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 49097A0508; Thu, 7 Apr 2022 05:02:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D42C428E2; Thu, 7 Apr 2022 05:00:03 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EBA6D428E9 for ; Thu, 7 Apr 2022 05:00:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649300402; x=1680836402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vZ1wK6tEwVCGfFyeyKkg16W2Djo88uHh23EhCqeAsCc=; b=HPyUNLBoUOyDKt5z8n65N0LisZhxHNagxw0nS60+oIrfKUkizLhbQeOW rQ7lCJUyfz1JTAfuciFP8O2AN+gVzHVDzVgETsHKKueQ/PSUDq6pocIqb omr2wKitkqrg2uGv3vqSK6EHcjNeRmPhxF+wxPcEejxtLUBufYpDTVfvF TpA901P77oXGUeLAHdJS5AouSD44q2d2kJD68Ivyel3hLmsCWBvMJOJES i09Obdwn3mB5znuiXhhFBPSkeFqxrPQAlSN/Wj0akqju44FR/iGN9S5ln fiTbjCiglUiLV4+YZ8SvGclj2mSPf40rKgoEtkncWyI7fJjPT/n77O1ST g==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="248738523" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="248738523" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 20:00:01 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="570850893" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:59 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Kevin Liu , Alvin Zhang Subject: [PATCH 39/39] net/ice: fix DCF reset Date: Thu, 7 Apr 2022 10:57:06 +0000 Message-Id: <20220407105706.18889-40-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220407105706.18889-1-kevinx.liu@intel.com> References: <20220407105706.18889-1-kevinx.liu@intel.com> 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 After the PF triggers the VF reset, before the VF PMD can perform any operations on the hardware, it must reinitialize the all resources. This patch adds a flag to indicate whether the VF has been reset by PF, and update the DCF resetting operations according to this flag. Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset") Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/base/ice_common.c | 4 +++- drivers/net/ice/ice_dcf.c | 2 +- drivers/net/ice/ice_dcf_ethdev.c | 17 ++++++++++++++++- drivers/net/ice/ice_dcf_parent.c | 3 +++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index 5d5ce894ff..530e766abf 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -779,6 +779,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw) status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list); if (status) { ice_free(hw, hw->switch_info); + hw->switch_info = NULL; return status; } return ICE_SUCCESS; @@ -848,7 +849,6 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw) ice_rm_sw_replay_rule_info(hw, sw); ice_free(hw, sw->buildin_recipes); ice_free(hw, sw->recp_list); - ice_free(hw, sw); } /** @@ -858,6 +858,8 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw) void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw) { ice_cleanup_fltr_mgmt_single(hw, hw->switch_info); + ice_free(hw, hw->switch_info); + hw->switch_info = NULL; } /** diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 6b210176a0..dfd6d5ff64 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -1430,7 +1430,7 @@ ice_dcf_cap_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) int ret; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; ice_dcf_disable_irq0(hw); rte_intr_disable(intr_handle); diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index b5381cdfc4..e09570cd40 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1005,6 +1005,15 @@ dcf_add_del_mc_addr_list(struct ice_dcf_hw *hw, uint32_t i; int len, err = 0; + if (hw->resetting) { + if (!add) + return 0; + + PMD_DRV_LOG(ERR, + "fail to add multicast MACs for VF resetting"); + return -EIO; + } + len = sizeof(struct virtchnl_ether_addr_list); len += sizeof(struct virtchnl_ether_addr) * mc_addrs_num; @@ -1643,7 +1652,13 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - (void)ice_dcf_dev_stop(dev); + if (adapter->parent.pf.adapter_stopped) + (void)ice_dcf_dev_stop(dev); + + if (adapter->real_hw.resetting) { + ice_dcf_uninit_hw(dev, &adapter->real_hw); + ice_dcf_init_hw(dev, &adapter->real_hw); + } ice_free_queues(dev); diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 2aa69c7368..2a936bd2c1 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -243,6 +243,9 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw, case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); dcf_hw->resetting = true; + rte_eth_dev_callback_process(dcf_hw->eth_dev, + RTE_ETH_EVENT_INTR_RESET, + NULL); break; case VIRTCHNL_EVENT_LINK_CHANGE: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event"); -- 2.33.1