From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 1/3] net/nfp: extract function to check physical reprsentor
Date: Wed, 30 Oct 2024 16:19:08 +0800 [thread overview]
Message-ID: <20241030081910.209308-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20241030081910.209308-1-chaoyong.he@corigine.com>
Extract a helper function to check the physical representor port.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
.../net/nfp/flower/nfp_flower_representor.c | 18 ++++++++++++------
.../net/nfp/flower/nfp_flower_representor.h | 1 +
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 7c55f0ed21..8efef482b5 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -96,7 +96,7 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev)
hw_priv = dev->process_private;
app_fw_flower = repr->app_fw_flower;
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ if (nfp_flower_repr_is_phy(repr)) {
ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 1);
if (ret < 0)
return ret;
@@ -127,7 +127,7 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev)
nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, false);
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ if (nfp_flower_repr_is_phy(repr)) {
ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 0);
if (ret == 1)
ret = 0;
@@ -411,7 +411,7 @@ nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev)
nfp_flower_repr_base_uninit(repr);
rte_free(repr->ring);
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ if (nfp_flower_repr_is_phy(repr)) {
index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
repr->app_fw_flower->phy_reprs[index] = NULL;
} else {
@@ -768,14 +768,14 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
goto ring_cleanup;
}
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT)
+ if (nfp_flower_repr_is_phy(repr))
eth_dev->data->representor_id = repr->vf_id;
else
eth_dev->data->representor_id = repr->vf_id +
app_fw_flower->num_phyport_reprs + 1;
/* Add repr to correct array */
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ if (nfp_flower_repr_is_phy(repr)) {
index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
app_fw_flower->phy_reprs[index] = repr;
} else {
@@ -783,7 +783,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
app_fw_flower->vf_reprs[index] = repr;
}
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ if (nfp_flower_repr_is_phy(repr)) {
repr->mac_stats = hw_priv->pf_dev->mac_stats_bar +
(repr->nfp_idx * NFP_MAC_STATS_SIZE);
}
@@ -1183,3 +1183,9 @@ nfp_flower_repr_is_vf(struct nfp_flower_representor *repr)
{
return repr->repr_type == NFP_REPR_TYPE_VF;
}
+
+bool
+nfp_flower_repr_is_phy(struct nfp_flower_representor *repr)
+{
+ return repr->repr_type == NFP_REPR_TYPE_PHYS_PORT;
+}
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h
index 4211ddf798..3f6ee32fe4 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.h
+++ b/drivers/net/nfp/flower/nfp_flower_representor.h
@@ -30,6 +30,7 @@ struct nfp_flower_representor {
int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,
struct nfp_net_hw_priv *hw_priv);
bool nfp_flower_repr_is_vf(struct nfp_flower_representor *repr);
+bool nfp_flower_repr_is_phy(struct nfp_flower_representor *repr);
int nfp_flower_repr_stats_reset(struct rte_eth_dev *ethdev);
#endif /* __NFP_FLOWER_REPRESENTOR_H__ */
--
2.43.5
next prev parent reply other threads:[~2024-10-30 8:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 8:19 [PATCH 0/3] NFP PMD enhancement Chaoyong He
2024-10-30 8:19 ` Chaoyong He [this message]
2024-10-30 8:19 ` [PATCH 2/3] net/nfp: add support for EEPROM functions Chaoyong He
2024-10-30 8:19 ` [PATCH 3/3] net/nfp: add support for port identify Chaoyong He
2024-10-30 8:27 ` [PATCH 0/4] NFP PMD enhancement Chaoyong He
2024-10-30 8:27 ` [PATCH 1/4] net/nfp: fix port index problem Chaoyong He
2024-10-30 8:27 ` [PATCH 2/4] net/nfp: extract function to check physical reprsentor Chaoyong He
2024-10-30 8:27 ` [PATCH 3/4] net/nfp: add support for EEPROM functions Chaoyong He
2024-10-30 8:27 ` [PATCH 4/4] net/nfp: add support for port identify Chaoyong He
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=20241030081910.209308-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--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).