From patchwork Tue Aug 10 02:51:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 96765 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCEABA0C54; Tue, 10 Aug 2021 04:51:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC0B4411FB; Tue, 10 Aug 2021 04:49:40 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id F21EB411F5 for ; Tue, 10 Aug 2021 04:49:38 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10070"; a="202002222" X-IronPort-AV: E=Sophos;i="5.84,309,1620716400"; d="scan'208";a="202002222" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2021 19:49:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,309,1620716400"; d="scan'208";a="483823822" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga008.fm.intel.com with ESMTP; 09 Aug 2021 19:49:36 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: junfeng.guo@intel.com, dev@dpdk.org, Qi Zhang , Anirudh Venkataramanan Date: Tue, 10 Aug 2021 10:51:38 +0800 Message-Id: <20210810025140.1698163-27-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210810025140.1698163-1-qi.z.zhang@intel.com> References: <20210810025140.1698163-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 26/28] net/ice/base: rename and add a setter function 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" Rename ucast_shared to umac_shared, as "umac" is a more widely used shorthand for "unicast MAC". Also add a helper function to set this flag. This helper is expected to be called by core drivers. Signed-off-by: Anirudh Venkataramanan Signed-off-by: Qi Zhang Acked-by: Junfeng Guo --- drivers/net/ice/base/ice_common.c | 11 +++++++++++ drivers/net/ice/base/ice_common.h | 1 + drivers/net/ice/base/ice_switch.c | 8 ++++---- drivers/net/ice/base/ice_type.h | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index ad9df0d3a2..9c6649b6c5 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -864,6 +864,17 @@ void ice_print_rollback_msg(struct ice_hw *hw) nvm_str, hw->fw_maj_ver, hw->fw_min_ver); } +/** + * ice_set_umac_shared + * @hw: pointer to the hw struct + * + * Set boolean flag to allow unicast MAC sharing + */ +void ice_set_umac_shared(struct ice_hw *hw) +{ + hw->umac_shared = true; +} + /** * ice_init_hw - main hardware initialization routine * @hw: pointer to the hardware structure diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h index ac6b487347..e84308444d 100644 --- a/drivers/net/ice/base/ice_common.h +++ b/drivers/net/ice/base/ice_common.h @@ -23,6 +23,7 @@ enum ice_fw_modes { enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw); void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw); +void ice_set_umac_shared(struct ice_hw *hw); enum ice_status ice_init_hw(struct ice_hw *hw); void ice_deinit_hw(struct ice_hw *hw); enum ice_status ice_check_reset(struct ice_hw *hw); diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 2d8904d2c3..9179f66c20 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -4681,7 +4681,7 @@ ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, * @sw: pointer to switch info struct for which function add rule * @lport: logic port number on which function add rule * - * IMPORTANT: When the ucast_shared flag is set to false and m_list has + * IMPORTANT: When the umac_shared flag is set to false and m_list has * multiple unicast addresses, the function assumes that all the * addresses are unique in a given add_mac call. It doesn't * check for duplicates in this case, removing duplicates from a given @@ -4724,7 +4724,7 @@ ice_add_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list, if (m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC || IS_ZERO_ETHER_ADDR(add)) return ICE_ERR_PARAM; - if (IS_UNICAST_ETHER_ADDR(add) && !hw->ucast_shared) { + if (IS_UNICAST_ETHER_ADDR(add) && !hw->umac_shared) { /* Don't overwrite the unicast address */ ice_acquire_lock(rule_lock); if (ice_find_rule_entry(rule_head, @@ -4735,7 +4735,7 @@ ice_add_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list, ice_release_lock(rule_lock); num_unicast++; } else if (IS_MULTICAST_ETHER_ADDR(add) || - (IS_UNICAST_ETHER_ADDR(add) && hw->ucast_shared)) { + (IS_UNICAST_ETHER_ADDR(add) && hw->umac_shared)) { m_list_itr->status = ice_add_rule_internal(hw, recp_list, lport, m_list_itr); @@ -5424,7 +5424,7 @@ ice_remove_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list, list_itr->fltr_info.fwd_id.hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); - if (IS_UNICAST_ETHER_ADDR(add) && !hw->ucast_shared) { + if (IS_UNICAST_ETHER_ADDR(add) && !hw->umac_shared) { /* Don't remove the unicast address that belongs to * another VSI on the switch, since it is not being * shared... diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 4e33d14c6d..56ee628f10 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -1194,7 +1194,8 @@ struct ice_hw { /* INTRL granularity in 1 us */ u8 intrl_gran; - u8 ucast_shared; /* true if VSIs can share unicast addr */ + /* true if VSIs can share unicast MAC addr */ + u8 umac_shared; #define ICE_PHY_PER_NAC 1 #define ICE_MAX_QUAD 2