From patchwork Fri Sep 11 10:18:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 77372 X-Patchwork-Delegate: qi.z.zhang@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 A0759A04B5; Fri, 11 Sep 2020 12:20:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 630351C0CC; Fri, 11 Sep 2020 12:20:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5F3521C0CA for ; Fri, 11 Sep 2020 12:20:50 +0200 (CEST) IronPort-SDR: yzKMvV/5osQtSH90WazycZej///tHtglJmzR7QuukuyHmOyHMdHgwHmOJrcILLvhgcQebgHUZY aeC9LMEeUnAQ== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="220285182" X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="220285182" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 03:20:48 -0700 IronPort-SDR: oSm69Xe+qC2Wb/fhASkONQYqi9WJjwEGGfgBeOJehorYsHDJGySKPWkPXRiJlH4TXYV63dDokT 6B9WfKsNEhuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="329721032" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by fmsmga004.fm.intel.com with ESMTP; 11 Sep 2020 03:20:46 -0700 From: Jeff Guo To: jingjing.wu@intel.com, qi.z.zhang@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, Xu@dpdk.org, HailinX Date: Fri, 11 Sep 2020 18:18:48 +0800 Message-Id: <20200911101848.111384-1-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200911052114.62723-1-jia.guo@intel.com> References: <20200911052114.62723-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] 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" 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 Tested-by: Xu, HailinX Acked-by: Qi Zhang --- v2->v1: rebase patch. --- 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 9ad331ee9..3198d85b3 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -134,7 +134,7 @@ struct iavf_info { uint16_t mc_addrs_num; /* Multicast mac addresses number */ struct iavf_vsi vsi; - bool vf_reset; + bool vf_reset; /* true for VF reset pending, false for no VF reset */ uint64_t flags; uint8_t *rss_lut; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 8e1d8a8d3..8fe81409c 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1288,6 +1288,8 @@ iavf_init_vf(struct rte_eth_dev *dev) } } + vf->vf_reset = 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 index ff77d7135..ddc6df849 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -457,6 +457,9 @@ iavf_hash_init(struct iavf_adapter *ad) struct iavf_flow_parser *parser; int ret; + if (vf->vf_reset) + return -EIO; + if (!vf->vf_res) return -EINVAL; @@ -967,6 +970,11 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *ad, static void iavf_hash_uninit(struct iavf_adapter *ad) { + struct iavf_info *vf = 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"); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 34c31a153..1871ba299 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -77,6 +77,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) if (_atomic_set_cmd(vf, args->ops)) return -1; + if (vf->vf_reset) + return -EIO; + ret = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS, args->in_args, args->in_args_size, NULL); if (ret) { @@ -187,6 +190,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 = true; _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break;