From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F993A04AB; Fri, 8 Nov 2019 06:58:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4C9E11BF1F; Fri, 8 Nov 2019 06:58:57 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id EF7971BF1F; Fri, 8 Nov 2019 06:58:54 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 21:58:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,280,1569308400"; d="scan'208";a="213179516" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga001.fm.intel.com with ESMTP; 07 Nov 2019 21:58:51 -0800 Date: Fri, 8 Nov 2019 13:54:44 +0800 From: Ye Xiaolong To: Qiming Yang Cc: dev@dpdk.org, wenzhuo.lu@intel.com, paul.m.stillwell.jr@intel.com, stable@dpdk.org Message-ID: <20191108055444.GJ100445@intel.com> References: <20191105050900.30836-1-qiming.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105050900.30836-1-qiming.yang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] net/ice: fix link status recovery 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" On 11/05, Qiming Yang wrote: >This patch fix a kernel driver link status issue by recovering s/fix/fixes >link status when device stop. s/stop/stops > >Fixes: e6161345d8a9 ("net/ice: support link status change") >Cc: stable@dpdk.org > >Signed-off-by: Qiming Yang >--- > drivers/net/ice/ice_ethdev.c | 27 ++++++++++++++++++++++++++- > drivers/net/ice/ice_ethdev.h | 1 + > 2 files changed, 27 insertions(+), 1 deletion(-) > >diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c >index d746758..212e1c7 100644 >--- a/drivers/net/ice/ice_ethdev.c >+++ b/drivers/net/ice/ice_ethdev.c >@@ -2277,7 +2277,10 @@ ice_dev_stop(struct rte_eth_dev *dev) > /* Clear all queues and release mbufs */ > ice_clear_queues(dev); > >- ice_dev_set_link_down(dev); >+ if (pf->init_link_status) >+ ice_dev_set_link_up(dev); >+ else >+ ice_dev_set_link_down(dev); > > /* Clean datapath event and queue/vec mapping */ > rte_intr_efd_disable(intr_handle); >@@ -2648,6 +2651,26 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev) > return 0; > } > >+static void ice_get_init_link_status(struct rte_eth_dev *dev) Put the return type in a single line. Thanks, Xiaolong >+{ >+ struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); >+ bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false; >+ struct ice_link_status link_status; >+ int ret; >+ >+ ret = ice_aq_get_link_info(hw->port_info, enable_lse, >+ &link_status, NULL); >+ if (ret != ICE_SUCCESS) { >+ PMD_DRV_LOG(ERR, "Failed to get link info"); >+ pf->init_link_status = false; >+ return; >+ } >+ >+ if (link_status.link_info & ICE_AQ_LINK_UP) >+ pf->init_link_status = true; >+} >+ > static int > ice_dev_start(struct rte_eth_dev *dev) > { >@@ -2717,6 +2740,8 @@ ice_dev_start(struct rte_eth_dev *dev) > if (ret != ICE_SUCCESS) > PMD_DRV_LOG(WARNING, "Fail to set phy mask"); > >+ ice_get_init_link_status(dev); >+ > ice_dev_set_link_up(dev); > > /* Call get_link_info aq commond to enable/disable LSE */ >diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h >index de67e59..27db4e7 100644 >--- a/drivers/net/ice/ice_ethdev.h >+++ b/drivers/net/ice/ice_ethdev.h >@@ -369,6 +369,7 @@ struct ice_pf { > struct ice_parser_list rss_parser_list; > struct ice_parser_list perm_parser_list; > struct ice_parser_list dist_parser_list; >+ bool init_link_status; > }; > > #define ICE_MAX_QUEUE_NUM 2048 >-- >2.9.5 >