From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59F7AA057B; Mon, 30 Mar 2020 13:43:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46B741C0B2; Mon, 30 Mar 2020 13:42:25 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C73EC1C0AE for ; Mon, 30 Mar 2020 13:42:21 +0200 (CEST) IronPort-SDR: QgEb3ZgDtkZ7fEbbLz0DJXcEw2bGFeFPTBVZ53oaa0Y5mHhvuGUhxksOJ7sTveM/xA6UuE8314 W1kpPyKpf4zA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 04:42:21 -0700 IronPort-SDR: im9NWge6MDU03y4oVUpIJGLArXAhP6wy06n81IpZRVuolPJpYc0oa11W2fEWLVoCQzOhVbw+Gq J8g4q1Zge65Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,324,1580803200"; d="scan'208";a="449769858" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by fmsmga006.fm.intel.com with ESMTP; 30 Mar 2020 04:42:19 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: xiaolong.ye@intel.com, dev@dpdk.org, Qi Zhang , Michal Swiatkowski , Paul M Stillwell Jr Date: Mon, 30 Mar 2020 19:45:28 +0800 Message-Id: <20200330114538.43275-7-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200330114538.43275-1-qi.z.zhang@intel.com> References: <20200330114538.43275-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 06/16] net/ice/base: allow adding MAC VLAN filter on the port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Add new API function to allow user to choose port on which mac vlan rule going to be added. Signed-off-by: Michal Swiatkowski Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 58 +++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 9c4fc0f0b..103894f65 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -3510,14 +3510,17 @@ ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) * ice_add_mac_vlan - Add MAC and VLAN pair based filter rule * @hw: pointer to the hardware structure * @mv_list: list of MAC and VLAN filters + * @sw: pointer to switch info struct for which function add rule + * @lport: logic port number on which function add rule * * If the VSI on which the MAC-VLAN pair has to be added has Rx and Tx VLAN * pruning bits enabled, then it is the responsibility of the caller to make * sure to add a VLAN only filter on the same VSI. Packets belonging to that * VLAN won't be received on that VSI otherwise. */ -enum ice_status -ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) +static enum ice_status +ice_add_mac_vlan_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list, + struct ice_switch_info *sw, u8 lport) { struct ice_fltr_list_entry *mv_list_itr; struct ice_sw_recipe *recp_list; @@ -3525,7 +3528,7 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) if (!mv_list || !hw) return ICE_ERR_PARAM; - recp_list = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC_VLAN]; + recp_list = &sw->recp_list[ICE_SW_LKUP_MAC_VLAN]; LIST_FOR_EACH_ENTRY(mv_list_itr, mv_list, ice_fltr_list_entry, list_entry) { enum ice_sw_lkup_type l_type = @@ -3535,8 +3538,7 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) return ICE_ERR_PARAM; mv_list_itr->fltr_info.flag = ICE_FLTR_TX; mv_list_itr->status = - ice_add_rule_internal(hw, recp_list, - hw->port_info->lport, + ice_add_rule_internal(hw, recp_list, lport, mv_list_itr); if (mv_list_itr->status) return mv_list_itr->status; @@ -3545,6 +3547,23 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) } /** + * ice_add_mac_vlan - Add a MAC VLAN address based filter rule + * @hw: pointer to the hardware structure + * @mv_list: list of MAC VLAN addresses and forwarding information + * + * Function add MAC VLAN rule for logical port from HW struct + */ +enum ice_status +ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) +{ + if (!mv_list || !hw) + return ICE_ERR_PARAM; + + return ice_add_mac_vlan_rule(hw, mv_list, hw->switch_info, + hw->port_info->lport); +} + +/** * ice_add_eth_mac_rule - Add ethertype and MAC based filter rule * @hw: pointer to the hardware structure * @em_list: list of ether type MAC filter, MAC is optional @@ -3946,18 +3965,16 @@ ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) } /** - * ice_remove_mac_vlan - Remove MAC VLAN based filter rule + * ice_remove_mac_vlan_rule - Remove MAC VLAN based filter rule * @hw: pointer to the hardware structure * @v_list: list of MAC VLAN entries and forwarding information + * @recp_list: list from which function remove MAC VLAN */ -enum ice_status -ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) +static enum ice_status +ice_remove_mac_vlan_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list, + struct ice_sw_recipe *recp_list) { struct ice_fltr_list_entry *v_list_itr, *tmp; - struct ice_sw_recipe *recp_list; - - if (!v_list || !hw) - return ICE_ERR_PARAM; recp_list = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC_VLAN]; LIST_FOR_EACH_ENTRY_SAFE(v_list_itr, tmp, v_list, ice_fltr_list_entry, @@ -3976,6 +3993,23 @@ ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) } /** + * ice_remove_mac_vlan - remove a MAC VLAN address based filter rule + * @hw: pointer to the hardware structure + * @mv_list: list of MAC VLAN and forwarding information + */ +enum ice_status +ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) +{ + struct ice_sw_recipe *recp_list; + + if (!mv_list || !hw) + return ICE_ERR_PARAM; + + recp_list = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC_VLAN]; + return ice_remove_mac_vlan_rule(hw, mv_list, recp_list); +} + +/** * ice_vsi_uses_fltr - Determine if given VSI uses specified filter * @fm_entry: filter entry to inspect * @vsi_handle: VSI handle to compare with filter info -- 2.13.6