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 9B3E145D03; Thu, 14 Nov 2024 10:39:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6467840E45; Thu, 14 Nov 2024 10:39:24 +0100 (CET) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B708C4026F for ; Thu, 14 Nov 2024 10:39:22 +0100 (CET) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AE7eRP7029883 for ; Thu, 14 Nov 2024 01:39:21 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=omcXJ+LfZ4Mvsnbk8a1xrJ8 t91SrQSaq6q6kKFiykYs=; b=InWQfsSHRmj2L+7QEtA21OpPPfzMczS31GfgKPQ qlWyJ6fhmR7K8ebGi8ic7c9KWslypQRvyQBkCZARXQwYvJ5e4zMD/iymT8HQiY3H IsTHyy6M7r/n637Eq2zX1qiN44TDOC1pKdLzYyaEr4gXb36n+IU6aiPwd86pNAG/ 2qPnmLhop5ocZpcXyYSXMGgUC4fBbLtwNtL32OyMgqPOCB7WXDfD7fcQ7hRE2jNA tNPqk7WJmp5+mH1Qb6tl2z/4S+MjqI/aDL6Dl8c7BIjyHxVqxmAsEIfYq64AUxpZ zqbknfhupdirJWfHeKlPskt1Zg/KKmy7+4cFOWm+HRPrvDQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 42wd11rkgj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2024 01:39:21 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 14 Nov 2024 01:39:20 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 14 Nov 2024 01:39:20 -0800 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id 1CFB03F7059; Thu, 14 Nov 2024 01:39:17 -0800 (PST) From: Harman Kalra To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: Subject: [PATCH] net/cnxk: toggle link status for representors Date: Thu, 14 Nov 2024 15:09:15 +0530 Message-ID: <20241114093915.180971-1-hkalra@marvell.com> X-Mailer: git-send-email 2.46.0.469.g4590f2e941 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: _d7KXVECkHB-igVCzrNxDzUO8sEwixcO X-Proofpoint-GUID: _d7KXVECkHB-igVCzrNxDzUO8sEwixcO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 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 Representor port link status should be toggled based on representee state i.e. if representee comes up representor link status should be up while when representee goes down representor port should indicate the same. Signed-off-by: Harman Kalra --- drivers/net/cnxk/cnxk_rep_ops.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c index 888842fa90..c88d28ff72 100644 --- a/drivers/net/cnxk/cnxk_rep_ops.c +++ b/drivers/net/cnxk/cnxk_rep_ops.c @@ -80,14 +80,12 @@ cnxk_rep_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) PLT_SET_USED(wait_to_complete); memset(&link, 0, sizeof(link)); - if (ethdev->data->dev_started) + if (ethdev->data->dev_started) { link.link_status = RTE_ETH_LINK_UP; - else - link.link_status = RTE_ETH_LINK_DOWN; - - link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; - link.link_autoneg = RTE_ETH_LINK_FIXED; - link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; + link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + link.link_autoneg = RTE_ETH_LINK_FIXED; + link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; + } return rte_eth_linkstatus_set(ethdev, &link); } @@ -234,6 +232,7 @@ int cnxk_rep_dev_start(struct rte_eth_dev *ethdev) { struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(ethdev); + struct rte_eth_link link; int rc = 0, qid; ethdev->rx_pkt_burst = cnxk_rep_rx_burst; @@ -278,6 +277,13 @@ cnxk_rep_dev_start(struct rte_eth_dev *ethdev) rep_dev->parent_dev->repr_cnt.nb_repr_started++; + link.link_status = RTE_ETH_LINK_UP; + link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + link.link_autoneg = RTE_ETH_LINK_FIXED; + link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; + rte_eth_linkstatus_set(ethdev, &link); + ethdev->data->dev_started = 1; + return 0; fail: return rc; @@ -293,6 +299,7 @@ int cnxk_rep_dev_stop(struct rte_eth_dev *ethdev) { struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(ethdev); + struct rte_eth_link link; ethdev->rx_pkt_burst = cnxk_rep_rx_burst_dummy; ethdev->tx_pkt_burst = cnxk_rep_tx_burst_dummy; @@ -300,6 +307,11 @@ cnxk_rep_dev_stop(struct rte_eth_dev *ethdev) cnxk_rep_tx_queue_stop(ethdev, 0); rep_dev->parent_dev->repr_cnt.nb_repr_started--; + /* Bring down link status internally */ + memset(&link, 0, sizeof(link)); + rte_eth_linkstatus_set(ethdev, &link); + ethdev->data->dev_started = 0; + return 0; } -- 2.46.0.469.g4590f2e941