xref: /freebsd/sys/dev/ice/ice_switch.h (revision aa1207ea4f030c50a91bca6a3df950ca25113d5a)
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 		} mac;
133 		struct {
134 			u8 mac_addr[ETH_ALEN];
135 			u16 vlan_id;
136 		} mac_vlan;
137 		struct {
138 			u16 vlan_id;
139 			u16 tpid;
140 			u8 tpid_valid;
141 		} vlan;
142 		/* Set lkup_type as ICE_SW_LKUP_ETHERTYPE
143 		 * if just using ethertype as filter. Set lkup_type as
144 		 * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be
145 		 * passed in as filter.
146 		 */
147 		struct {
148 			u16 ethertype;
149 			u8 mac_addr[ETH_ALEN]; /* optional */
150 		} ethertype_mac;
151 	} l_data; /* Make sure to zero out the memory of l_data before using
152 		   * it or only set the data associated with lookup match
153 		   * rest everything should be zero
154 		   */
155 
156 	/* Depending on filter action */
157 	union {
158 		/* queue ID in case of ICE_FWD_TO_Q and starting
159 		 * queue ID in case of ICE_FWD_TO_QGRP.
160 		 */
161 		u16 q_id:11;
162 		u16 hw_vsi_id:10;
163 		u16 vsi_list_id:10;
164 	} fwd_id;
165 
166 	/* Sw VSI handle */
167 	u16 vsi_handle;
168 
169 	/* Set to num_queues if action is ICE_FWD_TO_QGRP. This field
170 	 * determines the range of queues the packet needs to be forwarded to.
171 	 * Note that qgrp_size must be set to a power of 2.
172 	 */
173 	u8 qgrp_size;
174 
175 	/* Rule creations populate these indicators basing on the switch type */
176 	u8 lb_en;	/* Indicate if packet can be looped back */
177 	u8 lan_en;	/* Indicate if packet can be forwarded to the uplink */
178 };
179 
180 struct ice_adv_lkup_elem {
181 	enum ice_protocol_type type;
182 	union ice_prot_hdr h_u;	/* Header values */
183 	union ice_prot_hdr m_u;	/* Mask of header values to match */
184 };
185 
186 struct entry_vsi_fwd {
187 	u16 vsi_list;
188 	u8 list;
189 	u8 valid;
190 };
191 
192 struct entry_to_q {
193 	u16 q_idx;
194 	u8 q_region_sz;
195 	u8 q_pri;
196 };
197 
198 struct entry_prune {
199 	u16 vsi_list;
200 	u8 list;
201 	u8 egr;
202 	u8 ing;
203 	u8 prune_t;
204 };
205 
206 struct entry_mirror {
207 	u16 mirror_vsi;
208 };
209 
210 struct entry_generic_act {
211 	u16 generic_value;
212 	u8 offset;
213 	u8 priority;
214 };
215 
216 struct entry_statistics {
217 	u8 counter_idx;
218 };
219 
220 struct ice_sw_act_ctrl {
221 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
222 	u16 src;
223 	u16 flag;
224 	enum ice_sw_fwd_act_type fltr_act;
225 	/* Depending on filter action */
226 	union {
227 		/* This is a queue ID in case of ICE_FWD_TO_Q and starting
228 		 * queue ID in case of ICE_FWD_TO_QGRP.
229 		 */
230 		u16 q_id:11;
231 		u16 vsi_id:10;
232 		u16 hw_vsi_id:10;
233 		u16 vsi_list_id:10;
234 	} fwd_id;
235 	/* software VSI handle */
236 	u16 vsi_handle;
237 	u8 qgrp_size;
238 };
239 
240 struct ice_rule_query_data {
241 	/* Recipe ID for which the requested rule was added */
242 	u16 rid;
243 	/* Rule ID that was added or is supposed to be removed */
244 	u16 rule_id;
245 	/* vsi_handle for which Rule was added or is supposed to be removed */
246 	u16 vsi_handle;
247 };
248 
249 /*
250  * This structure allows to pass info about lb_en and lan_en
251  * flags to ice_add_adv_rule. Values in act would be used
252  * only if act_valid was set to true, otherwise dflt
253  * values would be used.
254  */
255 struct ice_adv_rule_flags_info {
256 	u32 act;
257 	u8 act_valid;		/* indicate if flags in act are valid */
258 };
259 
260 struct ice_adv_rule_info {
261 	enum ice_sw_tunnel_type tun_type;
262 	struct ice_sw_act_ctrl sw_act;
263 	u32 priority;
264 	u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */
265 	u8 add_dir_lkup;
266 	u16 fltr_rule_id;
267 	u16 lg_id;
268 	u16 vlan_type;
269 	struct ice_adv_rule_flags_info flags_info;
270 };
271 
272 /* A collection of one or more four word recipe */
273 struct ice_sw_recipe {
274 	/* For a chained recipe the root recipe is what should be used for
275 	 * programming rules
276 	 */
277 	u8 is_root;
278 	u8 root_rid;
279 	u8 recp_created;
280 
281 	/* Number of extraction words */
282 	u8 n_ext_words;
283 	/* Protocol ID and Offset pair (extraction word) to describe the
284 	 * recipe
285 	 */
286 	struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS];
287 	u16 word_masks[ICE_MAX_CHAIN_WORDS];
288 
289 	/* if this recipe is a collection of other recipe */
290 	u8 big_recp;
291 
292 	/* if this recipe is part of another bigger recipe then chain index
293 	 * corresponding to this recipe
294 	 */
295 	u8 chain_idx;
296 
297 	/* if this recipe is a collection of other recipe then count of other
298 	 * recipes and recipe IDs of those recipes
299 	 */
300 	u8 n_grp_count;
301 
302 	/* Bit map specifying the IDs associated with this group of recipe */
303 	ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
304 
305 	enum ice_sw_tunnel_type tun_type;
306 
307 	/* List of type ice_fltr_mgmt_list_entry or adv_rule */
308 	u8 adv_rule;
309 	struct LIST_HEAD_TYPE filt_rules;
310 	struct LIST_HEAD_TYPE filt_replay_rules;
311 
312 	struct ice_lock filt_rule_lock;	/* protect filter rule structure */
313 
314 	/* Profiles this recipe should be associated with */
315 	struct LIST_HEAD_TYPE fv_list;
316 
317 	/* Profiles this recipe is associated with */
318 	u8 num_profs, *prof_ids;
319 
320 	/* Bit map for possible result indexes */
321 	ice_declare_bitmap(res_idxs, ICE_MAX_FV_WORDS);
322 
323 	/* This allows user to specify the recipe priority.
324 	 * For now, this becomes 'fwd_priority' when recipe
325 	 * is created, usually recipes can have 'fwd' and 'join'
326 	 * priority.
327 	 */
328 	u8 priority;
329 
330 	struct LIST_HEAD_TYPE rg_list;
331 
332 	/* AQ buffer associated with this recipe */
333 	struct ice_aqc_recipe_data_elem *root_buf;
334 	/* This struct saves the fv_words for a given lookup */
335 	struct ice_prot_lkup_ext lkup_exts;
336 };
337 
338 /* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */
339 struct ice_vsi_list_map_info {
340 	struct LIST_ENTRY_TYPE list_entry;
341 	ice_declare_bitmap(vsi_map, ICE_MAX_VSI);
342 	u16 vsi_list_id;
343 	/* counter to track how many rules are reusing this VSI list */
344 	u16 ref_cnt;
345 };
346 
347 struct ice_fltr_list_entry {
348 	struct LIST_ENTRY_TYPE list_entry;
349 	enum ice_status status;
350 	struct ice_fltr_info fltr_info;
351 };
352 
353 /**
354  * enum ice_fltr_marker - Marker for syncing OS and driver filter lists
355  * @ICE_FLTR_NOT_FOUND: initial state, indicates filter has not been found
356  * @ICE_FLTR_FOUND: set when a filter has been found in both lists
357  *
358  * This enumeration is used to help sync an operating system provided filter
359  * list with the filters previously added.
360  *
361  * This is required for FreeBSD because the operating system does not provide
362  * individual indications of whether a filter has been added or deleted, but
363  * instead just notifies the driver with the entire new list.
364  *
365  * To use this marker state, the driver shall initially reset all filters to
366  * the ICE_FLTR_NOT_FOUND state. Then, for each filter in the OS list, it
367  * shall search the driver list for the filter. If found, the filter state
368  * will be set to ICE_FLTR_FOUND. If not found, that filter will be added.
369  * Finally, the driver shall search the internal filter list for all filters
370  * still marked as ICE_FLTR_NOT_FOUND and remove them.
371  */
372 enum ice_fltr_marker {
373 	ICE_FLTR_NOT_FOUND,
374 	ICE_FLTR_FOUND,
375 };
376 
377 /* This defines an entry in the list that maintains MAC or VLAN membership
378  * to HW list mapping, since multiple VSIs can subscribe to the same MAC or
379  * VLAN. As an optimization the VSI list should be created only when a
380  * second VSI becomes a subscriber to the same MAC address. VSI lists are always
381  * used for VLAN membership.
382  */
383 struct ice_fltr_mgmt_list_entry {
384 	/* back pointer to VSI list ID to VSI list mapping */
385 	struct ice_vsi_list_map_info *vsi_list_info;
386 	u16 vsi_count;
387 #define ICE_INVAL_LG_ACT_INDEX 0xffff
388 	u16 lg_act_idx;
389 #define ICE_INVAL_SW_MARKER_ID 0xffff
390 	u16 sw_marker_id;
391 	struct LIST_ENTRY_TYPE list_entry;
392 	struct ice_fltr_info fltr_info;
393 #define ICE_INVAL_COUNTER_ID 0xff
394 	u8 counter_index;
395 	enum ice_fltr_marker marker;
396 };
397 
398 struct ice_adv_fltr_mgmt_list_entry {
399 	struct LIST_ENTRY_TYPE list_entry;
400 
401 	struct ice_adv_lkup_elem *lkups;
402 	struct ice_adv_rule_info rule_info;
403 	u16 lkups_cnt;
404 	struct ice_vsi_list_map_info *vsi_list_info;
405 	u16 vsi_count;
406 };
407 
408 enum ice_promisc_flags {
409 	ICE_PROMISC_UCAST_RX = 0,
410 	ICE_PROMISC_UCAST_TX,
411 	ICE_PROMISC_MCAST_RX,
412 	ICE_PROMISC_MCAST_TX,
413 	ICE_PROMISC_BCAST_RX,
414 	ICE_PROMISC_BCAST_TX,
415 	ICE_PROMISC_VLAN_RX,
416 	ICE_PROMISC_VLAN_TX,
417 	ICE_PROMISC_UCAST_RX_LB,
418 	/* Max value */
419 	ICE_PROMISC_MAX,
420 };
421 
422 struct ice_dummy_pkt_offsets {
423 	enum ice_protocol_type type;
424 	u16 offset; /* ICE_PROTOCOL_LAST indicates end of list */
425 };
426 
427 void
428 ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
429 		      enum ice_sw_tunnel_type tun_type, const u8 **pkt,
430 		      u16 *pkt_len,
431 		      const struct ice_dummy_pkt_offsets **offsets);
432 
433 enum ice_status
434 ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
435 			  struct ice_sw_rule_lkup_rx_tx *s_rule,
436 			  const u8 *dummy_pkt, u16 pkt_len,
437 			  const struct ice_dummy_pkt_offsets *offsets);
438 
439 enum ice_status
440 ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
441 		   u16 lkups_cnt, struct ice_adv_rule_info *rinfo, u16 *rid);
442 
443 struct ice_adv_fltr_mgmt_list_entry *
444 ice_find_adv_rule_entry(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
445 			u16 lkups_cnt, u16 recp_id,
446 			struct ice_adv_rule_info *rinfo);
447 
448 enum ice_status
449 ice_adv_add_update_vsi_list(struct ice_hw *hw,
450 			    struct ice_adv_fltr_mgmt_list_entry *m_entry,
451 			    struct ice_adv_rule_info *cur_fltr,
452 			    struct ice_adv_rule_info *new_fltr);
453 
454 struct ice_vsi_list_map_info *
455 ice_find_vsi_list_entry(struct ice_sw_recipe *recp_list, u16 vsi_handle,
456 			u16 *vsi_list_id);
457 
458 /* VSI related commands */
459 enum ice_status
460 ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
461 	       struct ice_sq_cd *cd);
462 enum ice_status
463 ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
464 		bool keep_vsi_alloc, struct ice_sq_cd *cd);
465 enum ice_status
466 ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
467 		  struct ice_sq_cd *cd);
468 enum ice_status
469 ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
470 	    struct ice_sq_cd *cd);
471 enum ice_status
472 ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
473 	     bool keep_vsi_alloc, struct ice_sq_cd *cd);
474 enum ice_status
475 ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
476 	       struct ice_sq_cd *cd);
477 struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
478 void ice_clear_all_vsi_ctx(struct ice_hw *hw);
479 enum ice_status
480 ice_aq_get_vsi_params(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
481 		      struct ice_sq_cd *cd);
482 enum ice_status
483 ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,
484 			   u16 count, struct ice_mir_rule_buf *mr_buf,
485 			   struct ice_sq_cd *cd, u16 *rule_id);
486 enum ice_status
487 ice_aq_delete_mir_rule(struct ice_hw *hw, u16 rule_id, bool keep_allocd,
488 		       struct ice_sq_cd *cd);
489 enum ice_status
490 ice_aq_get_storm_ctrl(struct ice_hw *hw, u32 *bcast_thresh, u32 *mcast_thresh,
491 		      u32 *ctl_bitmask);
492 enum ice_status
493 ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh,
494 		      u32 ctl_bitmask);
495 /* Switch config */
496 enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
497 
498 enum ice_status
499 ice_alloc_vlan_res_counter(struct ice_hw *hw, u16 *counter_id);
500 enum ice_status
501 ice_free_vlan_res_counter(struct ice_hw *hw, u16 counter_id);
502 
503 enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
504 enum ice_status ice_alloc_rss_global_lut(struct ice_hw *hw, bool shared_res, u16 *global_lut_id);
505 enum ice_status ice_free_rss_global_lut(struct ice_hw *hw, u16 global_lut_id);
506 enum ice_status
507 ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,
508 	     u16 *counter_id);
509 enum ice_status
510 ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id);
511 enum ice_status
512 ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries,
513 		     struct ice_aqc_get_res_resp_elem *buf, u16 buf_size,
514 		     struct ice_sq_cd *cd);
515 enum ice_status
516 ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries,
517 		     struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type,
518 		     bool res_shared, u16 *desc_id, struct ice_sq_cd *cd);
519 enum ice_status
520 ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list);
521 enum ice_status ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list);
522 void ice_rem_all_sw_rules_info(struct ice_hw *hw);
523 enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
524 enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
525 enum ice_status
526 ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);
527 enum ice_status
528 ice_remove_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);
529 enum ice_status
530 ice_cfg_iwarp_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable);
531 
532 enum ice_status
533 ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info,
534 			   u16 sw_marker);
535 enum ice_status
536 ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info);
537 void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);
538 
539 /* Promisc/defport setup for VSIs */
540 enum ice_status
541 ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set,
542 		 u8 direction);
543 bool ice_check_if_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle,
544 			   bool *rule_exists);
545 enum ice_status
546 ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
547 		    ice_bitmap_t *promisc_mask, u16 vid);
548 enum ice_status
549 ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
550 		      ice_bitmap_t *promisc_mask, u16 vid);
551 enum ice_status
552 ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
553 			 ice_bitmap_t *promisc_mask, bool rm_vlan_promisc);
554 
555 /* Get VSIs Promisc/defport settings */
556 enum ice_status
557 ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
558 		    ice_bitmap_t *promisc_mask, u16 *vid);
559 enum ice_status
560 ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle,
561 			 ice_bitmap_t *promisc_mask, u16 *vid);
562 
563 enum ice_status ice_replay_all_fltr(struct ice_hw *hw);
564 
565 enum ice_status
566 ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list);
567 u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
568 bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
569 
570 enum ice_status
571 ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
572 			u16 vsi_handle);
573 void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw);
574 void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
575 enum ice_status
576 ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
577 		u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd);
578 #endif /* _ICE_SWITCH_H_ */
579