1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
8 /* In QLEN must be whole number of 32 descriptors. */
9 #define IAVF_ALIGN_RING_DESC 32
10 #define IAVF_MIN_RING_DESC 64
11 #define IAVF_MAX_RING_DESC 4096
12 #define IAVF_DMA_MEM_ALIGN 4096
13 /* Base address of the HW descriptor ring should be 128B aligned. */
14 #define IAVF_RING_BASE_ALIGN 128
16 /* used for Rx Bulk Allocate */
17 #define IAVF_RX_MAX_BURST 32
19 /* used for Vector PMD */
20 #define IAVF_VPMD_RX_MAX_BURST 32
21 #define IAVF_VPMD_TX_MAX_BURST 32
22 #define IAVF_RXQ_REARM_THRESH 32
23 #define IAVF_VPMD_DESCS_PER_LOOP 4
24 #define IAVF_VPMD_TX_MAX_FREE_BUF 64
26 #define IAVF_TX_NO_VECTOR_FLAGS ( \
27 RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \
28 RTE_ETH_TX_OFFLOAD_TCP_TSO | \
29 RTE_ETH_TX_OFFLOAD_SECURITY)
31 #define IAVF_TX_VECTOR_OFFLOAD ( \
32 RTE_ETH_TX_OFFLOAD_VLAN_INSERT | \
33 RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
34 RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \
35 RTE_ETH_TX_OFFLOAD_SCTP_CKSUM | \
36 RTE_ETH_TX_OFFLOAD_UDP_CKSUM | \
37 RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
39 #define IAVF_RX_VECTOR_OFFLOAD ( \
40 RTE_ETH_RX_OFFLOAD_CHECKSUM | \
41 RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \
42 RTE_ETH_RX_OFFLOAD_VLAN | \
43 RTE_ETH_RX_OFFLOAD_RSS_HASH)
45 #define IAVF_VECTOR_PATH 0
46 #define IAVF_VECTOR_OFFLOAD_PATH 1
48 #define DEFAULT_TX_RS_THRESH 32
49 #define DEFAULT_TX_FREE_THRESH 32
51 #define IAVF_MIN_TSO_MSS 256
52 #define IAVF_MAX_TSO_MSS 9668
53 #define IAVF_TSO_MAX_SEG UINT8_MAX
54 #define IAVF_TX_MAX_MTU_SEG 8
56 #define IAVF_TX_CKSUM_OFFLOAD_MASK ( \
57 RTE_MBUF_F_TX_IP_CKSUM | \
58 RTE_MBUF_F_TX_L4_MASK | \
59 RTE_MBUF_F_TX_TCP_SEG)
61 #define IAVF_TX_OFFLOAD_MASK ( \
62 RTE_MBUF_F_TX_OUTER_IPV6 | \
63 RTE_MBUF_F_TX_OUTER_IPV4 | \
64 RTE_MBUF_F_TX_IPV6 | \
65 RTE_MBUF_F_TX_IPV4 | \
66 RTE_MBUF_F_TX_VLAN | \
67 RTE_MBUF_F_TX_IP_CKSUM | \
68 RTE_MBUF_F_TX_L4_MASK | \
69 RTE_MBUF_F_TX_TCP_SEG | \
70 RTE_ETH_TX_OFFLOAD_SECURITY)
72 #define IAVF_TX_OFFLOAD_NOTSUP_MASK \
73 (RTE_MBUF_F_TX_OFFLOAD_MASK ^ IAVF_TX_OFFLOAD_MASK)
75 extern uint64_t iavf_timestamp_dynflag;
76 extern int iavf_timestamp_dynfield_offset;
80 * These descriptors are used instead of the legacy version descriptors
82 union iavf_16b_rx_flex_desc {
84 __le64 pkt_addr; /* Packet buffer address */
85 __le64 hdr_addr; /* Header buffer address */
86 /* bit 0 of hdr_addr is DD bit */
90 u8 rxdid; /* descriptor builder profile ID */
91 u8 mir_id_umb_cast; /* mirror=[5:0], umb=[7:6] */
92 __le16 ptype_flex_flags0; /* ptype=[9:0], ff0=[15:10] */
93 __le16 pkt_len; /* [15:14] are reserved */
94 __le16 hdr_len_sph_flex_flags1; /* header=[10:0] */
103 } wb; /* writeback */
106 union iavf_32b_rx_flex_desc {
108 __le64 pkt_addr; /* Packet buffer address */
109 __le64 hdr_addr; /* Header buffer address */
110 /* bit 0 of hdr_addr is DD bit */
116 u8 rxdid; /* descriptor builder profile ID */
117 u8 mir_id_umb_cast; /* mirror=[5:0], umb=[7:6] */
118 __le16 ptype_flex_flags0; /* ptype=[9:0], ff0=[15:10] */
119 __le16 pkt_len; /* [15:14] are reserved */
120 __le16 hdr_len_sph_flex_flags1; /* header=[10:0] */
122 /* ff1/ext=[15:12] */
125 __le16 status_error0;
131 __le16 status_error1;
147 } wb; /* writeback */
150 /* HW desc structure, both 16-byte and 32-byte types are supported */
151 #ifdef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
152 #define iavf_rx_desc iavf_16byte_rx_desc
153 #define iavf_rx_flex_desc iavf_16b_rx_flex_desc
155 #define iavf_rx_desc iavf_32byte_rx_desc
156 #define iavf_rx_flex_desc iavf_32b_rx_flex_desc
159 typedef void (*iavf_rxd_to_pkt_fields_t)(struct iavf_rx_queue *rxq,
161 volatile union iavf_rx_flex_desc *rxdp);
163 struct iavf_rxq_ops {
164 void (*release_mbufs)(struct iavf_rx_queue *rxq);
167 struct iavf_txq_ops {
168 void (*release_mbufs)(struct iavf_tx_queue *txq);
172 struct iavf_rx_queue_stats {
174 struct iavf_ipsec_crypto_stats ipsec_crypto;
177 /* Structure associated with each Rx queue. */
178 struct iavf_rx_queue {
179 struct rte_mempool *mp; /* mbuf pool to populate Rx ring */
180 const struct rte_memzone *mz; /* memzone for Rx ring */
181 volatile union iavf_rx_desc *rx_ring; /* Rx ring virtual address */
182 uint64_t rx_ring_phys_addr; /* Rx ring DMA address */
183 struct rte_mbuf **sw_ring; /* address of SW ring */
184 uint16_t nb_rx_desc; /* ring length */
185 uint16_t rx_tail; /* current value of tail */
186 volatile uint8_t *qrx_tail; /* register address of tail */
187 uint16_t rx_free_thresh; /* max free RX desc to hold */
188 uint16_t nb_rx_hold; /* number of held free RX desc */
189 struct rte_mbuf *pkt_first_seg; /* first segment of current packet */
190 struct rte_mbuf *pkt_last_seg; /* last segment of current packet */
191 struct rte_mbuf fake_mbuf; /* dummy mbuf */
195 uint16_t rxrearm_nb; /* number of remaining to be re-armed */
196 uint16_t rxrearm_start; /* the idx we start the re-arming from */
197 uint64_t mbuf_initializer; /* value to init mbufs */
200 uint16_t rx_nb_avail; /* number of staged packets ready */
201 uint16_t rx_next_avail; /* index of next staged packets */
202 uint16_t rx_free_trigger; /* triggers rx buffer allocation */
203 struct rte_mbuf *rx_stage[IAVF_RX_MAX_BURST * 2]; /* store mbuf */
205 uint16_t port_id; /* device port ID */
206 uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
207 uint8_t fdir_enabled; /* 0 if FDIR disabled, 1 when enabled */
208 uint16_t queue_id; /* Rx queue index */
209 uint16_t rx_buf_len; /* The packet buffer size */
210 uint16_t rx_hdr_len; /* The header buffer size */
211 uint16_t max_pkt_len; /* Maximum packet length */
212 struct iavf_vsi *vsi; /**< the VSI this queue belongs to */
214 bool q_set; /* if rx queue has been configured */
215 bool rx_deferred_start; /* don't start this queue in dev start */
216 const struct iavf_rxq_ops *ops;
218 #define IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG1 BIT(0)
219 #define IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG2_2 BIT(1)
220 uint8_t proto_xtr; /* protocol extraction type */
221 uint64_t xtr_ol_flag;
222 /* flexible descriptor metadata extraction offload flag */
223 struct iavf_rx_queue_stats stats;
227 struct iavf_tx_entry {
228 struct rte_mbuf *mbuf;
233 struct iavf_tx_vec_entry {
234 struct rte_mbuf *mbuf;
237 /* Structure associated with each TX queue. */
238 struct iavf_tx_queue {
239 const struct rte_memzone *mz; /* memzone for Tx ring */
240 volatile struct iavf_tx_desc *tx_ring; /* Tx ring virtual address */
241 uint64_t tx_ring_phys_addr; /* Tx ring DMA address */
242 struct iavf_tx_entry *sw_ring; /* address array of SW ring */
243 uint16_t nb_tx_desc; /* ring length */
244 uint16_t tx_tail; /* current value of tail */
245 volatile uint8_t *qtx_tail; /* register address of tail */
246 /* number of used desc since RS bit set */
249 uint16_t last_desc_cleaned; /* last desc have been cleaned*/
250 uint16_t free_thresh;
256 uint16_t next_dd; /* next to set RS, for VPMD */
257 uint16_t next_rs; /* next to check DD, for VPMD */
258 uint16_t ipsec_crypto_pkt_md_offset;
260 bool q_set; /* if rx queue has been configured */
261 bool tx_deferred_start; /* don't start this queue in dev start */
262 const struct iavf_txq_ops *ops;
263 #define IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 BIT(0)
264 #define IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 BIT(1)
269 /* Offload features */
270 union iavf_tx_offload {
273 uint64_t l2_len:7; /* L2 (MAC) Header Length. */
274 uint64_t l3_len:9; /* L3 (IP) Header Length. */
275 uint64_t l4_len:8; /* L4 Header Length. */
276 uint64_t tso_segsz:16; /* TCP TSO segment size */
277 /* uint64_t unused : 24; */
281 /* Rx Flex Descriptor
282 * RxDID Profile ID 16-21
283 * Flex-field 0: RSS hash lower 16-bits
284 * Flex-field 1: RSS hash upper 16-bits
285 * Flex-field 2: Flow ID lower 16-bits
286 * Flex-field 3: Flow ID upper 16-bits
290 struct iavf_32b_rx_flex_desc_comms {
294 __le16 ptype_flexi_flags0;
296 __le16 hdr_len_sph_flex_flags1;
299 __le16 status_error0;
304 __le16 status_error1;
321 /* Rx Flex Descriptor
322 * RxDID Profile ID 22-23 (swap Hash and FlowID)
323 * Flex-field 0: Flow ID lower 16-bits
324 * Flex-field 1: Flow ID upper 16-bits
325 * Flex-field 2: RSS hash lower 16-bits
326 * Flex-field 3: RSS hash upper 16-bits
330 struct iavf_32b_rx_flex_desc_comms_ovs {
334 __le16 ptype_flexi_flags0;
336 __le16 hdr_len_sph_flex_flags1;
339 __le16 status_error0;
344 __le16 status_error1;
361 /* Rx Flex Descriptor
362 * RxDID Profile ID 24 Inline IPsec
363 * Flex-field 0: RSS hash lower 16-bits
364 * Flex-field 1: RSS hash upper 16-bits
365 * Flex-field 2: Flow ID lower 16-bits
366 * Flex-field 3: Flow ID upper 16-bits
367 * Flex-field 4: Inline IPsec SAID lower 16-bits
368 * Flex-field 5: Inline IPsec SAID upper 16-bits
370 struct iavf_32b_rx_flex_desc_comms_ipsec {
374 __le16 ptype_flexi_flags0;
376 __le16 hdr_len_sph_flex_flags1;
379 __le16 status_error0;
384 __le16 status_error1;
395 /* Receive Flex Descriptor profile IDs: There are a total
396 * of 64 profiles where profile IDs 0/1 are for legacy; and
397 * profiles 2-63 are flex profiles that can be programmed
398 * with a specific metadata (profile 7 reserved for HW)
401 IAVF_RXDID_LEGACY_0 = 0,
402 IAVF_RXDID_LEGACY_1 = 1,
403 IAVF_RXDID_FLEX_NIC = 2,
404 IAVF_RXDID_FLEX_NIC_2 = 6,
406 IAVF_RXDID_COMMS_GENERIC = 16,
407 IAVF_RXDID_COMMS_AUX_VLAN = 17,
408 IAVF_RXDID_COMMS_AUX_IPV4 = 18,
409 IAVF_RXDID_COMMS_AUX_IPV6 = 19,
410 IAVF_RXDID_COMMS_AUX_IPV6_FLOW = 20,
411 IAVF_RXDID_COMMS_AUX_TCP = 21,
412 IAVF_RXDID_COMMS_OVS_1 = 22,
413 IAVF_RXDID_COMMS_OVS_2 = 23,
414 IAVF_RXDID_COMMS_IPSEC_CRYPTO = 24,
415 IAVF_RXDID_COMMS_AUX_IP_OFFSET = 25,
416 IAVF_RXDID_LAST = 63,
419 enum iavf_rx_flex_desc_status_error_0_bits {
420 /* Note: These are predefined bit offsets */
421 IAVF_RX_FLEX_DESC_STATUS0_DD_S = 0,
422 IAVF_RX_FLEX_DESC_STATUS0_EOF_S,
423 IAVF_RX_FLEX_DESC_STATUS0_HBO_S,
424 IAVF_RX_FLEX_DESC_STATUS0_L3L4P_S,
425 IAVF_RX_FLEX_DESC_STATUS0_XSUM_IPE_S,
426 IAVF_RX_FLEX_DESC_STATUS0_XSUM_L4E_S,
427 IAVF_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S,
428 IAVF_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,
429 IAVF_RX_FLEX_DESC_STATUS0_LPBK_S,
430 IAVF_RX_FLEX_DESC_STATUS0_IPV6EXADD_S,
431 IAVF_RX_FLEX_DESC_STATUS0_RXE_S,
432 IAVF_RX_FLEX_DESC_STATUS0_CRCP_S,
433 IAVF_RX_FLEX_DESC_STATUS0_RSS_VALID_S,
434 IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S,
435 IAVF_RX_FLEX_DESC_STATUS0_XTRMD0_VALID_S,
436 IAVF_RX_FLEX_DESC_STATUS0_XTRMD1_VALID_S,
437 IAVF_RX_FLEX_DESC_STATUS0_LAST /* this entry must be last!!! */
440 enum iavf_rx_flex_desc_status_error_1_bits {
441 /* Note: These are predefined bit offsets */
442 /* Bits 3:0 are reserved for inline ipsec status */
443 IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_0 = 0,
444 IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_1,
445 IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_2,
446 IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_3,
447 IAVF_RX_FLEX_DESC_STATUS1_NAT_S,
448 IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_PROCESSED,
449 /* [10:6] reserved */
450 IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S = 11,
451 IAVF_RX_FLEX_DESC_STATUS1_XTRMD2_VALID_S = 12,
452 IAVF_RX_FLEX_DESC_STATUS1_XTRMD3_VALID_S = 13,
453 IAVF_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S = 14,
454 IAVF_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S = 15,
455 IAVF_RX_FLEX_DESC_STATUS1_LAST /* this entry must be last!!! */
458 #define IAVF_RX_FLEX_DESC_IPSEC_CRYPTO_STATUS_MASK ( \
459 BIT(IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_0) | \
460 BIT(IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_1) | \
461 BIT(IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_2) | \
462 BIT(IAVF_RX_FLEX_DESC_STATUS1_IPSEC_CRYPTO_STATUS_3))
464 enum iavf_rx_flex_desc_ipsec_crypto_status {
465 IAVF_IPSEC_CRYPTO_STATUS_SUCCESS = 0,
466 IAVF_IPSEC_CRYPTO_STATUS_SAD_MISS,
467 IAVF_IPSEC_CRYPTO_STATUS_NOT_PROCESSED,
468 IAVF_IPSEC_CRYPTO_STATUS_ICV_CHECK_FAIL,
469 IAVF_IPSEC_CRYPTO_STATUS_LENGTH_ERR,
471 IAVF_IPSEC_CRYPTO_STATUS_MISC_ERR = 0xF
476 #define IAVF_TXD_DATA_QW1_DTYPE_SHIFT (0)
477 #define IAVF_TXD_DATA_QW1_DTYPE_MASK (0xFUL << IAVF_TXD_QW1_DTYPE_SHIFT)
479 #define IAVF_TXD_DATA_QW1_CMD_SHIFT (4)
480 #define IAVF_TXD_DATA_QW1_CMD_MASK (0x3FFUL << IAVF_TXD_DATA_QW1_CMD_SHIFT)
482 #define IAVF_TXD_DATA_QW1_OFFSET_SHIFT (16)
483 #define IAVF_TXD_DATA_QW1_OFFSET_MASK (0x3FFFFULL << \
484 IAVF_TXD_DATA_QW1_OFFSET_SHIFT)
486 #define IAVF_TXD_DATA_QW1_OFFSET_MACLEN_SHIFT (IAVF_TXD_DATA_QW1_OFFSET_SHIFT)
487 #define IAVF_TXD_DATA_QW1_OFFSET_MACLEN_MASK \
488 (0x7FUL << IAVF_TXD_DATA_QW1_OFFSET_MACLEN_SHIFT)
490 #define IAVF_TXD_DATA_QW1_OFFSET_IPLEN_SHIFT \
491 (IAVF_TXD_DATA_QW1_OFFSET_SHIFT + IAVF_TX_DESC_LENGTH_IPLEN_SHIFT)
492 #define IAVF_TXD_DATA_QW1_OFFSET_IPLEN_MASK \
493 (0x7FUL << IAVF_TXD_DATA_QW1_OFFSET_IPLEN_SHIFT)
495 #define IAVF_TXD_DATA_QW1_OFFSET_L4LEN_SHIFT \
496 (IAVF_TXD_DATA_QW1_OFFSET_SHIFT + IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT)
497 #define IAVF_TXD_DATA_QW1_OFFSET_L4LEN_MASK \
498 (0xFUL << IAVF_TXD_DATA_QW1_OFFSET_L4LEN_SHIFT)
500 #define IAVF_TXD_DATA_QW1_MACLEN_MASK \
501 (0x7FUL << IAVF_TX_DESC_LENGTH_MACLEN_SHIFT)
502 #define IAVF_TXD_DATA_QW1_IPLEN_MASK \
503 (0x7FUL << IAVF_TX_DESC_LENGTH_IPLEN_SHIFT)
504 #define IAVF_TXD_DATA_QW1_L4LEN_MASK \
505 (0xFUL << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT)
506 #define IAVF_TXD_DATA_QW1_FCLEN_MASK \
507 (0xFUL << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT)
509 #define IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT (34)
510 #define IAVF_TXD_DATA_QW1_TX_BUF_SZ_MASK \
511 (0x3FFFULL << IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT)
513 #define IAVF_TXD_DATA_QW1_L2TAG1_SHIFT (48)
514 #define IAVF_TXD_DATA_QW1_L2TAG1_MASK \
515 (0xFFFFULL << IAVF_TXD_DATA_QW1_L2TAG1_SHIFT)
517 #define IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT (11)
518 #define IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_MASK \
519 (0x7UL << IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT)
521 #define IAVF_TXD_CTX_QW1_IPSEC_PARAMS_ICVLEN_SHIFT (14)
522 #define IAVF_TXD_CTX_QW1_IPSEC_PARAMS_ICVLEN_MASK \
523 (0xFUL << IAVF_TXD_CTX_QW1_IPSEC_PARAMS_ICVLEN_SHIFT)
525 #define IAVF_TXD_CTX_QW1_SEG_PARAMS_TLEN_SHIFT (30)
526 #define IAVF_TXD_CTX_QW1_SEG_PARAMS_TLEN_MASK \
527 (0x3FFFFUL << IAVF_TXD_CTX_QW1_SEG_PARAMS_TLEN_SHIFT)
529 #define IAVF_TXD_CTX_QW1_TSYNC_PARAMS_TLEN_SHIFT (30)
530 #define IAVF_TXD_CTX_QW1_TSYNC_PARAMS_TLEN_MASK \
531 (0x3FUL << IAVF_TXD_CTX_QW1_SEG_PARAMS_TLEN_SHIFT)
533 #define IAVF_TXD_CTX_QW1_SEG_PARAMS_MSS_SHIFT (50)
534 #define IAVF_TXD_CTX_QW1_SEG_PARAMS_MSS_MASK \
535 (0x3FFFUL << IAVF_TXD_CTX_QW1_SEG_PARAMS_MSS_SHIFT)
537 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPT_SHIFT (0)
538 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPT_MASK (0x3UL)
540 enum iavf_tx_ctx_desc_tunnel_external_ip_type {
541 IAVF_TX_CTX_DESC_EIPT_NONE,
542 IAVF_TX_CTX_DESC_EIPT_IPV6,
543 IAVF_TX_CTX_DESC_EIPT_IPV4_NO_CHECKSUM_OFFLOAD,
544 IAVF_TX_CTX_DESC_EIPT_IPV4_CHECKSUM_OFFLOAD
547 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPLEN_SHIFT (2)
548 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIPLEN_MASK (0x7FUL)
550 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4TUNT_SHIFT (9)
551 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4TUNT_MASK (0x3UL)
553 enum iavf_tx_ctx_desc_tunnel_l4_tunnel_type {
554 IAVF_TX_CTX_DESC_L4_TUN_TYP_NO_UDP_GRE,
555 IAVF_TX_CTX_DESC_L4_TUN_TYP_UDP,
556 IAVF_TX_CTX_DESC_L4_TUN_TYP_GRE
559 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIP_NOINC_SHIFT (11)
560 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_EIP_NOINC_MASK (0x1UL)
562 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4TUNLEN_SHIFT (12)
563 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4TUNLEN_MASK (0x7FUL)
565 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_DECTTL_SHIFT (19)
566 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_DECTTL_MASK (0xFUL)
568 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4T_CS_SHIFT (23)
569 #define IAVF_TXD_CTX_QW0_TUN_PARAMS_L4T_CS_MASK (0x1UL)
571 #define IAVF_TXD_CTX_QW0_L2TAG2_PARAM (32)
572 #define IAVF_TXD_CTX_QW0_L2TAG2_MASK (0xFFFFUL)
575 #define IAVF_RX_FLEX_DESC_IPSEC_CRYPTO_SAID_MASK (0xFFFFF)
577 /* for iavf_32b_rx_flex_desc.ptype_flex_flags0 member */
578 #define IAVF_RX_FLEX_DESC_PTYPE_M (0x3FF) /* 10-bits */
581 /* for iavf_32b_rx_flex_desc.ptype_flex_flags0 member */
582 #define IAVF_RX_FLEX_DESC_PTYPE_M (0x3FF) /* 10-bits */
584 /* for iavf_32b_rx_flex_desc.pkt_len member */
585 #define IAVF_RX_FLX_DESC_PKT_LEN_M (0x3FFF) /* 14-bits */
587 int iavf_dev_rx_queue_setup(struct rte_eth_dev *dev,
590 unsigned int socket_id,
591 const struct rte_eth_rxconf *rx_conf,
592 struct rte_mempool *mp);
594 int iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
595 int iavf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
596 void iavf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
598 int iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
601 unsigned int socket_id,
602 const struct rte_eth_txconf *tx_conf);
603 int iavf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
604 int iavf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
605 int iavf_dev_tx_done_cleanup(void *txq, uint32_t free_cnt);
606 void iavf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
607 void iavf_stop_queues(struct rte_eth_dev *dev);
608 uint16_t iavf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
610 uint16_t iavf_recv_pkts_flex_rxd(void *rx_queue,
611 struct rte_mbuf **rx_pkts,
613 uint16_t iavf_recv_scattered_pkts(void *rx_queue,
614 struct rte_mbuf **rx_pkts,
616 uint16_t iavf_recv_scattered_pkts_flex_rxd(void *rx_queue,
617 struct rte_mbuf **rx_pkts,
619 uint16_t iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
621 uint16_t iavf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
623 void iavf_set_rx_function(struct rte_eth_dev *dev);
624 void iavf_set_tx_function(struct rte_eth_dev *dev);
625 void iavf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
626 struct rte_eth_rxq_info *qinfo);
627 void iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
628 struct rte_eth_txq_info *qinfo);
629 uint32_t iavf_dev_rxq_count(void *rx_queue);
630 int iavf_dev_rx_desc_status(void *rx_queue, uint16_t offset);
631 int iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset);
633 uint16_t iavf_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
635 uint16_t iavf_recv_pkts_vec_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
637 uint16_t iavf_recv_scattered_pkts_vec(void *rx_queue,
638 struct rte_mbuf **rx_pkts,
640 uint16_t iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue,
641 struct rte_mbuf **rx_pkts,
643 uint16_t iavf_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
645 uint16_t iavf_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
647 uint16_t iavf_recv_pkts_vec_avx2_flex_rxd(void *rx_queue,
648 struct rte_mbuf **rx_pkts,
650 uint16_t iavf_recv_scattered_pkts_vec_avx2(void *rx_queue,
651 struct rte_mbuf **rx_pkts,
653 uint16_t iavf_recv_scattered_pkts_vec_avx2_flex_rxd(void *rx_queue,
654 struct rte_mbuf **rx_pkts,
656 uint16_t iavf_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
658 uint16_t iavf_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
660 int iavf_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);
661 int iavf_rx_vec_dev_check(struct rte_eth_dev *dev);
662 int iavf_tx_vec_dev_check(struct rte_eth_dev *dev);
663 int iavf_rxq_vec_setup(struct iavf_rx_queue *rxq);
664 int iavf_txq_vec_setup(struct iavf_tx_queue *txq);
665 uint16_t iavf_recv_pkts_vec_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
667 uint16_t iavf_recv_pkts_vec_avx512_offload(void *rx_queue,
668 struct rte_mbuf **rx_pkts,
670 uint16_t iavf_recv_pkts_vec_avx512_flex_rxd(void *rx_queue,
671 struct rte_mbuf **rx_pkts,
673 uint16_t iavf_recv_pkts_vec_avx512_flex_rxd_offload(void *rx_queue,
674 struct rte_mbuf **rx_pkts,
676 uint16_t iavf_recv_scattered_pkts_vec_avx512(void *rx_queue,
677 struct rte_mbuf **rx_pkts,
679 uint16_t iavf_recv_scattered_pkts_vec_avx512_offload(void *rx_queue,
680 struct rte_mbuf **rx_pkts,
682 uint16_t iavf_recv_scattered_pkts_vec_avx512_flex_rxd(void *rx_queue,
683 struct rte_mbuf **rx_pkts,
685 uint16_t iavf_recv_scattered_pkts_vec_avx512_flex_rxd_offload(void *rx_queue,
686 struct rte_mbuf **rx_pkts,
688 uint16_t iavf_xmit_pkts_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
690 uint16_t iavf_xmit_pkts_vec_avx512_offload(void *tx_queue,
691 struct rte_mbuf **tx_pkts,
693 int iavf_txq_vec_setup_avx512(struct iavf_tx_queue *txq);
695 uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t xtr_type);
697 void iavf_set_default_ptype_table(struct rte_eth_dev *dev);
700 void iavf_dump_rx_descriptor(struct iavf_rx_queue *rxq,
701 const volatile void *desc,
704 #ifdef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
705 const volatile union iavf_16byte_rx_desc *rx_desc = desc;
707 printf("Queue %d Rx_desc %d: QW0: 0x%016"PRIx64" QW1: 0x%016"PRIx64"\n",
708 rxq->queue_id, rx_id, rx_desc->read.pkt_addr,
709 rx_desc->read.hdr_addr);
711 const volatile union iavf_32byte_rx_desc *rx_desc = desc;
713 printf("Queue %d Rx_desc %d: QW0: 0x%016"PRIx64" QW1: 0x%016"PRIx64
714 " QW2: 0x%016"PRIx64" QW3: 0x%016"PRIx64"\n", rxq->queue_id,
715 rx_id, rx_desc->read.pkt_addr, rx_desc->read.hdr_addr,
716 rx_desc->read.rsvd1, rx_desc->read.rsvd2);
720 /* All the descriptors are 16 bytes, so just use one of them
721 * to print the qwords
724 void iavf_dump_tx_descriptor(const struct iavf_tx_queue *txq,
725 const volatile void *desc, uint16_t tx_id)
728 const volatile struct iavf_tx_desc *tx_desc = desc;
729 enum iavf_tx_desc_dtype_value type;
732 type = (enum iavf_tx_desc_dtype_value)
733 rte_le_to_cpu_64(tx_desc->cmd_type_offset_bsz &
734 rte_cpu_to_le_64(IAVF_TXD_DATA_QW1_DTYPE_MASK));
736 case IAVF_TX_DESC_DTYPE_DATA:
737 name = "Tx_data_desc";
739 case IAVF_TX_DESC_DTYPE_CONTEXT:
740 name = "Tx_context_desc";
742 case IAVF_TX_DESC_DTYPE_IPSEC:
743 name = "Tx_IPsec_desc";
746 name = "unknown_desc";
750 printf("Queue %d %s %d: QW0: 0x%016"PRIx64" QW1: 0x%016"PRIx64"\n",
751 txq->queue_id, name, tx_id, tx_desc->buffer_addr,
752 tx_desc->cmd_type_offset_bsz);
755 #define FDIR_PROC_ENABLE_PER_QUEUE(ad, on) do { \
757 for (i = 0; i < (ad)->dev_data->nb_rx_queues; i++) { \
758 struct iavf_rx_queue *rxq = (ad)->dev_data->rx_queues[i]; \
761 rxq->fdir_enabled = on; \
763 PMD_DRV_LOG(DEBUG, "FDIR processing on RX set to %d", on); \
766 /* Enable/disable flow director Rx processing in data path. */
768 void iavf_fdir_rx_proc_enable(struct iavf_adapter *ad, bool on)
771 /* enable flow director processing */
772 FDIR_PROC_ENABLE_PER_QUEUE(ad, on);
775 if (ad->fdir_ref_cnt >= 1) {
778 if (ad->fdir_ref_cnt == 0)
779 FDIR_PROC_ENABLE_PER_QUEUE(ad, on);
785 uint64_t iavf_tstamp_convert_32b_64b(uint64_t time, uint32_t in_timestamp)
787 const uint64_t mask = 0xFFFFFFFF;
791 delta = (in_timestamp - (uint32_t)(time & mask));
792 if (delta > (mask / 2)) {
793 delta = ((uint32_t)(time & mask) - in_timestamp);
802 #ifdef RTE_LIBRTE_IAVF_DEBUG_DUMP_DESC
803 #define IAVF_DUMP_RX_DESC(rxq, desc, rx_id) \
804 iavf_dump_rx_descriptor(rxq, desc, rx_id)
805 #define IAVF_DUMP_TX_DESC(txq, desc, tx_id) \
806 iavf_dump_tx_descriptor(txq, desc, tx_id)
808 #define IAVF_DUMP_RX_DESC(rxq, desc, rx_id) do { } while (0)
809 #define IAVF_DUMP_TX_DESC(txq, desc, tx_id) do { } while (0)
812 #endif /* _IAVF_RXTX_H_ */