From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v3 1/4] ethdev: add function to check representor port
Date: Mon, 26 Feb 2024 09:44:57 +0800 [thread overview]
Message-ID: <20240226014500.3537561-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240226014500.3537561-1-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
Add a function to check if a device is representor port, also
modified the related codes for PMDs.
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/bnxt/bnxt.h | 3 ---
drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c | 12 ++++++------
drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 4 ++--
drivers/net/bnxt/tf_ulp/ulp_def_rules.c | 4 ++--
drivers/net/cpfl/cpfl_representor.c | 2 +-
drivers/net/enic/enic.h | 5 -----
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/enic/enic_fm_flow.c | 20 ++++++++++----------
drivers/net/enic/enic_main.c | 4 ++--
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/ice/ice_dcf_ethdev.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
drivers/net/nfp/flower/nfp_flower_flow.c | 2 +-
drivers/net/nfp/nfp_mtr.c | 2 +-
drivers/net/nfp/nfp_net_common.c | 4 ++--
drivers/net/nfp/nfp_net_flow.c | 2 +-
lib/ethdev/ethdev_driver.h | 17 +++++++++++++++++
lib/ethdev/rte_class_eth.c | 4 ++--
19 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index fcf2b8be97..82036a16a1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -1204,9 +1204,6 @@ extern const struct rte_flow_ops bnxt_flow_meter_ops;
} \
} while (0)
-#define BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev) \
- ((eth_dev)->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-
extern int bnxt_logtype_driver;
#define RTE_LOGTYPE_BNXT bnxt_logtype_driver
#define PMD_DRV_LOG_RAW(level, fmt, args...) \
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f8d83662f4..825e9c1941 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3525,7 +3525,7 @@ bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
if (!bp)
return -EIO;
- if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+ if (rte_eth_dev_is_repr(dev)) {
struct bnxt_representor *vfr = dev->data->dev_private;
bp = vfr->parent_dev->data->dev_private;
/* parent is deleted while children are still valid */
@@ -6781,7 +6781,7 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove\n", eth_dev->data->port_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(eth_dev))
return rte_eth_dev_destroy(eth_dev,
bnxt_representor_uninit);
else
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c b/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
index 239191e14e..96d61c3ed2 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
@@ -202,7 +202,7 @@ bnxt_pmd_get_svif(uint16_t port_id, bool func_svif,
struct bnxt *bp;
eth_dev = &rte_eth_devices[port_id];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+ if (rte_eth_dev_is_repr(eth_dev)) {
struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
@@ -260,7 +260,7 @@ bnxt_pmd_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type)
struct bnxt *bp;
eth_dev = &rte_eth_devices[port];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+ if (rte_eth_dev_is_repr(eth_dev)) {
struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
@@ -285,7 +285,7 @@ bnxt_pmd_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type)
struct bnxt *bp;
eth_dev = &rte_eth_devices[port];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+ if (rte_eth_dev_is_repr(eth_dev)) {
struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
@@ -308,7 +308,7 @@ bnxt_pmd_get_interface_type(uint16_t port)
struct bnxt *bp;
eth_dev = &rte_eth_devices[port];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev))
+ if (rte_eth_dev_is_repr(eth_dev))
return BNXT_ULP_INTF_TYPE_VF_REP;
bp = eth_dev->data->dev_private;
@@ -330,7 +330,7 @@ bnxt_pmd_get_phy_port_id(uint16_t port_id)
struct bnxt *bp;
eth_dev = &rte_eth_devices[port_id];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+ if (rte_eth_dev_is_repr(eth_dev)) {
vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
@@ -350,7 +350,7 @@ bnxt_pmd_get_parif(uint16_t port_id, enum bnxt_ulp_intf_type type)
struct bnxt *bp;
eth_dev = &rte_eth_devices[port_id];
- if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+ if (rte_eth_dev_is_repr(eth_dev)) {
struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 274e935a1f..33028c470f 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -1559,7 +1559,7 @@ bnxt_ulp_destroy_vfr_default_rules(struct bnxt *bp, bool global)
struct rte_eth_dev *vfr_eth_dev;
struct bnxt_representor *vfr_bp;
- if (!BNXT_TRUFLOW_EN(bp) || BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
+ if (!BNXT_TRUFLOW_EN(bp) || rte_eth_dev_is_repr(bp->eth_dev))
return;
if (!bp->ulp_ctx || !bp->ulp_ctx->cfg_data)
@@ -2316,7 +2316,7 @@ bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev)
{
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
- if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+ if (rte_eth_dev_is_repr(dev)) {
struct bnxt_representor *vfr = dev->data->dev_private;
bp = vfr->parent_dev->data->dev_private;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index fe1f65deb9..8237dbd294 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -449,7 +449,7 @@ bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global)
uint16_t port_id;
if (!BNXT_TRUFLOW_EN(bp) ||
- BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
+ rte_eth_dev_is_repr(bp->eth_dev))
return;
if (!bp->ulp_ctx || !bp->ulp_ctx->cfg_data)
@@ -514,7 +514,7 @@ bnxt_ulp_create_df_rules(struct bnxt *bp)
int rc = 0;
if (!BNXT_TRUFLOW_EN(bp) ||
- BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev) || !bp->ulp_ctx)
+ rte_eth_dev_is_repr(bp->eth_dev) || !bp->ulp_ctx)
return 0;
port_id = bp->eth_dev->data->port_id;
diff --git a/drivers/net/cpfl/cpfl_representor.c b/drivers/net/cpfl/cpfl_representor.c
index e2ed9eda04..60b72b5ec1 100644
--- a/drivers/net/cpfl/cpfl_representor.c
+++ b/drivers/net/cpfl/cpfl_representor.c
@@ -339,7 +339,7 @@ cpfl_repr_link_update(struct rte_eth_dev *ethdev,
struct cpfl_vport_id vi;
int ret;
- if (!(ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+ if (!rte_eth_dev_is_repr(ethdev)) {
PMD_INIT_LOG(ERR, "This ethdev is not representor.");
return -EINVAL;
}
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 78778704f2..f46903ea9e 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -233,11 +233,6 @@ struct enic_vf_representor {
#define VF_ENIC_TO_VF_REP(vf_enic) \
container_of(vf_enic, struct enic_vf_representor, enic)
-static inline int enic_is_vf_rep(struct enic *enic)
-{
- return !!(enic->rte_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR);
-}
-
/* Compute ethdev's max packet size from MTU */
static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu)
{
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 7e040c36c4..cad8db2f6f 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1386,7 +1386,7 @@ static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)
ethdev = rte_eth_dev_allocated(pci_dev->device.name);
if (!ethdev)
return -ENODEV;
- if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(ethdev))
return rte_eth_dev_destroy(ethdev, enic_vf_representor_uninit);
else
return rte_eth_dev_destroy(ethdev, eth_enic_dev_uninit);
diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 90027dc676..8988148454 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -1535,14 +1535,14 @@ vf_egress_port_id_action(struct enic_flowman *fm,
ENICPMD_FUNC_TRACE();
src_enic = fm->user_enic;
dst_enic = pmd_priv(dst_dev);
- if (!(src_enic->rte_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+ if (!rte_eth_dev_is_repr(src_enic->rte_dev)) {
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
NULL, "source port is not VF representor");
}
/* VF -> PF uplink. dst is not VF representor */
- if (!(dst_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+ if (!rte_eth_dev_is_repr(dst_dev)) {
/* PF is the VF's PF? Then nothing to do */
vf = VF_ENIC_TO_VF_REP(src_enic);
if (vf->pf == dst_enic) {
@@ -1954,7 +1954,7 @@ enic_fm_copy_action(struct enic_flowman *fm,
if (!(overlap & (FATE | PASSTHRU | COUNT | PORT_ID)))
goto unsupported;
/* Egress from VF: need implicit WQ match */
- if (enic_is_vf_rep(enic) && !ingress) {
+ if (rte_eth_dev_is_repr(enic->rte_dev) && !ingress) {
fmt->ftm_data.fk_wq_id = 0;
fmt->ftm_mask.fk_wq_id = 0xffff;
fmt->ftm_data.fk_wq_vnic = enic->fm_vnic_handle;
@@ -3226,7 +3226,7 @@ enic_fm_init(struct enic *enic)
return 0;
ENICPMD_FUNC_TRACE();
/* Get vnic handle and save for port-id action */
- if (enic_is_vf_rep(enic))
+ if (rte_eth_dev_is_repr(enic->rte_dev))
addr = &VF_ENIC_TO_VF_REP(enic)->bdf;
else
addr = &RTE_ETH_DEV_TO_PCI(enic->rte_dev)->addr;
@@ -3240,7 +3240,7 @@ enic_fm_init(struct enic *enic)
enic->fm_vnic_uif = vnic_dev_uif(enic->vdev);
ENICPMD_LOG(DEBUG, "uif %u", enic->fm_vnic_uif);
/* Nothing else to do for representor. It will share the PF flowman */
- if (enic_is_vf_rep(enic))
+ if (rte_eth_dev_is_repr(enic->rte_dev))
return 0;
fm = calloc(1, sizeof(*fm));
if (fm == NULL) {
@@ -3321,7 +3321,7 @@ enic_fm_destroy(struct enic *enic)
struct enic_fm_fet *fet;
ENICPMD_FUNC_TRACE();
- if (enic_is_vf_rep(enic)) {
+ if (rte_eth_dev_is_repr(enic->rte_dev)) {
delete_rep_flows(enic);
return;
}
@@ -3358,7 +3358,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
int ret;
ENICPMD_FUNC_TRACE();
- if (enic_is_vf_rep(pf))
+ if (rte_eth_dev_is_repr(pf->rte_dev))
return -EINVAL;
cur = pf;
cur_a = &RTE_ETH_DEV_TO_PCI(cur->rte_dev)->addr;
@@ -3367,7 +3367,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
dev = &rte_eth_devices[pid];
if (!dev_is_enic(dev))
continue;
- if (dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(dev))
continue;
if (dev == cur->rte_dev)
continue;
@@ -3597,7 +3597,7 @@ delete_rep_flows(struct enic *enic)
struct rte_eth_dev *dev;
uint32_t i;
- RTE_ASSERT(enic_is_vf_rep(enic));
+ RTE_ASSERT(rte_eth_dev_is_repr(enic->rte_dev));
vf = VF_ENIC_TO_VF_REP(enic);
dev = vf->pf->rte_dev;
for (i = 0; i < ARRAY_SIZE(vf->vf2rep_flow); i++) {
@@ -3617,7 +3617,7 @@ begin_fm(struct enic *enic)
struct enic_flowman *fm;
/* Representor uses PF flowman */
- if (enic_is_vf_rep(enic)) {
+ if (rte_eth_dev_is_repr(enic->rte_dev)) {
vf = VF_ENIC_TO_VF_REP(enic);
fm = vf->pf->fm;
} else {
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6aaa760ca..2f681315b6 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -824,7 +824,7 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
* Representor uses a reserved PF queue. Translate representor
* queue number to PF queue number.
*/
- if (enic_is_vf_rep(enic)) {
+ if (rte_eth_dev_is_repr(enic->rte_dev)) {
RTE_ASSERT(queue_idx == 0);
vf = VF_ENIC_TO_VF_REP(enic);
sop_queue_idx = vf->pf_rq_sop_idx;
@@ -1053,7 +1053,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
* Representor uses a reserved PF queue. Translate representor
* queue number to PF queue number.
*/
- if (enic_is_vf_rep(enic)) {
+ if (rte_eth_dev_is_repr(enic->rte_dev)) {
RTE_ASSERT(queue_idx == 0);
vf = VF_ENIC_TO_VF_REP(enic);
queue_idx = vf->pf_wq_idx;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4d21341382..ddbc2962bc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -706,7 +706,7 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
if (!ethdev)
return 0;
- if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(ethdev))
return rte_eth_dev_pci_generic_remove(pci_dev,
i40e_vf_representor_uninit);
else
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index bebf356f4d..d58ec9d907 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -2131,7 +2131,7 @@ eth_ice_dcf_pci_remove(struct rte_pci_device *pci_dev)
if (!eth_dev)
return 0;
- if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(eth_dev))
return rte_eth_dev_pci_generic_remove(pci_dev,
ice_dcf_vf_repr_uninit);
else
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0cd3d0b105..c61c52b296 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1842,7 +1842,7 @@ static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
if (!ethdev)
return 0;
- if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ if (rte_eth_dev_is_repr(ethdev))
return rte_eth_dev_pci_generic_remove(pci_dev,
ixgbe_vf_representor_uninit);
else
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index e26be30d18..501a8d87bd 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -4321,7 +4321,7 @@ int
nfp_flow_ops_get(struct rte_eth_dev *dev,
const struct rte_flow_ops **ops)
{
- if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
+ if (!rte_eth_dev_is_repr(dev)) {
*ops = NULL;
PMD_DRV_LOG(ERR, "Port is not a representor.");
return -EINVAL;
diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c
index 255977ec22..6abc6dc9bc 100644
--- a/drivers/net/nfp/nfp_mtr.c
+++ b/drivers/net/nfp/nfp_mtr.c
@@ -1066,7 +1066,7 @@ static const struct rte_mtr_ops nfp_mtr_ops = {
int
nfp_net_mtr_ops_get(struct rte_eth_dev *dev, void *arg)
{
- if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
+ if (!rte_eth_dev_is_repr(dev)) {
PMD_DRV_LOG(ERR, "Port is not a representor");
return -EINVAL;
}
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 99c319eb2d..0ee2811926 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -241,7 +241,7 @@ nfp_net_get_hw(const struct rte_eth_dev *dev)
{
struct nfp_net_hw *hw;
- if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+ if (rte_eth_dev_is_repr(dev)) {
struct nfp_flower_representor *repr;
repr = dev->data->dev_private;
hw = repr->app_fw_flower->pf_hw;
@@ -2143,7 +2143,7 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
hw = nfp_net_get_hw(dev);
- if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+ if (rte_eth_dev_is_repr(dev)) {
snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d",
hw->ver.extend, hw->ver.class,
hw->ver.major, hw->ver.minor);
diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index 98e8499756..3b33f3b6e9 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -932,7 +932,7 @@ nfp_net_flow_ops_get(struct rte_eth_dev *dev,
{
struct nfp_net_hw *hw;
- if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+ if (rte_eth_dev_is_repr(dev)) {
*ops = NULL;
PMD_DRV_LOG(ERR, "Port is a representor.");
return -EINVAL;
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 0e4c1f0743..0b088fdab7 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1813,6 +1813,23 @@ rte_eth_representor_id_get(uint16_t port_id,
int controller, int pf, int representor_port,
uint16_t *repr_id);
+/**
+ * @internal
+ * Check if the ethdev is a representor port.
+ *
+ * @param dev
+ * Pointer to struct rte_eth_dev.
+ *
+ * @return
+ * false the ethdev is not a representor port.
+ * true the ethdev is a representor port.
+ */
+static inline bool
+rte_eth_dev_is_repr(const struct rte_eth_dev *dev)
+{
+ return ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0);
+}
+
/**
* PMD helper function to parse ethdev arguments
*
diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c
index bc003db8af..b52f1dd9f2 100644
--- a/lib/ethdev/rte_class_eth.c
+++ b/lib/ethdev/rte_class_eth.c
@@ -69,7 +69,7 @@ eth_representor_cmp(const char *key __rte_unused,
struct rte_eth_devargs eth_da;
uint16_t id = 0, nc, np, nf, i, c, p, f;
- if ((data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0)
+ if (!rte_eth_dev_is_repr(edev))
return -1; /* not a representor port */
/* Parse devargs representor values. */
@@ -143,7 +143,7 @@ eth_dev_match(const struct rte_eth_dev *edev,
}
/* if no representor key, default is to not match representor ports */
if (ret != 0)
- if ((edev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0)
+ if (rte_eth_dev_is_repr(edev))
return -1; /* do not match any representor */
return 0;
--
2.39.1
next prev parent reply other threads:[~2024-02-26 1:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 10:42 [PATCH 0/4] add support of partial offload Chaoyong He
2024-02-10 10:42 ` [PATCH 1/4] net/nfp: support MARK flow action Chaoyong He
2024-02-10 10:42 ` [PATCH 2/4] net/nfp: add interface to check representor Chaoyong He
2024-02-12 16:24 ` Ferruh Yigit
2024-02-17 1:31 ` Chaoyong He
2024-02-10 10:42 ` [PATCH 3/4] net/nfp: representor adds RSS configuration Chaoyong He
2024-02-10 10:42 ` [PATCH 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-12 10:10 ` [PATCH 0/4] add support of partial offload David Marchand
2024-02-17 1:31 ` Chaoyong He
2024-02-23 2:42 ` [PATCH v2 0/4] add support of MARK and RSS flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 1/4] ethdev: add function to check representor port Chaoyong He
2024-02-23 9:29 ` Ferruh Yigit
2024-02-23 2:42 ` [PATCH v2 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-23 2:42 ` [PATCH v2 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 0/4] add support of MARK and " Chaoyong He
2024-02-26 1:44 ` Chaoyong He [this message]
2024-02-26 14:31 ` [PATCH v3 1/4] ethdev: add function to check representor port Ferruh Yigit
2024-02-26 1:44 ` [PATCH v3 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-26 1:45 ` [PATCH v3 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 14:31 ` [PATCH v3 0/4] add support of MARK and " 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=20240226014500.3537561-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@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).