From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E7A2459C6; Wed, 18 Sep 2024 09:52:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C77F342F0C; Wed, 18 Sep 2024 09:51:18 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 226B642EAB for ; Wed, 18 Sep 2024 09:51:03 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DD7FA1A1BE5; Wed, 18 Sep 2024 09:51:02 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A28D31A0343; Wed, 18 Sep 2024 09:51:02 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 22CEB183C480; Wed, 18 Sep 2024 15:51:02 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v2 11/43] net/dpaa2: add new PMD API to check dpaa platform version Date: Wed, 18 Sep 2024 13:20:24 +0530 Message-Id: <20240918075056.1838654-12-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240918075056.1838654-1-vanshika.shukla@nxp.com> References: <20240913055959.3246917-1-vanshika.shukla@nxp.com> <20240918075056.1838654-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jun Yang This patch add support to check the DPAA platform type from the applications. Signed-off-by: Jun Yang --- 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(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 2fb9b8ea95..f0b4843472 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2158,7 +2158,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 */ @@ -2200,7 +2200,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); @@ -2882,8 +2882,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; } diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index 6c7bac4d48..15f3343db4 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -3300,14 +3300,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; } diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index bebebcacdc..fc52a9218e 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -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 diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map index 7323fc8869..233c6e6b2c 100644 --- a/drivers/net/dpaa2/version.map +++ b/drivers/net/dpaa2/version.map @@ -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; -- 2.25.1