xref: /freebsd/sys/dev/ice/ice_switch.h (revision 71d104536b513298902be65342afe6f3792f29e4)
1*71d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */
2*71d10453SEric Joyner /*  Copyright (c) 2020, Intel Corporation
3*71d10453SEric Joyner  *  All rights reserved.
4*71d10453SEric Joyner  *
5*71d10453SEric Joyner  *  Redistribution and use in source and binary forms, with or without
6*71d10453SEric Joyner  *  modification, are permitted provided that the following conditions are met:
7*71d10453SEric Joyner  *
8*71d10453SEric Joyner  *   1. Redistributions of source code must retain the above copyright notice,
9*71d10453SEric Joyner  *      this list of conditions and the following disclaimer.
10*71d10453SEric Joyner  *
11*71d10453SEric Joyner  *   2. Redistributions in binary form must reproduce the above copyright
12*71d10453SEric Joyner  *      notice, this list of conditions and the following disclaimer in the
13*71d10453SEric Joyner  *      documentation and/or other materials provided with the distribution.
14*71d10453SEric Joyner  *
15*71d10453SEric Joyner  *   3. Neither the name of the Intel Corporation nor the names of its
16*71d10453SEric Joyner  *      contributors may be used to endorse or promote products derived from
17*71d10453SEric Joyner  *      this software without specific prior written permission.
18*71d10453SEric Joyner  *
19*71d10453SEric Joyner  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20*71d10453SEric Joyner  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*71d10453SEric Joyner  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*71d10453SEric Joyner  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23*71d10453SEric Joyner  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*71d10453SEric Joyner  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*71d10453SEric Joyner  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*71d10453SEric Joyner  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*71d10453SEric Joyner  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*71d10453SEric Joyner  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*71d10453SEric Joyner  *  POSSIBILITY OF SUCH DAMAGE.
30*71d10453SEric Joyner  */
31*71d10453SEric Joyner /*$FreeBSD$*/
32*71d10453SEric Joyner 
33*71d10453SEric Joyner #ifndef _ICE_SWITCH_H_
34*71d10453SEric Joyner #define _ICE_SWITCH_H_
35*71d10453SEric Joyner 
36*71d10453SEric Joyner #include "ice_common.h"
37*71d10453SEric Joyner #include "ice_protocol_type.h"
38*71d10453SEric Joyner 
39*71d10453SEric Joyner #define ICE_SW_CFG_MAX_BUF_LEN 2048
40*71d10453SEric Joyner #define ICE_MAX_SW 256
41*71d10453SEric Joyner #define ICE_DFLT_VSI_INVAL 0xff
42*71d10453SEric Joyner #define ICE_FLTR_RX BIT(0)
43*71d10453SEric Joyner #define ICE_FLTR_TX BIT(1)
44*71d10453SEric Joyner #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
45*71d10453SEric Joyner 
46*71d10453SEric Joyner /* Worst case buffer length for ice_aqc_opc_get_res_alloc */
47*71d10453SEric Joyner #define ICE_MAX_RES_TYPES 0x80
48*71d10453SEric Joyner #define ICE_AQ_GET_RES_ALLOC_BUF_LEN \
49*71d10453SEric Joyner 	(ICE_MAX_RES_TYPES * sizeof(struct ice_aqc_get_res_resp_elem))
50*71d10453SEric Joyner 
51*71d10453SEric Joyner #define ICE_VSI_INVAL_ID 0xFFFF
52*71d10453SEric Joyner #define ICE_INVAL_Q_HANDLE 0xFFFF
53*71d10453SEric Joyner 
54*71d10453SEric Joyner /* VSI context structure for add/get/update/free operations */
55*71d10453SEric Joyner struct ice_vsi_ctx {
56*71d10453SEric Joyner 	u16 vsi_num;
57*71d10453SEric Joyner 	u16 vsis_allocd;
58*71d10453SEric Joyner 	u16 vsis_unallocated;
59*71d10453SEric Joyner 	u16 flags;
60*71d10453SEric Joyner 	struct ice_aqc_vsi_props info;
61*71d10453SEric Joyner 	struct ice_sched_vsi_info sched;
62*71d10453SEric Joyner 	u8 alloc_from_pool;
63*71d10453SEric Joyner 	u8 vf_num;
64*71d10453SEric Joyner 	u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS];
65*71d10453SEric Joyner 	struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS];
66*71d10453SEric Joyner };
67*71d10453SEric Joyner 
68*71d10453SEric Joyner /* This is to be used by add/update mirror rule Admin Queue command */
69*71d10453SEric Joyner struct ice_mir_rule_buf {
70*71d10453SEric Joyner 	u16 vsi_idx; /* VSI index */
71*71d10453SEric Joyner 
72*71d10453SEric Joyner 	/* For each VSI, user can specify whether corresponding VSI
73*71d10453SEric Joyner 	 * should be added/removed to/from mirror rule
74*71d10453SEric Joyner 	 *
75*71d10453SEric Joyner 	 * add mirror rule: this should always be TRUE.
76*71d10453SEric Joyner 	 * update mirror rule:  add(true) or remove(false) VSI to/from
77*71d10453SEric Joyner 	 * mirror rule
78*71d10453SEric Joyner 	 */
79*71d10453SEric Joyner 	u8 add;
80*71d10453SEric Joyner };
81*71d10453SEric Joyner 
82*71d10453SEric Joyner /* Switch recipe ID enum values are specific to hardware */
83*71d10453SEric Joyner enum ice_sw_lkup_type {
84*71d10453SEric Joyner 	ICE_SW_LKUP_ETHERTYPE = 0,
85*71d10453SEric Joyner 	ICE_SW_LKUP_MAC = 1,
86*71d10453SEric Joyner 	ICE_SW_LKUP_MAC_VLAN = 2,
87*71d10453SEric Joyner 	ICE_SW_LKUP_PROMISC = 3,
88*71d10453SEric Joyner 	ICE_SW_LKUP_VLAN = 4,
89*71d10453SEric Joyner 	ICE_SW_LKUP_DFLT = 5,
90*71d10453SEric Joyner 	ICE_SW_LKUP_ETHERTYPE_MAC = 8,
91*71d10453SEric Joyner 	ICE_SW_LKUP_PROMISC_VLAN = 9,
92*71d10453SEric Joyner 	ICE_SW_LKUP_LAST
93*71d10453SEric Joyner };
94*71d10453SEric Joyner 
95*71d10453SEric Joyner /* type of filter src ID */
96*71d10453SEric Joyner enum ice_src_id {
97*71d10453SEric Joyner 	ICE_SRC_ID_UNKNOWN = 0,
98*71d10453SEric Joyner 	ICE_SRC_ID_VSI,
99*71d10453SEric Joyner 	ICE_SRC_ID_QUEUE,
100*71d10453SEric Joyner 	ICE_SRC_ID_LPORT,
101*71d10453SEric Joyner };
102*71d10453SEric Joyner 
103*71d10453SEric Joyner struct ice_fltr_info {
104*71d10453SEric Joyner 	/* Look up information: how to look up packet */
105*71d10453SEric Joyner 	enum ice_sw_lkup_type lkup_type;
106*71d10453SEric Joyner 	/* Forward action: filter action to do after lookup */
107*71d10453SEric Joyner 	enum ice_sw_fwd_act_type fltr_act;
108*71d10453SEric Joyner 	/* rule ID returned by firmware once filter rule is created */
109*71d10453SEric Joyner 	u16 fltr_rule_id;
110*71d10453SEric Joyner 	u16 flag;
111*71d10453SEric Joyner 
112*71d10453SEric Joyner 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
113*71d10453SEric Joyner 	u16 src;
114*71d10453SEric Joyner 	enum ice_src_id src_id;
115*71d10453SEric Joyner 
116*71d10453SEric Joyner 	union {
117*71d10453SEric Joyner 		struct {
118*71d10453SEric Joyner 			u8 mac_addr[ETH_ALEN];
119*71d10453SEric Joyner 		} mac;
120*71d10453SEric Joyner 		struct {
121*71d10453SEric Joyner 			u8 mac_addr[ETH_ALEN];
122*71d10453SEric Joyner 			u16 vlan_id;
123*71d10453SEric Joyner 		} mac_vlan;
124*71d10453SEric Joyner 		struct {
125*71d10453SEric Joyner 			u16 vlan_id;
126*71d10453SEric Joyner 		} vlan;
127*71d10453SEric Joyner 		/* Set lkup_type as ICE_SW_LKUP_ETHERTYPE
128*71d10453SEric Joyner 		 * if just using ethertype as filter. Set lkup_type as
129*71d10453SEric Joyner 		 * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be
130*71d10453SEric Joyner 		 * passed in as filter.
131*71d10453SEric Joyner 		 */
132*71d10453SEric Joyner 		struct {
133*71d10453SEric Joyner 			u16 ethertype;
134*71d10453SEric Joyner 			u8 mac_addr[ETH_ALEN]; /* optional */
135*71d10453SEric Joyner 		} ethertype_mac;
136*71d10453SEric Joyner 	} l_data; /* Make sure to zero out the memory of l_data before using
137*71d10453SEric Joyner 		   * it or only set the data associated with lookup match
138*71d10453SEric Joyner 		   * rest everything should be zero
139*71d10453SEric Joyner 		   */
140*71d10453SEric Joyner 
141*71d10453SEric Joyner 	/* Depending on filter action */
142*71d10453SEric Joyner 	union {
143*71d10453SEric Joyner 		/* queue ID in case of ICE_FWD_TO_Q and starting
144*71d10453SEric Joyner 		 * queue ID in case of ICE_FWD_TO_QGRP.
145*71d10453SEric Joyner 		 */
146*71d10453SEric Joyner 		u16 q_id:11;
147*71d10453SEric Joyner 		u16 hw_vsi_id:10;
148*71d10453SEric Joyner 		u16 vsi_id:10;
149*71d10453SEric Joyner 		u16 vsi_list_id:10;
150*71d10453SEric Joyner 	} fwd_id;
151*71d10453SEric Joyner 
152*71d10453SEric Joyner 	/* Sw VSI handle */
153*71d10453SEric Joyner 	u16 vsi_handle;
154*71d10453SEric Joyner 
155*71d10453SEric Joyner 	/* Set to num_queues if action is ICE_FWD_TO_QGRP. This field
156*71d10453SEric Joyner 	 * determines the range of queues the packet needs to be forwarded to.
157*71d10453SEric Joyner 	 * Note that qgrp_size must be set to a power of 2.
158*71d10453SEric Joyner 	 */
159*71d10453SEric Joyner 	u8 qgrp_size;
160*71d10453SEric Joyner 
161*71d10453SEric Joyner 	/* Rule creations populate these indicators basing on the switch type */
162*71d10453SEric Joyner 	u8 lb_en;	/* Indicate if packet can be looped back */
163*71d10453SEric Joyner 	u8 lan_en;	/* Indicate if packet can be forwarded to the uplink */
164*71d10453SEric Joyner };
165*71d10453SEric Joyner 
166*71d10453SEric Joyner struct ice_adv_lkup_elem {
167*71d10453SEric Joyner 	enum ice_protocol_type type;
168*71d10453SEric Joyner 	union ice_prot_hdr h_u;	/* Header values */
169*71d10453SEric Joyner 	union ice_prot_hdr m_u;	/* Mask of header values to match */
170*71d10453SEric Joyner };
171*71d10453SEric Joyner 
172*71d10453SEric Joyner struct ice_sw_act_ctrl {
173*71d10453SEric Joyner 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
174*71d10453SEric Joyner 	u16 src;
175*71d10453SEric Joyner 	u16 flag;
176*71d10453SEric Joyner 	enum ice_sw_fwd_act_type fltr_act;
177*71d10453SEric Joyner 	/* Depending on filter action */
178*71d10453SEric Joyner 	union {
179*71d10453SEric Joyner 		/* This is a queue ID in case of ICE_FWD_TO_Q and starting
180*71d10453SEric Joyner 		 * queue ID in case of ICE_FWD_TO_QGRP.
181*71d10453SEric Joyner 		 */
182*71d10453SEric Joyner 		u16 q_id:11;
183*71d10453SEric Joyner 		u16 vsi_id:10;
184*71d10453SEric Joyner 		u16 hw_vsi_id:10;
185*71d10453SEric Joyner 		u16 vsi_list_id:10;
186*71d10453SEric Joyner 	} fwd_id;
187*71d10453SEric Joyner 	/* software VSI handle */
188*71d10453SEric Joyner 	u16 vsi_handle;
189*71d10453SEric Joyner 	u8 qgrp_size;
190*71d10453SEric Joyner };
191*71d10453SEric Joyner 
192*71d10453SEric Joyner struct ice_rule_query_data {
193*71d10453SEric Joyner 	/* Recipe ID for which the requested rule was added */
194*71d10453SEric Joyner 	u16 rid;
195*71d10453SEric Joyner 	/* Rule ID that was added or is supposed to be removed */
196*71d10453SEric Joyner 	u16 rule_id;
197*71d10453SEric Joyner 	/* vsi_handle for which Rule was added or is supposed to be removed */
198*71d10453SEric Joyner 	u16 vsi_handle;
199*71d10453SEric Joyner };
200*71d10453SEric Joyner 
201*71d10453SEric Joyner struct ice_adv_rule_info {
202*71d10453SEric Joyner 	enum ice_sw_tunnel_type tun_type;
203*71d10453SEric Joyner 	struct ice_sw_act_ctrl sw_act;
204*71d10453SEric Joyner 	u32 priority;
205*71d10453SEric Joyner 	u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */
206*71d10453SEric Joyner 	u16 fltr_rule_id;
207*71d10453SEric Joyner };
208*71d10453SEric Joyner 
209*71d10453SEric Joyner /* A collection of one or more four word recipe */
210*71d10453SEric Joyner struct ice_sw_recipe {
211*71d10453SEric Joyner 	/* For a chained recipe the root recipe is what should be used for
212*71d10453SEric Joyner 	 * programming rules
213*71d10453SEric Joyner 	 */
214*71d10453SEric Joyner 	u8 is_root;
215*71d10453SEric Joyner 	u8 root_rid;
216*71d10453SEric Joyner 	u8 recp_created;
217*71d10453SEric Joyner 
218*71d10453SEric Joyner 	/* Number of extraction words */
219*71d10453SEric Joyner 	u8 n_ext_words;
220*71d10453SEric Joyner 	/* Protocol ID and Offset pair (extraction word) to describe the
221*71d10453SEric Joyner 	 * recipe
222*71d10453SEric Joyner 	 */
223*71d10453SEric Joyner 	struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS];
224*71d10453SEric Joyner 	u16 word_masks[ICE_MAX_CHAIN_WORDS];
225*71d10453SEric Joyner 
226*71d10453SEric Joyner 	/* if this recipe is a collection of other recipe */
227*71d10453SEric Joyner 	u8 big_recp;
228*71d10453SEric Joyner 
229*71d10453SEric Joyner 	/* if this recipe is part of another bigger recipe then chain index
230*71d10453SEric Joyner 	 * corresponding to this recipe
231*71d10453SEric Joyner 	 */
232*71d10453SEric Joyner 	u8 chain_idx;
233*71d10453SEric Joyner 
234*71d10453SEric Joyner 	/* if this recipe is a collection of other recipe then count of other
235*71d10453SEric Joyner 	 * recipes and recipe IDs of those recipes
236*71d10453SEric Joyner 	 */
237*71d10453SEric Joyner 	u8 n_grp_count;
238*71d10453SEric Joyner 
239*71d10453SEric Joyner 	/* Bit map specifying the IDs associated with this group of recipe */
240*71d10453SEric Joyner 	ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
241*71d10453SEric Joyner 
242*71d10453SEric Joyner 	enum ice_sw_tunnel_type tun_type;
243*71d10453SEric Joyner 
244*71d10453SEric Joyner 	/* List of type ice_fltr_mgmt_list_entry or adv_rule */
245*71d10453SEric Joyner 	u8 adv_rule;
246*71d10453SEric Joyner 	struct LIST_HEAD_TYPE filt_rules;
247*71d10453SEric Joyner 	struct LIST_HEAD_TYPE filt_replay_rules;
248*71d10453SEric Joyner 
249*71d10453SEric Joyner 	struct ice_lock filt_rule_lock;	/* protect filter rule structure */
250*71d10453SEric Joyner 
251*71d10453SEric Joyner 	/* Profiles this recipe should be associated with */
252*71d10453SEric Joyner 	struct LIST_HEAD_TYPE fv_list;
253*71d10453SEric Joyner 
254*71d10453SEric Joyner 	/* Profiles this recipe is associated with */
255*71d10453SEric Joyner 	u8 num_profs, *prof_ids;
256*71d10453SEric Joyner 
257*71d10453SEric Joyner 	/* Possible result indexes are 44, 45, 46 and 47 */
258*71d10453SEric Joyner #define ICE_POSSIBLE_RES_IDX 0x0000F00000000000ULL
259*71d10453SEric Joyner 	ice_declare_bitmap(res_idxs, ICE_MAX_FV_WORDS);
260*71d10453SEric Joyner 
261*71d10453SEric Joyner 	/* This allows user to specify the recipe priority.
262*71d10453SEric Joyner 	 * For now, this becomes 'fwd_priority' when recipe
263*71d10453SEric Joyner 	 * is created, usually recipes can have 'fwd' and 'join'
264*71d10453SEric Joyner 	 * priority.
265*71d10453SEric Joyner 	 */
266*71d10453SEric Joyner 	u8 priority;
267*71d10453SEric Joyner 
268*71d10453SEric Joyner 	struct LIST_HEAD_TYPE rg_list;
269*71d10453SEric Joyner 
270*71d10453SEric Joyner 	/* AQ buffer associated with this recipe */
271*71d10453SEric Joyner 	struct ice_aqc_recipe_data_elem *root_buf;
272*71d10453SEric Joyner 	/* This struct saves the fv_words for a given lookup */
273*71d10453SEric Joyner 	struct ice_prot_lkup_ext lkup_exts;
274*71d10453SEric Joyner };
275*71d10453SEric Joyner 
276*71d10453SEric Joyner /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */
277*71d10453SEric Joyner struct ice_vsi_list_map_info {
278*71d10453SEric Joyner 	struct LIST_ENTRY_TYPE list_entry;
279*71d10453SEric Joyner 	ice_declare_bitmap(vsi_map, ICE_MAX_VSI);
280*71d10453SEric Joyner 	u16 vsi_list_id;
281*71d10453SEric Joyner 	/* counter to track how many rules are reusing this VSI list */
282*71d10453SEric Joyner 	u16 ref_cnt;
283*71d10453SEric Joyner };
284*71d10453SEric Joyner 
285*71d10453SEric Joyner struct ice_fltr_list_entry {
286*71d10453SEric Joyner 	struct LIST_ENTRY_TYPE list_entry;
287*71d10453SEric Joyner 	enum ice_status status;
288*71d10453SEric Joyner 	struct ice_fltr_info fltr_info;
289*71d10453SEric Joyner };
290*71d10453SEric Joyner 
291*71d10453SEric Joyner /**
292*71d10453SEric Joyner  * enum ice_fltr_marker - Marker for syncing OS and driver filter lists
293*71d10453SEric Joyner  * @ICE_FLTR_NOT_FOUND: initial state, indicates filter has not been found
294*71d10453SEric Joyner  * @ICE_FLTR_FOUND: set when a filter has been found in both lists
295*71d10453SEric Joyner  *
296*71d10453SEric Joyner  * This enumeration is used to help sync an operating system provided filter
297*71d10453SEric Joyner  * list with the filters previously added.
298*71d10453SEric Joyner  *
299*71d10453SEric Joyner  * This is required for FreeBSD because the operating system does not provide
300*71d10453SEric Joyner  * individual indications of whether a filter has been added or deleted, but
301*71d10453SEric Joyner  * instead just notifies the driver with the entire new list.
302*71d10453SEric Joyner  *
303*71d10453SEric Joyner  * To use this marker state, the driver shall initially reset all filters to
304*71d10453SEric Joyner  * the ICE_FLTR_NOT_FOUND state. Then, for each filter in the OS list, it
305*71d10453SEric Joyner  * shall search the driver list for the filter. If found, the filter state
306*71d10453SEric Joyner  * will be set to ICE_FLTR_FOUND. If not found, that filter will be added.
307*71d10453SEric Joyner  * Finally, the driver shall search the internal filter list for all filters
308*71d10453SEric Joyner  * still marked as ICE_FLTR_NOT_FOUND and remove them.
309*71d10453SEric Joyner  */
310*71d10453SEric Joyner enum ice_fltr_marker {
311*71d10453SEric Joyner 	ICE_FLTR_NOT_FOUND,
312*71d10453SEric Joyner 	ICE_FLTR_FOUND,
313*71d10453SEric Joyner };
314*71d10453SEric Joyner 
315*71d10453SEric Joyner /* This defines an entry in the list that maintains MAC or VLAN membership
316*71d10453SEric Joyner  * to HW list mapping, since multiple VSIs can subscribe to the same MAC or
317*71d10453SEric Joyner  * VLAN. As an optimization the VSI list should be created only when a
318*71d10453SEric Joyner  * second VSI becomes a subscriber to the same MAC address. VSI lists are always
319*71d10453SEric Joyner  * used for VLAN membership.
320*71d10453SEric Joyner  */
321*71d10453SEric Joyner struct ice_fltr_mgmt_list_entry {
322*71d10453SEric Joyner 	/* back pointer to VSI list ID to VSI list mapping */
323*71d10453SEric Joyner 	struct ice_vsi_list_map_info *vsi_list_info;
324*71d10453SEric Joyner 	u16 vsi_count;
325*71d10453SEric Joyner #define ICE_INVAL_LG_ACT_INDEX 0xffff
326*71d10453SEric Joyner 	u16 lg_act_idx;
327*71d10453SEric Joyner #define ICE_INVAL_SW_MARKER_ID 0xffff
328*71d10453SEric Joyner 	u16 sw_marker_id;
329*71d10453SEric Joyner 	struct LIST_ENTRY_TYPE list_entry;
330*71d10453SEric Joyner 	struct ice_fltr_info fltr_info;
331*71d10453SEric Joyner #define ICE_INVAL_COUNTER_ID 0xff
332*71d10453SEric Joyner 	u8 counter_index;
333*71d10453SEric Joyner 	enum ice_fltr_marker marker;
334*71d10453SEric Joyner };
335*71d10453SEric Joyner 
336*71d10453SEric Joyner struct ice_adv_fltr_mgmt_list_entry {
337*71d10453SEric Joyner 	struct LIST_ENTRY_TYPE list_entry;
338*71d10453SEric Joyner 
339*71d10453SEric Joyner 	struct ice_adv_lkup_elem *lkups;
340*71d10453SEric Joyner 	struct ice_adv_rule_info rule_info;
341*71d10453SEric Joyner 	u16 lkups_cnt;
342*71d10453SEric Joyner 	struct ice_vsi_list_map_info *vsi_list_info;
343*71d10453SEric Joyner 	u16 vsi_count;
344*71d10453SEric Joyner };
345*71d10453SEric Joyner 
346*71d10453SEric Joyner enum ice_promisc_flags {
347*71d10453SEric Joyner 	ICE_PROMISC_UCAST_RX = 0x1,
348*71d10453SEric Joyner 	ICE_PROMISC_UCAST_TX = 0x2,
349*71d10453SEric Joyner 	ICE_PROMISC_MCAST_RX = 0x4,
350*71d10453SEric Joyner 	ICE_PROMISC_MCAST_TX = 0x8,
351*71d10453SEric Joyner 	ICE_PROMISC_BCAST_RX = 0x10,
352*71d10453SEric Joyner 	ICE_PROMISC_BCAST_TX = 0x20,
353*71d10453SEric Joyner 	ICE_PROMISC_VLAN_RX = 0x40,
354*71d10453SEric Joyner 	ICE_PROMISC_VLAN_TX = 0x80,
355*71d10453SEric Joyner };
356*71d10453SEric Joyner 
357*71d10453SEric Joyner /* VSI related commands */
358*71d10453SEric Joyner enum ice_status
359*71d10453SEric Joyner ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
360*71d10453SEric Joyner 	       struct ice_sq_cd *cd);
361*71d10453SEric Joyner enum ice_status
362*71d10453SEric Joyner ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
363*71d10453SEric Joyner 		bool keep_vsi_alloc, struct ice_sq_cd *cd);
364*71d10453SEric Joyner enum ice_status
365*71d10453SEric Joyner ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
366*71d10453SEric Joyner 		  struct ice_sq_cd *cd);
367*71d10453SEric Joyner enum ice_status
368*71d10453SEric Joyner ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
369*71d10453SEric Joyner 	    struct ice_sq_cd *cd);
370*71d10453SEric Joyner enum ice_status
371*71d10453SEric Joyner ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
372*71d10453SEric Joyner 	     bool keep_vsi_alloc, struct ice_sq_cd *cd);
373*71d10453SEric Joyner enum ice_status
374*71d10453SEric Joyner ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
375*71d10453SEric Joyner 	       struct ice_sq_cd *cd);
376*71d10453SEric Joyner struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
377*71d10453SEric Joyner void ice_clear_all_vsi_ctx(struct ice_hw *hw);
378*71d10453SEric Joyner enum ice_status
379*71d10453SEric Joyner ice_aq_get_vsi_params(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
380*71d10453SEric Joyner 		      struct ice_sq_cd *cd);
381*71d10453SEric Joyner enum ice_status
382*71d10453SEric Joyner ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,
383*71d10453SEric Joyner 			   u16 count, struct ice_mir_rule_buf *mr_buf,
384*71d10453SEric Joyner 			   struct ice_sq_cd *cd, u16 *rule_id);
385*71d10453SEric Joyner enum ice_status
386*71d10453SEric Joyner ice_aq_delete_mir_rule(struct ice_hw *hw, u16 rule_id, bool keep_allocd,
387*71d10453SEric Joyner 		       struct ice_sq_cd *cd);
388*71d10453SEric Joyner enum ice_status
389*71d10453SEric Joyner ice_aq_get_storm_ctrl(struct ice_hw *hw, u32 *bcast_thresh, u32 *mcast_thresh,
390*71d10453SEric Joyner 		      u32 *ctl_bitmask);
391*71d10453SEric Joyner enum ice_status
392*71d10453SEric Joyner ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh,
393*71d10453SEric Joyner 		      u32 ctl_bitmask);
394*71d10453SEric Joyner /* Switch config */
395*71d10453SEric Joyner enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
396*71d10453SEric Joyner 
397*71d10453SEric Joyner enum ice_status
398*71d10453SEric Joyner ice_alloc_vlan_res_counter(struct ice_hw *hw, u16 *counter_id);
399*71d10453SEric Joyner enum ice_status
400*71d10453SEric Joyner ice_free_vlan_res_counter(struct ice_hw *hw, u16 counter_id);
401*71d10453SEric Joyner 
402*71d10453SEric Joyner /* Switch/bridge related commands */
403*71d10453SEric Joyner enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
404*71d10453SEric Joyner enum ice_status
405*71d10453SEric Joyner ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,
406*71d10453SEric Joyner 	     u16 *counter_id);
407*71d10453SEric Joyner enum ice_status
408*71d10453SEric Joyner ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id);
409*71d10453SEric Joyner enum ice_status
410*71d10453SEric Joyner ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf,
411*71d10453SEric Joyner 		     u16 buf_size, struct ice_sq_cd *cd);
412*71d10453SEric Joyner enum ice_status
413*71d10453SEric Joyner ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries,
414*71d10453SEric Joyner 		     struct ice_aqc_get_allocd_res_desc_resp *buf,
415*71d10453SEric Joyner 		     u16 buf_size, u16 res_type, bool res_shared, u16 *desc_id,
416*71d10453SEric Joyner 		     struct ice_sq_cd *cd);
417*71d10453SEric Joyner enum ice_status
418*71d10453SEric Joyner ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list);
419*71d10453SEric Joyner enum ice_status
420*71d10453SEric Joyner ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list);
421*71d10453SEric Joyner void ice_rem_all_sw_rules_info(struct ice_hw *hw);
422*71d10453SEric Joyner enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
423*71d10453SEric Joyner enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
424*71d10453SEric Joyner enum ice_status
425*71d10453SEric Joyner ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);
426*71d10453SEric Joyner enum ice_status
427*71d10453SEric Joyner ice_remove_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);
428*71d10453SEric Joyner 
429*71d10453SEric Joyner enum ice_status
430*71d10453SEric Joyner ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info,
431*71d10453SEric Joyner 			   u16 sw_marker);
432*71d10453SEric Joyner enum ice_status
433*71d10453SEric Joyner ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info);
434*71d10453SEric Joyner void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);
435*71d10453SEric Joyner 
436*71d10453SEric Joyner /* Promisc/defport setup for VSIs */
437*71d10453SEric Joyner enum ice_status
438*71d10453SEric Joyner ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set,
439*71d10453SEric Joyner 		 u8 direction);
440*71d10453SEric Joyner enum ice_status
441*71d10453SEric Joyner ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
442*71d10453SEric Joyner 		    u16 vid);
443*71d10453SEric Joyner enum ice_status
444*71d10453SEric Joyner ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
445*71d10453SEric Joyner 		      u16 vid);
446*71d10453SEric Joyner enum ice_status
447*71d10453SEric Joyner ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
448*71d10453SEric Joyner 			 bool rm_vlan_promisc);
449*71d10453SEric Joyner 
450*71d10453SEric Joyner /* Get VSIs Promisc/defport settings */
451*71d10453SEric Joyner enum ice_status
452*71d10453SEric Joyner ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
453*71d10453SEric Joyner 		    u16 *vid);
454*71d10453SEric Joyner enum ice_status
455*71d10453SEric Joyner ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
456*71d10453SEric Joyner 			 u16 *vid);
457*71d10453SEric Joyner 
458*71d10453SEric Joyner enum ice_status ice_replay_all_fltr(struct ice_hw *hw);
459*71d10453SEric Joyner 
460*71d10453SEric Joyner enum ice_status
461*71d10453SEric Joyner ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list);
462*71d10453SEric Joyner u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
463*71d10453SEric Joyner bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
464*71d10453SEric Joyner 
465*71d10453SEric Joyner enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle);
466*71d10453SEric Joyner void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
467*71d10453SEric Joyner 
468*71d10453SEric Joyner #endif /* _ICE_SWITCH_H_ */
469