Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C86BC2D0A8 for ; Wed, 30 Sep 2020 05:48:48 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id A313E206DB for ; Wed, 30 Sep 2020 05:48:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A313E206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D777E1D538; Wed, 30 Sep 2020 07:48:45 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A6AFD1D422 for ; Wed, 30 Sep 2020 07:48:43 +0200 (CEST) IronPort-SDR: 3Avli8C2GBHsVohFfPEhYw9Kxa+M5LN5JW1D1PbVFGjSIUGJesfOEndXfwY1y1PcQnyPhLTbcv etPgMyu7xU7w== X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="161591511" X-IronPort-AV: E=Sophos;i="5.77,321,1596524400"; d="scan'208";a="161591511" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2020 22:48:41 -0700 IronPort-SDR: CP3SRr1N44FzJXSXDAEUYnplPWmWCnoDAtYBdsYPkFaRWjy8fNuD68FNjCF4wRuidp54XBarBD HrYOO26UBIwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,321,1596524400"; d="scan'208";a="324929129" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga002.jf.intel.com with ESMTP; 29 Sep 2020 22:48:39 -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 Date: Wed, 30 Sep 2020 13:44:12 +0800 Message-Id: <20200930054412.92792-1-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1] net/iavf: fix flow flush 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" When VF begin reset after PF reset, VF will be uninitialized at first and then be initialized, during the time any invalid cmd such as flow flush should not be sent to PF until the uninitialization is finished. Fixes: 1eab95fe2e36 ("net/iavf: fix command after PF reset") Signed-off-by: Jeff Guo --- drivers/net/iavf/iavf_ethdev.c | 4 ++-- drivers/net/iavf/iavf_hash.c | 4 ++++ drivers/net/iavf/iavf_vchnl.c | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index a88d53ab0..ffcbb0ed8 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1677,8 +1677,6 @@ iavf_init_vf(struct rte_eth_dev *dev) } } - vf->vf_reset = false; - iavf_init_proto_xtr(dev); return 0; @@ -1900,6 +1898,8 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + + vf->vf_reset = false; } static int diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index 4b7f4a872..be821b62e 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -1034,9 +1034,13 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *ad, struct rte_flow *flow, __rte_unused struct rte_flow_error *error) { + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); struct virtchnl_rss_cfg *rss_cfg; int ret = 0; + if (vf->vf_reset) + return 0; + rss_cfg = (struct virtchnl_rss_cfg *)flow->rule; ret = iavf_add_del_rss_cfg(ad, rss_cfg, false); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 7981dfa30..a7bed5327 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -73,12 +73,12 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) int err = 0; int i = 0; - if (_atomic_set_cmd(vf, args->ops)) - return -1; - if (vf->vf_reset) return -EIO; + if (_atomic_set_cmd(vf, args->ops)) + return -1; + ret = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS, args->in_args, args->in_args_size, NULL); if (ret) { @@ -189,6 +189,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; -- 2.20.1