Re: [dpdk-dev] [EXT] Re: [PATCH v6 2/5] net/enetfec: add UIO support
From: Apeksha Gupta <hidden>
Date: 2021-11-08 18:44:46
-----Original Message----- From: Ferruh Yigit <redacted> Sent: Wednesday, October 27, 2021 7:52 PM To: Apeksha Gupta <redacted>; david.marchand@redhat.com; andrew.rybchenko@oktetlabs.ru; ferruh.yigit@intel.com Cc: dev@dpdk.org; Sachin Saxena <redacted>; Hemant Agrawal [off-list ref] Subject: [EXT] Re: [dpdk-dev] [PATCH v6 2/5] net/enetfec: add UIO support Caution: EXT Email On 10/21/2021 5:46 AM, Apeksha Gupta wrote:quoted
Implemented the fec-uio driver in kernel. enetfec PMD uses UIO interface to interact with "fec-uio" driver implemented in kernel for PHY initialisation and for mapping the allocated memory of register & BD from kernel to DPDK which gives access to non-cacheable memory for BD. Signed-off-by: Sachin Saxena <redacted> Signed-off-by: Apeksha Gupta <redacted><...>quoted
+ +#define NUM_OF_QUEUES 6I guess this is number of BD queues, may be good to have it in macro name.
[Apeksha] okay, updated in v7 patch series.
quoted
+ +uint32_t e_cntl; +Is this global variable really needed, most of the times what you need is per port varible. For example I can see this variable is updated based on port start/stop, what if you have multiple ports and they are different start/stop state, will the value of variable still be correct? And if it will be global, can you please make it 'static' and prefix driver namespace to it?
[Apeksha] Sure, we will update.
quoted
+/* + * This function is called to start or restart the ENETFEC during a link + * change, transmit timeout, or to reconfigure the ENETFEC. The network + * packet processing for this device must be stopped before this call. + */ +static void +enetfec_restart(struct rte_eth_dev *dev) +{ + struct enetfec_private *fep = dev->data->dev_private; + uint32_t temp_mac[2]; + uint32_t rcntl = OPT_FRAME_SIZE | 0x04; + uint32_t ecntl = ENETFEC_ETHEREN; + + /* default mac address */ + struct rte_ether_addr addr = { + .addr_bytes = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6} }; + uint32_t val; + + /* + * enet-mac reset will reset mac address registers too, + * so need to reconfigure it. + */ + memcpy(&temp_mac, addr.addr_bytes, ETH_ALEN); + rte_write32(rte_cpu_to_be_32(temp_mac[0]), + (uint8_t *)fep->hw_baseaddr_v + ENETFEC_PALR); + rte_write32(rte_cpu_to_be_32(temp_mac[1]), + (uint8_t *)fep->hw_baseaddr_v + ENETFEC_PAUR); +Is same MAC address used for all ports? Also probe sets a different MAC address, which one is valid?
[Apeksha] we will remove MAC address from here in next version. Also mac address feature is yet to be implemented. At present sets the fixed mac address from probe.
<...>quoted
+ +static int +enetfec_eth_start(struct rte_eth_dev *dev) +{ + enetfec_restart(dev); + + return 0; +}Empty line is missing between two functions.
[Apeksha] okay.
quoted
+/* ENETFEC enable function. + * @param[in] base ENETFEC base address + */ +void +enetfec_enable(void *base) +{ + rte_write32(rte_read32((uint8_t *)base + ENETFEC_ECR) | e_cntl, + (uint8_t *)base + ENETFEC_ECR); +} + +/* ENETFEC disable function. + * @param[in] base ENETFEC base address + */ +void +enetfec_disable(void *base) +{ + rte_write32(rte_read32((uint8_t *)base + ENETFEC_ECR) & ~e_cntl, + (uint8_t *)base + ENETFEC_ECR); +} +Are these 'enetfec_enable()'/'enetfec_disable()' functions used out of this file, if not why not make them static, and remove definition in header file?
[Apeksha] I do agree as these functions not used out of the file. Updated in v7 patch series.
quoted
+static int +enetfec_eth_stop(__rte_unused struct rte_eth_dev *dev)'dev' is used, so can drop '__rte_unused'.
[Apeksha] okay.
quoted
+{ + struct enetfec_private *fep = dev->data->dev_private; + + dev->data->dev_started = 0; + enetfec_disable(fep->hw_baseaddr_v); + + return 0; +}<...>