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