From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BCB843977; Wed, 30 May 2018 10:39:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2018 01:39:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,459,1520924400"; d="scan'208";a="232879595" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by fmsmga005.fm.intel.com with ESMTP; 30 May 2018 01:39:42 -0700 From: Fan Zhang To: dev@dpdk.org Cc: helin.zhang@intel.com, roy.fan.zhang@intel.com, qi.z.zhang@intel.com, stable@dpdk.org Date: Wed, 30 May 2018 09:30:09 +0100 Message-Id: <20180530083009.33942-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180530082634.33843-1-roy.fan.zhang@intel.com> References: <20180530082634.33843-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link status update 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: , X-List-Received-Date: Wed, 30 May 2018 08:39:46 -0000 This patch fixes link status update problem in interrupt mode. Previously, directly reading link status register instead of accessing via admin queue command may cause the link status change interrupt callback inactive. This patch fixes the problem by making the driver only read the register in "no wait" and polling mode. Bugzilla ID 54, link https://dpdk.org/tracker/show_bug.cgi?id=54 Fixes: eef2daf2e199 ("net/i40e: fix link update no wait") Cc: stable@dpdk.org Signed-off-by: Fan Zhang --- drivers/net/i40e/i40e_ethdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7d4f1c9da..13c5d3296 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2522,7 +2522,7 @@ i40e_dev_set_link_down(struct rte_eth_dev *dev) } static __rte_always_inline void -update_link_no_wait(struct i40e_hw *hw, struct rte_eth_link *link) +update_link_reg(struct i40e_hw *hw, struct rte_eth_link *link) { /* Link status registers and values*/ #define I40E_PRTMAC_LINKSTA 0x001E2420 @@ -2576,8 +2576,8 @@ update_link_no_wait(struct i40e_hw *hw, struct rte_eth_link *link) } static __rte_always_inline void -update_link_wait(struct i40e_hw *hw, struct rte_eth_link *link, - bool enable_lse) +update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link, + bool enable_lse, int wait_to_complete) { #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_REPEAT_TIME 10 /* 1s (10 * 100ms) in total */ @@ -2601,7 +2601,7 @@ update_link_wait(struct i40e_hw *hw, struct rte_eth_link *link, } link->link_status = link_status.link_info & I40E_AQ_LINK_UP; - if (unlikely(link->link_status != 0)) + if (!wait_to_complete || link->link_status) break; rte_delay_ms(CHECK_INTERVAL); @@ -2649,10 +2649,10 @@ i40e_dev_link_update(struct rte_eth_dev *dev, link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - if (!wait_to_complete) - update_link_no_wait(hw, &link); + if (!wait_to_complete && !enable_lse) + update_link_reg(hw, &link); else - update_link_wait(hw, &link, enable_lse); + update_link_aq(hw, &link, enable_lse, wait_to_complete); ret = rte_eth_linkstatus_set(dev, &link); i40e_notify_all_vfs_link_status(dev); -- 2.13.6