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) 13d76a60baSAnirudh Venkataramanan #define ICE_VSI_INVAL_ID 0xffff 14bb87ee0eSAnirudh Venkataramanan #define ICE_INVAL_Q_HANDLE 0xFFFF 15bb87ee0eSAnirudh Venkataramanan 169a225f81SMarcin Szycik /* Switch Profile IDs for Profile related switch rules */ 179a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPC_TEID 41 189a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPC_NO_TEID 42 199a225f81SMarcin Szycik #define ICE_PROFID_IPV4_GTPU_TEID 43 209a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPC_TEID 44 219a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPC_NO_TEID 45 229a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPU_TEID 46 239a225f81SMarcin Szycik #define ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER 70 249a225f81SMarcin Szycik 2523ccae5cSDave Ertman #define ICE_SW_RULE_VSI_LIST_SIZE(s, n) struct_size((s), vsi, (n)) 2623ccae5cSDave Ertman #define ICE_SW_RULE_RX_TX_HDR_SIZE(s, l) struct_size((s), hdr_data, (l)) 2723ccae5cSDave Ertman #define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s) \ 2823ccae5cSDave Ertman ICE_SW_RULE_RX_TX_HDR_SIZE((s), DUMMY_ETH_HDR_LEN) 2923ccae5cSDave Ertman #define ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s) \ 3023ccae5cSDave Ertman ICE_SW_RULE_RX_TX_HDR_SIZE((s), 0) 3123ccae5cSDave Ertman #define ICE_SW_RULE_LG_ACT_SIZE(s, n) struct_size((s), act, (n)) 3223ccae5cSDave Ertman 33ec5a6c5fSDave Ertman #define DUMMY_ETH_HDR_LEN 16 34ec5a6c5fSDave Ertman 353a858ba3SAnirudh Venkataramanan /* VSI context structure for add/get/update/free operations */ 363a858ba3SAnirudh Venkataramanan struct ice_vsi_ctx { 373a858ba3SAnirudh Venkataramanan u16 vsi_num; 383a858ba3SAnirudh Venkataramanan u16 vsis_allocd; 393a858ba3SAnirudh Venkataramanan u16 vsis_unallocated; 403a858ba3SAnirudh Venkataramanan u16 flags; 413a858ba3SAnirudh Venkataramanan struct ice_aqc_vsi_props info; 424fb33f31SAnirudh Venkataramanan struct ice_sched_vsi_info sched; 4343f8b224SBruce Allan u8 alloc_from_pool; 448ede0178SAnirudh Venkataramanan u8 vf_num; 45bb87ee0eSAnirudh Venkataramanan u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS]; 46bb87ee0eSAnirudh Venkataramanan struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 47348048e7SDave Ertman u16 num_rdma_q_entries[ICE_MAX_TRAFFIC_CLASS]; 48348048e7SDave Ertman struct ice_q_ctx *rdma_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 493a858ba3SAnirudh Venkataramanan }; 503a858ba3SAnirudh Venkataramanan 519daf8208SAnirudh Venkataramanan /* Switch recipe ID enum values are specific to hardware */ 529daf8208SAnirudh Venkataramanan enum ice_sw_lkup_type { 539daf8208SAnirudh Venkataramanan ICE_SW_LKUP_ETHERTYPE = 0, 549daf8208SAnirudh Venkataramanan ICE_SW_LKUP_MAC = 1, 559daf8208SAnirudh Venkataramanan ICE_SW_LKUP_MAC_VLAN = 2, 569daf8208SAnirudh Venkataramanan ICE_SW_LKUP_PROMISC = 3, 579daf8208SAnirudh Venkataramanan ICE_SW_LKUP_VLAN = 4, 589daf8208SAnirudh Venkataramanan ICE_SW_LKUP_DFLT = 5, 599daf8208SAnirudh Venkataramanan ICE_SW_LKUP_ETHERTYPE_MAC = 8, 609daf8208SAnirudh Venkataramanan ICE_SW_LKUP_PROMISC_VLAN = 9, 6180d144c9SAnirudh Venkataramanan ICE_SW_LKUP_LAST 629daf8208SAnirudh Venkataramanan }; 639daf8208SAnirudh Venkataramanan 64f9867df6SAnirudh Venkataramanan /* type of filter src ID */ 655726ca0eSAnirudh Venkataramanan enum ice_src_id { 665726ca0eSAnirudh Venkataramanan ICE_SRC_ID_UNKNOWN = 0, 675726ca0eSAnirudh Venkataramanan ICE_SRC_ID_VSI, 685726ca0eSAnirudh Venkataramanan ICE_SRC_ID_QUEUE, 695726ca0eSAnirudh Venkataramanan ICE_SRC_ID_LPORT, 705726ca0eSAnirudh Venkataramanan }; 715726ca0eSAnirudh Venkataramanan 729daf8208SAnirudh Venkataramanan struct ice_fltr_info { 739daf8208SAnirudh Venkataramanan /* Look up information: how to look up packet */ 749daf8208SAnirudh Venkataramanan enum ice_sw_lkup_type lkup_type; 759daf8208SAnirudh Venkataramanan /* Forward action: filter action to do after lookup */ 769daf8208SAnirudh Venkataramanan enum ice_sw_fwd_act_type fltr_act; 779daf8208SAnirudh Venkataramanan /* rule ID returned by firmware once filter rule is created */ 789daf8208SAnirudh Venkataramanan u16 fltr_rule_id; 799daf8208SAnirudh Venkataramanan u16 flag; 809daf8208SAnirudh Venkataramanan 819daf8208SAnirudh Venkataramanan /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 829daf8208SAnirudh Venkataramanan u16 src; 835726ca0eSAnirudh Venkataramanan enum ice_src_id src_id; 849daf8208SAnirudh Venkataramanan 859daf8208SAnirudh Venkataramanan union { 869daf8208SAnirudh Venkataramanan struct { 879daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; 889daf8208SAnirudh Venkataramanan } mac; 899daf8208SAnirudh Venkataramanan struct { 909daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; 919daf8208SAnirudh Venkataramanan u16 vlan_id; 929daf8208SAnirudh Venkataramanan } mac_vlan; 939daf8208SAnirudh Venkataramanan struct { 949daf8208SAnirudh Venkataramanan u16 vlan_id; 952bfefa2dSBrett Creeley u16 tpid; 962bfefa2dSBrett Creeley u8 tpid_valid; 979daf8208SAnirudh Venkataramanan } vlan; 989daf8208SAnirudh Venkataramanan /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE 999daf8208SAnirudh Venkataramanan * if just using ethertype as filter. Set lkup_type as 1009daf8208SAnirudh Venkataramanan * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be 1019daf8208SAnirudh Venkataramanan * passed in as filter. 1029daf8208SAnirudh Venkataramanan */ 1039daf8208SAnirudh Venkataramanan struct { 1049daf8208SAnirudh Venkataramanan u16 ethertype; 1059daf8208SAnirudh Venkataramanan u8 mac_addr[ETH_ALEN]; /* optional */ 1069daf8208SAnirudh Venkataramanan } ethertype_mac; 1075726ca0eSAnirudh Venkataramanan } l_data; /* Make sure to zero out the memory of l_data before using 1085726ca0eSAnirudh Venkataramanan * it or only set the data associated with lookup match 1095726ca0eSAnirudh Venkataramanan * rest everything should be zero 1105726ca0eSAnirudh Venkataramanan */ 1119daf8208SAnirudh Venkataramanan 1129daf8208SAnirudh Venkataramanan /* Depending on filter action */ 1139daf8208SAnirudh Venkataramanan union { 114f9867df6SAnirudh Venkataramanan /* queue ID in case of ICE_FWD_TO_Q and starting 115f9867df6SAnirudh Venkataramanan * queue ID in case of ICE_FWD_TO_QGRP. 1169daf8208SAnirudh Venkataramanan */ 1179daf8208SAnirudh Venkataramanan u16 q_id:11; 1185726ca0eSAnirudh Venkataramanan u16 hw_vsi_id:10; 1199daf8208SAnirudh Venkataramanan u16 vsi_list_id:10; 1209daf8208SAnirudh Venkataramanan } fwd_id; 1219daf8208SAnirudh Venkataramanan 1225726ca0eSAnirudh Venkataramanan /* Sw VSI handle */ 1235726ca0eSAnirudh Venkataramanan u16 vsi_handle; 1245726ca0eSAnirudh Venkataramanan 1259daf8208SAnirudh Venkataramanan /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field 1265726ca0eSAnirudh Venkataramanan * determines the range of queues the packet needs to be forwarded to. 1275726ca0eSAnirudh Venkataramanan * Note that qgrp_size must be set to a power of 2. 1289daf8208SAnirudh Venkataramanan */ 1299daf8208SAnirudh Venkataramanan u8 qgrp_size; 1309daf8208SAnirudh Venkataramanan 1319daf8208SAnirudh Venkataramanan /* Rule creations populate these indicators basing on the switch type */ 13243f8b224SBruce Allan u8 lb_en; /* Indicate if packet can be looped back */ 13343f8b224SBruce Allan u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ 1349daf8208SAnirudh Venkataramanan }; 1359daf8208SAnirudh Venkataramanan 136a1ffafb0SBrett Creeley struct ice_update_recipe_lkup_idx_params { 137a1ffafb0SBrett Creeley u16 rid; 138a1ffafb0SBrett Creeley u16 fv_idx; 139a1ffafb0SBrett Creeley bool ignore_valid; 140a1ffafb0SBrett Creeley u16 mask; 141a1ffafb0SBrett Creeley bool mask_valid; 142a1ffafb0SBrett Creeley u8 lkup_idx; 143a1ffafb0SBrett Creeley }; 144a1ffafb0SBrett Creeley 145fd2a6b71SDan Nowlin struct ice_adv_lkup_elem { 146fd2a6b71SDan Nowlin enum ice_protocol_type type; 147135a161aSAlexander Lobakin union { 148fd2a6b71SDan Nowlin union ice_prot_hdr h_u; /* Header values */ 149135a161aSAlexander Lobakin /* Used to iterate over the headers */ 150135a161aSAlexander Lobakin u16 h_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 151135a161aSAlexander Lobakin }; 152135a161aSAlexander Lobakin union { 153fd2a6b71SDan Nowlin union ice_prot_hdr m_u; /* Mask of header values to match */ 154135a161aSAlexander Lobakin /* Used to iterate over header mask */ 155135a161aSAlexander Lobakin u16 m_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 156135a161aSAlexander Lobakin }; 157fd2a6b71SDan Nowlin }; 15880d144c9SAnirudh Venkataramanan 159fd2a6b71SDan Nowlin struct ice_sw_act_ctrl { 160fd2a6b71SDan Nowlin /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 161fd2a6b71SDan Nowlin u16 src; 162fd2a6b71SDan Nowlin u16 flag; 163fd2a6b71SDan Nowlin enum ice_sw_fwd_act_type fltr_act; 164fd2a6b71SDan Nowlin /* Depending on filter action */ 165fd2a6b71SDan Nowlin union { 166fd2a6b71SDan Nowlin /* This is a queue ID in case of ICE_FWD_TO_Q and starting 167fd2a6b71SDan Nowlin * queue ID in case of ICE_FWD_TO_QGRP. 16880d144c9SAnirudh Venkataramanan */ 169fd2a6b71SDan Nowlin u16 q_id:11; 170fd2a6b71SDan Nowlin u16 vsi_id:10; 171fd2a6b71SDan Nowlin u16 hw_vsi_id:10; 172fd2a6b71SDan Nowlin u16 vsi_list_id:10; 173fd2a6b71SDan Nowlin } fwd_id; 174fd2a6b71SDan Nowlin /* software VSI handle */ 175fd2a6b71SDan Nowlin u16 vsi_handle; 176fd2a6b71SDan Nowlin u8 qgrp_size; 177fd2a6b71SDan Nowlin }; 17880d144c9SAnirudh Venkataramanan 179fd2a6b71SDan Nowlin struct ice_rule_query_data { 180fd2a6b71SDan Nowlin /* Recipe ID for which the requested rule was added */ 181fd2a6b71SDan Nowlin u16 rid; 182fd2a6b71SDan Nowlin /* Rule ID that was added or is supposed to be removed */ 183fd2a6b71SDan Nowlin u16 rule_id; 184fd2a6b71SDan Nowlin /* vsi_handle for which Rule was added or is supposed to be removed */ 185fd2a6b71SDan Nowlin u16 vsi_handle; 186fd2a6b71SDan Nowlin }; 187fd2a6b71SDan Nowlin 18873b483b7SWojciech Drewek /* This structure allows to pass info about lb_en and lan_en 18973b483b7SWojciech Drewek * flags to ice_add_adv_rule. Values in act would be used 19073b483b7SWojciech Drewek * only if act_valid was set to true, otherwise default 19173b483b7SWojciech Drewek * values would be used. 19273b483b7SWojciech Drewek */ 19373b483b7SWojciech Drewek struct ice_adv_rule_flags_info { 19473b483b7SWojciech Drewek u32 act; 19573b483b7SWojciech Drewek u8 act_valid; /* indicate if flags in act are valid */ 19673b483b7SWojciech Drewek }; 19773b483b7SWojciech Drewek 198fd2a6b71SDan Nowlin struct ice_adv_rule_info { 19903592a14SMichal Swiatkowski /* Store metadata values in rule info */ 2009e300987SMichal Swiatkowski enum ice_sw_tunnel_type tun_type; 201ea71b967SMartyna Szapar-Mudlaw u16 vlan_type; 20240fd7492SMichal Swiatkowski u16 fltr_rule_id; 20340fd7492SMichal Swiatkowski u32 priority; 204bccd9bceSMarcin Szycik u16 need_pass_l2:1; 205bccd9bceSMarcin Szycik u16 allow_pass_l2:1; 20603592a14SMichal Swiatkowski u16 src_vsi; 20740fd7492SMichal Swiatkowski struct ice_sw_act_ctrl sw_act; 20873b483b7SWojciech Drewek struct ice_adv_rule_flags_info flags_info; 209fd2a6b71SDan Nowlin }; 210fd2a6b71SDan Nowlin 211fd2a6b71SDan Nowlin /* A collection of one or more four word recipe */ 212fd2a6b71SDan Nowlin struct ice_sw_recipe { 213fd2a6b71SDan Nowlin /* For a chained recipe the root recipe is what should be used for 214fd2a6b71SDan Nowlin * programming rules 215fd2a6b71SDan Nowlin */ 216fd2a6b71SDan Nowlin u8 is_root; 217fd2a6b71SDan Nowlin u8 root_rid; 218fd2a6b71SDan Nowlin u8 recp_created; 219fd2a6b71SDan Nowlin 220fd2a6b71SDan Nowlin /* Number of extraction words */ 221fd2a6b71SDan Nowlin u8 n_ext_words; 222fd2a6b71SDan Nowlin /* Protocol ID and Offset pair (extraction word) to describe the 223fd2a6b71SDan Nowlin * recipe 224fd2a6b71SDan Nowlin */ 225fd2a6b71SDan Nowlin struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS]; 226fd2a6b71SDan Nowlin u16 word_masks[ICE_MAX_CHAIN_WORDS]; 227fd2a6b71SDan Nowlin 228fd2a6b71SDan Nowlin /* if this recipe is a collection of other recipe */ 229fd2a6b71SDan Nowlin u8 big_recp; 230fd2a6b71SDan Nowlin 231fd2a6b71SDan Nowlin /* if this recipe is part of another bigger recipe then chain index 232fd2a6b71SDan Nowlin * corresponding to this recipe 233fd2a6b71SDan Nowlin */ 234fd2a6b71SDan Nowlin u8 chain_idx; 235fd2a6b71SDan Nowlin 236fd2a6b71SDan Nowlin /* if this recipe is a collection of other recipe then count of other 237fd2a6b71SDan Nowlin * recipes and recipe IDs of those recipes 238fd2a6b71SDan Nowlin */ 239fd2a6b71SDan Nowlin u8 n_grp_count; 240fd2a6b71SDan Nowlin 241fd2a6b71SDan Nowlin /* Bit map specifying the IDs associated with this group of recipe */ 242fd2a6b71SDan Nowlin DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); 243fd2a6b71SDan Nowlin 2448b032a55SMichal Swiatkowski enum ice_sw_tunnel_type tun_type; 2458b032a55SMichal Swiatkowski 246fd2a6b71SDan Nowlin /* List of type ice_fltr_mgmt_list_entry or adv_rule */ 247fd2a6b71SDan Nowlin u8 adv_rule; 24880d144c9SAnirudh Venkataramanan struct list_head filt_rules; 249334cb062SAnirudh Venkataramanan struct list_head filt_replay_rules; 25080d144c9SAnirudh Venkataramanan 251fd2a6b71SDan Nowlin struct mutex filt_rule_lock; /* protect filter rule structure */ 25280d144c9SAnirudh Venkataramanan 253fd2a6b71SDan Nowlin /* Profiles this recipe should be associated with */ 254fd2a6b71SDan Nowlin struct list_head fv_list; 255fd2a6b71SDan Nowlin 256fd2a6b71SDan Nowlin /* Profiles this recipe is associated with */ 257fd2a6b71SDan Nowlin u8 num_profs, *prof_ids; 258fd2a6b71SDan Nowlin 259fd2a6b71SDan Nowlin /* Bit map for possible result indexes */ 260fd2a6b71SDan Nowlin DECLARE_BITMAP(res_idxs, ICE_MAX_FV_WORDS); 261fd2a6b71SDan Nowlin 262fd2a6b71SDan Nowlin /* This allows user to specify the recipe priority. 263fd2a6b71SDan Nowlin * For now, this becomes 'fwd_priority' when recipe 264fd2a6b71SDan Nowlin * is created, usually recipes can have 'fwd' and 'join' 265fd2a6b71SDan Nowlin * priority. 266fd2a6b71SDan Nowlin */ 267fd2a6b71SDan Nowlin u8 priority; 268fd2a6b71SDan Nowlin 269bccd9bceSMarcin Szycik u8 need_pass_l2:1; 270bccd9bceSMarcin Szycik u8 allow_pass_l2:1; 271bccd9bceSMarcin Szycik 272fd2a6b71SDan Nowlin struct list_head rg_list; 273fd2a6b71SDan Nowlin 274fd2a6b71SDan Nowlin /* AQ buffer associated with this recipe */ 275fd2a6b71SDan Nowlin struct ice_aqc_recipe_data_elem *root_buf; 276fd2a6b71SDan Nowlin /* This struct saves the fv_words for a given lookup */ 277fd2a6b71SDan Nowlin struct ice_prot_lkup_ext lkup_exts; 27880d144c9SAnirudh Venkataramanan }; 27980d144c9SAnirudh Venkataramanan 280f9867df6SAnirudh Venkataramanan /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ 2819daf8208SAnirudh Venkataramanan struct ice_vsi_list_map_info { 2829daf8208SAnirudh Venkataramanan struct list_head list_entry; 2839daf8208SAnirudh Venkataramanan DECLARE_BITMAP(vsi_map, ICE_MAX_VSI); 2849daf8208SAnirudh Venkataramanan u16 vsi_list_id; 2855726ca0eSAnirudh Venkataramanan /* counter to track how many rules are reusing this VSI list */ 2865726ca0eSAnirudh Venkataramanan u16 ref_cnt; 2879daf8208SAnirudh Venkataramanan }; 2889daf8208SAnirudh Venkataramanan 2899daf8208SAnirudh Venkataramanan struct ice_fltr_list_entry { 2909daf8208SAnirudh Venkataramanan struct list_head list_entry; 2915e24d598STony Nguyen int status; 2929daf8208SAnirudh Venkataramanan struct ice_fltr_info fltr_info; 2939daf8208SAnirudh Venkataramanan }; 2949daf8208SAnirudh Venkataramanan 2959daf8208SAnirudh Venkataramanan /* This defines an entry in the list that maintains MAC or VLAN membership 2969daf8208SAnirudh Venkataramanan * to HW list mapping, since multiple VSIs can subscribe to the same MAC or 2979daf8208SAnirudh Venkataramanan * VLAN. As an optimization the VSI list should be created only when a 298f31028bfSBrett Creeley * second VSI becomes a subscriber to the same MAC address. VSI lists are always 299f31028bfSBrett Creeley * used for VLAN membership. 3009daf8208SAnirudh Venkataramanan */ 3019daf8208SAnirudh Venkataramanan struct ice_fltr_mgmt_list_entry { 302f9867df6SAnirudh Venkataramanan /* back pointer to VSI list ID to VSI list mapping */ 3039daf8208SAnirudh Venkataramanan struct ice_vsi_list_map_info *vsi_list_info; 3049daf8208SAnirudh Venkataramanan u16 vsi_count; 3059daf8208SAnirudh Venkataramanan #define ICE_INVAL_LG_ACT_INDEX 0xffff 3069daf8208SAnirudh Venkataramanan u16 lg_act_idx; 3079daf8208SAnirudh Venkataramanan #define ICE_INVAL_SW_MARKER_ID 0xffff 3089daf8208SAnirudh Venkataramanan u16 sw_marker_id; 3099daf8208SAnirudh Venkataramanan struct list_head list_entry; 3109daf8208SAnirudh Venkataramanan struct ice_fltr_info fltr_info; 3119daf8208SAnirudh Venkataramanan #define ICE_INVAL_COUNTER_ID 0xff 3129daf8208SAnirudh Venkataramanan u8 counter_index; 3139daf8208SAnirudh Venkataramanan }; 3149daf8208SAnirudh Venkataramanan 3150f94570dSGrishma Kotecha struct ice_adv_fltr_mgmt_list_entry { 3160f94570dSGrishma Kotecha struct list_head list_entry; 3170f94570dSGrishma Kotecha 3180f94570dSGrishma Kotecha struct ice_adv_lkup_elem *lkups; 3190f94570dSGrishma Kotecha struct ice_adv_rule_info rule_info; 3200f94570dSGrishma Kotecha u16 lkups_cnt; 3210f94570dSGrishma Kotecha struct ice_vsi_list_map_info *vsi_list_info; 3220f94570dSGrishma Kotecha u16 vsi_count; 3230f94570dSGrishma Kotecha }; 3240f94570dSGrishma Kotecha 3255eda8afdSAkeem G Abodunrin enum ice_promisc_flags { 3265eda8afdSAkeem G Abodunrin ICE_PROMISC_UCAST_RX = 0x1, 3275eda8afdSAkeem G Abodunrin ICE_PROMISC_UCAST_TX = 0x2, 3285eda8afdSAkeem G Abodunrin ICE_PROMISC_MCAST_RX = 0x4, 3295eda8afdSAkeem G Abodunrin ICE_PROMISC_MCAST_TX = 0x8, 3305eda8afdSAkeem G Abodunrin ICE_PROMISC_BCAST_RX = 0x10, 3315eda8afdSAkeem G Abodunrin ICE_PROMISC_BCAST_TX = 0x20, 3325eda8afdSAkeem G Abodunrin ICE_PROMISC_VLAN_RX = 0x40, 3335eda8afdSAkeem G Abodunrin ICE_PROMISC_VLAN_TX = 0x80, 3345eda8afdSAkeem G Abodunrin }; 3355eda8afdSAkeem G Abodunrin 3363a858ba3SAnirudh Venkataramanan /* VSI related commands */ 3375e24d598STony Nguyen int 3380f9d5027SAnirudh Venkataramanan ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3390f9d5027SAnirudh Venkataramanan struct ice_sq_cd *cd); 3405e24d598STony Nguyen int 3410f9d5027SAnirudh Venkataramanan ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3423a858ba3SAnirudh Venkataramanan bool keep_vsi_alloc, struct ice_sq_cd *cd); 3435e24d598STony Nguyen int 3445726ca0eSAnirudh Venkataramanan ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 3455726ca0eSAnirudh Venkataramanan struct ice_sq_cd *cd); 3464fb33f31SAnirudh Venkataramanan bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 3474fb33f31SAnirudh Venkataramanan struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 34833e055fcSVictor Raj void ice_clear_all_vsi_ctx(struct ice_hw *hw); 34933e055fcSVictor Raj /* Switch config */ 3505e24d598STony Nguyen int ice_get_initial_sw_cfg(struct ice_hw *hw); 3519c20346bSAnirudh Venkataramanan 3525e24d598STony Nguyen int 353148beb61SHenry Tieman ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 354148beb61SHenry Tieman u16 *counter_id); 3555e24d598STony Nguyen int 356148beb61SHenry Tieman ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 357148beb61SHenry Tieman u16 counter_id); 35823ccae5cSDave Ertman int ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id); 359148beb61SHenry Tieman 3609daf8208SAnirudh Venkataramanan /* Switch/bridge related commands */ 36103592a14SMichal Swiatkowski void ice_rule_add_tunnel_metadata(struct ice_adv_lkup_elem *lkup); 3620960a27bSMarcin Szycik void ice_rule_add_direction_metadata(struct ice_adv_lkup_elem *lkup); 36303592a14SMichal Swiatkowski void ice_rule_add_vlan_metadata(struct ice_adv_lkup_elem *lkup); 3640ef4479dSMichal Swiatkowski void ice_rule_add_src_vsi_metadata(struct ice_adv_lkup_elem *lkup); 3655e24d598STony Nguyen int 3660f94570dSGrishma Kotecha ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, 3670f94570dSGrishma Kotecha u16 lkups_cnt, struct ice_adv_rule_info *rinfo, 3680f94570dSGrishma Kotecha struct ice_rule_query_data *added_entry); 3695e24d598STony Nguyen int ice_update_sw_rule_bridge_mode(struct ice_hw *hw); 3705518ac2aSTony Nguyen int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); 3715518ac2aSTony Nguyen int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); 3725e24d598STony Nguyen int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); 3735e24d598STony Nguyen int ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); 3749fea7498SKiran Patil bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle); 3755518ac2aSTony Nguyen int ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list); 3765518ac2aSTony Nguyen int ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list); 3775518ac2aSTony Nguyen int ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable); 3785726ca0eSAnirudh Venkataramanan void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); 3795eda8afdSAkeem G Abodunrin 3805eda8afdSAkeem G Abodunrin /* Promisc/defport setup for VSIs */ 381d7393425SMichal Wilczynski int 382d7393425SMichal Wilczynski ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, 383d7393425SMichal Wilczynski u8 direction); 384d7393425SMichal Wilczynski bool 385d7393425SMichal Wilczynski ice_check_if_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, 386d7393425SMichal Wilczynski bool *rule_exists); 387d7393425SMichal Wilczynski 3885e24d598STony Nguyen int 3895eda8afdSAkeem G Abodunrin ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3905eda8afdSAkeem G Abodunrin u16 vid); 3915e24d598STony Nguyen int 3925eda8afdSAkeem G Abodunrin ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3935eda8afdSAkeem G Abodunrin u16 vid); 3945e24d598STony Nguyen int 3955eda8afdSAkeem G Abodunrin ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 3965eda8afdSAkeem G Abodunrin bool rm_vlan_promisc); 3970f9d5027SAnirudh Venkataramanan 3985e24d598STony Nguyen int 3998bb98f33SShivanshu Shukla ice_rem_adv_rule_by_id(struct ice_hw *hw, 4008bb98f33SShivanshu Shukla struct ice_rule_query_data *remove_entry); 4018bb98f33SShivanshu Shukla 4025e24d598STony Nguyen int ice_init_def_sw_recp(struct ice_hw *hw); 403334cb062SAnirudh Venkataramanan u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); 404334cb062SAnirudh Venkataramanan 4055e24d598STony Nguyen int ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); 406334cb062SAnirudh Venkataramanan void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); 407ec5a6c5fSDave Ertman void ice_fill_eth_hdr(u8 *eth_hdr); 408d76a60baSAnirudh Venkataramanan 4095e24d598STony Nguyen int 410bd676b29SMichal Swiatkowski ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, 411bd676b29SMichal Swiatkowski u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd); 412a1ffafb0SBrett Creeley int 413a1ffafb0SBrett Creeley ice_update_recipe_lkup_idx(struct ice_hw *hw, 414a1ffafb0SBrett Creeley struct ice_update_recipe_lkup_idx_params *params); 415a1ffafb0SBrett Creeley void ice_change_proto_id_to_dvm(void); 41623ccae5cSDave Ertman struct ice_vsi_list_map_info * 41723ccae5cSDave Ertman ice_find_vsi_list_entry(struct ice_hw *hw, u8 recp_id, u16 vsi_handle, 41823ccae5cSDave Ertman u16 *vsi_list_id); 41923ccae5cSDave Ertman int ice_alloc_recipe(struct ice_hw *hw, u16 *rid); 42023ccae5cSDave Ertman int ice_aq_get_recipe(struct ice_hw *hw, 42123ccae5cSDave Ertman struct ice_aqc_recipe_data_elem *s_recipe_list, 42223ccae5cSDave Ertman u16 *num_recipes, u16 recipe_root, struct ice_sq_cd *cd); 42323ccae5cSDave Ertman int ice_aq_add_recipe(struct ice_hw *hw, 42423ccae5cSDave Ertman struct ice_aqc_recipe_data_elem *s_recipe_list, 42523ccae5cSDave Ertman u16 num_recipes, struct ice_sq_cd *cd); 42623ccae5cSDave Ertman int 427*493b2993SSteven Zou ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 *r_assoc, 42823ccae5cSDave Ertman struct ice_sq_cd *cd); 42923ccae5cSDave Ertman int 430*493b2993SSteven Zou ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 r_assoc, 43123ccae5cSDave Ertman struct ice_sq_cd *cd); 43223ccae5cSDave Ertman 4339c20346bSAnirudh Venkataramanan #endif /* _ICE_SWITCH_H_ */ 434