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 01B8CA034C; Wed, 27 Apr 2022 17:00:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C79B4283E; Wed, 27 Apr 2022 16:58:53 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp11.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 879F842836 for ; Wed, 27 Apr 2022 16:58:49 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 1DF08C0000E8; Wed, 27 Apr 2022 07:58:47 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 1DF08C0000E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1651071529; bh=V2qTiTAHbM7PA1dh8478W3I8J17sDjAo3KY8eUJO+ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYdJpjqm5iRQ1Lx7acJH4df5JSnT9BwBWFurMx3b91hXron0JCfuroL+dCYmflzED Z5X1hRGPzEItSJpQNK8U2zXGC9+Jc/091S+C8uxaRWxqGxbPZFgRM/zwU+9DHIV2gW eWmgKWThJ721RQpi/g3AB3UPg6CxNHywoKxaEF+M= From: Kalesh A P To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com Subject: [PATCH 14/17] net/bnxt: fix reporting link status when port is stopped Date: Wed, 27 Apr 2022 20:28:18 +0530 Message-Id: <20220427145821.5987-15-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> References: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> 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: Kalesh AP Driver forces link down during port stop. But device is not obliged link down in certain scenarios, even when forced. In that case, subsequent link queries returns link as up. Fixed to return link status as down when port is stopped. Driver is already doing that for VF/NPAR/MH functions. Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1904db9..69f1117 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1826,6 +1826,14 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete) if (bp->link_info == NULL) goto out; + /* Only single function PF can bring the phy down. + * In certain scenarios, device is not obliged link down even when forced. + * When port is stopped, report link down in those cases. + */ + if (!eth_dev->data->dev_started && + (!BNXT_SINGLE_PF(bp) || bnxt_force_link_config(bp))) + goto out; + do { /* Retrieve link info from hardware */ rc = bnxt_get_hwrm_link_config(bp, &new); @@ -1843,12 +1851,6 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete) rte_delay_ms(BNXT_LINK_WAIT_INTERVAL); } while (cnt--); - /* Only single function PF can bring phy down. - * When port is stopped, report link down for VF/MH/NPAR functions. - */ - if (!BNXT_SINGLE_PF(bp) && !eth_dev->data->dev_started) - memset(&new, 0, sizeof(new)); - out: /* Timed out or success */ if (new.link_status != eth_dev->data->dev_link.link_status || -- 2.10.1