171d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */ 2d08b8680SEric Joyner /* Copyright (c) 2021, Intel Corporation 371d10453SEric Joyner * All rights reserved. 471d10453SEric Joyner * 571d10453SEric Joyner * Redistribution and use in source and binary forms, with or without 671d10453SEric Joyner * modification, are permitted provided that the following conditions are met: 771d10453SEric Joyner * 871d10453SEric Joyner * 1. Redistributions of source code must retain the above copyright notice, 971d10453SEric Joyner * this list of conditions and the following disclaimer. 1071d10453SEric Joyner * 1171d10453SEric Joyner * 2. Redistributions in binary form must reproduce the above copyright 1271d10453SEric Joyner * notice, this list of conditions and the following disclaimer in the 1371d10453SEric Joyner * documentation and/or other materials provided with the distribution. 1471d10453SEric Joyner * 1571d10453SEric Joyner * 3. Neither the name of the Intel Corporation nor the names of its 1671d10453SEric Joyner * contributors may be used to endorse or promote products derived from 1771d10453SEric Joyner * this software without specific prior written permission. 1871d10453SEric Joyner * 1971d10453SEric Joyner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2071d10453SEric Joyner * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2171d10453SEric Joyner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2271d10453SEric Joyner * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2371d10453SEric Joyner * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2471d10453SEric Joyner * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2571d10453SEric Joyner * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2671d10453SEric Joyner * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2771d10453SEric Joyner * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2871d10453SEric Joyner * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2971d10453SEric Joyner * POSSIBILITY OF SUCH DAMAGE. 3071d10453SEric Joyner */ 3171d10453SEric Joyner /*$FreeBSD$*/ 3271d10453SEric Joyner 3371d10453SEric Joyner #ifndef _ICE_SWITCH_H_ 3471d10453SEric Joyner #define _ICE_SWITCH_H_ 3571d10453SEric Joyner 3671d10453SEric Joyner #include "ice_common.h" 3771d10453SEric Joyner #include "ice_protocol_type.h" 3871d10453SEric Joyner 3971d10453SEric Joyner #define ICE_SW_CFG_MAX_BUF_LEN 2048 4071d10453SEric Joyner #define ICE_MAX_SW 256 4171d10453SEric Joyner #define ICE_DFLT_VSI_INVAL 0xff 4271d10453SEric Joyner #define ICE_FLTR_RX BIT(0) 4371d10453SEric Joyner #define ICE_FLTR_TX BIT(1) 4471d10453SEric Joyner #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) 4571d10453SEric Joyner 467d7af7f8SEric Joyner #define DUMMY_ETH_HDR_LEN 16 477d7af7f8SEric Joyner #define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \ 487d7af7f8SEric Joyner (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \ 497d7af7f8SEric Joyner (DUMMY_ETH_HDR_LEN * \ 507d7af7f8SEric Joyner sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0]))) 517d7af7f8SEric Joyner #define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \ 527d7af7f8SEric Joyner (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr)) 537d7af7f8SEric Joyner #define ICE_SW_RULE_LG_ACT_SIZE(n) \ 547d7af7f8SEric Joyner (offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \ 557d7af7f8SEric Joyner ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0]))) 567d7af7f8SEric Joyner #define ICE_SW_RULE_VSI_LIST_SIZE(n) \ 577d7af7f8SEric Joyner (offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \ 587d7af7f8SEric Joyner ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0]))) 597d7af7f8SEric Joyner 6071d10453SEric Joyner /* Worst case buffer length for ice_aqc_opc_get_res_alloc */ 6171d10453SEric Joyner #define ICE_MAX_RES_TYPES 0x80 6271d10453SEric Joyner #define ICE_AQ_GET_RES_ALLOC_BUF_LEN \ 6371d10453SEric Joyner (ICE_MAX_RES_TYPES * sizeof(struct ice_aqc_get_res_resp_elem)) 6471d10453SEric Joyner 6571d10453SEric Joyner #define ICE_VSI_INVAL_ID 0xFFFF 6671d10453SEric Joyner #define ICE_INVAL_Q_HANDLE 0xFFFF 6771d10453SEric Joyner 6871d10453SEric Joyner /* VSI context structure for add/get/update/free operations */ 6971d10453SEric Joyner struct ice_vsi_ctx { 7071d10453SEric Joyner u16 vsi_num; 7171d10453SEric Joyner u16 vsis_allocd; 7271d10453SEric Joyner u16 vsis_unallocated; 7371d10453SEric Joyner u16 flags; 7471d10453SEric Joyner struct ice_aqc_vsi_props info; 7571d10453SEric Joyner struct ice_sched_vsi_info sched; 7671d10453SEric Joyner u8 alloc_from_pool; 7771d10453SEric Joyner u8 vf_num; 7871d10453SEric Joyner u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS]; 7971d10453SEric Joyner struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 8071d10453SEric Joyner }; 8171d10453SEric Joyner 8271d10453SEric Joyner /* This is to be used by add/update mirror rule Admin Queue command */ 8371d10453SEric Joyner struct ice_mir_rule_buf { 8471d10453SEric Joyner u16 vsi_idx; /* VSI index */ 8571d10453SEric Joyner 8671d10453SEric Joyner /* For each VSI, user can specify whether corresponding VSI 8771d10453SEric Joyner * should be added/removed to/from mirror rule 8871d10453SEric Joyner * 8971d10453SEric Joyner * add mirror rule: this should always be TRUE. 9071d10453SEric Joyner * update mirror rule: add(true) or remove(false) VSI to/from 9171d10453SEric Joyner * mirror rule 9271d10453SEric Joyner */ 9371d10453SEric Joyner u8 add; 9471d10453SEric Joyner }; 9571d10453SEric Joyner 9671d10453SEric Joyner /* Switch recipe ID enum values are specific to hardware */ 9771d10453SEric Joyner enum ice_sw_lkup_type { 9871d10453SEric Joyner ICE_SW_LKUP_ETHERTYPE = 0, 9971d10453SEric Joyner ICE_SW_LKUP_MAC = 1, 10071d10453SEric Joyner ICE_SW_LKUP_MAC_VLAN = 2, 10171d10453SEric Joyner ICE_SW_LKUP_PROMISC = 3, 10271d10453SEric Joyner ICE_SW_LKUP_VLAN = 4, 10371d10453SEric Joyner ICE_SW_LKUP_DFLT = 5, 10471d10453SEric Joyner ICE_SW_LKUP_ETHERTYPE_MAC = 8, 10571d10453SEric Joyner ICE_SW_LKUP_PROMISC_VLAN = 9, 10671d10453SEric Joyner ICE_SW_LKUP_LAST 10771d10453SEric Joyner }; 10871d10453SEric Joyner 10971d10453SEric Joyner /* type of filter src ID */ 11071d10453SEric Joyner enum ice_src_id { 11171d10453SEric Joyner ICE_SRC_ID_UNKNOWN = 0, 11271d10453SEric Joyner ICE_SRC_ID_VSI, 11371d10453SEric Joyner ICE_SRC_ID_QUEUE, 11471d10453SEric Joyner ICE_SRC_ID_LPORT, 11571d10453SEric Joyner }; 11671d10453SEric Joyner 11771d10453SEric Joyner struct ice_fltr_info { 11871d10453SEric Joyner /* Look up information: how to look up packet */ 11971d10453SEric Joyner enum ice_sw_lkup_type lkup_type; 12071d10453SEric Joyner /* Forward action: filter action to do after lookup */ 12171d10453SEric Joyner enum ice_sw_fwd_act_type fltr_act; 12271d10453SEric Joyner /* rule ID returned by firmware once filter rule is created */ 12371d10453SEric Joyner u16 fltr_rule_id; 12471d10453SEric Joyner u16 flag; 12571d10453SEric Joyner 12671d10453SEric Joyner /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 12771d10453SEric Joyner u16 src; 12871d10453SEric Joyner enum ice_src_id src_id; 12971d10453SEric Joyner 13071d10453SEric Joyner union { 13171d10453SEric Joyner struct { 13271d10453SEric Joyner u8 mac_addr[ETH_ALEN]; 13371d10453SEric Joyner } mac; 13471d10453SEric Joyner struct { 13571d10453SEric Joyner u8 mac_addr[ETH_ALEN]; 13671d10453SEric Joyner u16 vlan_id; 13771d10453SEric Joyner } mac_vlan; 13871d10453SEric Joyner struct { 13971d10453SEric Joyner u16 vlan_id; 140*9cf1841cSEric Joyner u16 tpid; 141*9cf1841cSEric Joyner u8 tpid_valid; 14271d10453SEric Joyner } vlan; 14371d10453SEric Joyner /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE 14471d10453SEric Joyner * if just using ethertype as filter. Set lkup_type as 14571d10453SEric Joyner * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be 14671d10453SEric Joyner * passed in as filter. 14771d10453SEric Joyner */ 14871d10453SEric Joyner struct { 14971d10453SEric Joyner u16 ethertype; 15071d10453SEric Joyner u8 mac_addr[ETH_ALEN]; /* optional */ 15171d10453SEric Joyner } ethertype_mac; 15271d10453SEric Joyner } l_data; /* Make sure to zero out the memory of l_data before using 15371d10453SEric Joyner * it or only set the data associated with lookup match 15471d10453SEric Joyner * rest everything should be zero 15571d10453SEric Joyner */ 15671d10453SEric Joyner 15771d10453SEric Joyner /* Depending on filter action */ 15871d10453SEric Joyner union { 15971d10453SEric Joyner /* queue ID in case of ICE_FWD_TO_Q and starting 16071d10453SEric Joyner * queue ID in case of ICE_FWD_TO_QGRP. 16171d10453SEric Joyner */ 16271d10453SEric Joyner u16 q_id:11; 16371d10453SEric Joyner u16 hw_vsi_id:10; 16471d10453SEric Joyner u16 vsi_list_id:10; 16571d10453SEric Joyner } fwd_id; 16671d10453SEric Joyner 16771d10453SEric Joyner /* Sw VSI handle */ 16871d10453SEric Joyner u16 vsi_handle; 16971d10453SEric Joyner 17071d10453SEric Joyner /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field 17171d10453SEric Joyner * determines the range of queues the packet needs to be forwarded to. 17271d10453SEric Joyner * Note that qgrp_size must be set to a power of 2. 17371d10453SEric Joyner */ 17471d10453SEric Joyner u8 qgrp_size; 17571d10453SEric Joyner 17671d10453SEric Joyner /* Rule creations populate these indicators basing on the switch type */ 17771d10453SEric Joyner u8 lb_en; /* Indicate if packet can be looped back */ 17871d10453SEric Joyner u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ 17971d10453SEric Joyner }; 18071d10453SEric Joyner 18171d10453SEric Joyner struct ice_adv_lkup_elem { 18271d10453SEric Joyner enum ice_protocol_type type; 18371d10453SEric Joyner union ice_prot_hdr h_u; /* Header values */ 18471d10453SEric Joyner union ice_prot_hdr m_u; /* Mask of header values to match */ 18571d10453SEric Joyner }; 18671d10453SEric Joyner 18771d10453SEric Joyner struct ice_sw_act_ctrl { 18871d10453SEric Joyner /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 18971d10453SEric Joyner u16 src; 19071d10453SEric Joyner u16 flag; 19171d10453SEric Joyner enum ice_sw_fwd_act_type fltr_act; 19271d10453SEric Joyner /* Depending on filter action */ 19371d10453SEric Joyner union { 19471d10453SEric Joyner /* This is a queue ID in case of ICE_FWD_TO_Q and starting 19571d10453SEric Joyner * queue ID in case of ICE_FWD_TO_QGRP. 19671d10453SEric Joyner */ 19771d10453SEric Joyner u16 q_id:11; 19871d10453SEric Joyner u16 vsi_id:10; 19971d10453SEric Joyner u16 hw_vsi_id:10; 20071d10453SEric Joyner u16 vsi_list_id:10; 20171d10453SEric Joyner } fwd_id; 20271d10453SEric Joyner /* software VSI handle */ 20371d10453SEric Joyner u16 vsi_handle; 20471d10453SEric Joyner u8 qgrp_size; 20571d10453SEric Joyner }; 20671d10453SEric Joyner 20771d10453SEric Joyner struct ice_rule_query_data { 20871d10453SEric Joyner /* Recipe ID for which the requested rule was added */ 20971d10453SEric Joyner u16 rid; 21071d10453SEric Joyner /* Rule ID that was added or is supposed to be removed */ 21171d10453SEric Joyner u16 rule_id; 21271d10453SEric Joyner /* vsi_handle for which Rule was added or is supposed to be removed */ 21371d10453SEric Joyner u16 vsi_handle; 21471d10453SEric Joyner }; 21571d10453SEric Joyner 21671d10453SEric Joyner struct ice_adv_rule_info { 21771d10453SEric Joyner enum ice_sw_tunnel_type tun_type; 21871d10453SEric Joyner struct ice_sw_act_ctrl sw_act; 21971d10453SEric Joyner u32 priority; 22071d10453SEric Joyner u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */ 22171d10453SEric Joyner u16 fltr_rule_id; 22271d10453SEric Joyner }; 22371d10453SEric Joyner 22471d10453SEric Joyner /* A collection of one or more four word recipe */ 22571d10453SEric Joyner struct ice_sw_recipe { 22671d10453SEric Joyner /* For a chained recipe the root recipe is what should be used for 22771d10453SEric Joyner * programming rules 22871d10453SEric Joyner */ 22971d10453SEric Joyner u8 is_root; 23071d10453SEric Joyner u8 root_rid; 23171d10453SEric Joyner u8 recp_created; 23271d10453SEric Joyner 23371d10453SEric Joyner /* Number of extraction words */ 23471d10453SEric Joyner u8 n_ext_words; 23571d10453SEric Joyner /* Protocol ID and Offset pair (extraction word) to describe the 23671d10453SEric Joyner * recipe 23771d10453SEric Joyner */ 23871d10453SEric Joyner struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS]; 23971d10453SEric Joyner u16 word_masks[ICE_MAX_CHAIN_WORDS]; 24071d10453SEric Joyner 24171d10453SEric Joyner /* if this recipe is a collection of other recipe */ 24271d10453SEric Joyner u8 big_recp; 24371d10453SEric Joyner 24471d10453SEric Joyner /* if this recipe is part of another bigger recipe then chain index 24571d10453SEric Joyner * corresponding to this recipe 24671d10453SEric Joyner */ 24771d10453SEric Joyner u8 chain_idx; 24871d10453SEric Joyner 24971d10453SEric Joyner /* if this recipe is a collection of other recipe then count of other 25071d10453SEric Joyner * recipes and recipe IDs of those recipes 25171d10453SEric Joyner */ 25271d10453SEric Joyner u8 n_grp_count; 25371d10453SEric Joyner 25471d10453SEric Joyner /* Bit map specifying the IDs associated with this group of recipe */ 25571d10453SEric Joyner ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES); 25671d10453SEric Joyner 25771d10453SEric Joyner enum ice_sw_tunnel_type tun_type; 25871d10453SEric Joyner 25971d10453SEric Joyner /* List of type ice_fltr_mgmt_list_entry or adv_rule */ 26071d10453SEric Joyner u8 adv_rule; 26171d10453SEric Joyner struct LIST_HEAD_TYPE filt_rules; 26271d10453SEric Joyner struct LIST_HEAD_TYPE filt_replay_rules; 26371d10453SEric Joyner 26471d10453SEric Joyner struct ice_lock filt_rule_lock; /* protect filter rule structure */ 26571d10453SEric Joyner 26671d10453SEric Joyner /* Profiles this recipe should be associated with */ 26771d10453SEric Joyner struct LIST_HEAD_TYPE fv_list; 26871d10453SEric Joyner 26971d10453SEric Joyner /* Profiles this recipe is associated with */ 27071d10453SEric Joyner u8 num_profs, *prof_ids; 27171d10453SEric Joyner 2727d7af7f8SEric Joyner /* Bit map for possible result indexes */ 27371d10453SEric Joyner ice_declare_bitmap(res_idxs, ICE_MAX_FV_WORDS); 27471d10453SEric Joyner 27571d10453SEric Joyner /* This allows user to specify the recipe priority. 27671d10453SEric Joyner * For now, this becomes 'fwd_priority' when recipe 27771d10453SEric Joyner * is created, usually recipes can have 'fwd' and 'join' 27871d10453SEric Joyner * priority. 27971d10453SEric Joyner */ 28071d10453SEric Joyner u8 priority; 28171d10453SEric Joyner 28271d10453SEric Joyner struct LIST_HEAD_TYPE rg_list; 28371d10453SEric Joyner 28471d10453SEric Joyner /* AQ buffer associated with this recipe */ 28571d10453SEric Joyner struct ice_aqc_recipe_data_elem *root_buf; 28671d10453SEric Joyner /* This struct saves the fv_words for a given lookup */ 28771d10453SEric Joyner struct ice_prot_lkup_ext lkup_exts; 28871d10453SEric Joyner }; 28971d10453SEric Joyner 29071d10453SEric Joyner /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ 29171d10453SEric Joyner struct ice_vsi_list_map_info { 29271d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 29371d10453SEric Joyner ice_declare_bitmap(vsi_map, ICE_MAX_VSI); 29471d10453SEric Joyner u16 vsi_list_id; 29571d10453SEric Joyner /* counter to track how many rules are reusing this VSI list */ 29671d10453SEric Joyner u16 ref_cnt; 29771d10453SEric Joyner }; 29871d10453SEric Joyner 29971d10453SEric Joyner struct ice_fltr_list_entry { 30071d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 30171d10453SEric Joyner enum ice_status status; 30271d10453SEric Joyner struct ice_fltr_info fltr_info; 30371d10453SEric Joyner }; 30471d10453SEric Joyner 30571d10453SEric Joyner /** 30671d10453SEric Joyner * enum ice_fltr_marker - Marker for syncing OS and driver filter lists 30771d10453SEric Joyner * @ICE_FLTR_NOT_FOUND: initial state, indicates filter has not been found 30871d10453SEric Joyner * @ICE_FLTR_FOUND: set when a filter has been found in both lists 30971d10453SEric Joyner * 31071d10453SEric Joyner * This enumeration is used to help sync an operating system provided filter 31171d10453SEric Joyner * list with the filters previously added. 31271d10453SEric Joyner * 31371d10453SEric Joyner * This is required for FreeBSD because the operating system does not provide 31471d10453SEric Joyner * individual indications of whether a filter has been added or deleted, but 31571d10453SEric Joyner * instead just notifies the driver with the entire new list. 31671d10453SEric Joyner * 31771d10453SEric Joyner * To use this marker state, the driver shall initially reset all filters to 31871d10453SEric Joyner * the ICE_FLTR_NOT_FOUND state. Then, for each filter in the OS list, it 31971d10453SEric Joyner * shall search the driver list for the filter. If found, the filter state 32071d10453SEric Joyner * will be set to ICE_FLTR_FOUND. If not found, that filter will be added. 32171d10453SEric Joyner * Finally, the driver shall search the internal filter list for all filters 32271d10453SEric Joyner * still marked as ICE_FLTR_NOT_FOUND and remove them. 32371d10453SEric Joyner */ 32471d10453SEric Joyner enum ice_fltr_marker { 32571d10453SEric Joyner ICE_FLTR_NOT_FOUND, 32671d10453SEric Joyner ICE_FLTR_FOUND, 32771d10453SEric Joyner }; 32871d10453SEric Joyner 32971d10453SEric Joyner /* This defines an entry in the list that maintains MAC or VLAN membership 33071d10453SEric Joyner * to HW list mapping, since multiple VSIs can subscribe to the same MAC or 33171d10453SEric Joyner * VLAN. As an optimization the VSI list should be created only when a 33271d10453SEric Joyner * second VSI becomes a subscriber to the same MAC address. VSI lists are always 33371d10453SEric Joyner * used for VLAN membership. 33471d10453SEric Joyner */ 33571d10453SEric Joyner struct ice_fltr_mgmt_list_entry { 33671d10453SEric Joyner /* back pointer to VSI list ID to VSI list mapping */ 33771d10453SEric Joyner struct ice_vsi_list_map_info *vsi_list_info; 33871d10453SEric Joyner u16 vsi_count; 33971d10453SEric Joyner #define ICE_INVAL_LG_ACT_INDEX 0xffff 34071d10453SEric Joyner u16 lg_act_idx; 34171d10453SEric Joyner #define ICE_INVAL_SW_MARKER_ID 0xffff 34271d10453SEric Joyner u16 sw_marker_id; 34371d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 34471d10453SEric Joyner struct ice_fltr_info fltr_info; 34571d10453SEric Joyner #define ICE_INVAL_COUNTER_ID 0xff 34671d10453SEric Joyner u8 counter_index; 34771d10453SEric Joyner enum ice_fltr_marker marker; 34871d10453SEric Joyner }; 34971d10453SEric Joyner 35071d10453SEric Joyner struct ice_adv_fltr_mgmt_list_entry { 35171d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 35271d10453SEric Joyner 35371d10453SEric Joyner struct ice_adv_lkup_elem *lkups; 35471d10453SEric Joyner struct ice_adv_rule_info rule_info; 35571d10453SEric Joyner u16 lkups_cnt; 35671d10453SEric Joyner struct ice_vsi_list_map_info *vsi_list_info; 35771d10453SEric Joyner u16 vsi_count; 35871d10453SEric Joyner }; 35971d10453SEric Joyner 36071d10453SEric Joyner enum ice_promisc_flags { 36171d10453SEric Joyner ICE_PROMISC_UCAST_RX = 0x1, 36271d10453SEric Joyner ICE_PROMISC_UCAST_TX = 0x2, 36371d10453SEric Joyner ICE_PROMISC_MCAST_RX = 0x4, 36471d10453SEric Joyner ICE_PROMISC_MCAST_TX = 0x8, 36571d10453SEric Joyner ICE_PROMISC_BCAST_RX = 0x10, 36671d10453SEric Joyner ICE_PROMISC_BCAST_TX = 0x20, 36771d10453SEric Joyner ICE_PROMISC_VLAN_RX = 0x40, 36871d10453SEric Joyner ICE_PROMISC_VLAN_TX = 0x80, 36971d10453SEric Joyner }; 37071d10453SEric Joyner 37171d10453SEric Joyner /* VSI related commands */ 37271d10453SEric Joyner enum ice_status 37371d10453SEric Joyner ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 37471d10453SEric Joyner struct ice_sq_cd *cd); 37571d10453SEric Joyner enum ice_status 37671d10453SEric Joyner ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 37771d10453SEric Joyner bool keep_vsi_alloc, struct ice_sq_cd *cd); 37871d10453SEric Joyner enum ice_status 37971d10453SEric Joyner ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 38071d10453SEric Joyner struct ice_sq_cd *cd); 38171d10453SEric Joyner enum ice_status 38271d10453SEric Joyner ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 38371d10453SEric Joyner struct ice_sq_cd *cd); 38471d10453SEric Joyner enum ice_status 38571d10453SEric Joyner ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 38671d10453SEric Joyner bool keep_vsi_alloc, struct ice_sq_cd *cd); 38771d10453SEric Joyner enum ice_status 38871d10453SEric Joyner ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 38971d10453SEric Joyner struct ice_sq_cd *cd); 39071d10453SEric Joyner struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 39171d10453SEric Joyner void ice_clear_all_vsi_ctx(struct ice_hw *hw); 39271d10453SEric Joyner enum ice_status 39371d10453SEric Joyner ice_aq_get_vsi_params(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 39471d10453SEric Joyner struct ice_sq_cd *cd); 39571d10453SEric Joyner enum ice_status 39671d10453SEric Joyner ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi, 39771d10453SEric Joyner u16 count, struct ice_mir_rule_buf *mr_buf, 39871d10453SEric Joyner struct ice_sq_cd *cd, u16 *rule_id); 39971d10453SEric Joyner enum ice_status 40071d10453SEric Joyner ice_aq_delete_mir_rule(struct ice_hw *hw, u16 rule_id, bool keep_allocd, 40171d10453SEric Joyner struct ice_sq_cd *cd); 40271d10453SEric Joyner enum ice_status 40371d10453SEric Joyner ice_aq_get_storm_ctrl(struct ice_hw *hw, u32 *bcast_thresh, u32 *mcast_thresh, 40471d10453SEric Joyner u32 *ctl_bitmask); 40571d10453SEric Joyner enum ice_status 40671d10453SEric Joyner ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh, 40771d10453SEric Joyner u32 ctl_bitmask); 40871d10453SEric Joyner /* Switch config */ 40971d10453SEric Joyner enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); 41071d10453SEric Joyner 41171d10453SEric Joyner enum ice_status 41271d10453SEric Joyner ice_alloc_vlan_res_counter(struct ice_hw *hw, u16 *counter_id); 41371d10453SEric Joyner enum ice_status 41471d10453SEric Joyner ice_free_vlan_res_counter(struct ice_hw *hw, u16 counter_id); 41571d10453SEric Joyner 41671d10453SEric Joyner enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw); 417d08b8680SEric Joyner enum ice_status ice_alloc_rss_global_lut(struct ice_hw *hw, bool shared_res, u16 *global_lut_id); 418d08b8680SEric Joyner enum ice_status ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id); 41971d10453SEric Joyner enum ice_status 42071d10453SEric Joyner ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id, 42171d10453SEric Joyner u16 *counter_id); 42271d10453SEric Joyner enum ice_status 42371d10453SEric Joyner ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id); 42471d10453SEric Joyner enum ice_status 4257d7af7f8SEric Joyner ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, 4267d7af7f8SEric Joyner struct ice_aqc_get_res_resp_elem *buf, u16 buf_size, 4277d7af7f8SEric Joyner struct ice_sq_cd *cd); 42871d10453SEric Joyner enum ice_status 42971d10453SEric Joyner ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, 4307d7af7f8SEric Joyner struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type, 4317d7af7f8SEric Joyner bool res_shared, u16 *desc_id, struct ice_sq_cd *cd); 43271d10453SEric Joyner enum ice_status 43371d10453SEric Joyner ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list); 43471d10453SEric Joyner enum ice_status 43571d10453SEric Joyner ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list); 43671d10453SEric Joyner void ice_rem_all_sw_rules_info(struct ice_hw *hw); 43771d10453SEric Joyner enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst); 43871d10453SEric Joyner enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst); 43971d10453SEric Joyner enum ice_status 44071d10453SEric Joyner ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); 44171d10453SEric Joyner enum ice_status 44271d10453SEric Joyner ice_remove_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); 44371d10453SEric Joyner 44471d10453SEric Joyner enum ice_status 44571d10453SEric Joyner ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info, 44671d10453SEric Joyner u16 sw_marker); 44771d10453SEric Joyner enum ice_status 44871d10453SEric Joyner ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info); 44971d10453SEric Joyner void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); 45071d10453SEric Joyner 45171d10453SEric Joyner /* Promisc/defport setup for VSIs */ 45271d10453SEric Joyner enum ice_status 45371d10453SEric Joyner ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, 45471d10453SEric Joyner u8 direction); 45571d10453SEric Joyner enum ice_status 45671d10453SEric Joyner ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 45771d10453SEric Joyner u16 vid); 45871d10453SEric Joyner enum ice_status 45971d10453SEric Joyner ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 46071d10453SEric Joyner u16 vid); 46171d10453SEric Joyner enum ice_status 46271d10453SEric Joyner ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 46371d10453SEric Joyner bool rm_vlan_promisc); 46471d10453SEric Joyner 46571d10453SEric Joyner /* Get VSIs Promisc/defport settings */ 46671d10453SEric Joyner enum ice_status 46771d10453SEric Joyner ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, 46871d10453SEric Joyner u16 *vid); 46971d10453SEric Joyner enum ice_status 47071d10453SEric Joyner ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, 47171d10453SEric Joyner u16 *vid); 47271d10453SEric Joyner 47371d10453SEric Joyner enum ice_status ice_replay_all_fltr(struct ice_hw *hw); 47471d10453SEric Joyner 47571d10453SEric Joyner enum ice_status 47671d10453SEric Joyner ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list); 47771d10453SEric Joyner u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); 47871d10453SEric Joyner bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 47971d10453SEric Joyner 4807d7af7f8SEric Joyner enum ice_status 4817d7af7f8SEric Joyner ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi, 4827d7af7f8SEric Joyner u16 vsi_handle); 4837d7af7f8SEric Joyner void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw); 48471d10453SEric Joyner void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); 48571d10453SEric Joyner #endif /* _ICE_SWITCH_H_ */ 486