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 2C57645B37; Mon, 14 Oct 2024 14:02:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC6D140A6D; Mon, 14 Oct 2024 14:01:39 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 48CB840664 for ; Mon, 14 Oct 2024 14:01:32 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 29F6020091B; Mon, 14 Oct 2024 14:01:32 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E367F202283; Mon, 14 Oct 2024 14:01:31 +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 5E5E1183DC03; Mon, 14 Oct 2024 20:01:31 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Rohit Raj Subject: [v3 09/43] net/dpaa2: support link state for eth interfaces Date: Mon, 14 Oct 2024 17:30:52 +0530 Message-Id: <20241014120126.170790-10-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014120126.170790-1-vanshika.shukla@nxp.com> References: <20240918075056.1838654-2-vanshika.shukla@nxp.com> <20241014120126.170790-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: Rohit Raj This patch add support to update the duplex value along with link status and link speed after setting the link UP. Signed-off-by: Rohit Raj --- drivers/net/dpaa2/dpaa2_ethdev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 439b8f97a4..b120e2c815 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1988,7 +1988,7 @@ dpaa2_dev_set_link_up(struct rte_eth_dev *dev) if (ret) { /* Unable to obtain dpni status; Not continuing */ DPAA2_PMD_ERR("Interface Link UP failed (%d)", ret); - return -EINVAL; + return ret; } /* Enable link if not already enabled */ @@ -1996,13 +1996,13 @@ dpaa2_dev_set_link_up(struct rte_eth_dev *dev) ret = dpni_enable(dpni, CMD_PRI_LOW, priv->token); if (ret) { DPAA2_PMD_ERR("Interface Link UP failed (%d)", ret); - return -EINVAL; + return ret; } } ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state); if (ret < 0) { DPAA2_PMD_DEBUG("Unable to get link state (%d)", ret); - return -1; + return ret; } /* changing tx burst function to start enqueues */ @@ -2010,10 +2010,15 @@ dpaa2_dev_set_link_up(struct rte_eth_dev *dev) dev->data->dev_link.link_status = state.up; dev->data->dev_link.link_speed = state.rate; + if (state.options & DPNI_LINK_OPT_HALF_DUPLEX) + dev->data->dev_link.link_duplex = RTE_ETH_LINK_HALF_DUPLEX; + else + dev->data->dev_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + if (state.up) - DPAA2_PMD_INFO("Port %d Link is Up", dev->data->port_id); + DPAA2_PMD_DEBUG("Port %d Link is Up", dev->data->port_id); else - DPAA2_PMD_INFO("Port %d Link is Down", dev->data->port_id); + DPAA2_PMD_DEBUG("Port %d Link is Down", dev->data->port_id); return ret; } -- 2.25.1