[PATCH 07/14] net/nfp: support NFDK firmware

Kevin Liu jin.liu at corigine.com
Tue Jun 14 10:49:12 CEST 2022


We also want to just use one function 'nfp_net_tx_queue_release()' to service both NFD3 and NFDk, But we can not get the version of NFD in function 'nfp_net_tx_queue_release()',  now get NFD version through 'hw->ver'

For the function 'nfp_net_ethdev_ops_mount()', the logic below is in two different C files, nfp_ethdev.c and nfp_ethdev_vf.c And the variable of struct eth_dev_ops is defined as static, if we want to use function both in nfp_ethdev.c and nfp_ethdev_vf.c We need to change the eth_dev_ops variable as non-static, this is not we want.

	> +	switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
	> +	case NFP_NET_CFG_VERSION_DP_NFD3:
	> +		break;
	> +	case NFP_NET_CFG_VERSION_DP_NFDK:
	> +		if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
	> +			PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d",
	> +				NFD_CFG_MAJOR_VERSION_of(hw->ver));
	> +			return -EINVAL;
	> +		}
	> +		break;
	> +	default:
	> +		PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
	> +		return -EINVAL;

-----Original Message-----
From: Ferruh Yigit <ferruh.yigit at xilinx.com> 
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <jin.liu at corigine.com>; dev at dpdk.org
Cc: Niklas Soderlund <niklas.soderlund at corigine.com>; Diana Wang <na.wang at corigine.com>; Nole Zhang <peng.zhang at corigine.com>; Chaoyong He <chaoyong.he at corigine.com>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware

On 6/2/2022 2:52 AM, Jin Liu wrote:
> Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, 
> will according to the firmware version, mount different driver functions.
> 

Creating a new set of dev_ops for new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multiple dev_ops can be difficult (driver already has different ones for PF & VF).

Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW.
Like keeping dev_ops as 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having two dev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'.
If difference is small, this can be better to reduce duplication.

What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff?

> Signed-off-by: Jin Liu <jin.liu at corigine.com>
> Signed-off-by: Diana Wang <na.wang at corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang at corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at corigine.com>

<...>

> @@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
>   	eth_dev->rx_pkt_burst = &nfp_net_recv_pkts;
>   	eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
>   
> +	hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr;
> +	if (hw->ctrl_bar == NULL) {
> +		PMD_DRV_LOG(ERR,
> +			"hw->ctrl_bar is NULL. BAR0 not configured");
> +		return -ENODEV;
> +	}
> +
> +	PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
> +
> +	hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
> +
> +	switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
> +	case NFP_NET_CFG_VERSION_DP_NFD3:
> +		break;
> +	case NFP_NET_CFG_VERSION_DP_NFDK:
> +		if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
> +			PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d",
> +				NFD_CFG_MAJOR_VERSION_of(hw->ver));
> +			return -EINVAL;
> +		}
> +		break;
> +	default:
> +		PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
> +		return -EINVAL;
> +	}
> +

This part seems extracted to its own function for PF ('nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them.




More information about the dev mailing list