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]; 80*8a13362dSEric Joyner u16 num_rdma_q_entries[ICE_MAX_TRAFFIC_CLASS]; 81*8a13362dSEric Joyner struct ice_q_ctx *rdma_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 8271d10453SEric Joyner }; 8371d10453SEric Joyner 8471d10453SEric Joyner /* This is to be used by add/update mirror rule Admin Queue command */ 8571d10453SEric Joyner struct ice_mir_rule_buf { 8671d10453SEric Joyner u16 vsi_idx; /* VSI index */ 8771d10453SEric Joyner 8871d10453SEric Joyner /* For each VSI, user can specify whether corresponding VSI 8971d10453SEric Joyner * should be added/removed to/from mirror rule 9071d10453SEric Joyner * 9171d10453SEric Joyner * add mirror rule: this should always be TRUE. 9271d10453SEric Joyner * update mirror rule: add(true) or remove(false) VSI to/from 9371d10453SEric Joyner * mirror rule 9471d10453SEric Joyner */ 9571d10453SEric Joyner u8 add; 9671d10453SEric Joyner }; 9771d10453SEric Joyner 9871d10453SEric Joyner /* Switch recipe ID enum values are specific to hardware */ 9971d10453SEric Joyner enum ice_sw_lkup_type { 10071d10453SEric Joyner ICE_SW_LKUP_ETHERTYPE = 0, 10171d10453SEric Joyner ICE_SW_LKUP_MAC = 1, 10271d10453SEric Joyner ICE_SW_LKUP_MAC_VLAN = 2, 10371d10453SEric Joyner ICE_SW_LKUP_PROMISC = 3, 10471d10453SEric Joyner ICE_SW_LKUP_VLAN = 4, 10571d10453SEric Joyner ICE_SW_LKUP_DFLT = 5, 10671d10453SEric Joyner ICE_SW_LKUP_ETHERTYPE_MAC = 8, 10771d10453SEric Joyner ICE_SW_LKUP_PROMISC_VLAN = 9, 10871d10453SEric Joyner ICE_SW_LKUP_LAST 10971d10453SEric Joyner }; 11071d10453SEric Joyner 11171d10453SEric Joyner /* type of filter src ID */ 11271d10453SEric Joyner enum ice_src_id { 11371d10453SEric Joyner ICE_SRC_ID_UNKNOWN = 0, 11471d10453SEric Joyner ICE_SRC_ID_VSI, 11571d10453SEric Joyner ICE_SRC_ID_QUEUE, 11671d10453SEric Joyner ICE_SRC_ID_LPORT, 11771d10453SEric Joyner }; 11871d10453SEric Joyner 11971d10453SEric Joyner struct ice_fltr_info { 12071d10453SEric Joyner /* Look up information: how to look up packet */ 12171d10453SEric Joyner enum ice_sw_lkup_type lkup_type; 12271d10453SEric Joyner /* Forward action: filter action to do after lookup */ 12371d10453SEric Joyner enum ice_sw_fwd_act_type fltr_act; 12471d10453SEric Joyner /* rule ID returned by firmware once filter rule is created */ 12571d10453SEric Joyner u16 fltr_rule_id; 12671d10453SEric Joyner u16 flag; 12771d10453SEric Joyner 12871d10453SEric Joyner /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 12971d10453SEric Joyner u16 src; 13071d10453SEric Joyner enum ice_src_id src_id; 13171d10453SEric Joyner 13271d10453SEric Joyner union { 13371d10453SEric Joyner struct { 13471d10453SEric Joyner u8 mac_addr[ETH_ALEN]; 13571d10453SEric Joyner } mac; 13671d10453SEric Joyner struct { 13771d10453SEric Joyner u8 mac_addr[ETH_ALEN]; 13871d10453SEric Joyner u16 vlan_id; 13971d10453SEric Joyner } mac_vlan; 14071d10453SEric Joyner struct { 14171d10453SEric Joyner u16 vlan_id; 1429cf1841cSEric Joyner u16 tpid; 1439cf1841cSEric Joyner u8 tpid_valid; 14471d10453SEric Joyner } vlan; 14571d10453SEric Joyner /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE 14671d10453SEric Joyner * if just using ethertype as filter. Set lkup_type as 14771d10453SEric Joyner * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be 14871d10453SEric Joyner * passed in as filter. 14971d10453SEric Joyner */ 15071d10453SEric Joyner struct { 15171d10453SEric Joyner u16 ethertype; 15271d10453SEric Joyner u8 mac_addr[ETH_ALEN]; /* optional */ 15371d10453SEric Joyner } ethertype_mac; 15471d10453SEric Joyner } l_data; /* Make sure to zero out the memory of l_data before using 15571d10453SEric Joyner * it or only set the data associated with lookup match 15671d10453SEric Joyner * rest everything should be zero 15771d10453SEric Joyner */ 15871d10453SEric Joyner 15971d10453SEric Joyner /* Depending on filter action */ 16071d10453SEric Joyner union { 16171d10453SEric Joyner /* queue ID in case of ICE_FWD_TO_Q and starting 16271d10453SEric Joyner * queue ID in case of ICE_FWD_TO_QGRP. 16371d10453SEric Joyner */ 16471d10453SEric Joyner u16 q_id:11; 16571d10453SEric Joyner u16 hw_vsi_id:10; 16671d10453SEric Joyner u16 vsi_list_id:10; 16771d10453SEric Joyner } fwd_id; 16871d10453SEric Joyner 16971d10453SEric Joyner /* Sw VSI handle */ 17071d10453SEric Joyner u16 vsi_handle; 17171d10453SEric Joyner 17271d10453SEric Joyner /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field 17371d10453SEric Joyner * determines the range of queues the packet needs to be forwarded to. 17471d10453SEric Joyner * Note that qgrp_size must be set to a power of 2. 17571d10453SEric Joyner */ 17671d10453SEric Joyner u8 qgrp_size; 17771d10453SEric Joyner 17871d10453SEric Joyner /* Rule creations populate these indicators basing on the switch type */ 17971d10453SEric Joyner u8 lb_en; /* Indicate if packet can be looped back */ 18071d10453SEric Joyner u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ 18171d10453SEric Joyner }; 18271d10453SEric Joyner 18371d10453SEric Joyner struct ice_adv_lkup_elem { 18471d10453SEric Joyner enum ice_protocol_type type; 18571d10453SEric Joyner union ice_prot_hdr h_u; /* Header values */ 18671d10453SEric Joyner union ice_prot_hdr m_u; /* Mask of header values to match */ 18771d10453SEric Joyner }; 18871d10453SEric Joyner 18971d10453SEric Joyner struct ice_sw_act_ctrl { 19071d10453SEric Joyner /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 19171d10453SEric Joyner u16 src; 19271d10453SEric Joyner u16 flag; 19371d10453SEric Joyner enum ice_sw_fwd_act_type fltr_act; 19471d10453SEric Joyner /* Depending on filter action */ 19571d10453SEric Joyner union { 19671d10453SEric Joyner /* This is a queue ID in case of ICE_FWD_TO_Q and starting 19771d10453SEric Joyner * queue ID in case of ICE_FWD_TO_QGRP. 19871d10453SEric Joyner */ 19971d10453SEric Joyner u16 q_id:11; 20071d10453SEric Joyner u16 vsi_id:10; 20171d10453SEric Joyner u16 hw_vsi_id:10; 20271d10453SEric Joyner u16 vsi_list_id:10; 20371d10453SEric Joyner } fwd_id; 20471d10453SEric Joyner /* software VSI handle */ 20571d10453SEric Joyner u16 vsi_handle; 20671d10453SEric Joyner u8 qgrp_size; 20771d10453SEric Joyner }; 20871d10453SEric Joyner 20971d10453SEric Joyner struct ice_rule_query_data { 21071d10453SEric Joyner /* Recipe ID for which the requested rule was added */ 21171d10453SEric Joyner u16 rid; 21271d10453SEric Joyner /* Rule ID that was added or is supposed to be removed */ 21371d10453SEric Joyner u16 rule_id; 21471d10453SEric Joyner /* vsi_handle for which Rule was added or is supposed to be removed */ 21571d10453SEric Joyner u16 vsi_handle; 21671d10453SEric Joyner }; 21771d10453SEric Joyner 21856429daeSEric Joyner /* 21956429daeSEric Joyner * This structure allows to pass info about lb_en and lan_en 22056429daeSEric Joyner * flags to ice_add_adv_rule. Values in act would be used 22156429daeSEric Joyner * only if act_valid was set to true, otherwise dflt 22256429daeSEric Joyner * values would be used. 22356429daeSEric Joyner */ 22456429daeSEric Joyner struct ice_adv_rule_flags_info { 22556429daeSEric Joyner u32 act; 22656429daeSEric Joyner u8 act_valid; /* indicate if flags in act are valid */ 22756429daeSEric Joyner }; 22856429daeSEric Joyner 22971d10453SEric Joyner struct ice_adv_rule_info { 23071d10453SEric Joyner enum ice_sw_tunnel_type tun_type; 23171d10453SEric Joyner struct ice_sw_act_ctrl sw_act; 23271d10453SEric Joyner u32 priority; 23371d10453SEric Joyner u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */ 23471d10453SEric Joyner u16 fltr_rule_id; 23556429daeSEric Joyner struct ice_adv_rule_flags_info flags_info; 23671d10453SEric Joyner }; 23771d10453SEric Joyner 23871d10453SEric Joyner /* A collection of one or more four word recipe */ 23971d10453SEric Joyner struct ice_sw_recipe { 24071d10453SEric Joyner /* For a chained recipe the root recipe is what should be used for 24171d10453SEric Joyner * programming rules 24271d10453SEric Joyner */ 24371d10453SEric Joyner u8 is_root; 24471d10453SEric Joyner u8 root_rid; 24571d10453SEric Joyner u8 recp_created; 24671d10453SEric Joyner 24771d10453SEric Joyner /* Number of extraction words */ 24871d10453SEric Joyner u8 n_ext_words; 24971d10453SEric Joyner /* Protocol ID and Offset pair (extraction word) to describe the 25071d10453SEric Joyner * recipe 25171d10453SEric Joyner */ 25271d10453SEric Joyner struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS]; 25371d10453SEric Joyner u16 word_masks[ICE_MAX_CHAIN_WORDS]; 25471d10453SEric Joyner 25571d10453SEric Joyner /* if this recipe is a collection of other recipe */ 25671d10453SEric Joyner u8 big_recp; 25771d10453SEric Joyner 25871d10453SEric Joyner /* if this recipe is part of another bigger recipe then chain index 25971d10453SEric Joyner * corresponding to this recipe 26071d10453SEric Joyner */ 26171d10453SEric Joyner u8 chain_idx; 26271d10453SEric Joyner 26371d10453SEric Joyner /* if this recipe is a collection of other recipe then count of other 26471d10453SEric Joyner * recipes and recipe IDs of those recipes 26571d10453SEric Joyner */ 26671d10453SEric Joyner u8 n_grp_count; 26771d10453SEric Joyner 26871d10453SEric Joyner /* Bit map specifying the IDs associated with this group of recipe */ 26971d10453SEric Joyner ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES); 27071d10453SEric Joyner 27171d10453SEric Joyner enum ice_sw_tunnel_type tun_type; 27271d10453SEric Joyner 27371d10453SEric Joyner /* List of type ice_fltr_mgmt_list_entry or adv_rule */ 27471d10453SEric Joyner u8 adv_rule; 27571d10453SEric Joyner struct LIST_HEAD_TYPE filt_rules; 27671d10453SEric Joyner struct LIST_HEAD_TYPE filt_replay_rules; 27771d10453SEric Joyner 27871d10453SEric Joyner struct ice_lock filt_rule_lock; /* protect filter rule structure */ 27971d10453SEric Joyner 28071d10453SEric Joyner /* Profiles this recipe should be associated with */ 28171d10453SEric Joyner struct LIST_HEAD_TYPE fv_list; 28271d10453SEric Joyner 28371d10453SEric Joyner /* Profiles this recipe is associated with */ 28471d10453SEric Joyner u8 num_profs, *prof_ids; 28571d10453SEric Joyner 2867d7af7f8SEric Joyner /* Bit map for possible result indexes */ 28771d10453SEric Joyner ice_declare_bitmap(res_idxs, ICE_MAX_FV_WORDS); 28871d10453SEric Joyner 28971d10453SEric Joyner /* This allows user to specify the recipe priority. 29071d10453SEric Joyner * For now, this becomes 'fwd_priority' when recipe 29171d10453SEric Joyner * is created, usually recipes can have 'fwd' and 'join' 29271d10453SEric Joyner * priority. 29371d10453SEric Joyner */ 29471d10453SEric Joyner u8 priority; 29571d10453SEric Joyner 29671d10453SEric Joyner struct LIST_HEAD_TYPE rg_list; 29771d10453SEric Joyner 29871d10453SEric Joyner /* AQ buffer associated with this recipe */ 29971d10453SEric Joyner struct ice_aqc_recipe_data_elem *root_buf; 30071d10453SEric Joyner /* This struct saves the fv_words for a given lookup */ 30171d10453SEric Joyner struct ice_prot_lkup_ext lkup_exts; 30271d10453SEric Joyner }; 30371d10453SEric Joyner 30471d10453SEric Joyner /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ 30571d10453SEric Joyner struct ice_vsi_list_map_info { 30671d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 30771d10453SEric Joyner ice_declare_bitmap(vsi_map, ICE_MAX_VSI); 30871d10453SEric Joyner u16 vsi_list_id; 30971d10453SEric Joyner /* counter to track how many rules are reusing this VSI list */ 31071d10453SEric Joyner u16 ref_cnt; 31171d10453SEric Joyner }; 31271d10453SEric Joyner 31371d10453SEric Joyner struct ice_fltr_list_entry { 31471d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 31571d10453SEric Joyner enum ice_status status; 31671d10453SEric Joyner struct ice_fltr_info fltr_info; 31771d10453SEric Joyner }; 31871d10453SEric Joyner 31971d10453SEric Joyner /** 32071d10453SEric Joyner * enum ice_fltr_marker - Marker for syncing OS and driver filter lists 32171d10453SEric Joyner * @ICE_FLTR_NOT_FOUND: initial state, indicates filter has not been found 32271d10453SEric Joyner * @ICE_FLTR_FOUND: set when a filter has been found in both lists 32371d10453SEric Joyner * 32471d10453SEric Joyner * This enumeration is used to help sync an operating system provided filter 32571d10453SEric Joyner * list with the filters previously added. 32671d10453SEric Joyner * 32771d10453SEric Joyner * This is required for FreeBSD because the operating system does not provide 32871d10453SEric Joyner * individual indications of whether a filter has been added or deleted, but 32971d10453SEric Joyner * instead just notifies the driver with the entire new list. 33071d10453SEric Joyner * 33171d10453SEric Joyner * To use this marker state, the driver shall initially reset all filters to 33271d10453SEric Joyner * the ICE_FLTR_NOT_FOUND state. Then, for each filter in the OS list, it 33371d10453SEric Joyner * shall search the driver list for the filter. If found, the filter state 33471d10453SEric Joyner * will be set to ICE_FLTR_FOUND. If not found, that filter will be added. 33571d10453SEric Joyner * Finally, the driver shall search the internal filter list for all filters 33671d10453SEric Joyner * still marked as ICE_FLTR_NOT_FOUND and remove them. 33771d10453SEric Joyner */ 33871d10453SEric Joyner enum ice_fltr_marker { 33971d10453SEric Joyner ICE_FLTR_NOT_FOUND, 34071d10453SEric Joyner ICE_FLTR_FOUND, 34171d10453SEric Joyner }; 34271d10453SEric Joyner 34371d10453SEric Joyner /* This defines an entry in the list that maintains MAC or VLAN membership 34471d10453SEric Joyner * to HW list mapping, since multiple VSIs can subscribe to the same MAC or 34571d10453SEric Joyner * VLAN. As an optimization the VSI list should be created only when a 34671d10453SEric Joyner * second VSI becomes a subscriber to the same MAC address. VSI lists are always 34771d10453SEric Joyner * used for VLAN membership. 34871d10453SEric Joyner */ 34971d10453SEric Joyner struct ice_fltr_mgmt_list_entry { 35071d10453SEric Joyner /* back pointer to VSI list ID to VSI list mapping */ 35171d10453SEric Joyner struct ice_vsi_list_map_info *vsi_list_info; 35271d10453SEric Joyner u16 vsi_count; 35371d10453SEric Joyner #define ICE_INVAL_LG_ACT_INDEX 0xffff 35471d10453SEric Joyner u16 lg_act_idx; 35571d10453SEric Joyner #define ICE_INVAL_SW_MARKER_ID 0xffff 35671d10453SEric Joyner u16 sw_marker_id; 35771d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 35871d10453SEric Joyner struct ice_fltr_info fltr_info; 35971d10453SEric Joyner #define ICE_INVAL_COUNTER_ID 0xff 36071d10453SEric Joyner u8 counter_index; 36171d10453SEric Joyner enum ice_fltr_marker marker; 36271d10453SEric Joyner }; 36371d10453SEric Joyner 36471d10453SEric Joyner struct ice_adv_fltr_mgmt_list_entry { 36571d10453SEric Joyner struct LIST_ENTRY_TYPE list_entry; 36671d10453SEric Joyner 36771d10453SEric Joyner struct ice_adv_lkup_elem *lkups; 36871d10453SEric Joyner struct ice_adv_rule_info rule_info; 36971d10453SEric Joyner u16 lkups_cnt; 37071d10453SEric Joyner struct ice_vsi_list_map_info *vsi_list_info; 37171d10453SEric Joyner u16 vsi_count; 37271d10453SEric Joyner }; 37371d10453SEric Joyner 37471d10453SEric Joyner enum ice_promisc_flags { 37571d10453SEric Joyner ICE_PROMISC_UCAST_RX = 0x1, 37671d10453SEric Joyner ICE_PROMISC_UCAST_TX = 0x2, 37771d10453SEric Joyner ICE_PROMISC_MCAST_RX = 0x4, 37871d10453SEric Joyner ICE_PROMISC_MCAST_TX = 0x8, 37971d10453SEric Joyner ICE_PROMISC_BCAST_RX = 0x10, 38071d10453SEric Joyner ICE_PROMISC_BCAST_TX = 0x20, 38171d10453SEric Joyner ICE_PROMISC_VLAN_RX = 0x40, 38271d10453SEric Joyner ICE_PROMISC_VLAN_TX = 0x80, 38371d10453SEric Joyner }; 38471d10453SEric Joyner 38571d10453SEric Joyner /* VSI related commands */ 38671d10453SEric Joyner enum ice_status 38771d10453SEric Joyner ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 38871d10453SEric Joyner struct ice_sq_cd *cd); 38971d10453SEric Joyner enum ice_status 39071d10453SEric Joyner ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 39171d10453SEric Joyner bool keep_vsi_alloc, struct ice_sq_cd *cd); 39271d10453SEric Joyner enum ice_status 39371d10453SEric Joyner ice_aq_update_vsi(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_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 39771d10453SEric Joyner struct ice_sq_cd *cd); 39871d10453SEric Joyner enum ice_status 39971d10453SEric Joyner ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 40071d10453SEric Joyner bool keep_vsi_alloc, struct ice_sq_cd *cd); 40171d10453SEric Joyner enum ice_status 40271d10453SEric Joyner ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 40371d10453SEric Joyner struct ice_sq_cd *cd); 40471d10453SEric Joyner struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 40571d10453SEric Joyner void ice_clear_all_vsi_ctx(struct ice_hw *hw); 40671d10453SEric Joyner enum ice_status 40771d10453SEric Joyner ice_aq_get_vsi_params(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 40871d10453SEric Joyner struct ice_sq_cd *cd); 40971d10453SEric Joyner enum ice_status 41071d10453SEric Joyner ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi, 41171d10453SEric Joyner u16 count, struct ice_mir_rule_buf *mr_buf, 41271d10453SEric Joyner struct ice_sq_cd *cd, u16 *rule_id); 41371d10453SEric Joyner enum ice_status 41471d10453SEric Joyner ice_aq_delete_mir_rule(struct ice_hw *hw, u16 rule_id, bool keep_allocd, 41571d10453SEric Joyner struct ice_sq_cd *cd); 41671d10453SEric Joyner enum ice_status 41771d10453SEric Joyner ice_aq_get_storm_ctrl(struct ice_hw *hw, u32 *bcast_thresh, u32 *mcast_thresh, 41871d10453SEric Joyner u32 *ctl_bitmask); 41971d10453SEric Joyner enum ice_status 42071d10453SEric Joyner ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh, 42171d10453SEric Joyner u32 ctl_bitmask); 42271d10453SEric Joyner /* Switch config */ 42371d10453SEric Joyner enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); 42471d10453SEric Joyner 42571d10453SEric Joyner enum ice_status 42671d10453SEric Joyner ice_alloc_vlan_res_counter(struct ice_hw *hw, u16 *counter_id); 42771d10453SEric Joyner enum ice_status 42871d10453SEric Joyner ice_free_vlan_res_counter(struct ice_hw *hw, u16 counter_id); 42971d10453SEric Joyner 43071d10453SEric Joyner enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw); 431d08b8680SEric Joyner enum ice_status ice_alloc_rss_global_lut(struct ice_hw *hw, bool shared_res, u16 *global_lut_id); 432d08b8680SEric Joyner enum ice_status ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id); 43371d10453SEric Joyner enum ice_status 43471d10453SEric Joyner ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id, 43571d10453SEric Joyner u16 *counter_id); 43671d10453SEric Joyner enum ice_status 43771d10453SEric Joyner ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id); 43871d10453SEric Joyner enum ice_status 4397d7af7f8SEric Joyner ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, 4407d7af7f8SEric Joyner struct ice_aqc_get_res_resp_elem *buf, u16 buf_size, 4417d7af7f8SEric Joyner struct ice_sq_cd *cd); 44271d10453SEric Joyner enum ice_status 44371d10453SEric Joyner ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, 4447d7af7f8SEric Joyner struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type, 4457d7af7f8SEric Joyner bool res_shared, u16 *desc_id, struct ice_sq_cd *cd); 44671d10453SEric Joyner enum ice_status 44771d10453SEric Joyner ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list); 44871d10453SEric Joyner enum ice_status 44971d10453SEric Joyner ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list); 45071d10453SEric Joyner void ice_rem_all_sw_rules_info(struct ice_hw *hw); 45171d10453SEric Joyner enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst); 45271d10453SEric Joyner enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst); 45371d10453SEric Joyner enum ice_status 45471d10453SEric Joyner ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); 45571d10453SEric Joyner enum ice_status 45671d10453SEric Joyner ice_remove_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list); 457*8a13362dSEric Joyner enum ice_status 458*8a13362dSEric Joyner ice_cfg_iwarp_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable); 45971d10453SEric Joyner 46071d10453SEric Joyner enum ice_status 46171d10453SEric Joyner ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info, 46271d10453SEric Joyner u16 sw_marker); 46371d10453SEric Joyner enum ice_status 46471d10453SEric Joyner ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info); 46571d10453SEric Joyner void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); 46671d10453SEric Joyner 46771d10453SEric Joyner /* Promisc/defport setup for VSIs */ 46871d10453SEric Joyner enum ice_status 46971d10453SEric Joyner ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, 47071d10453SEric Joyner u8 direction); 47171d10453SEric Joyner enum ice_status 47271d10453SEric Joyner ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 47371d10453SEric Joyner u16 vid); 47471d10453SEric Joyner enum ice_status 47571d10453SEric Joyner ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 47671d10453SEric Joyner u16 vid); 47771d10453SEric Joyner enum ice_status 47871d10453SEric Joyner ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 47971d10453SEric Joyner bool rm_vlan_promisc); 48071d10453SEric Joyner 48171d10453SEric Joyner /* Get VSIs Promisc/defport settings */ 48271d10453SEric Joyner enum ice_status 48371d10453SEric Joyner ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, 48471d10453SEric Joyner u16 *vid); 48571d10453SEric Joyner enum ice_status 48671d10453SEric Joyner ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, 48771d10453SEric Joyner u16 *vid); 48871d10453SEric Joyner 48971d10453SEric Joyner enum ice_status ice_replay_all_fltr(struct ice_hw *hw); 49071d10453SEric Joyner 49171d10453SEric Joyner enum ice_status 49271d10453SEric Joyner ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list); 49371d10453SEric Joyner u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); 49471d10453SEric Joyner bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 49571d10453SEric Joyner 4967d7af7f8SEric Joyner enum ice_status 4977d7af7f8SEric Joyner ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi, 4987d7af7f8SEric Joyner u16 vsi_handle); 4997d7af7f8SEric Joyner void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw); 50071d10453SEric Joyner void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); 50171d10453SEric Joyner #endif /* _ICE_SWITCH_H_ */ 502