[1/4] net/nfp: add a new flag to indicate PF
Checks
Commit Message
Add a new flag field 'is_pf' into 'struct nfp_net_hw_priv', to indicate
if the device is PF or not.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 2 ++
drivers/net/nfp/nfp_net_common.c | 6 +++---
drivers/net/nfp/nfp_net_common.h | 2 ++
3 files changed, 7 insertions(+), 3 deletions(-)
@@ -2298,6 +2298,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
if (ret != 0)
goto vf_cfg_tbl_cleanup;
+ hw_priv->is_pf = true;
hw_priv->pf_dev = pf_dev;
hw_priv->dev_info = dev_info;
@@ -2544,6 +2545,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
pf_dev->pci_dev = pci_dev;
pf_dev->sync = sync;
+ hw_priv->is_pf = true;
hw_priv->pf_dev = pf_dev;
hw_priv->dev_info = dev_info;
@@ -783,7 +783,7 @@ nfp_net_link_update_common(struct rte_eth_dev *dev,
hw_priv = dev->process_private;
if (link->link_status == RTE_ETH_LINK_UP) {
- if (hw_priv->pf_dev != NULL) {
+ if (hw_priv->is_pf) {
nfp_net_speed_aneg_update(dev, hw, hw_priv, link);
} else {
/*
@@ -845,7 +845,7 @@ nfp_net_link_update(struct rte_eth_dev *dev,
* Not applicable for VFs as the associated PF is still attached to the
* kernel driver.
*/
- if (hw_priv != NULL && hw_priv->pf_dev != NULL)
+ if (hw_priv != NULL && hw_priv->is_pf)
nfp_net_notify_port_speed(hw, &link);
return ret;
@@ -1366,7 +1366,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
}
/* Only PF supports getting speed capability. */
- if (hw_priv->pf_dev != NULL)
+ if (hw_priv->is_pf)
dev_info->speed_capa = hw_priv->pf_dev->speed_capa;
return 0;
@@ -207,6 +207,8 @@ struct nfp_net_hw_priv {
/** NFP ASIC params */
const struct nfp_dev_info *dev_info;
+
+ bool is_pf;
};
struct nfp_net_hw {