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 93F6C454EF; Tue, 25 Jun 2024 13:18:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4188142E1D; Tue, 25 Jun 2024 13:15:59 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 19A52427E5 for ; Tue, 25 Jun 2024 13:15:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314138; x=1750850138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DlhQQWQCtOPHBg1L70zssugBYhfT6hsrz39VvBWpxqI=; b=m2rZryUr8jSJ/WrjrIDT6EASkcG30Yvy06q1RL0sU65b02fd2L6WdGGo S9p0islL6OSBrSZsFkSjAp0tkGjdNkYyqm/c71JpOv4pJejwrj5H0grRR 2zoMhiWAjEhtlEqZLjDF2p7fUHXVw05K8T4zRFtt8NiKNwOIdIt/PtGZQ wnEpvSIfOH6MlAV4/GideKBEh51hQDYgIbwylJNDw1LYj4zntVnjtmfdr fbAtg6CyifikYVPyyKdo28yyuYTtJTu+sTjOHGb6BSGBpFmeig1RfJGB4 HaDnH8Y2qYrt39hnxxSQAPpMCuoSfoQqUhzCXoRNzPMMKx5KWc477qyzi w==; X-CSE-ConnectionGUID: XzFQk6lPSHmrMR0hGHy1UQ== X-CSE-MsgGUID: 8RwbADCMQc6TelPTDJ7W0g== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080111" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080111" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:15:37 -0700 X-CSE-ConnectionGUID: oStqr8tnRrylT3eiAFpaiA== X-CSE-MsgGUID: OpYoRsNLSdK/qCIqVHis7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719031" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:15:36 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Mateusz Pacuszka , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 023/129] net/ice/base: use ice_bitmap_t in promisc functions Date: Tue, 25 Jun 2024 12:12:28 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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 From: Mateusz Pacuszka Currently all functions related to promiscuous modes use u8 bit mask. All 8 bits are utilized already and to be able to add any new flag, all the drivers need to comply. To address that, change u8 into ice_bitmap_t and use dedicated functions to process it. Signed-off-by: Mateusz Pacuszka Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_switch.c | 159 ++++++++++++++++++------------ drivers/net/ice/base/ice_switch.h | 38 +++---- drivers/net/ice/ice_ethdev.c | 24 ++--- 3 files changed, 127 insertions(+), 94 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 7528d35ca7..1d56c46b55 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6152,34 +6152,38 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, /** * ice_determine_promisc_mask * @fi: filter info to parse + * @promisc_mask: pointer to mask to be filled in * * Helper function to determine which ICE_PROMISC_ mask corresponds * to given filter into. */ -static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi) +static void ice_determine_promisc_mask(struct ice_fltr_info *fi, + ice_bitmap_t *promisc_mask) { u16 vid = fi->l_data.mac_vlan.vlan_id; u8 *macaddr = fi->l_data.mac.mac_addr; bool is_tx_fltr = false; - u8 promisc_mask = 0; + + ice_zero_bitmap(promisc_mask, ICE_PROMISC_MAX); if (fi->flag == ICE_FLTR_TX) is_tx_fltr = true; - if (IS_BROADCAST_ETHER_ADDR(macaddr)) - promisc_mask |= is_tx_fltr ? - ICE_PROMISC_BCAST_TX : ICE_PROMISC_BCAST_RX; - else if (IS_MULTICAST_ETHER_ADDR(macaddr)) - promisc_mask |= is_tx_fltr ? - ICE_PROMISC_MCAST_TX : ICE_PROMISC_MCAST_RX; - else if (IS_UNICAST_ETHER_ADDR(macaddr)) - promisc_mask |= is_tx_fltr ? - ICE_PROMISC_UCAST_TX : ICE_PROMISC_UCAST_RX; - if (vid) - promisc_mask |= is_tx_fltr ? - ICE_PROMISC_VLAN_TX : ICE_PROMISC_VLAN_RX; + if (IS_BROADCAST_ETHER_ADDR(macaddr)) { + ice_set_bit(is_tx_fltr ? ICE_PROMISC_BCAST_TX + : ICE_PROMISC_BCAST_RX, promisc_mask); + } else if (IS_MULTICAST_ETHER_ADDR(macaddr)) { + ice_set_bit(is_tx_fltr ? ICE_PROMISC_MCAST_TX + : ICE_PROMISC_MCAST_RX, promisc_mask); + } else if (IS_UNICAST_ETHER_ADDR(macaddr)) { + ice_set_bit(is_tx_fltr ? ICE_PROMISC_UCAST_TX + : ICE_PROMISC_UCAST_RX, promisc_mask); + } - return promisc_mask; + if (vid) { + ice_set_bit(is_tx_fltr ? ICE_PROMISC_VLAN_TX + : ICE_PROMISC_VLAN_RX, promisc_mask); + } } /** @@ -6192,10 +6196,11 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi) * @lkup: switch rule filter lookup type */ static int -_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid, struct ice_switch_info *sw, - enum ice_sw_lkup_type lkup) +_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 *vid, + struct ice_switch_info *sw, enum ice_sw_lkup_type lkup) { + ice_declare_bitmap(fltr_promisc_mask, ICE_PROMISC_MAX); struct ice_fltr_mgmt_list_entry *itr; struct LIST_HEAD_TYPE *rule_head; struct ice_lock *rule_lock; /* Lock to protect filter rule list */ @@ -6205,10 +6210,11 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, return ICE_ERR_PARAM; *vid = 0; - *promisc_mask = 0; rule_head = &sw->recp_list[lkup].filt_rules; rule_lock = &sw->recp_list[lkup].filt_rule_lock; + ice_zero_bitmap(promisc_mask, ICE_PROMISC_MAX); + ice_acquire_lock(rule_lock); LIST_FOR_EACH_ENTRY(itr, rule_head, ice_fltr_mgmt_list_entry, list_entry) { @@ -6218,7 +6224,9 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, if (!ice_vsi_uses_fltr(itr, vsi_handle)) continue; - *promisc_mask |= ice_determine_promisc_mask(&itr->fltr_info); + ice_determine_promisc_mask(&itr->fltr_info, fltr_promisc_mask); + ice_or_bitmap(promisc_mask, promisc_mask, fltr_promisc_mask, + ICE_PROMISC_MAX); } ice_release_lock(rule_lock); @@ -6233,9 +6241,12 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, * @vid: VLAN ID of promisc VLAN VSI */ int -ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid) +ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 *vid) { + if (!vid || !promisc_mask || !hw) + return ICE_ERR_PARAM; + return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask, vid, hw->switch_info, ICE_SW_LKUP_PROMISC); } @@ -6248,8 +6259,8 @@ ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, * @vid: VLAN ID of promisc VLAN VSI */ int -ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid) +ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 *vid) { return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask, vid, hw->switch_info, @@ -6284,14 +6295,17 @@ ice_remove_promisc(struct ice_hw *hw, u8 recp_id, * _ice_clear_vsi_promisc - clear specified promiscuous mode(s) * @hw: pointer to the hardware structure * @vsi_handle: VSI handle to clear mode - * @promisc_mask: mask of promiscuous config bits to clear + * @promisc_mask: pointer to mask of promiscuous config bits to clear * @vid: VLAN ID to clear VLAN promiscuous * @sw: pointer to switch info struct for which function add rule */ static int -_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - u16 vid, struct ice_switch_info *sw) +_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 vid, + struct ice_switch_info *sw) { + ice_declare_bitmap(compl_promisc_mask, ICE_PROMISC_MAX); + ice_declare_bitmap(fltr_promisc_mask, ICE_PROMISC_MAX); struct ice_fltr_list_entry *fm_entry, *tmp; struct LIST_HEAD_TYPE remove_list_head; struct ice_fltr_mgmt_list_entry *itr; @@ -6303,7 +6317,8 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, if (!ice_is_vsi_valid(hw, vsi_handle)) return ICE_ERR_PARAM; - if (promisc_mask & (ICE_PROMISC_VLAN_RX | ICE_PROMISC_VLAN_TX)) + if (ice_is_bit_set(promisc_mask, ICE_PROMISC_VLAN_RX) && + ice_is_bit_set(promisc_mask, ICE_PROMISC_VLAN_TX)) recipe_id = ICE_SW_LKUP_PROMISC_VLAN; else recipe_id = ICE_SW_LKUP_PROMISC; @@ -6317,7 +6332,7 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, LIST_FOR_EACH_ENTRY(itr, rule_head, ice_fltr_mgmt_list_entry, list_entry) { struct ice_fltr_info *fltr_info; - u8 fltr_promisc_mask = 0; + ice_zero_bitmap(compl_promisc_mask, ICE_PROMISC_MAX); if (!ice_vsi_uses_fltr(itr, vsi_handle)) continue; @@ -6327,10 +6342,12 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, vid != fltr_info->l_data.mac_vlan.vlan_id) continue; - fltr_promisc_mask |= ice_determine_promisc_mask(fltr_info); + ice_determine_promisc_mask(fltr_info, fltr_promisc_mask); + ice_andnot_bitmap(compl_promisc_mask, fltr_promisc_mask, + promisc_mask, ICE_PROMISC_MAX); /* Skip if filter is not completely specified by given mask */ - if (fltr_promisc_mask & ~promisc_mask) + if (ice_is_any_bit_set(compl_promisc_mask, ICE_PROMISC_MAX)) continue; status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, @@ -6359,13 +6376,16 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI * @hw: pointer to the hardware structure * @vsi_handle: VSI handle to clear mode - * @promisc_mask: mask of promiscuous config bits to clear + * @promisc_mask: pointer to mask of promiscuous config bits to clear * @vid: VLAN ID to clear VLAN promiscuous */ int ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, - u8 promisc_mask, u16 vid) + ice_bitmap_t *promisc_mask, u16 vid) { + if (!hw || !promisc_mask) + return ICE_ERR_PARAM; + return _ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, vid, hw->switch_info); } @@ -6374,16 +6394,18 @@ ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, * _ice_set_vsi_promisc - set given VSI to given promiscuous mode(s) * @hw: pointer to the hardware structure * @vsi_handle: VSI handle to configure - * @promisc_mask: mask of promiscuous config bits + * @promisc_mask: pointer to mask of promiscuous config bits * @vid: VLAN ID to set VLAN promiscuous * @lport: logical port number to configure promisc mode * @sw: pointer to switch info struct for which function add rule */ static int -_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - u16 vid, u8 lport, struct ice_switch_info *sw) +_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 vid, u8 lport, + struct ice_switch_info *sw) { enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR }; + ice_declare_bitmap(p_mask, ICE_PROMISC_MAX); struct ice_fltr_list_entry f_list_entry; bool is_tx_fltr; struct ice_fltr_info new_fltr; @@ -6400,7 +6422,11 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, ice_memset(&new_fltr, 0, sizeof(new_fltr), ICE_NONDMA_MEM); - if (promisc_mask & (ICE_PROMISC_VLAN_RX | ICE_PROMISC_VLAN_TX)) { + /* Do not modify original bitmap */ + ice_cp_bitmap(p_mask, promisc_mask, ICE_PROMISC_MAX); + + if (ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_RX) && + ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_TX)) { new_fltr.lkup_type = ICE_SW_LKUP_PROMISC_VLAN; new_fltr.l_data.mac_vlan.vlan_id = vid; recipe_id = ICE_SW_LKUP_PROMISC_VLAN; @@ -6414,44 +6440,43 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * individual type, and clear it out in the input mask as it * is found. */ - while (promisc_mask) { + while (ice_is_any_bit_set(p_mask, ICE_PROMISC_MAX)) { struct ice_sw_recipe *recp_list; u8 *mac_addr; pkt_type = 0; is_tx_fltr = false; - if (promisc_mask & ICE_PROMISC_UCAST_RX) { - promisc_mask &= ~ICE_PROMISC_UCAST_RX; + if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_RX, + p_mask)) { pkt_type = UCAST_FLTR; - } else if (promisc_mask & ICE_PROMISC_UCAST_TX) { - promisc_mask &= ~ICE_PROMISC_UCAST_TX; + } else if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_TX, + p_mask)) { pkt_type = UCAST_FLTR; is_tx_fltr = true; - } else if (promisc_mask & ICE_PROMISC_MCAST_RX) { - promisc_mask &= ~ICE_PROMISC_MCAST_RX; + } else if (ice_test_and_clear_bit(ICE_PROMISC_MCAST_RX, + p_mask)) { pkt_type = MCAST_FLTR; - } else if (promisc_mask & ICE_PROMISC_MCAST_TX) { - promisc_mask &= ~ICE_PROMISC_MCAST_TX; + } else if (ice_test_and_clear_bit(ICE_PROMISC_MCAST_TX, + p_mask)) { pkt_type = MCAST_FLTR; is_tx_fltr = true; - } else if (promisc_mask & ICE_PROMISC_BCAST_RX) { - promisc_mask &= ~ICE_PROMISC_BCAST_RX; + } else if (ice_test_and_clear_bit(ICE_PROMISC_BCAST_RX, + p_mask)) { pkt_type = BCAST_FLTR; - } else if (promisc_mask & ICE_PROMISC_BCAST_TX) { - promisc_mask &= ~ICE_PROMISC_BCAST_TX; + } else if (ice_test_and_clear_bit(ICE_PROMISC_BCAST_TX, + p_mask)) { pkt_type = BCAST_FLTR; is_tx_fltr = true; } /* Check for VLAN promiscuous flag */ - if (promisc_mask & ICE_PROMISC_VLAN_RX) { - promisc_mask &= ~ICE_PROMISC_VLAN_RX; - } else if (promisc_mask & ICE_PROMISC_VLAN_TX) { - promisc_mask &= ~ICE_PROMISC_VLAN_TX; + if (ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_RX)) { + ice_clear_bit(ICE_PROMISC_VLAN_RX, p_mask); + } else if (ice_test_and_clear_bit(ICE_PROMISC_VLAN_TX, + p_mask)) { is_tx_fltr = true; } - /* Set filter DA based on packet type */ mac_addr = new_fltr.l_data.mac.mac_addr; if (pkt_type == BCAST_FLTR) { @@ -6495,13 +6520,16 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s) * @hw: pointer to the hardware structure * @vsi_handle: VSI handle to configure - * @promisc_mask: mask of promiscuous config bits + * @promisc_mask: pointer to mask of promiscuous config bits * @vid: VLAN ID to set VLAN promiscuous */ int -ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - u16 vid) +ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 vid) { + if (!hw || !promisc_mask) + return ICE_ERR_PARAM; + return _ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid, hw->port_info->lport, hw->switch_info); @@ -6511,7 +6539,7 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * _ice_set_vlan_vsi_promisc * @hw: pointer to the hardware structure * @vsi_handle: VSI handle to configure - * @promisc_mask: mask of promiscuous config bits + * @promisc_mask: pointer to mask of promiscuous config bits * @rm_vlan_promisc: Clear VLANs VSI promisc mode * @lport: logical port number to configure promisc mode * @sw: pointer to switch info struct for which function add rule @@ -6519,9 +6547,9 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * Configure VSI with all associated VLANs to given promiscuous mode(s) */ static int -_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - bool rm_vlan_promisc, u8 lport, - struct ice_switch_info *sw) +_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, bool rm_vlan_promisc, + u8 lport, struct ice_switch_info *sw) { struct ice_fltr_list_entry *list_itr, *tmp; struct LIST_HEAD_TYPE vsi_list_head; @@ -6581,9 +6609,12 @@ _ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, * Configure VSI with all associated VLANs to given promiscuous mode(s) */ int -ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - bool rm_vlan_promisc) +ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, bool rm_vlan_promisc) { + if (!hw || !promisc_mask) + return ICE_ERR_PARAM; + return _ice_set_vlan_vsi_promisc(hw, vsi_handle, promisc_mask, rm_vlan_promisc, hw->port_info->lport, hw->switch_info); diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 38daab0adb..473784dc30 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -418,14 +418,16 @@ struct ice_adv_fltr_mgmt_list_entry { }; enum ice_promisc_flags { - ICE_PROMISC_UCAST_RX = 0x1, - ICE_PROMISC_UCAST_TX = 0x2, - ICE_PROMISC_MCAST_RX = 0x4, - ICE_PROMISC_MCAST_TX = 0x8, - ICE_PROMISC_BCAST_RX = 0x10, - ICE_PROMISC_BCAST_TX = 0x20, - ICE_PROMISC_VLAN_RX = 0x40, - ICE_PROMISC_VLAN_TX = 0x80, + ICE_PROMISC_UCAST_RX = 0, + ICE_PROMISC_UCAST_TX, + ICE_PROMISC_MCAST_RX, + ICE_PROMISC_MCAST_TX, + ICE_PROMISC_BCAST_RX, + ICE_PROMISC_BCAST_TX, + ICE_PROMISC_VLAN_RX, + ICE_PROMISC_VLAN_TX, + /* Max value */ + ICE_PROMISC_MAX, }; /* VSI related commands */ @@ -526,22 +528,22 @@ ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, bool ice_check_if_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool *rule_exists); int -ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - u16 vid); +ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 vid); int -ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - u16 vid); +ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 vid); int -ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, - bool rm_vlan_promisc); +ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, bool rm_vlan_promisc); /* Get VSIs Promisc/defport settings */ int -ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid); +ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 *vid); int -ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, - u16 *vid); +ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, + ice_bitmap_t *promisc_mask, u16 *vid); int ice_aq_add_recipe(struct ice_hw *hw, diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 93691fb72c..dec26f8219 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3798,6 +3798,7 @@ ice_dev_start(struct rte_eth_dev *dev) uint8_t timer = hw->func_caps.ts_func_info.tmr_index_owned; uint32_t pin_idx = ad->devargs.pin_idx; struct rte_tm_error tm_err; + ice_bitmap_t pmask; /* program Tx queues' context in hardware */ for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) { @@ -3854,10 +3855,9 @@ ice_dev_start(struct rte_eth_dev *dev) return -EIO; /* Enable receiving broadcast packets and transmitting packets */ - ret = ice_set_vsi_promisc(hw, vsi->idx, - ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX | - ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX, - 0); + pmask = ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX | + ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX; + ret = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0); if (ret != ICE_SUCCESS) PMD_DRV_LOG(INFO, "fail to set vsi broadcast"); @@ -5202,12 +5202,12 @@ ice_promisc_enable(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; int status, ret = 0; - uint8_t pmask; + ice_bitmap_t pmask; pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; - status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0); + status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0); switch (status) { case ICE_ERR_ALREADY_EXISTS: PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled"); @@ -5228,7 +5228,7 @@ ice_promisc_disable(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; int status, ret = 0; - uint8_t pmask; + ice_bitmap_t pmask; if (dev->data->all_multicast == 1) pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX; @@ -5236,7 +5236,7 @@ ice_promisc_disable(struct rte_eth_dev *dev) pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; - status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0); + status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0); if (status != ICE_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status); ret = -EAGAIN; @@ -5252,11 +5252,11 @@ ice_allmulti_enable(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; int status, ret = 0; - uint8_t pmask; + ice_bitmap_t pmask; pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; - status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0); + status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0); switch (status) { case ICE_ERR_ALREADY_EXISTS: @@ -5278,14 +5278,14 @@ ice_allmulti_disable(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; int status, ret = 0; - uint8_t pmask; + ice_bitmap_t pmask; if (dev->data->promiscuous == 1) return 0; /* must remain in all_multicast mode */ pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX; - status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0); + status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0); if (status != ICE_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status); ret = -EAGAIN; -- 2.43.0