xref: /dpdk/drivers/net/ice/ice_ethdev.h (revision c14ef1ec)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 
5 #ifndef _ICE_ETHDEV_H_
6 #define _ICE_ETHDEV_H_
7 
8 #include <rte_kvargs.h>
9 
10 #include <rte_ethdev_driver.h>
11 
12 #include "base/ice_common.h"
13 #include "base/ice_adminq_cmd.h"
14 
15 #define ICE_VLAN_TAG_SIZE        4
16 
17 #define ICE_ADMINQ_LEN               32
18 #define ICE_SBIOQ_LEN                32
19 #define ICE_MAILBOXQ_LEN             32
20 #define ICE_ADMINQ_BUF_SZ            4096
21 #define ICE_SBIOQ_BUF_SZ             4096
22 #define ICE_MAILBOXQ_BUF_SZ          4096
23 /* Number of queues per TC should be one of 1, 2, 4, 8, 16, 32, 64 */
24 #define ICE_MAX_Q_PER_TC         64
25 #define ICE_NUM_DESC_DEFAULT     512
26 #define ICE_BUF_SIZE_MIN         1024
27 #define ICE_FRAME_SIZE_MAX       9728
28 #define ICE_QUEUE_BASE_ADDR_UNIT 128
29 /* number of VSIs and queue default setting */
30 #define ICE_MAX_QP_NUM_PER_VF    16
31 #define ICE_DEFAULT_QP_NUM_FDIR  1
32 #define ICE_UINT32_BIT_SIZE      (CHAR_BIT * sizeof(uint32_t))
33 #define ICE_VFTA_SIZE            (4096 / ICE_UINT32_BIT_SIZE)
34 /* Maximun number of MAC addresses */
35 #define ICE_NUM_MACADDR_MAX       64
36 /* Maximum number of VFs */
37 #define ICE_MAX_VF               128
38 #define ICE_MAX_INTR_QUEUE_NUM   256
39 
40 #define ICE_MISC_VEC_ID          RTE_INTR_VEC_ZERO_OFFSET
41 #define ICE_RX_VEC_ID            RTE_INTR_VEC_RXTX_OFFSET
42 
43 #define ICE_MAX_PKT_TYPE  1024
44 
45 /* DDP package search path */
46 #define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg"
47 #define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg"
48 #define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/"
49 #define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/"
50 #define ICE_MAX_PKG_FILENAME_SIZE   256
51 
52 /**
53  * vlan_id is a 12 bit number.
54  * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
55  * 2^5 = 32. The val of lower 5 bits specifies the bit in the 32bit element.
56  * The higher 7 bit val specifies VFTA array index.
57  */
58 #define ICE_VFTA_BIT(vlan_id)    (1 << ((vlan_id) & 0x1F))
59 #define ICE_VFTA_IDX(vlan_id)    ((vlan_id) >> 5)
60 
61 /* Default TC traffic in case DCB is not enabled */
62 #define ICE_DEFAULT_TCMAP        0x1
63 #define ICE_FDIR_QUEUE_ID        0
64 
65 /* Always assign pool 0 to main VSI, VMDQ will start from 1 */
66 #define ICE_VMDQ_POOL_BASE       1
67 
68 #define ICE_DEFAULT_RX_FREE_THRESH  32
69 #define ICE_DEFAULT_RX_PTHRESH      8
70 #define ICE_DEFAULT_RX_HTHRESH      8
71 #define ICE_DEFAULT_RX_WTHRESH      0
72 
73 #define ICE_DEFAULT_TX_FREE_THRESH  32
74 #define ICE_DEFAULT_TX_PTHRESH      32
75 #define ICE_DEFAULT_TX_HTHRESH      0
76 #define ICE_DEFAULT_TX_WTHRESH      0
77 #define ICE_DEFAULT_TX_RSBIT_THRESH 32
78 
79 /* Bit shift and mask */
80 #define ICE_4_BIT_WIDTH  (CHAR_BIT / 2)
81 #define ICE_4_BIT_MASK   RTE_LEN2MASK(ICE_4_BIT_WIDTH, uint8_t)
82 #define ICE_8_BIT_WIDTH  CHAR_BIT
83 #define ICE_8_BIT_MASK   UINT8_MAX
84 #define ICE_16_BIT_WIDTH (CHAR_BIT * 2)
85 #define ICE_16_BIT_MASK  UINT16_MAX
86 #define ICE_32_BIT_WIDTH (CHAR_BIT * 4)
87 #define ICE_32_BIT_MASK  UINT32_MAX
88 #define ICE_40_BIT_WIDTH (CHAR_BIT * 5)
89 #define ICE_40_BIT_MASK  RTE_LEN2MASK(ICE_40_BIT_WIDTH, uint64_t)
90 #define ICE_48_BIT_WIDTH (CHAR_BIT * 6)
91 #define ICE_48_BIT_MASK  RTE_LEN2MASK(ICE_48_BIT_WIDTH, uint64_t)
92 
93 #define ICE_FLAG_RSS                   BIT_ULL(0)
94 #define ICE_FLAG_DCB                   BIT_ULL(1)
95 #define ICE_FLAG_VMDQ                  BIT_ULL(2)
96 #define ICE_FLAG_SRIOV                 BIT_ULL(3)
97 #define ICE_FLAG_HEADER_SPLIT_DISABLED BIT_ULL(4)
98 #define ICE_FLAG_HEADER_SPLIT_ENABLED  BIT_ULL(5)
99 #define ICE_FLAG_FDIR                  BIT_ULL(6)
100 #define ICE_FLAG_VXLAN                 BIT_ULL(7)
101 #define ICE_FLAG_RSS_AQ_CAPABLE        BIT_ULL(8)
102 #define ICE_FLAG_VF_MAC_BY_PF          BIT_ULL(9)
103 #define ICE_FLAG_ALL  (ICE_FLAG_RSS | \
104 		       ICE_FLAG_DCB | \
105 		       ICE_FLAG_VMDQ | \
106 		       ICE_FLAG_SRIOV | \
107 		       ICE_FLAG_HEADER_SPLIT_DISABLED | \
108 		       ICE_FLAG_HEADER_SPLIT_ENABLED | \
109 		       ICE_FLAG_FDIR | \
110 		       ICE_FLAG_VXLAN | \
111 		       ICE_FLAG_RSS_AQ_CAPABLE | \
112 		       ICE_FLAG_VF_MAC_BY_PF)
113 
114 #define ICE_RSS_OFFLOAD_ALL ( \
115 	ETH_RSS_IPV4 | \
116 	ETH_RSS_FRAG_IPV4 | \
117 	ETH_RSS_NONFRAG_IPV4_TCP | \
118 	ETH_RSS_NONFRAG_IPV4_UDP | \
119 	ETH_RSS_NONFRAG_IPV4_SCTP | \
120 	ETH_RSS_NONFRAG_IPV4_OTHER | \
121 	ETH_RSS_IPV6 | \
122 	ETH_RSS_FRAG_IPV6 | \
123 	ETH_RSS_NONFRAG_IPV6_TCP | \
124 	ETH_RSS_NONFRAG_IPV6_UDP | \
125 	ETH_RSS_NONFRAG_IPV6_SCTP | \
126 	ETH_RSS_NONFRAG_IPV6_OTHER | \
127 	ETH_RSS_L2_PAYLOAD)
128 
129 /**
130  * The overhead from MTU to max frame size.
131  * Considering QinQ packet, the VLAN tag needs to be counted twice.
132  */
133 #define ICE_ETH_OVERHEAD \
134 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
135 
136 #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK)
137 #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK)
138 
139 /* DDP package type */
140 enum ice_pkg_type {
141 	ICE_PKG_TYPE_UNKNOWN,
142 	ICE_PKG_TYPE_OS_DEFAULT,
143 	ICE_PKG_TYPE_COMMS,
144 };
145 
146 struct ice_adapter;
147 
148 /**
149  * MAC filter structure
150  */
151 struct ice_mac_filter_info {
152 	struct rte_ether_addr mac_addr;
153 };
154 
155 TAILQ_HEAD(ice_mac_filter_list, ice_mac_filter);
156 
157 /* MAC filter list structure */
158 struct ice_mac_filter {
159 	TAILQ_ENTRY(ice_mac_filter) next;
160 	struct ice_mac_filter_info mac_info;
161 };
162 
163 /**
164  * VLAN filter structure
165  */
166 struct ice_vlan_filter_info {
167 	uint16_t vlan_id;
168 };
169 
170 TAILQ_HEAD(ice_vlan_filter_list, ice_vlan_filter);
171 
172 /* VLAN filter list structure */
173 struct ice_vlan_filter {
174 	TAILQ_ENTRY(ice_vlan_filter) next;
175 	struct ice_vlan_filter_info vlan_info;
176 };
177 
178 struct pool_entry {
179 	LIST_ENTRY(pool_entry) next;
180 	uint16_t base;
181 	uint16_t len;
182 };
183 
184 LIST_HEAD(res_list, pool_entry);
185 
186 struct ice_res_pool_info {
187 	uint32_t base;              /* Resource start index */
188 	uint32_t num_alloc;         /* Allocated resource number */
189 	uint32_t num_free;          /* Total available resource number */
190 	struct res_list alloc_list; /* Allocated resource list */
191 	struct res_list free_list;  /* Available resource list */
192 };
193 
194 TAILQ_HEAD(ice_vsi_list_head, ice_vsi_list);
195 
196 struct ice_vsi;
197 
198 /* VSI list structure */
199 struct ice_vsi_list {
200 	TAILQ_ENTRY(ice_vsi_list) list;
201 	struct ice_vsi *vsi;
202 };
203 
204 struct ice_rx_queue;
205 struct ice_tx_queue;
206 
207 /**
208  * Structure that defines a VSI, associated with a adapter.
209  */
210 struct ice_vsi {
211 	struct ice_adapter *adapter; /* Backreference to associated adapter */
212 	struct ice_aqc_vsi_props info; /* VSI properties */
213 	/**
214 	 * When drivers loaded, only a default main VSI exists. In case new VSI
215 	 * needs to add, HW needs to know the layout that VSIs are organized.
216 	 * Besides that, VSI isan element and can't switch packets, which needs
217 	 * to add new component VEB to perform switching. So, a new VSI needs
218 	 * to specify the the uplink VSI (Parent VSI) before created. The
219 	 * uplink VSI will check whether it had a VEB to switch packets. If no,
220 	 * it will try to create one. Then, uplink VSI will move the new VSI
221 	 * into its' sib_vsi_list to manage all the downlink VSI.
222 	 *  sib_vsi_list: the VSI list that shared the same uplink VSI.
223 	 *  parent_vsi  : the uplink VSI. It's NULL for main VSI.
224 	 *  veb         : the VEB associates with the VSI.
225 	 */
226 	struct ice_vsi_list sib_vsi_list; /* sibling vsi list */
227 	struct ice_vsi *parent_vsi;
228 	enum ice_vsi_type type; /* VSI types */
229 	uint16_t vlan_num;       /* Total VLAN number */
230 	uint16_t mac_num;        /* Total mac number */
231 	struct ice_mac_filter_list mac_list; /* macvlan filter list */
232 	struct ice_vlan_filter_list vlan_list; /* vlan filter list */
233 	uint16_t nb_qps;         /* Number of queue pairs VSI can occupy */
234 	uint16_t nb_used_qps;    /* Number of queue pairs VSI uses */
235 	uint16_t max_macaddrs;   /* Maximum number of MAC addresses */
236 	uint16_t base_queue;     /* The first queue index of this VSI */
237 	uint16_t vsi_id;         /* Hardware Id */
238 	uint16_t idx;            /* vsi_handle: SW index in hw->vsi_ctx */
239 	/* VF number to which the VSI connects, valid when VSI is VF type */
240 	uint8_t vf_num;
241 	uint16_t msix_intr; /* The MSIX interrupt binds to VSI */
242 	uint16_t nb_msix;   /* The max number of msix vector */
243 	uint8_t enabled_tc; /* The traffic class enabled */
244 	uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */
245 	uint8_t vlan_filter_on; /* The VLAN filter enabled */
246 	/* information about rss configuration */
247 	u32 rss_key_size;
248 	u32 rss_lut_size;
249 	uint8_t *rss_lut;
250 	uint8_t *rss_key;
251 	struct ice_eth_stats eth_stats_offset;
252 	struct ice_eth_stats eth_stats;
253 	bool offset_loaded;
254 	uint64_t old_rx_bytes;
255 	uint64_t old_tx_bytes;
256 };
257 
258 enum proto_xtr_type {
259 	PROTO_XTR_NONE,
260 	PROTO_XTR_VLAN,
261 	PROTO_XTR_IPV4,
262 	PROTO_XTR_IPV6,
263 	PROTO_XTR_IPV6_FLOW,
264 	PROTO_XTR_TCP,
265 };
266 
267 enum ice_fdir_tunnel_type {
268 	ICE_FDIR_TUNNEL_TYPE_NONE = 0,
269 	ICE_FDIR_TUNNEL_TYPE_VXLAN,
270 	ICE_FDIR_TUNNEL_TYPE_GTPU,
271 	ICE_FDIR_TUNNEL_TYPE_GTPU_EH,
272 };
273 
274 struct rte_flow;
275 TAILQ_HEAD(ice_flow_list, rte_flow);
276 
277 struct ice_flow_parser_node;
278 TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);
279 
280 struct ice_fdir_filter_conf {
281 	struct ice_fdir_fltr input;
282 	enum ice_fdir_tunnel_type tunnel_type;
283 
284 	struct ice_fdir_counter *counter; /* flow specific counter context */
285 	struct rte_flow_action_count act_count;
286 
287 	uint64_t input_set;
288 };
289 
290 #define ICE_MAX_FDIR_FILTER_NUM		(1024 * 16)
291 
292 struct ice_fdir_fltr_pattern {
293 	enum ice_fltr_ptype flow_type;
294 
295 	union {
296 		struct ice_fdir_v4 v4;
297 		struct ice_fdir_v6 v6;
298 	} ip, mask;
299 
300 	struct ice_fdir_udp_gtp gtpu_data;
301 	struct ice_fdir_udp_gtp gtpu_mask;
302 
303 	struct ice_fdir_extra ext_data;
304 	struct ice_fdir_extra ext_mask;
305 
306 	enum ice_fdir_tunnel_type tunnel_type;
307 };
308 
309 #define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE	1
310 #define ICE_FDIR_COUNTER_MAX_POOL_SIZE		32
311 #define ICE_FDIR_COUNTERS_PER_BLOCK		256
312 #define ICE_FDIR_COUNTER_INDEX(base_idx) \
313 				((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK)
314 struct ice_fdir_counter_pool;
315 
316 struct ice_fdir_counter {
317 	TAILQ_ENTRY(ice_fdir_counter) next;
318 	struct ice_fdir_counter_pool *pool;
319 	uint8_t shared;
320 	uint32_t ref_cnt;
321 	uint32_t id;
322 	uint64_t hits;
323 	uint64_t bytes;
324 	uint32_t hw_index;
325 };
326 
327 TAILQ_HEAD(ice_fdir_counter_list, ice_fdir_counter);
328 
329 struct ice_fdir_counter_pool {
330 	TAILQ_ENTRY(ice_fdir_counter_pool) next;
331 	struct ice_fdir_counter_list counter_list;
332 	struct ice_fdir_counter counters[0];
333 };
334 
335 TAILQ_HEAD(ice_fdir_counter_pool_list, ice_fdir_counter_pool);
336 
337 struct ice_fdir_counter_pool_container {
338 	struct ice_fdir_counter_pool_list pool_list;
339 	struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE];
340 	uint8_t index_free;
341 };
342 
343 /**
344  *  A structure used to define fields of a FDIR related info.
345  */
346 struct ice_fdir_info {
347 	struct ice_vsi *fdir_vsi;     /* pointer to fdir VSI structure */
348 	struct ice_tx_queue *txq;
349 	struct ice_rx_queue *rxq;
350 	void *prg_pkt;                 /* memory for fdir program packet */
351 	uint64_t dma_addr;             /* physic address of packet memory*/
352 	const struct rte_memzone *mz;
353 	struct ice_fdir_filter_conf conf;
354 
355 	struct ice_fdir_filter_conf **hash_map;
356 	struct rte_hash *hash_table;
357 
358 	struct ice_fdir_counter_pool_container counter;
359 };
360 
361 #define ICE_HASH_CFG_VALID(p)		\
362 	((p)->hash_fld != 0 && (p)->pkt_hdr != 0)
363 
364 #define ICE_HASH_CFG_RESET(p) do {	\
365 	(p)->hash_fld = 0;		\
366 	(p)->pkt_hdr = 0;		\
367 } while (0)
368 
369 #define ICE_HASH_CFG_IS_ROTATING(p)	\
370 	((p)->rotate == true)
371 
372 #define ICE_HASH_CFG_ROTATE_START(p)	\
373 	((p)->rotate = true)
374 
375 #define ICE_HASH_CFG_ROTATE_STOP(p)	\
376 	((p)->rotate = false)
377 
378 struct ice_hash_cfg {
379 	uint32_t pkt_hdr;
380 	uint64_t hash_fld;
381 	bool rotate;  /* rotate l3 rule after l4 rule. */
382 	bool symm;
383 };
384 
385 struct ice_hash_gtpu_ctx {
386 	struct ice_hash_cfg ipv4;
387 	struct ice_hash_cfg ipv6;
388 	struct ice_hash_cfg ipv4_udp;
389 	struct ice_hash_cfg ipv6_udp;
390 	struct ice_hash_cfg ipv4_tcp;
391 	struct ice_hash_cfg ipv6_tcp;
392 };
393 
394 struct ice_pf {
395 	struct ice_adapter *adapter; /* The adapter this PF associate to */
396 	struct ice_vsi *main_vsi; /* pointer to main VSI structure */
397 	/* Used for next free software vsi idx.
398 	 * To save the effort, we don't recycle the index.
399 	 * Suppose the indexes are more than enough.
400 	 */
401 	uint16_t next_vsi_idx;
402 	uint16_t vsis_allocated;
403 	uint16_t vsis_unallocated;
404 	struct ice_res_pool_info qp_pool;    /*Queue pair pool */
405 	struct ice_res_pool_info msix_pool;  /* MSIX interrupt pool */
406 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
407 	struct rte_ether_addr dev_addr; /* PF device mac address */
408 	uint64_t flags; /* PF feature flags */
409 	uint16_t hash_lut_size; /* The size of hash lookup table */
410 	uint16_t lan_nb_qp_max;
411 	uint16_t lan_nb_qps; /* The number of queue pairs of LAN */
412 	uint16_t base_queue; /* The base queue pairs index  in the device */
413 	uint8_t *proto_xtr; /* Protocol extraction type for all queues */
414 	uint16_t fdir_nb_qps; /* The number of queue pairs of Flow Director */
415 	uint16_t fdir_qp_offset;
416 	struct ice_fdir_info fdir; /* flow director info */
417 	struct ice_hash_gtpu_ctx gtpu_hash_ctx;
418 	uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
419 	uint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
420 	struct ice_hw_port_stats stats_offset;
421 	struct ice_hw_port_stats stats;
422 	/* internal packet statistics, it should be excluded from the total */
423 	struct ice_eth_stats internal_stats_offset;
424 	struct ice_eth_stats internal_stats;
425 	bool offset_loaded;
426 	bool adapter_stopped;
427 	struct ice_flow_list flow_list;
428 	rte_spinlock_t flow_ops_lock;
429 	struct ice_parser_list rss_parser_list;
430 	struct ice_parser_list perm_parser_list;
431 	struct ice_parser_list dist_parser_list;
432 	bool init_link_up;
433 	uint64_t old_rx_bytes;
434 	uint64_t old_tx_bytes;
435 };
436 
437 #define ICE_MAX_QUEUE_NUM  2048
438 
439 /**
440  * Cache devargs parse result.
441  */
442 struct ice_devargs {
443 	int safe_mode_support;
444 	uint8_t proto_xtr_dflt;
445 	int pipe_mode_support;
446 	int flow_mark_support;
447 	uint8_t proto_xtr[ICE_MAX_QUEUE_NUM];
448 };
449 
450 /**
451  * Structure to store private data for each PF/VF instance.
452  */
453 struct ice_adapter {
454 	/* Common for both PF and VF */
455 	struct ice_hw hw;
456 	struct rte_eth_dev *eth_dev;
457 	struct ice_pf pf;
458 	bool rx_bulk_alloc_allowed;
459 	bool rx_vec_allowed;
460 	bool tx_vec_allowed;
461 	bool tx_simple_allowed;
462 	/* ptype mapping table */
463 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
464 	bool is_safe_mode;
465 	struct ice_devargs devargs;
466 	enum ice_pkg_type active_pkg_type; /* loaded ddp package type */
467 };
468 
469 struct ice_vsi_vlan_pvid_info {
470 	uint16_t on;		/* Enable or disable pvid */
471 	union {
472 		uint16_t pvid;	/* Valid in case 'on' is set to set pvid */
473 		struct {
474 			/* Valid in case 'on' is cleared. 'tagged' will reject
475 			 * tagged packets, while 'untagged' will reject
476 			 * untagged packets.
477 			 */
478 			uint8_t tagged;
479 			uint8_t untagged;
480 		} reject;
481 	} config;
482 };
483 
484 #define ICE_DEV_TO_PCI(eth_dev) \
485 	RTE_DEV_TO_PCI((eth_dev)->device)
486 
487 /* ICE_DEV_PRIVATE_TO */
488 #define ICE_DEV_PRIVATE_TO_PF(adapter) \
489 	(&((struct ice_adapter *)adapter)->pf)
490 #define ICE_DEV_PRIVATE_TO_HW(adapter) \
491 	(&((struct ice_adapter *)adapter)->hw)
492 #define ICE_DEV_PRIVATE_TO_ADAPTER(adapter) \
493 	((struct ice_adapter *)adapter)
494 
495 /* ICE_VSI_TO */
496 #define ICE_VSI_TO_HW(vsi) \
497 	(&(((struct ice_vsi *)vsi)->adapter->hw))
498 #define ICE_VSI_TO_PF(vsi) \
499 	(&(((struct ice_vsi *)vsi)->adapter->pf))
500 #define ICE_VSI_TO_ETH_DEV(vsi) \
501 	(((struct ice_vsi *)vsi)->adapter->eth_dev)
502 
503 /* ICE_PF_TO */
504 #define ICE_PF_TO_HW(pf) \
505 	(&(((struct ice_pf *)pf)->adapter->hw))
506 #define ICE_PF_TO_ADAPTER(pf) \
507 	((struct ice_adapter *)(pf)->adapter)
508 #define ICE_PF_TO_ETH_DEV(pf) \
509 	(((struct ice_pf *)pf)->adapter->eth_dev)
510 
511 enum ice_pkg_type ice_load_pkg_type(struct ice_hw *hw);
512 struct ice_vsi *
513 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type);
514 int
515 ice_release_vsi(struct ice_vsi *vsi);
516 void ice_vsi_enable_queues_intr(struct ice_vsi *vsi);
517 void ice_vsi_disable_queues_intr(struct ice_vsi *vsi);
518 void ice_vsi_queues_bind_intr(struct ice_vsi *vsi);
519 int ice_add_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id,
520 		uint64_t hash_fld, uint32_t pkt_hdr, bool symm);
521 int ice_rem_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id,
522 		uint64_t hash_fld, uint32_t pkt_hdr);
523 
524 static inline int
525 ice_align_floor(int n)
526 {
527 	if (n == 0)
528 		return 0;
529 	return 1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n));
530 }
531 
532 #define ICE_PHY_TYPE_SUPPORT_50G(phy_type) \
533 	(((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CR2) || \
534 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR2) || \
535 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR2) || \
536 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR2) || \
537 	((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC) || \
538 	((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2) || \
539 	((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC) || \
540 	((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2) || \
541 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CP) || \
542 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR) || \
543 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_FR) || \
544 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR) || \
545 	((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) || \
546 	((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC) || \
547 	((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1))
548 
549 #define ICE_PHY_TYPE_SUPPORT_100G_LOW(phy_type) \
550 	(((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR4) || \
551 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR4) || \
552 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_LR4) || \
553 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR4) || \
554 	((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC) || \
555 	((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4) || \
556 	((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC) || \
557 	((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4) || \
558 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4) || \
559 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4) || \
560 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CP2) || \
561 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR2) || \
562 	((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_DR))
563 
564 #define ICE_PHY_TYPE_SUPPORT_100G_HIGH(phy_type) \
565 	(((phy_type) & ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4) || \
566 	((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC) || \
567 	((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2) || \
568 	((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC) || \
569 	((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2))
570 
571 #endif /* _ICE_ETHDEV_H_ */
572