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 EC91EA04B5; Fri, 11 Sep 2020 11:45:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 52D601BFCD; Fri, 11 Sep 2020 11:45:48 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 5378A1B9B7 for ; Fri, 11 Sep 2020 11:45:45 +0200 (CEST) IronPort-SDR: Zb2ZrrnHQoBjqSGGPSh48G314DjkAa0NkjWHeHoDwxqpr5Oq53WZSOh00oJIvhlA096C2tUMe3 E9zS1aAJAOkA== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="158008921" X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="158008921" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 02:45:44 -0700 IronPort-SDR: biRDhhIp7Ji7pCJWPnfnpwX1yzfRi2yCd7TdvnFo17fWSusYwnER1Uu0M+SF1iU9skywzLJakU 3/2YzvHf5SSA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="449933039" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 11 Sep 2020 02:45:44 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 11 Sep 2020 02:45:30 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 11 Sep 2020 17:45:29 +0800 Received: from shsmsx602.ccr.corp.intel.com ([10.109.6.142]) by SHSMSX602.ccr.corp.intel.com ([10.109.6.142]) with mapi id 15.01.1713.004; Fri, 11 Sep 2020 17:45:29 +0800 From: "Xu, HailinX" To: "Guo, Jia" , "Wu, Jingjing" , "Zhang, Qi Z" , "Xing, Beilei" CC: "dev@dpdk.org" , "Guo, Jia" Thread-Topic: [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset Thread-Index: AQHWh/uveB4hcb0qfU+A0adkbXTGz6ljMIyg Date: Fri, 11 Sep 2020 09:45:29 +0000 Message-ID: References: <20200911052114.62723-1-jia.guo@intel.com> In-Reply-To: <20200911052114.62723-1-jia.guo@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset 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" Tested-by: Xu, HailinX Regards, Xu, Hailin -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jeff Guo Sent: Friday, September 11, 2020 1:21 PM To: Wu, Jingjing ; Zhang, Qi Z ; Xing, Beilei Cc: dev@dpdk.org; Guo, Jia Subject: [dpdk-dev] [PATCH v1] net/iavf: fix invalid cmd after pf reset If PF reset is finished but VF reset is pending, VF should no need to send = any invalid cmd to PF. That would avoid mass unexpected behaviors affecting= the robust. Fixes: 22b123a36d07 ("net/avf: initialize PMD") Fixes: 9e03acd726cf ("net/iavf: fix flow access") Signed-off-by: Jeff Guo --- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 2 ++ drivers/net/iavf/iavf_hash.c | 8 ++++++++ drivers/net/iavf/iavf_vchnl.c | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 9be8a2= 381..2b76c4b11 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -130,7 +130,7 @@ struct iavf_info { uint32_t link_speed; =20 struct iavf_vsi vsi; - bool vf_reset; + bool vf_reset; /* true for VF reset pending, false for no VF reset */ uint64_t flags; =20 uint8_t *rss_lut; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.= c index c3aa4cd72..5c3f8eac0 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1240,6 +1240,8 @@ iavf_init_vf(struct rte_eth_dev *dev) } } =20 + vf->vf_reset =3D false; + return 0; err_rss: rte_free(vf->rss_key); diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c in= dex c06b52ea9..8df2adb9d 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -3694,6 +3694,9 @@ iavf_hash_init(struct iavf_adapter *ad) struct iavf_flow_parser *parser; int ret; =20 + if (vf->vf_reset) + return -EIO; + if (!vf->vf_res) return -EINVAL; =20 @@ -3994,6 +3997,11 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *= ad, static void iavf_hash_uninit(struct iavf_adapter *ad) { + struct iavf_info *vf =3D IAVF_DEV_PRIVATE_TO_VF(ad); + + if (vf->vf_reset) + return; + if (iavf_hash_default_set(ad, false)) PMD_DRV_LOG(ERR, "fail to delete default RSS"); =20 diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c = index 33acea54a..1a9f7aa39 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -73,6 +73,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct = iavf_cmd_info *args) if (_atomic_set_cmd(vf, args->ops)) return -1; =20 + if (vf->vf_reset) + return -EIO; + ret =3D iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS, args->in_args, args->in_args_size, NULL); if (ret) { @@ -183,6 +186,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8= _t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset =3D true; _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; -- 2.20.1