From: Jun Yang <jun.yang@nxp.com>
This patch add support to check the DPAA platform type from
the applications.
Signed-off-by: Jun Yang <jun.yang@nxp.com>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 16 +++++++++++++---
drivers/net/dpaa2/dpaa2_flow.c | 5 ++---
drivers/net/dpaa2/rte_pmd_dpaa2.h | 4 ++++
drivers/net/dpaa2/version.map | 1 +
4 files changed, 20 insertions(+), 6 deletions(-)
@@ -2161,7 +2161,7 @@ dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
ret = dpni_get_link_cfg(dpni, CMD_PRI_LOW, priv->token, &cfg);
if (ret) {
DPAA2_PMD_ERR("Unable to get link cfg (err=%d)", ret);
- return -1;
+ return ret;
}
/* Disable link before setting configuration */
@@ -2203,7 +2203,7 @@ dpaa2_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
default:
DPAA2_PMD_ERR("Incorrect Flow control flag (%d)",
fc_conf->mode);
- return -1;
+ return -EINVAL;
}
ret = dpni_set_link_cfg(dpni, CMD_PRI_LOW, priv->token, &cfg);
@@ -2885,8 +2885,18 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
return ret;
}
-int dpaa2_dev_is_dpaa2(struct rte_eth_dev *dev)
+int
+rte_pmd_dpaa2_dev_is_dpaa2(uint32_t eth_id)
{
+ struct rte_eth_dev *dev;
+
+ if (eth_id >= RTE_MAX_ETHPORTS)
+ return false;
+
+ dev = &rte_eth_devices[eth_id];
+ if (!dev->device)
+ return false;
+
return dev->device->driver == &rte_dpaa2_pmd.driver;
}
@@ -3296,14 +3296,13 @@ dpaa2_flow_redirect_dev(struct dpaa2_dev_priv *priv,
if (idx >= 0) {
if (!rte_eth_dev_is_valid_port(idx))
return NULL;
+ if (!rte_pmd_dpaa2_dev_is_dpaa2(idx))
+ return NULL;
dest_dev = &rte_eth_devices[idx];
} else {
dest_dev = priv->eth_dev;
}
- if (!dpaa2_dev_is_dpaa2(dest_dev))
- return NULL;
-
return dest_dev;
}
@@ -127,6 +127,10 @@ __rte_experimental
uint32_t
rte_pmd_dpaa2_get_tlu_hash(uint8_t *key, int size);
+__rte_experimental
+int
+rte_pmd_dpaa2_dev_is_dpaa2(uint32_t eth_id);
+
#if defined(RTE_LIBRTE_IEEE1588)
__rte_experimental
int
@@ -17,6 +17,7 @@ EXPERIMENTAL {
# added in 21.11
rte_pmd_dpaa2_get_tlu_hash;
# added in 24.11
+ rte_pmd_dpaa2_dev_is_dpaa2;
rte_pmd_dpaa2_set_one_step_ts;
rte_pmd_dpaa2_get_one_step_ts;
rte_pmd_dpaa2_mux_dump_counter;