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 76EE6A0C4D; Thu, 12 Aug 2021 04:00:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BFA7F411FA; Thu, 12 Aug 2021 04:00:40 +0200 (CEST) Received: from smtpbg501.qq.com (smtpbg501.qq.com [203.205.250.101]) by mails.dpdk.org (Postfix) with ESMTP id 2A040411FC for ; Thu, 12 Aug 2021 04:00:37 +0200 (CEST) X-QQ-mid: bizesmtp31t1628733628tga64ogm Received: from jiawenwu.trustnetic.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Thu, 12 Aug 2021 10:00:27 +0800 (CST) X-QQ-SSF: 01400000002000E0F000B00A0000000 X-QQ-FEAT: ttxN9vkG2OQjSuvoPZrYCcMCLANOv3MRSBLyLEd8n9zd0nUStXj/kGH4kwjgj NAX1RVKFIcpHNV4dJVwUalyY4U33gSR2mjSecBOitXdgp4QncnyjIyfxeKXikLl+tc7/ayZ tvVlTBLr4rCNhHQlSXjO4GkwyJA5VCm1fKEl+HeV2o3rUiLV4aXs6ScWzjHAkoVnS8+OOr/ wS8aQz0DY+ISItP+jhkeZgap06hceOprJ66+amlE/AC+sqZefdIGAbAxcYkE4GKrf7QBdIi p+UdvDLEW1IBlG68IpkXx7diRz4xG7bj7YjnTPNaiEPpAc1KqOECIh9xscBaL4TGLdqhbYg Y+0cEt2Pby8kacb8sXFYMjgccWabQ== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu , stable@dpdk.org Date: Thu, 12 Aug 2021 10:00:18 +0800 Message-Id: <20210812020020.12656-2-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210812020020.12656-1-jiawenwu@trustnetic.com> References: <20210812020020.12656-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign7 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH 1/3] net/txgbe: fix link status when device stopped 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" When device is stopped, the port status is not changed and only the Tx laser is turned off by hardware design. Fixes: 0c061eadec59 ("net/txgbe: add link status change") Cc: stable@dpdk.org Signed-off-by: Jiawen Wu --- drivers/net/txgbe/base/txgbe_type.h | 1 + drivers/net/txgbe/txgbe_ethdev.c | 4 ++++ drivers/net/txgbe/txgbe_ethdev_vf.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/drivers/net/txgbe/base/txgbe_type.h b/drivers/net/txgbe/base/txgbe_type.h index 823c6756e7..d95467f9f8 100644 --- a/drivers/net/txgbe/base/txgbe_type.h +++ b/drivers/net/txgbe/base/txgbe_type.h @@ -781,6 +781,7 @@ struct txgbe_hw { int api_version; bool allow_unsupported_sfp; bool need_crosstalk_fix; + bool dev_start; struct txgbe_devargs devarg; uint64_t isb_dma; diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index e62675520a..0063994688 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -1664,6 +1664,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) return -1; hw->mac.start_hw(hw); hw->mac.get_link_status = true; + hw->dev_start = true; /* configure PF module if SRIOV enabled */ txgbe_pf_host_configure(dev); @@ -1933,6 +1934,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev) hw->adapter_stopped = true; dev->data->dev_started = 0; + hw->dev_start = false; return 0; } @@ -2735,6 +2737,8 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev, txgbe_dev_setup_link_alarm_handler, dev); } return rte_eth_linkstatus_set(dev, &link); + } else if (!hw->dev_start) { + return rte_eth_linkstatus_set(dev, &link); } intr->flags &= ~TXGBE_FLAG_NEED_LINK_CONFIG; diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index 0bae6ffd1f..18ed94bd27 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -628,6 +628,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev) return err; } hw->mac.get_link_status = true; + hw->dev_start = true; /* negotiate mailbox API version to use with the PF. */ txgbevf_negotiate_api(hw); @@ -749,6 +750,7 @@ txgbevf_dev_stop(struct rte_eth_dev *dev) } adapter->rss_reta_updated = 0; + hw->dev_start = false; return 0; } -- 2.21.0.windows.1