19c20346bSAnirudh Venkataramanan /* SPDX-License-Identifier: GPL-2.0 */ 29c20346bSAnirudh Venkataramanan /* Copyright (c) 2018, Intel Corporation. */ 39c20346bSAnirudh Venkataramanan 49c20346bSAnirudh Venkataramanan #ifndef _ICE_SWITCH_H_ 59c20346bSAnirudh Venkataramanan #define _ICE_SWITCH_H_ 69c20346bSAnirudh Venkataramanan 79c20346bSAnirudh Venkataramanan #include "ice_common.h" 89c20346bSAnirudh Venkataramanan 99c20346bSAnirudh Venkataramanan #define ICE_SW_CFG_MAX_BUF_LEN 2048 109c20346bSAnirudh Venkataramanan #define ICE_DFLT_VSI_INVAL 0xff 111eb11036SAnirudh Venkataramanan #define ICE_FLTR_RX BIT(0) 121eb11036SAnirudh Venkataramanan #define ICE_FLTR_TX BIT(1) 131eb11036SAnirudh Venkataramanan #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) 14d76a60baSAnirudh Venkataramanan #define ICE_VSI_INVAL_ID 0xffff 15bb87ee0eSAnirudh Venkataramanan #define ICE_INVAL_Q_HANDLE 0xFFFF 16bb87ee0eSAnirudh Venkataramanan 179a225f81SMarcin Szycik /* Switch Profile IDs for Profile related switch rules */ 189a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPC_TEID 41 199a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPC_NO_TEID 42 209a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPU_TEID 43 219a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPC_TEID 44 229a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPC_NO_TEID 45 239a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPU_TEID 46 249a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER 70 259a225f81SMarcin Szycik 263a858ba3SAnirudh Venkataramanan /* VSI context structure for add/get/update/free operations */ 273a858ba3SAnirudh Venkataramanan struct ice_vsi_ctx { 283a858ba3SAnirudh Venkataramanan u16 vsi_num; 293a858ba3SAnirudh Venkataramanan u16 vsis_allocd; 303a858ba3SAnirudh Venkataramanan u16 vsis_unallocated; 313a858ba3SAnirudh Venkataramanan u16 flags; 323a858ba3SAnirudh Venkataramanan struct ice_aqc_vsi_props info; 334fb33f31SAnirudh Venkataramanan struct ice_sched_vsi_info sched; 3443f8b224SBruce Allan u8 alloc_from_pool; 358ede0178SAnirudh Venkataramanan u8 vf_num; 36bb87ee0eSAnirudh Venkataramanan u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS]; 37bb87ee0eSAnirudh Venkataramanan struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 38348048e7SDave Ertman u16 num_rdma_q_entries[ICE_MAX_TRAFFIC_CLASS]; 39348048e7SDave Ertman struct ice_q_ctx *rdma_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 403a858ba3SAnirudh Venkataramanan }; 413a858ba3SAnirudh Venkataramanan 429daf8208SAnirudh Venkataramanan /* Switch recipe ID enum values are specific to hardware */ 439daf8208SAnirudh Venkataramanan enum ice_sw_lkup_type { 449daf8208SAnirudh Venkataramanan ICE_SW_LKUP_ETHERTYPE = 0, 459daf8208SAnirudh Venkataramanan ICE_SW_LKUP_MAC = 1, 469daf8208SAnirudh Venkataramanan ICE_SW_LKUP_MAC_VLAN = 2, 479daf8208SAnirudh Venkataramanan ICE_SW_LKUP_PROMISC = 3, 489daf8208SAnirudh Venkataramanan ICE_SW_LKUP_VLAN = 4, 499daf8208SAnirudh Venkataramanan ICE_SW_LKUP_DFLT = 5, 509daf8208SAnirudh Venkataramanan ICE_SW_LKUP_ETHERTYPE_MAC = 8, 519daf8208SAnirudh Venkataramanan ICE_SW_LKUP_PROMISC_VLAN = 9, 5280d144c9SAnirudh Venkataramanan ICE_SW_LKUP_LAST 539daf8208SAnirudh Venkataramanan }; 549daf8208SAnirudh Venkataramanan 55f9867df6SAnirudh Venkataramanan /* type of filter src ID */ 565726ca0eSAnirudh Venkataramanan enum ice_src_id { 575726ca0eSAnirudh Venkataramanan ICE_SRC_ID_UNKNOWN = 0, 585726ca0eSAnirudh Venkataramanan ICE_SRC_ID_VSI, 595726ca0eSAnirudh Venkataramanan ICE_SRC_ID_QUEUE, 605726ca0eSAnirudh Venkataramanan ICE_SRC_ID_LPORT, 615726ca0eSAnirudh Venkataramanan }; 625726ca0eSAnirudh Venkataramanan 639daf8208SAnirudh Venkataramanan struct ice_fltr_info { 649daf8208SAnirudh Venkataramanan /* Look up information: how to look up packet */ 659daf8208SAnirudh Venkataramanan enum ice_sw_lkup_type lkup_type; 669daf8208SAnirudh Venkataramanan /* Forward action: filter action to do after lookup */ 679daf8208SAnirudh Venkataramanan enum ice_sw_fwd_act_type fltr_act; 689daf8208SAnirudh Venkataramanan /* rule ID returned by firmware once filter rule is created */ 699daf8208SAnirudh Venkataramanan u16 fltr_rule_id; 709daf8208SAnirudh Venkataramanan u16 flag; 719daf8208SAnirudh Venkataramanan 729daf8208SAnirudh Venkataramanan /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 739daf8208SAnirudh Venkataramanan u16 src; 745726ca0eSAnirudh Venkataramanan enum ice_src_id src_id; 759daf8208SAnirudh Venkataramanan 769daf8208SAnirudh Venkataramanan union { 779daf8208SAnirudh Venkataramanan struct { 789daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; 799daf8208SAnirudh Venkataramanan } mac; 809daf8208SAnirudh Venkataramanan struct { 819daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; 829daf8208SAnirudh Venkataramanan u16 vlan_id; 839daf8208SAnirudh Venkataramanan } mac_vlan; 849daf8208SAnirudh Venkataramanan struct { 859daf8208SAnirudh Venkataramanan u16 vlan_id; 862bfefa2dSBrett Creeley u16 tpid; 872bfefa2dSBrett Creeley u8 tpid_valid; 889daf8208SAnirudh Venkataramanan } vlan; 899daf8208SAnirudh Venkataramanan /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE 909daf8208SAnirudh Venkataramanan * if just using ethertype as filter. Set lkup_type as 919daf8208SAnirudh Venkataramanan * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be 929daf8208SAnirudh Venkataramanan * passed in as filter. 939daf8208SAnirudh Venkataramanan */ 949daf8208SAnirudh Venkataramanan struct { 959daf8208SAnirudh Venkataramanan u16 ethertype; 969daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; /* optional */ 979daf8208SAnirudh Venkataramanan } ethertype_mac; 985726ca0eSAnirudh Venkataramanan } l_data; /* Make sure to zero out the memory of l_data before using 995726ca0eSAnirudh Venkataramanan * it or only set the data associated with lookup match 1005726ca0eSAnirudh Venkataramanan * rest everything should be zero 1015726ca0eSAnirudh Venkataramanan */ 1029daf8208SAnirudh Venkataramanan 1039daf8208SAnirudh Venkataramanan /* Depending on filter action */ 1049daf8208SAnirudh Venkataramanan union { 105f9867df6SAnirudh Venkataramanan /* queue ID in case of ICE_FWD_TO_Q and starting 106f9867df6SAnirudh Venkataramanan * queue ID in case of ICE_FWD_TO_QGRP. 1079daf8208SAnirudh Venkataramanan */ 1089daf8208SAnirudh Venkataramanan u16 q_id:11; 1095726ca0eSAnirudh Venkataramanan u16 hw_vsi_id:10; 1109daf8208SAnirudh Venkataramanan u16 vsi_list_id:10; 1119daf8208SAnirudh Venkataramanan } fwd_id; 1129daf8208SAnirudh Venkataramanan 1135726ca0eSAnirudh Venkataramanan /* Sw VSI handle */ 1145726ca0eSAnirudh Venkataramanan u16 vsi_handle; 1155726ca0eSAnirudh Venkataramanan 1169daf8208SAnirudh Venkataramanan /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field 1175726ca0eSAnirudh Venkataramanan * determines the range of queues the packet needs to be forwarded to. 1185726ca0eSAnirudh Venkataramanan * Note that qgrp_size must be set to a power of 2. 1199daf8208SAnirudh Venkataramanan */ 1209daf8208SAnirudh Venkataramanan u8 qgrp_size; 1219daf8208SAnirudh Venkataramanan 1229daf8208SAnirudh Venkataramanan /* Rule creations populate these indicators basing on the switch type */ 12343f8b224SBruce Allan u8 lb_en; /* Indicate if packet can be looped back */ 12443f8b224SBruce Allan u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ 1259daf8208SAnirudh Venkataramanan }; 1269daf8208SAnirudh Venkataramanan 127a1ffafb0SBrett Creeley struct ice_update_recipe_lkup_idx_params { 128a1ffafb0SBrett Creeley u16 rid; 129a1ffafb0SBrett Creeley u16 fv_idx; 130a1ffafb0SBrett Creeley bool ignore_valid; 131a1ffafb0SBrett Creeley u16 mask; 132a1ffafb0SBrett Creeley bool mask_valid; 133a1ffafb0SBrett Creeley u8 lkup_idx; 134a1ffafb0SBrett Creeley }; 135a1ffafb0SBrett Creeley 136fd2a6b71SDan Nowlin struct ice_adv_lkup_elem { 137fd2a6b71SDan Nowlin enum ice_protocol_type type; 138135a161aSAlexander Lobakin union { 139fd2a6b71SDan Nowlin union ice_prot_hdr h_u; /* Header values */ 140135a161aSAlexander Lobakin /* Used to iterate over the headers */ 141135a161aSAlexander Lobakin u16 h_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 142135a161aSAlexander Lobakin }; 143135a161aSAlexander Lobakin union { 144fd2a6b71SDan Nowlin union ice_prot_hdr m_u; /* Mask of header values to match */ 145135a161aSAlexander Lobakin /* Used to iterate over header mask */ 146135a161aSAlexander Lobakin u16 m_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 147135a161aSAlexander Lobakin }; 148fd2a6b71SDan Nowlin }; 14980d144c9SAnirudh Venkataramanan 150fd2a6b71SDan Nowlin struct ice_sw_act_ctrl { 151fd2a6b71SDan Nowlin /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 152fd2a6b71SDan Nowlin u16 src; 153fd2a6b71SDan Nowlin u16 flag; 154fd2a6b71SDan Nowlin enum ice_sw_fwd_act_type fltr_act; 155fd2a6b71SDan Nowlin /* Depending on filter action */ 156fd2a6b71SDan Nowlin union { 157fd2a6b71SDan Nowlin /* This is a queue ID in case of ICE_FWD_TO_Q and starting 158fd2a6b71SDan Nowlin * queue ID in case of ICE_FWD_TO_QGRP. 15980d144c9SAnirudh Venkataramanan */ 160fd2a6b71SDan Nowlin u16 q_id:11; 161fd2a6b71SDan Nowlin u16 vsi_id:10; 162fd2a6b71SDan Nowlin u16 hw_vsi_id:10; 163fd2a6b71SDan Nowlin u16 vsi_list_id:10; 164fd2a6b71SDan Nowlin } fwd_id; 165fd2a6b71SDan Nowlin /* software VSI handle */ 166fd2a6b71SDan Nowlin u16 vsi_handle; 167fd2a6b71SDan Nowlin u8 qgrp_size; 168fd2a6b71SDan Nowlin }; 16980d144c9SAnirudh Venkataramanan 170fd2a6b71SDan Nowlin struct ice_rule_query_data { 171fd2a6b71SDan Nowlin /* Recipe ID for which the requested rule was added */ 172fd2a6b71SDan Nowlin u16 rid; 173fd2a6b71SDan Nowlin /* Rule ID that was added or is supposed to be removed */ 174fd2a6b71SDan Nowlin u16 rule_id; 175fd2a6b71SDan Nowlin /* vsi_handle for which Rule was added or is supposed to be removed */ 176fd2a6b71SDan Nowlin u16 vsi_handle; 177fd2a6b71SDan Nowlin }; 178fd2a6b71SDan Nowlin 17973b483b7SWojciech Drewek /* This structure allows to pass info about lb_en and lan_en 18073b483b7SWojciech Drewek * flags to ice_add_adv_rule. Values in act would be used 18173b483b7SWojciech Drewek * only if act_valid was set to true, otherwise default 18273b483b7SWojciech Drewek * values would be used. 18373b483b7SWojciech Drewek */ 18473b483b7SWojciech Drewek struct ice_adv_rule_flags_info { 18573b483b7SWojciech Drewek u32 act; 18673b483b7SWojciech Drewek u8 act_valid; /* indicate if flags in act are valid */ 18773b483b7SWojciech Drewek }; 18873b483b7SWojciech Drewek 189fd2a6b71SDan Nowlin struct ice_adv_rule_info { 1909e300987SMichal Swiatkowski enum ice_sw_tunnel_type tun_type; 191fd2a6b71SDan Nowlin struct ice_sw_act_ctrl sw_act; 192fd2a6b71SDan Nowlin u32 priority; 193fd2a6b71SDan Nowlin u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */ 194fd2a6b71SDan Nowlin u16 fltr_rule_id; 195*ea71b967SMartyna Szapar-Mudlaw u16 vlan_type; 19673b483b7SWojciech Drewek struct ice_adv_rule_flags_info flags_info; 197fd2a6b71SDan Nowlin }; 198fd2a6b71SDan Nowlin 199fd2a6b71SDan Nowlin /* A collection of one or more four word recipe */ 200fd2a6b71SDan Nowlin struct ice_sw_recipe { 201fd2a6b71SDan Nowlin /* For a chained recipe the root recipe is what should be used for 202fd2a6b71SDan Nowlin * programming rules 203fd2a6b71SDan Nowlin */ 204fd2a6b71SDan Nowlin u8 is_root; 205fd2a6b71SDan Nowlin u8 root_rid; 206fd2a6b71SDan Nowlin u8 recp_created; 207fd2a6b71SDan Nowlin 208fd2a6b71SDan Nowlin /* Number of extraction words */ 209fd2a6b71SDan Nowlin u8 n_ext_words; 210fd2a6b71SDan Nowlin /* Protocol ID and Offset pair (extraction word) to describe the 211fd2a6b71SDan Nowlin * recipe 212fd2a6b71SDan Nowlin */ 213fd2a6b71SDan Nowlin struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS]; 214fd2a6b71SDan Nowlin u16 word_masks[ICE_MAX_CHAIN_WORDS]; 215fd2a6b71SDan Nowlin 216fd2a6b71SDan Nowlin /* if this recipe is a collection of other recipe */ 217fd2a6b71SDan Nowlin u8 big_recp; 218fd2a6b71SDan Nowlin 219fd2a6b71SDan Nowlin /* if this recipe is part of another bigger recipe then chain index 220fd2a6b71SDan Nowlin * corresponding to this recipe 221fd2a6b71SDan Nowlin */ 222fd2a6b71SDan Nowlin u8 chain_idx; 223fd2a6b71SDan Nowlin 224fd2a6b71SDan Nowlin /* if this recipe is a collection of other recipe then count of other 225fd2a6b71SDan Nowlin * recipes and recipe IDs of those recipes 226fd2a6b71SDan Nowlin */ 227fd2a6b71SDan Nowlin u8 n_grp_count; 228fd2a6b71SDan Nowlin 229fd2a6b71SDan Nowlin /* Bit map specifying the IDs associated with this group of recipe */ 230fd2a6b71SDan Nowlin DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); 231fd2a6b71SDan Nowlin 2328b032a55SMichal Swiatkowski enum ice_sw_tunnel_type tun_type; 2338b032a55SMichal Swiatkowski 234fd2a6b71SDan Nowlin /* List of type ice_fltr_mgmt_list_entry or adv_rule */ 235fd2a6b71SDan Nowlin u8 adv_rule; 23680d144c9SAnirudh Venkataramanan struct list_head filt_rules; 237334cb062SAnirudh Venkataramanan struct list_head filt_replay_rules; 23880d144c9SAnirudh Venkataramanan 239fd2a6b71SDan Nowlin struct mutex filt_rule_lock; /* protect filter rule structure */ 24080d144c9SAnirudh Venkataramanan 241fd2a6b71SDan Nowlin /* Profiles this recipe should be associated with */ 242fd2a6b71SDan Nowlin struct list_head fv_list; 243fd2a6b71SDan Nowlin 244fd2a6b71SDan Nowlin /* Profiles this recipe is associated with */ 245fd2a6b71SDan Nowlin u8 num_profs, *prof_ids; 246fd2a6b71SDan Nowlin 247fd2a6b71SDan Nowlin /* Bit map for possible result indexes */ 248fd2a6b71SDan Nowlin DECLARE_BITMAP(res_idxs, ICE_MAX_FV_WORDS); 249fd2a6b71SDan Nowlin 250fd2a6b71SDan Nowlin /* This allows user to specify the recipe priority. 251fd2a6b71SDan Nowlin * For now, this becomes 'fwd_priority' when recipe 252fd2a6b71SDan Nowlin * is created, usually recipes can have 'fwd' and 'join' 253fd2a6b71SDan Nowlin * priority. 254fd2a6b71SDan Nowlin */ 255fd2a6b71SDan Nowlin u8 priority; 256fd2a6b71SDan Nowlin 257fd2a6b71SDan Nowlin struct list_head rg_list; 258fd2a6b71SDan Nowlin 259fd2a6b71SDan Nowlin /* AQ buffer associated with this recipe */ 260fd2a6b71SDan Nowlin struct ice_aqc_recipe_data_elem *root_buf; 261fd2a6b71SDan Nowlin /* This struct saves the fv_words for a given lookup */ 262fd2a6b71SDan Nowlin struct ice_prot_lkup_ext lkup_exts; 26380d144c9SAnirudh Venkataramanan }; 26480d144c9SAnirudh Venkataramanan 265f9867df6SAnirudh Venkataramanan /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ 2669daf8208SAnirudh Venkataramanan struct ice_vsi_list_map_info { 2679daf8208SAnirudh Venkataramanan struct list_head list_entry; 2689daf8208SAnirudh Venkataramanan DECLARE_BITMAP(vsi_map, ICE_MAX_VSI); 2699daf8208SAnirudh Venkataramanan u16 vsi_list_id; 2705726ca0eSAnirudh Venkataramanan /* counter to track how many rules are reusing this VSI list */ 2715726ca0eSAnirudh Venkataramanan u16 ref_cnt; 2729daf8208SAnirudh Venkataramanan }; 2739daf8208SAnirudh Venkataramanan 2749daf8208SAnirudh Venkataramanan struct ice_fltr_list_entry { 2759daf8208SAnirudh Venkataramanan struct list_head list_entry; 2765e24d598STony Nguyen int status; 2779daf8208SAnirudh Venkataramanan struct ice_fltr_info fltr_info; 2789daf8208SAnirudh Venkataramanan }; 2799daf8208SAnirudh Venkataramanan 2809daf8208SAnirudh Venkataramanan /* This defines an entry in the list that maintains MAC or VLAN membership 2819daf8208SAnirudh Venkataramanan * to HW list mapping, since multiple VSIs can subscribe to the same MAC or 2829daf8208SAnirudh Venkataramanan * VLAN. As an optimization the VSI list should be created only when a 283f31028bfSBrett Creeley * second VSI becomes a subscriber to the same MAC address. VSI lists are always 284f31028bfSBrett Creeley * used for VLAN membership. 2859daf8208SAnirudh Venkataramanan */ 2869daf8208SAnirudh Venkataramanan struct ice_fltr_mgmt_list_entry { 287f9867df6SAnirudh Venkataramanan /* back pointer to VSI list ID to VSI list mapping */ 2889daf8208SAnirudh Venkataramanan struct ice_vsi_list_map_info *vsi_list_info; 2899daf8208SAnirudh Venkataramanan u16 vsi_count; 2909daf8208SAnirudh Venkataramanan #define ICE_INVAL_LG_ACT_INDEX 0xffff 2919daf8208SAnirudh Venkataramanan u16 lg_act_idx; 2929daf8208SAnirudh Venkataramanan #define ICE_INVAL_SW_MARKER_ID 0xffff 2939daf8208SAnirudh Venkataramanan u16 sw_marker_id; 2949daf8208SAnirudh Venkataramanan struct list_head list_entry; 2959daf8208SAnirudh Venkataramanan struct ice_fltr_info fltr_info; 2969daf8208SAnirudh Venkataramanan #define ICE_INVAL_COUNTER_ID 0xff 2979daf8208SAnirudh Venkataramanan u8 counter_index; 2989daf8208SAnirudh Venkataramanan }; 2999daf8208SAnirudh Venkataramanan 3000f94570dSGrishma Kotecha struct ice_adv_fltr_mgmt_list_entry { 3010f94570dSGrishma Kotecha struct list_head list_entry; 3020f94570dSGrishma Kotecha 3030f94570dSGrishma Kotecha struct ice_adv_lkup_elem *lkups; 3040f94570dSGrishma Kotecha struct ice_adv_rule_info rule_info; 3050f94570dSGrishma Kotecha u16 lkups_cnt; 3060f94570dSGrishma Kotecha struct ice_vsi_list_map_info *vsi_list_info; 3070f94570dSGrishma Kotecha u16 vsi_count; 3080f94570dSGrishma Kotecha }; 3090f94570dSGrishma Kotecha 3105eda8afdSAkeem G Abodunrin enum ice_promisc_flags { 3115eda8afdSAkeem G Abodunrin ICE_PROMISC_UCAST_RX = 0x1, 3125eda8afdSAkeem G Abodunrin ICE_PROMISC_UCAST_TX = 0x2, 3135eda8afdSAkeem G Abodunrin ICE_PROMISC_MCAST_RX = 0x4, 3145eda8afdSAkeem G Abodunrin ICE_PROMISC_MCAST_TX = 0x8, 3155eda8afdSAkeem G Abodunrin ICE_PROMISC_BCAST_RX = 0x10, 3165eda8afdSAkeem G Abodunrin ICE_PROMISC_BCAST_TX = 0x20, 3175eda8afdSAkeem G Abodunrin ICE_PROMISC_VLAN_RX = 0x40, 3185eda8afdSAkeem G Abodunrin ICE_PROMISC_VLAN_TX = 0x80, 3195eda8afdSAkeem G Abodunrin }; 3205eda8afdSAkeem G Abodunrin 3213a858ba3SAnirudh Venkataramanan /* VSI related commands */ 3225e24d598STony Nguyen int 3230f9d5027SAnirudh Venkataramanan ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3240f9d5027SAnirudh Venkataramanan struct ice_sq_cd *cd); 3255e24d598STony Nguyen int 3260f9d5027SAnirudh Venkataramanan ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3273a858ba3SAnirudh Venkataramanan bool keep_vsi_alloc, struct ice_sq_cd *cd); 3285e24d598STony Nguyen int 3295726ca0eSAnirudh Venkataramanan ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3305726ca0eSAnirudh Venkataramanan struct ice_sq_cd *cd); 3314fb33f31SAnirudh Venkataramanan bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 3324fb33f31SAnirudh Venkataramanan struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 33333e055fcSVictor Raj void ice_clear_all_vsi_ctx(struct ice_hw *hw); 33433e055fcSVictor Raj /* Switch config */ 3355e24d598STony Nguyen int ice_get_initial_sw_cfg(struct ice_hw *hw); 3369c20346bSAnirudh Venkataramanan 3375e24d598STony Nguyen int 338148beb61SHenry Tieman ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 339148beb61SHenry Tieman u16 *counter_id); 3405e24d598STony Nguyen int 341148beb61SHenry Tieman ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 342148beb61SHenry Tieman u16 counter_id); 343148beb61SHenry Tieman 3449daf8208SAnirudh Venkataramanan /* Switch/bridge related commands */ 3455e24d598STony Nguyen int 3460f94570dSGrishma Kotecha ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, 3470f94570dSGrishma Kotecha u16 lkups_cnt, struct ice_adv_rule_info *rinfo, 3480f94570dSGrishma Kotecha struct ice_rule_query_data *added_entry); 3495e24d598STony Nguyen int ice_update_sw_rule_bridge_mode(struct ice_hw *hw); 3505518ac2aSTony Nguyen int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); 3515518ac2aSTony Nguyen int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); 3525e24d598STony Nguyen int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); 3535e24d598STony Nguyen int ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); 3549fea7498SKiran Patil bool ice_mac_fltr_exist(struct ice_hw *hw, u8 *mac, u16 vsi_handle); 3559fea7498SKiran Patil bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle); 3565518ac2aSTony Nguyen int ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list); 3575518ac2aSTony Nguyen int ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list); 3585518ac2aSTony Nguyen int ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable); 3595726ca0eSAnirudh Venkataramanan void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); 3605eda8afdSAkeem G Abodunrin 3615eda8afdSAkeem G Abodunrin /* Promisc/defport setup for VSIs */ 3625518ac2aSTony Nguyen int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction); 3635e24d598STony Nguyen int 3645eda8afdSAkeem G Abodunrin ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3655eda8afdSAkeem G Abodunrin u16 vid); 3665e24d598STony Nguyen int 3675eda8afdSAkeem G Abodunrin ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3685eda8afdSAkeem G Abodunrin u16 vid); 3695e24d598STony Nguyen int 3705eda8afdSAkeem G Abodunrin ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3715eda8afdSAkeem G Abodunrin bool rm_vlan_promisc); 3720f9d5027SAnirudh Venkataramanan 3735518ac2aSTony Nguyen int ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle); 3745e24d598STony Nguyen int 3758bb98f33SShivanshu Shukla ice_rem_adv_rule_by_id(struct ice_hw *hw, 3768bb98f33SShivanshu Shukla struct ice_rule_query_data *remove_entry); 3778bb98f33SShivanshu Shukla 3785e24d598STony Nguyen int ice_init_def_sw_recp(struct ice_hw *hw); 379334cb062SAnirudh Venkataramanan u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); 380334cb062SAnirudh Venkataramanan 3815e24d598STony Nguyen int ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); 382334cb062SAnirudh Venkataramanan void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); 383d76a60baSAnirudh Venkataramanan 3845e24d598STony Nguyen int 385bd676b29SMichal Swiatkowski ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, 386bd676b29SMichal Swiatkowski u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd); 387a1ffafb0SBrett Creeley int 388a1ffafb0SBrett Creeley ice_update_recipe_lkup_idx(struct ice_hw *hw, 389a1ffafb0SBrett Creeley struct ice_update_recipe_lkup_idx_params *params); 390a1ffafb0SBrett Creeley void ice_change_proto_id_to_dvm(void); 3919c20346bSAnirudh Venkataramanan #endif /* _ICE_SWITCH_H_ */ 392