From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AFA0545949; Mon, 9 Sep 2024 13:04:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B5B240E35; Mon, 9 Sep 2024 13:04:08 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id 3834740E2B; Mon, 9 Sep 2024 13:04:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725879847; x=1757415847; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=coyM3LN8VhVsDzn4AeKYXqBRxXz4re6NhavEF1unNq8=; b=h4rTyBCIbVde6Hf7FBN1qneSPizgwOWGj7GbYTdClk1+0eDP4aPcN9XM fSYrE8jX/tvi8Na8T6te2AQWODRyKIUfSdmbEb/HAA/gHdafjBjjxK2Oa cRlvi5nZeG0RZ8vulDQmC4LoET89HmVKyl8/EQdyZUh+aN2iP5H6Khjku 9pOCW6xRAm0Kx+CG3o8XiCucrbVDg8b1vOJZsnSe3jBp6lJEHKaLbO5Tn 7Exz8UNgPV0ycTRTxCt3iN1CCXa8LEDwOvo+WZQutko68fmIiOqixAoix 70m/79h4dQ5BgTD2KnOo3TDnUPHtH0eL2qxP3PVy06K6nqv66X2xXYjO+ w==; X-CSE-ConnectionGUID: eemY8Tr+RMqLwNM5WA793A== X-CSE-MsgGUID: aI+GKAjbSFeVdCKH6Amqhg== X-IronPort-AV: E=McAfee;i="6700,10204,11189"; a="24369175" X-IronPort-AV: E=Sophos;i="6.10,214,1719903600"; d="scan'208";a="24369175" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 04:04:05 -0700 X-CSE-ConnectionGUID: uTO47qqlTEa6m6qPPS+ZVQ== X-CSE-MsgGUID: VLNU7J14QV2OYOBNGg1oGA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,214,1719903600"; d="scan'208";a="66632583" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa009.fm.intel.com with ESMTP; 09 Sep 2024 04:04:03 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , kaiwenx.deng@intel.com, stable@dpdk.org Subject: [PATCH] net/iavf: delay VF reset command Date: Mon, 9 Sep 2024 12:03:56 +0100 Message-ID: <20240909110356.23757-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Commit 0f9ec0cbd2a9 ("net/iavf: fix VF reset when using DCF"), introduced a VF-reset adminq call into the reset sequence for iavf. However, that call was very early in the sequence before other adminq commands had been sent. To delay the VF reset, we can put the message sending in the "dev_close" function, right before the adminq is shut down, and thereby guaranteeing that we won't have any subsequent issues with adminq messages. In the process of making this change, we can also use the iavf_vf_reset function from common/iavf, rather than hard-coding the message sending lower-level calls in the net driver. Fixes: e74e1bb6280d ("net/iavf: enable port reset") Fixes: 0f9ec0cbd2a9 ("net/iavf: fix VF reset when using DCF") Cc: kaiwenx.deng@intel.com Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- drivers/common/iavf/iavf_prototype.h | 1 + drivers/common/iavf/version.map | 1 + drivers/net/iavf/iavf_ethdev.c | 12 +----------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/common/iavf/iavf_prototype.h b/drivers/common/iavf/iavf_prototype.h index ba78ec5169..7c43a817bb 100644 --- a/drivers/common/iavf/iavf_prototype.h +++ b/drivers/common/iavf/iavf_prototype.h @@ -79,6 +79,7 @@ STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype) __rte_internal void iavf_vf_parse_hw_config(struct iavf_hw *hw, struct virtchnl_vf_resource *msg); +__rte_internal enum iavf_status iavf_vf_reset(struct iavf_hw *hw); __rte_internal enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw, diff --git a/drivers/common/iavf/version.map b/drivers/common/iavf/version.map index e0f117197c..6c1427cca4 100644 --- a/drivers/common/iavf/version.map +++ b/drivers/common/iavf/version.map @@ -7,6 +7,7 @@ INTERNAL { iavf_set_mac_type; iavf_shutdown_adminq; iavf_vf_parse_hw_config; + iavf_vf_reset; local: *; }; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 44276dcf38..11036bc179 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2962,6 +2962,7 @@ iavf_dev_close(struct rte_eth_dev *dev) if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled) iavf_config_promisc(adapter, false, false); + iavf_vf_reset(hw); iavf_shutdown_adminq(hw); if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) { /* disable uio intr before callback unregister */ @@ -3041,17 +3042,6 @@ iavf_dev_reset(struct rte_eth_dev *dev) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); - - if (!vf->in_reset_recovery) { - ret = iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF, - IAVF_SUCCESS, NULL, 0, NULL); - if (ret) { - PMD_DRV_LOG(ERR, "fail to send cmd VIRTCHNL_OP_RESET_VF"); - return ret; - } - } - /* * Check whether the VF reset has been done and inform application, * to avoid calling the virtual channel command, which may cause -- 2.43.0