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 54FB3A0524; Tue, 13 Apr 2021 16:27:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3978161048; Tue, 13 Apr 2021 16:27:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 46E1316103E for ; Tue, 13 Apr 2021 16:26:59 +0200 (CEST) IronPort-SDR: X99+b0DzfvgUMWHflKTHU6jXnFNxEYZb1TIR1R4VfjUpmDdMqsdb+qjvW8M3tq9zwVM9jxOGho 5e5Zmesp1YCQ== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="214904195" X-IronPort-AV: E=Sophos;i="5.82,219,1613462400"; d="scan'208";a="214904195" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2021 07:26:58 -0700 IronPort-SDR: Ft3xkTFbI3az8/L/Kc34RIXT0bNMFfaWISG2RehKqteM5snz/nP+9Zr52xUBx5DvgZmMvuvdLL Kzar0GxI5H6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,219,1613462400"; d="scan'208";a="417875116" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga008.fm.intel.com with ESMTP; 13 Apr 2021 07:26:56 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, Qi Zhang , Vignesh Sridhar Date: Tue, 13 Apr 2021 22:30:26 +0800 Message-Id: <20210413143038.2621294-3-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210413143038.2621294-1-qi.z.zhang@intel.com> References: <20210329141411.2395069-1-qi.z.zhang@intel.com> <20210413143038.2621294-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 02/14] net/ice/base: support removing VSI from flow profile 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 Sender: "dev" Adding a function ice_flow_rem_vsi_prof() to remove flow entries associated to the sw vsi handle. Once complete clear the vsi index from the flow profile bitmap. This will ensure that the a vsi once removed can be re-added and the package block rules will be added again. Signed-off-by: Vignesh Sridhar Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_flow.c | 55 +++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_flow.h | 2 ++ 2 files changed, 57 insertions(+) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index c12ddfa247..e462a8c542 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -3295,6 +3295,61 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, seg->raws_cnt++; } +/** + * ice_flow_rem_vsi_prof - remove vsi from flow profile + * @hw: pointer to the hardware structure + * @blk: classification stage + * @vsi_handle: software VSI handle + * @prof_id: unique ID to identify this flow profile + * + * This function removes the flow entries associated to the input + * vsi handle and disassociates the vsi from the flow profile. + */ +enum ice_status ice_flow_rem_vsi_prof(struct ice_hw *hw, enum ice_block blk, u16 vsi_handle, + u64 prof_id) +{ + struct ice_flow_prof *prof = NULL; + enum ice_status status = ICE_SUCCESS; + + if (blk >= ICE_BLK_COUNT || !ice_is_vsi_valid(hw, vsi_handle)) + return ICE_ERR_PARAM; + + /* find flow profile pointer with input package block and profile id */ + prof = ice_flow_find_prof_id(hw, ICE_BLK_FD, prof_id); + if (!prof) { + ice_debug(hw, ICE_DBG_PKG, + "Cannot find flow profile id=%" PRIu64 "\n", prof_id); + return ICE_ERR_DOES_NOT_EXIST; + } + + /* Remove all remaining flow entries before removing the flow profile */ + if (!LIST_EMPTY(&prof->entries)) { + struct ice_flow_entry *e, *t; + + ice_acquire_lock(&prof->entries_lock); + LIST_FOR_EACH_ENTRY_SAFE(e, t, &prof->entries, ice_flow_entry, + l_entry) { + if (e->vsi_handle != vsi_handle) + continue; + + status = ice_flow_rem_entry_sync(hw, blk, e); + if (status) + break; + } + ice_release_lock(&prof->entries_lock); + } + if (status) + return status; + + /* disassociate the flow profile from sw vsi handle */ + status = ice_flow_disassoc_prof(hw, blk, prof, vsi_handle); + if (status) + ice_debug(hw, ICE_DBG_PKG, + "ice_flow_disassoc_prof() failed with status=%d\n", + status); + return status; +} + #define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \ (ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN) diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h index af15ecb0ff..40a75f53f9 100644 --- a/drivers/net/ice/base/ice_flow.h +++ b/drivers/net/ice/base/ice_flow.h @@ -553,6 +553,8 @@ ice_flow_set_fld_prefix(struct ice_flow_seg_info *seg, enum ice_flow_field fld, void ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, u16 val_loc, u16 mask_loc); +enum ice_status ice_flow_rem_vsi_prof(struct ice_hw *hw, enum ice_block blk, + u16 vsi_handle, u64 prof_id); void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle); enum ice_status ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle); enum ice_status -- 2.26.2