From patchwork Tue Oct 29 05:33:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Zhang X-Patchwork-Id: 62140 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8F7DAA00BE; Tue, 29 Oct 2019 06:36:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BE6D1BEE6; Tue, 29 Oct 2019 06:36:07 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A5B731BED7; Tue, 29 Oct 2019 06:36:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 22:36:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,242,1569308400"; d="scan'208";a="399675182" Received: from npg-dpdk-zhangxiao.sh.intel.com ([10.67.110.203]) by fmsmga005.fm.intel.com with ESMTP; 28 Oct 2019 22:36:02 -0700 From: Xiao Zhang To: dev@dpdk.org Cc: wei.zhao1@intel.com, xiaolong.ye@intel.com, Xiao Zhang , stable@dpdk.org Date: Tue, 29 Oct 2019 13:33:23 +0800 Message-Id: <1572327203-32298-1-git-send-email-xiao.zhang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1567425132-59486-1-git-send-email-xiao.zhang@intel.com> References: <1567425132-59486-1-git-send-email-xiao.zhang@intel.com> Subject: [dpdk-dev] [v2] net/ixgbe:fix wrong link status X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The link status for 82599eb got from link status register was not correct, check the enable/disable flag of tx laser when getting the link status, set the link status down if tx laser disabled since the tx laser flag could be set correctly when up/down the link status. Fixes: dc66e5fd01b9 ("net/ixgbe: improve link state check on VF") Cc: stable@dpdk.org Signed-off-by: Xiao Zhang Reviewed-by: Wei Zhao Acked-by: Xiaolong Ye --- v2 Rebase the patch to latest master code. --- drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index dbce7a8..3202c28 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2904,6 +2904,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) } else { /* Turn on the laser */ ixgbe_enable_tx_laser(hw); + ixgbe_dev_link_update(dev, 0); } return 0; @@ -2934,6 +2935,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) } else { /* Turn off the laser */ ixgbe_disable_tx_laser(hw); + ixgbe_dev_link_update(dev, 0); } return 0; @@ -4108,6 +4110,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, int link_up; int diag; int wait = 1; + u32 esdp_reg; memset(&link, 0, sizeof(link)); link.link_status = ETH_LINK_DOWN; @@ -4135,6 +4138,10 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &link); } + esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); + if ((esdp_reg & IXGBE_ESDP_SDP3)) + link_up = 0; + if (link_up == 0) { if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;