[PATCH 07/14] net/nfp: support NFDK firmware
Ferruh Yigit
ferruh.yigit at xilinx.com
Fri Jun 3 00:53:42 CEST 2022
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