From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
Long Wu <long.wu@corigine.com>
Subject: [PATCH 1/4] net/nfp: add a new flag to indicate PF
Date: Tue, 3 Sep 2024 09:41:42 +0800 [thread overview]
Message-ID: <20240903014145.2635710-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240903014145.2635710-1-chaoyong.he@corigine.com>
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index bd35df2dc9..181fd74efe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 3d916cd147..b471fd032a 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index bebb754ced..67ec5a2d89 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -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 {
--
2.39.1
next prev parent reply other threads:[~2024-09-03 1:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 1:41 [PATCH 0/4] Support new card using NFP 3800 chip Chaoyong He
2024-09-03 1:41 ` Chaoyong He [this message]
2024-09-03 1:41 ` [PATCH 2/4] net/nfp: refactor the firmware version logic Chaoyong He
2024-09-03 1:41 ` [PATCH 3/4] net/nfp: support different configuration BAR size Chaoyong He
2024-09-03 1:41 ` [PATCH 4/4] net/nfp: support different flow steering rules limit Chaoyong He
2024-10-04 4:26 ` [PATCH 0/4] Support new card using NFP 3800 chip Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240903014145.2635710-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).