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 AE901A00C3; Mon, 15 Aug 2022 01:22:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E59F342685; Mon, 15 Aug 2022 01:22:20 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id EA796427F9 for ; Mon, 15 Aug 2022 01:22:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660519339; x=1692055339; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FpMBRmcA4/j+c5uVHSN5c8R6sNVERw/9xQ3n0uwJX+s=; b=V5OW00C0B5XJS/6wLc95/zzmZs/WzuVtWexhd6XftEnf32Wm4WWJVPg9 ++QgrD/SKi/UmY/9oUi4c8uekbOJ5F4zEmLhLuLnFSOUzYfYNAV3N9YWr eq0Bz4PiVL3dv7jObJbD29x2AuwRNZqD6KQsUShFJYO50m7u3XKrfIEkP HR8rMKqi3Rb2HhaGmbdSBhYCQBRgla2UbcZ6KRF4NaeXcTRk7rmKsKm1U 7gxqmkKNLcs06/JIomVVIIqTK25u202p8SsOgtAmCzQ9HoZu+BSWtOs7f o2aeb+syX52jYPk53Y4NyxH47np1lhYUopmrOefnA7GVx1SIIxil0Ylhn Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10439"; a="291857912" X-IronPort-AV: E=Sophos;i="5.93,237,1654585200"; d="scan'208";a="291857912" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2022 16:22:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,237,1654585200"; d="scan'208";a="635282987" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.115.4]) by orsmga008.jf.intel.com with ESMTP; 14 Aug 2022 16:22:17 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, Qi Zhang , Wiktor Pilarczyk Subject: [PATCH v2 03/70] net/ice/base: combine functions for VSI promisc Date: Mon, 15 Aug 2022 03:30:59 -0400 Message-Id: <20220815073206.2917968-4-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220815073206.2917968-1-qi.z.zhang@intel.com> References: <20220815071306.2910599-1-qi.z.zhang@intel.com> <20220815073206.2917968-1-qi.z.zhang@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 Remove ice_get_vsi_vlan_promisc, cause of similar implementation as ice_get_vsi_promisc, which will now handle the use case of ice_get_vsi_vlan_promisc. Signed-off-by: Wiktor Pilarczyk Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 58 ++++++------------------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index c0df3a1815..513623a0a4 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -5825,22 +5825,25 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi) * @promisc_mask: pointer to mask to be filled in * @vid: VLAN ID of promisc VLAN VSI * @sw: pointer to switch info struct for which function add rule + * @lkup: switch rule filter lookup type */ static enum ice_status _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid, struct ice_switch_info *sw) + u16 *vid, struct ice_switch_info *sw, + enum ice_sw_lkup_type lkup) { struct ice_fltr_mgmt_list_entry *itr; struct LIST_HEAD_TYPE *rule_head; struct ice_lock *rule_lock; /* Lock to protect filter rule list */ - if (!ice_is_vsi_valid(hw, vsi_handle)) + if (!ice_is_vsi_valid(hw, vsi_handle) || + (lkup != ICE_SW_LKUP_PROMISC && lkup != ICE_SW_LKUP_PROMISC_VLAN)) return ICE_ERR_PARAM; *vid = 0; *promisc_mask = 0; - rule_head = &sw->recp_list[ICE_SW_LKUP_PROMISC].filt_rules; - rule_lock = &sw->recp_list[ICE_SW_LKUP_PROMISC].filt_rule_lock; + rule_head = &sw->recp_list[lkup].filt_rules; + rule_lock = &sw->recp_list[lkup].filt_rule_lock; ice_acquire_lock(rule_lock); LIST_FOR_EACH_ENTRY(itr, rule_head, @@ -5870,47 +5873,7 @@ ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, u16 *vid) { return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask, - vid, hw->switch_info); -} - -/** - * _ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI - * @hw: pointer to the hardware structure - * @vsi_handle: VSI handle to retrieve info from - * @promisc_mask: pointer to mask to be filled in - * @vid: VLAN ID of promisc VLAN VSI - * @sw: pointer to switch info struct for which function add rule - */ -static enum ice_status -_ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid, struct ice_switch_info *sw) -{ - struct ice_fltr_mgmt_list_entry *itr; - struct LIST_HEAD_TYPE *rule_head; - struct ice_lock *rule_lock; /* Lock to protect filter rule list */ - - if (!ice_is_vsi_valid(hw, vsi_handle)) - return ICE_ERR_PARAM; - - *vid = 0; - *promisc_mask = 0; - rule_head = &sw->recp_list[ICE_SW_LKUP_PROMISC_VLAN].filt_rules; - rule_lock = &sw->recp_list[ICE_SW_LKUP_PROMISC_VLAN].filt_rule_lock; - - ice_acquire_lock(rule_lock); - LIST_FOR_EACH_ENTRY(itr, rule_head, ice_fltr_mgmt_list_entry, - list_entry) { - /* Continue if this filter doesn't apply to this VSI or the - * VSI ID is not in the VSI map for this filter - */ - if (!ice_vsi_uses_fltr(itr, vsi_handle)) - continue; - - *promisc_mask |= ice_determine_promisc_mask(&itr->fltr_info); - } - ice_release_lock(rule_lock); - - return ICE_SUCCESS; + vid, hw->switch_info, ICE_SW_LKUP_PROMISC); } /** @@ -5924,8 +5887,9 @@ enum ice_status ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, u16 *vid) { - return _ice_get_vsi_vlan_promisc(hw, vsi_handle, promisc_mask, - vid, hw->switch_info); + return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask, + vid, hw->switch_info, + ICE_SW_LKUP_PROMISC_VLAN); } /** -- 2.31.1