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 48FC8A0548; Tue, 22 Jun 2021 22:06:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F65840DDD; Tue, 22 Jun 2021 22:06:26 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B148C40DDA for ; Tue, 22 Jun 2021 22:06:24 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15MK1TVh001994 for ; Tue, 22 Jun 2021 13:06:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=dzmNyJwqvyV4hJPWEfe+Em1DWd6KusvAi3TPRBrvqZg=; b=HKoBImFTqPTTa3B+snwHiB/jTW9mD5pkEHAAxRTV4WKCkoKZlH05KmLMrpLpZ+nuhb1D j1/a02JSN9jMFMsMqxuET2n7UkLDiWNvyySp2W92sfZKmGnTvPgGlE0L5rK4qevaGY/N cUXDbes1yhx0Q9K0lXuft2Z1r3+1jcoYSnsMFwa9qxvPHFqdp+HQPGBIBfeqqQOj1SPw J3KJdwqclGrFg2dZt6B3S0etedkD/90i62kJrrGg8mu3QxY4aNZ/ftcAtZiNQ3aP5LY8 MRpTEgodcr+UKVoJzgrrb0kdG6cropXarudyX9dqpwfJPkOnq/qUGtsr6XACN+4zu3yN Hw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 39b91hbqdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 22 Jun 2021 13:06:23 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Jun 2021 13:06:22 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 22 Jun 2021 13:06:22 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id C77B95B6925; Tue, 22 Jun 2021 13:06:20 -0700 (PDT) From: Harman Kalra To: Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K CC: , Harman Kalra Date: Wed, 23 Jun 2021 01:35:54 +0530 Message-ID: <20210622200554.1544-2-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210622200554.1544-1-hkalra@marvell.com> References: <20210622200554.1544-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: oNPJcqzFG4LnRxQSukKA1O9bONQ_Hl7n X-Proofpoint-GUID: oNPJcqzFG4LnRxQSukKA1O9bONQ_Hl7n X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-22_13:2021-06-22, 2021-06-22 signatures=0 Subject: [dpdk-dev] [PATCH 2/2] net/octeontx2: callback for getting link status 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 Sender: "dev" Adding a new callback for reading the link status. PF can read it's link status and can forward the same to VF once it comes up. Signed-off-by: Harman Kalra --- drivers/net/octeontx2/otx2_ethdev.c | 8 +++++++- drivers/net/octeontx2/otx2_ethdev.h | 2 ++ drivers/net/octeontx2/otx2_link.c | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index 0834de0cb1..471fa34da1 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -42,7 +42,8 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev) static const struct otx2_dev_ops otx2_dev_ops = { .link_status_update = otx2_eth_dev_link_status_update, - .ptp_info_update = otx2_eth_dev_ptp_info_update + .ptp_info_update = otx2_eth_dev_ptp_info_update, + .link_status_get = otx2_eth_dev_link_status_get }; static int @@ -2625,6 +2626,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) nix_cgx_stop_link_event(dev); + /* Unregister the dev ops, this is required to stop VFs from + * receiving link status updates on exit path. + */ + dev->ops = NULL; + /* Free up SQs */ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { otx2_nix_tx_queue_release(eth_dev->data->tx_queues[i]); diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index ac50da7b18..08f9a2a7bc 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -453,6 +453,8 @@ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set); int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); void otx2_eth_dev_link_status_update(struct otx2_dev *dev, struct cgx_link_user_info *link); +void otx2_eth_dev_link_status_get(struct otx2_dev *dev, + struct cgx_link_user_info *link); int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev); int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev); int otx2_apply_link_speed(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c index a79b997376..5378e5c3b9 100644 --- a/drivers/net/octeontx2/otx2_link.c +++ b/drivers/net/octeontx2/otx2_link.c @@ -47,6 +47,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link) otx2_info("Port %d: Link Down", (int)(eth_dev->data->port_id)); } +void +otx2_eth_dev_link_status_get(struct otx2_dev *dev, + struct cgx_link_user_info *link) +{ + struct otx2_eth_dev *otx2_dev = (struct otx2_eth_dev *)dev; + struct rte_eth_link eth_link; + struct rte_eth_dev *eth_dev; + + if (!link || !dev) + return; + + eth_dev = otx2_dev->eth_dev; + if (!eth_dev) + return; + + rte_eth_linkstatus_get(eth_dev, ð_link); + + link->link_up = eth_link.link_status; + link->speed = eth_link.link_speed; + link->an = eth_link.link_autoneg; + link->full_duplex = eth_link.link_duplex; +} + void otx2_eth_dev_link_status_update(struct otx2_dev *dev, struct cgx_link_user_info *link) -- 2.18.0