[dpdk-dev] [PATCH v6 2/5] net/enetfec: add UIO support

Ferruh Yigit ferruh.yigit at intel.com
Wed Oct 27 16:21:58 CEST 2021


On 10/21/2021 5:46 AM, Apeksha Gupta wrote:
> 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 <sachin.saxena at nxp.com>
> Signed-off-by: Apeksha Gupta <apeksha.gupta at nxp.com>

<...>

> +
> +#define NUM_OF_QUEUES			6

I guess this is number of BD queues, may be good to have it in macro name.

> +
> +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?

> +/*
> + * 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?
<...>

> +
> +static int
> +enetfec_eth_start(struct rte_eth_dev *dev)
> +{
> +	enetfec_restart(dev);
> +
> +	return 0;
> +}

Empty line is missing between two functions.

> +/* 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?

> +static int
> +enetfec_eth_stop(__rte_unused struct rte_eth_dev *dev)

'dev' is used, so can drop '__rte_unused'.

> +{
> +	struct enetfec_private *fep = dev->data->dev_private;
> +
> +	dev->data->dev_started = 0;
> +	enetfec_disable(fep->hw_baseaddr_v);
> +
> +	return 0;
> +}

<...>


More information about the dev mailing list