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 40955459C6; Wed, 18 Sep 2024 09:52:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52B3A42EE0; Wed, 18 Sep 2024 09:51:14 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 2B34442EA1 for ; Wed, 18 Sep 2024 09:51:02 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 11309201BCD; 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 inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CAA51201BDD; Wed, 18 Sep 2024 09:51:01 +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 47C52183C482; Wed, 18 Sep 2024 15:51:01 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Rohit Raj Subject: [v2 09/43] net/dpaa2: support link state for eth interfaces Date: Wed, 18 Sep 2024 13:20:22 +0530 Message-Id: <20240918075056.1838654-10-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: 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 4dc7a82b47..9172097abf 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1985,7 +1985,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 */ @@ -1993,13 +1993,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 */ @@ -2007,10 +2007,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