1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
13 #include <sys/queue.h>
15 #include <rte_string_fns.h>
16 #include <rte_memzone.h>
18 #include <rte_malloc.h>
19 #include <rte_ether.h>
20 #include <rte_ethdev_driver.h>
28 #include "iavf_rxtx.h"
31 check_rx_thresh(uint16_t nb_desc, uint16_t thresh)
33 /* The following constraints must be satisfied:
34 * thresh < rxq->nb_rx_desc
36 if (thresh >= nb_desc) {
37 PMD_INIT_LOG(ERR, "rx_free_thresh (%u) must be less than %u",
45 check_tx_thresh(uint16_t nb_desc, uint16_t tx_rs_thresh,
46 uint16_t tx_free_thresh)
48 /* TX descriptors will have their RS bit set after tx_rs_thresh
49 * descriptors have been used. The TX descriptor ring will be cleaned
50 * after tx_free_thresh descriptors are used or if the number of
51 * descriptors required to transmit a packet is greater than the
52 * number of free TX descriptors.
54 * The following constraints must be satisfied:
55 * - tx_rs_thresh must be less than the size of the ring minus 2.
56 * - tx_free_thresh must be less than the size of the ring minus 3.
57 * - tx_rs_thresh must be less than or equal to tx_free_thresh.
58 * - tx_rs_thresh must be a divisor of the ring size.
60 * One descriptor in the TX ring is used as a sentinel to avoid a H/W
61 * race condition, hence the maximum threshold constraints. When set
62 * to zero use default values.
64 if (tx_rs_thresh >= (nb_desc - 2)) {
65 PMD_INIT_LOG(ERR, "tx_rs_thresh (%u) must be less than the "
66 "number of TX descriptors (%u) minus 2",
67 tx_rs_thresh, nb_desc);
70 if (tx_free_thresh >= (nb_desc - 3)) {
71 PMD_INIT_LOG(ERR, "tx_free_thresh (%u) must be less than the "
72 "number of TX descriptors (%u) minus 3.",
73 tx_free_thresh, nb_desc);
76 if (tx_rs_thresh > tx_free_thresh) {
77 PMD_INIT_LOG(ERR, "tx_rs_thresh (%u) must be less than or "
78 "equal to tx_free_thresh (%u).",
79 tx_rs_thresh, tx_free_thresh);
82 if ((nb_desc % tx_rs_thresh) != 0) {
83 PMD_INIT_LOG(ERR, "tx_rs_thresh (%u) must be a divisor of the "
84 "number of TX descriptors (%u).",
85 tx_rs_thresh, nb_desc);
93 check_rx_vec_allow(struct iavf_rx_queue *rxq)
95 if (rxq->rx_free_thresh >= IAVF_VPMD_RX_MAX_BURST &&
96 rxq->nb_rx_desc % rxq->rx_free_thresh == 0) {
97 PMD_INIT_LOG(DEBUG, "Vector Rx can be enabled on this rxq.");
101 PMD_INIT_LOG(DEBUG, "Vector Rx cannot be enabled on this rxq.");
106 check_tx_vec_allow(struct iavf_tx_queue *txq)
108 if (!(txq->offloads & IAVF_NO_VECTOR_FLAGS) &&
109 txq->rs_thresh >= IAVF_VPMD_TX_MAX_BURST &&
110 txq->rs_thresh <= IAVF_VPMD_TX_MAX_FREE_BUF) {
111 PMD_INIT_LOG(DEBUG, "Vector tx can be enabled on this txq.");
114 PMD_INIT_LOG(DEBUG, "Vector Tx cannot be enabled on this txq.");
119 check_rx_bulk_allow(struct iavf_rx_queue *rxq)
123 if (!(rxq->rx_free_thresh >= IAVF_RX_MAX_BURST)) {
124 PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
125 "rxq->rx_free_thresh=%d, "
126 "IAVF_RX_MAX_BURST=%d",
127 rxq->rx_free_thresh, IAVF_RX_MAX_BURST);
129 } else if (rxq->nb_rx_desc % rxq->rx_free_thresh != 0) {
130 PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
131 "rxq->nb_rx_desc=%d, "
132 "rxq->rx_free_thresh=%d",
133 rxq->nb_rx_desc, rxq->rx_free_thresh);
140 reset_rx_queue(struct iavf_rx_queue *rxq)
148 len = rxq->nb_rx_desc + IAVF_RX_MAX_BURST;
150 for (i = 0; i < len * sizeof(union iavf_rx_desc); i++)
151 ((volatile char *)rxq->rx_ring)[i] = 0;
153 memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
155 for (i = 0; i < IAVF_RX_MAX_BURST; i++)
156 rxq->sw_ring[rxq->nb_rx_desc + i] = &rxq->fake_mbuf;
159 rxq->rx_nb_avail = 0;
160 rxq->rx_next_avail = 0;
161 rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
165 rxq->pkt_first_seg = NULL;
166 rxq->pkt_last_seg = NULL;
170 reset_tx_queue(struct iavf_tx_queue *txq)
172 struct iavf_tx_entry *txe;
177 PMD_DRV_LOG(DEBUG, "Pointer to txq is NULL");
182 size = sizeof(struct iavf_tx_desc) * txq->nb_tx_desc;
183 for (i = 0; i < size; i++)
184 ((volatile char *)txq->tx_ring)[i] = 0;
186 prev = (uint16_t)(txq->nb_tx_desc - 1);
187 for (i = 0; i < txq->nb_tx_desc; i++) {
188 txq->tx_ring[i].cmd_type_offset_bsz =
189 rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
192 txe[prev].next_id = i;
199 txq->last_desc_cleaned = txq->nb_tx_desc - 1;
200 txq->nb_free = txq->nb_tx_desc - 1;
202 txq->next_dd = txq->rs_thresh - 1;
203 txq->next_rs = txq->rs_thresh - 1;
207 alloc_rxq_mbufs(struct iavf_rx_queue *rxq)
209 volatile union iavf_rx_desc *rxd;
210 struct rte_mbuf *mbuf = NULL;
214 for (i = 0; i < rxq->nb_rx_desc; i++) {
215 mbuf = rte_mbuf_raw_alloc(rxq->mp);
216 if (unlikely(!mbuf)) {
217 PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX");
221 rte_mbuf_refcnt_set(mbuf, 1);
223 mbuf->data_off = RTE_PKTMBUF_HEADROOM;
225 mbuf->port = rxq->port_id;
228 rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
230 rxd = &rxq->rx_ring[i];
231 rxd->read.pkt_addr = dma_addr;
232 rxd->read.hdr_addr = 0;
233 #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
238 rxq->sw_ring[i] = mbuf;
245 release_rxq_mbufs(struct iavf_rx_queue *rxq)
252 for (i = 0; i < rxq->nb_rx_desc; i++) {
253 if (rxq->sw_ring[i]) {
254 rte_pktmbuf_free_seg(rxq->sw_ring[i]);
255 rxq->sw_ring[i] = NULL;
260 if (rxq->rx_nb_avail == 0)
262 for (i = 0; i < rxq->rx_nb_avail; i++) {
263 struct rte_mbuf *mbuf;
265 mbuf = rxq->rx_stage[rxq->rx_next_avail + i];
266 rte_pktmbuf_free_seg(mbuf);
268 rxq->rx_nb_avail = 0;
272 release_txq_mbufs(struct iavf_tx_queue *txq)
276 if (!txq || !txq->sw_ring) {
277 PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL");
281 for (i = 0; i < txq->nb_tx_desc; i++) {
282 if (txq->sw_ring[i].mbuf) {
283 rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
284 txq->sw_ring[i].mbuf = NULL;
289 static const struct iavf_rxq_ops def_rxq_ops = {
290 .release_mbufs = release_rxq_mbufs,
293 static const struct iavf_txq_ops def_txq_ops = {
294 .release_mbufs = release_txq_mbufs,
298 iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
299 uint16_t nb_desc, unsigned int socket_id,
300 const struct rte_eth_rxconf *rx_conf,
301 struct rte_mempool *mp)
303 struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
304 struct iavf_adapter *ad =
305 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
306 struct iavf_info *vf =
307 IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
308 struct iavf_vsi *vsi = &vf->vsi;
309 struct iavf_rx_queue *rxq;
310 const struct rte_memzone *mz;
313 uint16_t rx_free_thresh;
315 PMD_INIT_FUNC_TRACE();
317 if (nb_desc % IAVF_ALIGN_RING_DESC != 0 ||
318 nb_desc > IAVF_MAX_RING_DESC ||
319 nb_desc < IAVF_MIN_RING_DESC) {
320 PMD_INIT_LOG(ERR, "Number (%u) of receive descriptors is "
325 /* Check free threshold */
326 rx_free_thresh = (rx_conf->rx_free_thresh == 0) ?
327 IAVF_DEFAULT_RX_FREE_THRESH :
328 rx_conf->rx_free_thresh;
329 if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
332 /* Free memory if needed */
333 if (dev->data->rx_queues[queue_idx]) {
334 iavf_dev_rx_queue_release(dev->data->rx_queues[queue_idx]);
335 dev->data->rx_queues[queue_idx] = NULL;
338 /* Allocate the rx queue data structure */
339 rxq = rte_zmalloc_socket("iavf rxq",
340 sizeof(struct iavf_rx_queue),
344 PMD_INIT_LOG(ERR, "Failed to allocate memory for "
345 "rx queue data structure");
349 if (vf->vf_res->vf_cap_flags &
350 VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
351 vf->supported_rxdid & BIT(IAVF_RXDID_COMMS_OVS_1)) {
352 rxq->rxdid = IAVF_RXDID_COMMS_OVS_1;
354 rxq->rxdid = IAVF_RXDID_LEGACY_1;
358 rxq->nb_rx_desc = nb_desc;
359 rxq->rx_free_thresh = rx_free_thresh;
360 rxq->queue_id = queue_idx;
361 rxq->port_id = dev->data->port_id;
362 rxq->crc_len = 0; /* crc stripping by default */
363 rxq->rx_deferred_start = rx_conf->rx_deferred_start;
367 len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
368 rxq->rx_buf_len = RTE_ALIGN(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT));
370 /* Allocate the software ring. */
371 len = nb_desc + IAVF_RX_MAX_BURST;
373 rte_zmalloc_socket("iavf rx sw ring",
374 sizeof(struct rte_mbuf *) * len,
378 PMD_INIT_LOG(ERR, "Failed to allocate memory for SW ring");
383 /* Allocate the maximun number of RX ring hardware descriptor with
384 * a liitle more to support bulk allocate.
386 len = IAVF_MAX_RING_DESC + IAVF_RX_MAX_BURST;
387 ring_size = RTE_ALIGN(len * sizeof(union iavf_rx_desc),
389 mz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx,
390 ring_size, IAVF_RING_BASE_ALIGN,
393 PMD_INIT_LOG(ERR, "Failed to reserve DMA memory for RX");
394 rte_free(rxq->sw_ring);
398 /* Zero all the descriptors in the ring. */
399 memset(mz->addr, 0, ring_size);
400 rxq->rx_ring_phys_addr = mz->iova;
401 rxq->rx_ring = (union iavf_rx_desc *)mz->addr;
406 dev->data->rx_queues[queue_idx] = rxq;
407 rxq->qrx_tail = hw->hw_addr + IAVF_QRX_TAIL1(rxq->queue_id);
408 rxq->ops = &def_rxq_ops;
410 if (check_rx_bulk_allow(rxq) == true) {
411 PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are "
412 "satisfied. Rx Burst Bulk Alloc function will be "
413 "used on port=%d, queue=%d.",
414 rxq->port_id, rxq->queue_id);
416 PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are "
417 "not satisfied, Scattered Rx is requested "
418 "on port=%d, queue=%d.",
419 rxq->port_id, rxq->queue_id);
420 ad->rx_bulk_alloc_allowed = false;
423 if (check_rx_vec_allow(rxq) == false)
424 ad->rx_vec_allowed = false;
430 iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
433 unsigned int socket_id,
434 const struct rte_eth_txconf *tx_conf)
436 struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
437 struct iavf_tx_queue *txq;
438 const struct rte_memzone *mz;
440 uint16_t tx_rs_thresh, tx_free_thresh;
443 PMD_INIT_FUNC_TRACE();
445 offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads;
447 if (nb_desc % IAVF_ALIGN_RING_DESC != 0 ||
448 nb_desc > IAVF_MAX_RING_DESC ||
449 nb_desc < IAVF_MIN_RING_DESC) {
450 PMD_INIT_LOG(ERR, "Number (%u) of transmit descriptors is "
455 tx_rs_thresh = (uint16_t)((tx_conf->tx_rs_thresh) ?
456 tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH);
457 tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
458 tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH);
459 check_tx_thresh(nb_desc, tx_rs_thresh, tx_rs_thresh);
461 /* Free memory if needed. */
462 if (dev->data->tx_queues[queue_idx]) {
463 iavf_dev_tx_queue_release(dev->data->tx_queues[queue_idx]);
464 dev->data->tx_queues[queue_idx] = NULL;
467 /* Allocate the TX queue data structure. */
468 txq = rte_zmalloc_socket("iavf txq",
469 sizeof(struct iavf_tx_queue),
473 PMD_INIT_LOG(ERR, "Failed to allocate memory for "
474 "tx queue structure");
478 txq->nb_tx_desc = nb_desc;
479 txq->rs_thresh = tx_rs_thresh;
480 txq->free_thresh = tx_free_thresh;
481 txq->queue_id = queue_idx;
482 txq->port_id = dev->data->port_id;
483 txq->offloads = offloads;
484 txq->tx_deferred_start = tx_conf->tx_deferred_start;
486 /* Allocate software ring */
488 rte_zmalloc_socket("iavf tx sw ring",
489 sizeof(struct iavf_tx_entry) * nb_desc,
493 PMD_INIT_LOG(ERR, "Failed to allocate memory for SW TX ring");
498 /* Allocate TX hardware ring descriptors. */
499 ring_size = sizeof(struct iavf_tx_desc) * IAVF_MAX_RING_DESC;
500 ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
501 mz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
502 ring_size, IAVF_RING_BASE_ALIGN,
505 PMD_INIT_LOG(ERR, "Failed to reserve DMA memory for TX");
506 rte_free(txq->sw_ring);
510 txq->tx_ring_phys_addr = mz->iova;
511 txq->tx_ring = (struct iavf_tx_desc *)mz->addr;
516 dev->data->tx_queues[queue_idx] = txq;
517 txq->qtx_tail = hw->hw_addr + IAVF_QTX_TAIL1(queue_idx);
518 txq->ops = &def_txq_ops;
520 if (check_tx_vec_allow(txq) == false) {
521 struct iavf_adapter *ad =
522 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
523 ad->tx_vec_allowed = false;
530 iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
532 struct iavf_adapter *adapter =
533 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
534 struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
535 struct iavf_rx_queue *rxq;
538 PMD_DRV_FUNC_TRACE();
540 if (rx_queue_id >= dev->data->nb_rx_queues)
543 rxq = dev->data->rx_queues[rx_queue_id];
545 err = alloc_rxq_mbufs(rxq);
547 PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf");
553 /* Init the RX tail register. */
554 IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
555 IAVF_WRITE_FLUSH(hw);
557 /* Ready to switch the queue on */
558 err = iavf_switch_queue(adapter, rx_queue_id, true, true);
560 PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on",
563 dev->data->rx_queue_state[rx_queue_id] =
564 RTE_ETH_QUEUE_STATE_STARTED;
570 iavf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
572 struct iavf_adapter *adapter =
573 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
574 struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
575 struct iavf_tx_queue *txq;
578 PMD_DRV_FUNC_TRACE();
580 if (tx_queue_id >= dev->data->nb_tx_queues)
583 txq = dev->data->tx_queues[tx_queue_id];
585 /* Init the RX tail register. */
586 IAVF_PCI_REG_WRITE(txq->qtx_tail, 0);
587 IAVF_WRITE_FLUSH(hw);
589 /* Ready to switch the queue on */
590 err = iavf_switch_queue(adapter, tx_queue_id, false, true);
593 PMD_DRV_LOG(ERR, "Failed to switch TX queue %u on",
596 dev->data->tx_queue_state[tx_queue_id] =
597 RTE_ETH_QUEUE_STATE_STARTED;
603 iavf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
605 struct iavf_adapter *adapter =
606 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
607 struct iavf_rx_queue *rxq;
610 PMD_DRV_FUNC_TRACE();
612 if (rx_queue_id >= dev->data->nb_rx_queues)
615 err = iavf_switch_queue(adapter, rx_queue_id, true, false);
617 PMD_DRV_LOG(ERR, "Failed to switch RX queue %u off",
622 rxq = dev->data->rx_queues[rx_queue_id];
623 rxq->ops->release_mbufs(rxq);
625 dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
631 iavf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
633 struct iavf_adapter *adapter =
634 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
635 struct iavf_tx_queue *txq;
638 PMD_DRV_FUNC_TRACE();
640 if (tx_queue_id >= dev->data->nb_tx_queues)
643 err = iavf_switch_queue(adapter, tx_queue_id, false, false);
645 PMD_DRV_LOG(ERR, "Failed to switch TX queue %u off",
650 txq = dev->data->tx_queues[tx_queue_id];
651 txq->ops->release_mbufs(txq);
653 dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
659 iavf_dev_rx_queue_release(void *rxq)
661 struct iavf_rx_queue *q = (struct iavf_rx_queue *)rxq;
666 q->ops->release_mbufs(q);
667 rte_free(q->sw_ring);
668 rte_memzone_free(q->mz);
673 iavf_dev_tx_queue_release(void *txq)
675 struct iavf_tx_queue *q = (struct iavf_tx_queue *)txq;
680 q->ops->release_mbufs(q);
681 rte_free(q->sw_ring);
682 rte_memzone_free(q->mz);
687 iavf_stop_queues(struct rte_eth_dev *dev)
689 struct iavf_adapter *adapter =
690 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
691 struct iavf_rx_queue *rxq;
692 struct iavf_tx_queue *txq;
695 /* Stop All queues */
696 ret = iavf_disable_queues(adapter);
698 PMD_DRV_LOG(WARNING, "Fail to stop queues");
700 for (i = 0; i < dev->data->nb_tx_queues; i++) {
701 txq = dev->data->tx_queues[i];
704 txq->ops->release_mbufs(txq);
706 dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
708 for (i = 0; i < dev->data->nb_rx_queues; i++) {
709 rxq = dev->data->rx_queues[i];
712 rxq->ops->release_mbufs(rxq);
714 dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
719 iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union iavf_rx_desc *rxdp)
721 if (rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len) &
722 (1 << IAVF_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
723 mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
725 rte_le_to_cpu_16(rxdp->wb.qword0.lo_dword.l2tag1);
732 iavf_flex_rxd_to_vlan_tci(struct rte_mbuf *mb,
733 volatile union iavf_rx_flex_desc *rxdp)
735 if (rte_le_to_cpu_64(rxdp->wb.status_error0) &
736 (1 << IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S)) {
737 mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
739 rte_le_to_cpu_16(rxdp->wb.l2tag1);
745 /* Translate the rx descriptor status and error fields to pkt flags */
746 static inline uint64_t
747 iavf_rxd_to_pkt_flags(uint64_t qword)
750 uint64_t error_bits = (qword >> IAVF_RXD_QW1_ERROR_SHIFT);
752 #define IAVF_RX_ERR_BITS 0x3f
754 /* Check if RSS_HASH */
755 flags = (((qword >> IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT) &
756 IAVF_RX_DESC_FLTSTAT_RSS_HASH) ==
757 IAVF_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0;
759 /* Check if FDIR Match */
760 flags |= (qword & (1 << IAVF_RX_DESC_STATUS_FLM_SHIFT) ?
763 if (likely((error_bits & IAVF_RX_ERR_BITS) == 0)) {
764 flags |= (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD);
768 if (unlikely(error_bits & (1 << IAVF_RX_DESC_ERROR_IPE_SHIFT)))
769 flags |= PKT_RX_IP_CKSUM_BAD;
771 flags |= PKT_RX_IP_CKSUM_GOOD;
773 if (unlikely(error_bits & (1 << IAVF_RX_DESC_ERROR_L4E_SHIFT)))
774 flags |= PKT_RX_L4_CKSUM_BAD;
776 flags |= PKT_RX_L4_CKSUM_GOOD;
778 /* TODO: Oversize error bit is not processed here */
783 static inline uint64_t
784 iavf_rxd_build_fdir(volatile union iavf_rx_desc *rxdp, struct rte_mbuf *mb)
787 #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
790 flexbh = (rte_le_to_cpu_32(rxdp->wb.qword2.ext_status) >>
791 IAVF_RX_DESC_EXT_STATUS_FLEXBH_SHIFT) &
792 IAVF_RX_DESC_EXT_STATUS_FLEXBH_MASK;
794 if (flexbh == IAVF_RX_DESC_EXT_STATUS_FLEXBH_FD_ID) {
796 rte_le_to_cpu_32(rxdp->wb.qword3.hi_dword.fd_id);
797 flags |= PKT_RX_FDIR_ID;
801 rte_le_to_cpu_32(rxdp->wb.qword0.hi_dword.fd_id);
802 flags |= PKT_RX_FDIR_ID;
808 /* Translate the rx flex descriptor status to pkt flags */
810 iavf_rxd_to_pkt_fields(struct rte_mbuf *mb,
811 volatile union iavf_rx_flex_desc *rxdp)
813 volatile struct iavf_32b_rx_flex_desc_comms_ovs *desc =
814 (volatile struct iavf_32b_rx_flex_desc_comms_ovs *)rxdp;
815 #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
818 stat_err = rte_le_to_cpu_16(desc->status_error0);
819 if (likely(stat_err & (1 << IAVF_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) {
820 mb->ol_flags |= PKT_RX_RSS_HASH;
821 mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash);
825 if (desc->flow_id != 0xFFFFFFFF) {
826 mb->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
827 mb->hash.fdir.hi = rte_le_to_cpu_32(desc->flow_id);
831 #define IAVF_RX_FLEX_ERR0_BITS \
832 ((1 << IAVF_RX_FLEX_DESC_STATUS0_HBO_S) | \
833 (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_IPE_S) | \
834 (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_L4E_S) | \
835 (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S) | \
836 (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S) | \
837 (1 << IAVF_RX_FLEX_DESC_STATUS0_RXE_S))
839 /* Rx L3/L4 checksum */
840 static inline uint64_t
841 iavf_flex_rxd_error_to_pkt_flags(uint16_t stat_err0)
845 /* check if HW has decoded the packet and checksum */
846 if (unlikely(!(stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_L3L4P_S))))
849 if (likely(!(stat_err0 & IAVF_RX_FLEX_ERR0_BITS))) {
850 flags |= (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD);
854 if (unlikely(stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_IPE_S)))
855 flags |= PKT_RX_IP_CKSUM_BAD;
857 flags |= PKT_RX_IP_CKSUM_GOOD;
859 if (unlikely(stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_L4E_S)))
860 flags |= PKT_RX_L4_CKSUM_BAD;
862 flags |= PKT_RX_L4_CKSUM_GOOD;
864 if (unlikely(stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))
865 flags |= PKT_RX_EIP_CKSUM_BAD;
870 /* If the number of free RX descriptors is greater than the RX free
871 * threshold of the queue, advance the Receive Descriptor Tail (RDT)
872 * register. Update the RDT with the value of the last processed RX
873 * descriptor minus 1, to guarantee that the RDT register is never
874 * equal to the RDH register, which creates a "full" ring situation
875 * from the hardware point of view.
878 iavf_update_rx_tail(struct iavf_rx_queue *rxq, uint16_t nb_hold, uint16_t rx_id)
880 nb_hold = (uint16_t)(nb_hold + rxq->nb_rx_hold);
882 if (nb_hold > rxq->rx_free_thresh) {
884 "port_id=%u queue_id=%u rx_tail=%u nb_hold=%u",
885 rxq->port_id, rxq->queue_id, rx_id, nb_hold);
886 rx_id = (uint16_t)((rx_id == 0) ?
887 (rxq->nb_rx_desc - 1) : (rx_id - 1));
888 IAVF_PCI_REG_WRITE(rxq->qrx_tail, rx_id);
891 rxq->nb_rx_hold = nb_hold;
894 /* implement recv_pkts */
896 iavf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
898 volatile union iavf_rx_desc *rx_ring;
899 volatile union iavf_rx_desc *rxdp;
900 struct iavf_rx_queue *rxq;
901 union iavf_rx_desc rxd;
902 struct rte_mbuf *rxe;
903 struct rte_eth_dev *dev;
904 struct rte_mbuf *rxm;
905 struct rte_mbuf *nmb;
909 uint16_t rx_packet_len;
910 uint16_t rx_id, nb_hold;
913 const uint32_t *ptype_tbl;
918 rx_id = rxq->rx_tail;
919 rx_ring = rxq->rx_ring;
920 ptype_tbl = rxq->vsi->adapter->ptype_tbl;
922 while (nb_rx < nb_pkts) {
923 rxdp = &rx_ring[rx_id];
924 qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
925 rx_status = (qword1 & IAVF_RXD_QW1_STATUS_MASK) >>
926 IAVF_RXD_QW1_STATUS_SHIFT;
928 /* Check the DD bit first */
929 if (!(rx_status & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT)))
931 IAVF_DUMP_RX_DESC(rxq, rxdp, rx_id);
933 nmb = rte_mbuf_raw_alloc(rxq->mp);
934 if (unlikely(!nmb)) {
935 dev = &rte_eth_devices[rxq->port_id];
936 dev->data->rx_mbuf_alloc_failed++;
937 PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
938 "queue_id=%u", rxq->port_id, rxq->queue_id);
944 rxe = rxq->sw_ring[rx_id];
946 if (unlikely(rx_id == rxq->nb_rx_desc))
949 /* Prefetch next mbuf */
950 rte_prefetch0(rxq->sw_ring[rx_id]);
952 /* When next RX descriptor is on a cache line boundary,
953 * prefetch the next 4 RX descriptors and next 8 pointers
956 if ((rx_id & 0x3) == 0) {
957 rte_prefetch0(&rx_ring[rx_id]);
958 rte_prefetch0(rxq->sw_ring[rx_id]);
962 rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
963 rxdp->read.hdr_addr = 0;
964 rxdp->read.pkt_addr = dma_addr;
966 rx_packet_len = ((qword1 & IAVF_RXD_QW1_LENGTH_PBUF_MASK) >>
967 IAVF_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;
969 rxm->data_off = RTE_PKTMBUF_HEADROOM;
970 rte_prefetch0(RTE_PTR_ADD(rxm->buf_addr, RTE_PKTMBUF_HEADROOM));
973 rxm->pkt_len = rx_packet_len;
974 rxm->data_len = rx_packet_len;
975 rxm->port = rxq->port_id;
977 iavf_rxd_to_vlan_tci(rxm, &rxd);
978 pkt_flags = iavf_rxd_to_pkt_flags(qword1);
980 ptype_tbl[(uint8_t)((qword1 &
981 IAVF_RXD_QW1_PTYPE_MASK) >> IAVF_RXD_QW1_PTYPE_SHIFT)];
983 if (pkt_flags & PKT_RX_RSS_HASH)
985 rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss);
987 if (pkt_flags & PKT_RX_FDIR)
988 pkt_flags |= iavf_rxd_build_fdir(&rxd, rxm);
990 rxm->ol_flags |= pkt_flags;
992 rx_pkts[nb_rx++] = rxm;
994 rxq->rx_tail = rx_id;
996 iavf_update_rx_tail(rxq, nb_hold, rx_id);
1001 /* implement recv_pkts for flexible Rx descriptor */
1003 iavf_recv_pkts_flex_rxd(void *rx_queue,
1004 struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
1006 volatile union iavf_rx_desc *rx_ring;
1007 volatile union iavf_rx_flex_desc *rxdp;
1008 struct iavf_rx_queue *rxq;
1009 union iavf_rx_flex_desc rxd;
1010 struct rte_mbuf *rxe;
1011 struct rte_eth_dev *dev;
1012 struct rte_mbuf *rxm;
1013 struct rte_mbuf *nmb;
1015 uint16_t rx_stat_err0;
1016 uint16_t rx_packet_len;
1017 uint16_t rx_id, nb_hold;
1020 const uint32_t *ptype_tbl;
1025 rx_id = rxq->rx_tail;
1026 rx_ring = rxq->rx_ring;
1027 ptype_tbl = rxq->vsi->adapter->ptype_tbl;
1029 while (nb_rx < nb_pkts) {
1030 rxdp = (volatile union iavf_rx_flex_desc *)&rx_ring[rx_id];
1031 rx_stat_err0 = rte_le_to_cpu_16(rxdp->wb.status_error0);
1033 /* Check the DD bit first */
1034 if (!(rx_stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_DD_S)))
1036 IAVF_DUMP_RX_DESC(rxq, rxdp, rx_id);
1038 nmb = rte_mbuf_raw_alloc(rxq->mp);
1039 if (unlikely(!nmb)) {
1040 dev = &rte_eth_devices[rxq->port_id];
1041 dev->data->rx_mbuf_alloc_failed++;
1042 PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
1043 "queue_id=%u", rxq->port_id, rxq->queue_id);
1049 rxe = rxq->sw_ring[rx_id];
1051 if (unlikely(rx_id == rxq->nb_rx_desc))
1054 /* Prefetch next mbuf */
1055 rte_prefetch0(rxq->sw_ring[rx_id]);
1057 /* When next RX descriptor is on a cache line boundary,
1058 * prefetch the next 4 RX descriptors and next 8 pointers
1061 if ((rx_id & 0x3) == 0) {
1062 rte_prefetch0(&rx_ring[rx_id]);
1063 rte_prefetch0(rxq->sw_ring[rx_id]);
1067 rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
1068 rxdp->read.hdr_addr = 0;
1069 rxdp->read.pkt_addr = dma_addr;
1071 rx_packet_len = (rte_le_to_cpu_16(rxd.wb.pkt_len) &
1072 IAVF_RX_FLX_DESC_PKT_LEN_M) - rxq->crc_len;
1074 rxm->data_off = RTE_PKTMBUF_HEADROOM;
1075 rte_prefetch0(RTE_PTR_ADD(rxm->buf_addr, RTE_PKTMBUF_HEADROOM));
1078 rxm->pkt_len = rx_packet_len;
1079 rxm->data_len = rx_packet_len;
1080 rxm->port = rxq->port_id;
1082 rxm->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
1083 rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
1084 iavf_flex_rxd_to_vlan_tci(rxm, &rxd);
1085 iavf_rxd_to_pkt_fields(rxm, &rxd);
1086 pkt_flags = iavf_flex_rxd_error_to_pkt_flags(rx_stat_err0);
1087 rxm->ol_flags |= pkt_flags;
1089 rx_pkts[nb_rx++] = rxm;
1091 rxq->rx_tail = rx_id;
1093 iavf_update_rx_tail(rxq, nb_hold, rx_id);
1098 /* implement recv_scattered_pkts for flexible Rx descriptor */
1100 iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
1103 struct iavf_rx_queue *rxq = rx_queue;
1104 union iavf_rx_flex_desc rxd;
1105 struct rte_mbuf *rxe;
1106 struct rte_mbuf *first_seg = rxq->pkt_first_seg;
1107 struct rte_mbuf *last_seg = rxq->pkt_last_seg;
1108 struct rte_mbuf *nmb, *rxm;
1109 uint16_t rx_id = rxq->rx_tail;
1110 uint16_t nb_rx = 0, nb_hold = 0, rx_packet_len;
1111 struct rte_eth_dev *dev;
1112 uint16_t rx_stat_err0;
1116 volatile union iavf_rx_desc *rx_ring = rxq->rx_ring;
1117 volatile union iavf_rx_flex_desc *rxdp;
1118 const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
1120 while (nb_rx < nb_pkts) {
1121 rxdp = (volatile union iavf_rx_flex_desc *)&rx_ring[rx_id];
1122 rx_stat_err0 = rte_le_to_cpu_16(rxdp->wb.status_error0);
1124 /* Check the DD bit */
1125 if (!(rx_stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_DD_S)))
1127 IAVF_DUMP_RX_DESC(rxq, rxdp, rx_id);
1129 nmb = rte_mbuf_raw_alloc(rxq->mp);
1130 if (unlikely(!nmb)) {
1131 PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
1132 "queue_id=%u", rxq->port_id, rxq->queue_id);
1133 dev = &rte_eth_devices[rxq->port_id];
1134 dev->data->rx_mbuf_alloc_failed++;
1140 rxe = rxq->sw_ring[rx_id];
1142 if (rx_id == rxq->nb_rx_desc)
1145 /* Prefetch next mbuf */
1146 rte_prefetch0(rxq->sw_ring[rx_id]);
1148 /* When next RX descriptor is on a cache line boundary,
1149 * prefetch the next 4 RX descriptors and next 8 pointers
1152 if ((rx_id & 0x3) == 0) {
1153 rte_prefetch0(&rx_ring[rx_id]);
1154 rte_prefetch0(rxq->sw_ring[rx_id]);
1159 rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
1161 /* Set data buffer address and data length of the mbuf */
1162 rxdp->read.hdr_addr = 0;
1163 rxdp->read.pkt_addr = dma_addr;
1164 rx_packet_len = rte_le_to_cpu_16(rxd.wb.pkt_len) &
1165 IAVF_RX_FLX_DESC_PKT_LEN_M;
1166 rxm->data_len = rx_packet_len;
1167 rxm->data_off = RTE_PKTMBUF_HEADROOM;
1169 /* If this is the first buffer of the received packet, set the
1170 * pointer to the first mbuf of the packet and initialize its
1171 * context. Otherwise, update the total length and the number
1172 * of segments of the current scattered packet, and update the
1173 * pointer to the last mbuf of the current packet.
1177 first_seg->nb_segs = 1;
1178 first_seg->pkt_len = rx_packet_len;
1180 first_seg->pkt_len =
1181 (uint16_t)(first_seg->pkt_len +
1183 first_seg->nb_segs++;
1184 last_seg->next = rxm;
1187 /* If this is not the last buffer of the received packet,
1188 * update the pointer to the last mbuf of the current scattered
1189 * packet and continue to parse the RX ring.
1191 if (!(rx_stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_EOF_S))) {
1196 /* This is the last buffer of the received packet. If the CRC
1197 * is not stripped by the hardware:
1198 * - Subtract the CRC length from the total packet length.
1199 * - If the last buffer only contains the whole CRC or a part
1200 * of it, free the mbuf associated to the last buffer. If part
1201 * of the CRC is also contained in the previous mbuf, subtract
1202 * the length of that CRC part from the data length of the
1206 if (unlikely(rxq->crc_len > 0)) {
1207 first_seg->pkt_len -= RTE_ETHER_CRC_LEN;
1208 if (rx_packet_len <= RTE_ETHER_CRC_LEN) {
1209 rte_pktmbuf_free_seg(rxm);
1210 first_seg->nb_segs--;
1211 last_seg->data_len =
1212 (uint16_t)(last_seg->data_len -
1213 (RTE_ETHER_CRC_LEN - rx_packet_len));
1214 last_seg->next = NULL;
1216 rxm->data_len = (uint16_t)(rx_packet_len -
1221 first_seg->port = rxq->port_id;
1222 first_seg->ol_flags = 0;
1223 first_seg->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
1224 rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
1225 iavf_flex_rxd_to_vlan_tci(first_seg, &rxd);
1226 iavf_rxd_to_pkt_fields(first_seg, &rxd);
1227 pkt_flags = iavf_flex_rxd_error_to_pkt_flags(rx_stat_err0);
1229 first_seg->ol_flags |= pkt_flags;
1231 /* Prefetch data of first segment, if configured to do so. */
1232 rte_prefetch0(RTE_PTR_ADD(first_seg->buf_addr,
1233 first_seg->data_off));
1234 rx_pkts[nb_rx++] = first_seg;
1238 /* Record index of the next RX descriptor to probe. */
1239 rxq->rx_tail = rx_id;
1240 rxq->pkt_first_seg = first_seg;
1241 rxq->pkt_last_seg = last_seg;
1243 iavf_update_rx_tail(rxq, nb_hold, rx_id);
1248 /* implement recv_scattered_pkts */
1250 iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
1253 struct iavf_rx_queue *rxq = rx_queue;
1254 union iavf_rx_desc rxd;
1255 struct rte_mbuf *rxe;
1256 struct rte_mbuf *first_seg = rxq->pkt_first_seg;
1257 struct rte_mbuf *last_seg = rxq->pkt_last_seg;
1258 struct rte_mbuf *nmb, *rxm;
1259 uint16_t rx_id = rxq->rx_tail;
1260 uint16_t nb_rx = 0, nb_hold = 0, rx_packet_len;
1261 struct rte_eth_dev *dev;
1267 volatile union iavf_rx_desc *rx_ring = rxq->rx_ring;
1268 volatile union iavf_rx_desc *rxdp;
1269 const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
1271 while (nb_rx < nb_pkts) {
1272 rxdp = &rx_ring[rx_id];
1273 qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
1274 rx_status = (qword1 & IAVF_RXD_QW1_STATUS_MASK) >>
1275 IAVF_RXD_QW1_STATUS_SHIFT;
1277 /* Check the DD bit */
1278 if (!(rx_status & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT)))
1280 IAVF_DUMP_RX_DESC(rxq, rxdp, rx_id);
1282 nmb = rte_mbuf_raw_alloc(rxq->mp);
1283 if (unlikely(!nmb)) {
1284 PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
1285 "queue_id=%u", rxq->port_id, rxq->queue_id);
1286 dev = &rte_eth_devices[rxq->port_id];
1287 dev->data->rx_mbuf_alloc_failed++;
1293 rxe = rxq->sw_ring[rx_id];
1295 if (rx_id == rxq->nb_rx_desc)
1298 /* Prefetch next mbuf */
1299 rte_prefetch0(rxq->sw_ring[rx_id]);
1301 /* When next RX descriptor is on a cache line boundary,
1302 * prefetch the next 4 RX descriptors and next 8 pointers
1305 if ((rx_id & 0x3) == 0) {
1306 rte_prefetch0(&rx_ring[rx_id]);
1307 rte_prefetch0(rxq->sw_ring[rx_id]);
1312 rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
1314 /* Set data buffer address and data length of the mbuf */
1315 rxdp->read.hdr_addr = 0;
1316 rxdp->read.pkt_addr = dma_addr;
1317 rx_packet_len = (qword1 & IAVF_RXD_QW1_LENGTH_PBUF_MASK) >>
1318 IAVF_RXD_QW1_LENGTH_PBUF_SHIFT;
1319 rxm->data_len = rx_packet_len;
1320 rxm->data_off = RTE_PKTMBUF_HEADROOM;
1322 /* If this is the first buffer of the received packet, set the
1323 * pointer to the first mbuf of the packet and initialize its
1324 * context. Otherwise, update the total length and the number
1325 * of segments of the current scattered packet, and update the
1326 * pointer to the last mbuf of the current packet.
1330 first_seg->nb_segs = 1;
1331 first_seg->pkt_len = rx_packet_len;
1333 first_seg->pkt_len =
1334 (uint16_t)(first_seg->pkt_len +
1336 first_seg->nb_segs++;
1337 last_seg->next = rxm;
1340 /* If this is not the last buffer of the received packet,
1341 * update the pointer to the last mbuf of the current scattered
1342 * packet and continue to parse the RX ring.
1344 if (!(rx_status & (1 << IAVF_RX_DESC_STATUS_EOF_SHIFT))) {
1349 /* This is the last buffer of the received packet. If the CRC
1350 * is not stripped by the hardware:
1351 * - Subtract the CRC length from the total packet length.
1352 * - If the last buffer only contains the whole CRC or a part
1353 * of it, free the mbuf associated to the last buffer. If part
1354 * of the CRC is also contained in the previous mbuf, subtract
1355 * the length of that CRC part from the data length of the
1359 if (unlikely(rxq->crc_len > 0)) {
1360 first_seg->pkt_len -= RTE_ETHER_CRC_LEN;
1361 if (rx_packet_len <= RTE_ETHER_CRC_LEN) {
1362 rte_pktmbuf_free_seg(rxm);
1363 first_seg->nb_segs--;
1364 last_seg->data_len =
1365 (uint16_t)(last_seg->data_len -
1366 (RTE_ETHER_CRC_LEN - rx_packet_len));
1367 last_seg->next = NULL;
1369 rxm->data_len = (uint16_t)(rx_packet_len -
1373 first_seg->port = rxq->port_id;
1374 first_seg->ol_flags = 0;
1375 iavf_rxd_to_vlan_tci(first_seg, &rxd);
1376 pkt_flags = iavf_rxd_to_pkt_flags(qword1);
1377 first_seg->packet_type =
1378 ptype_tbl[(uint8_t)((qword1 &
1379 IAVF_RXD_QW1_PTYPE_MASK) >> IAVF_RXD_QW1_PTYPE_SHIFT)];
1381 if (pkt_flags & PKT_RX_RSS_HASH)
1382 first_seg->hash.rss =
1383 rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss);
1385 if (pkt_flags & PKT_RX_FDIR)
1386 pkt_flags |= iavf_rxd_build_fdir(&rxd, first_seg);
1388 first_seg->ol_flags |= pkt_flags;
1390 /* Prefetch data of first segment, if configured to do so. */
1391 rte_prefetch0(RTE_PTR_ADD(first_seg->buf_addr,
1392 first_seg->data_off));
1393 rx_pkts[nb_rx++] = first_seg;
1397 /* Record index of the next RX descriptor to probe. */
1398 rxq->rx_tail = rx_id;
1399 rxq->pkt_first_seg = first_seg;
1400 rxq->pkt_last_seg = last_seg;
1402 iavf_update_rx_tail(rxq, nb_hold, rx_id);
1407 #define IAVF_LOOK_AHEAD 8
1409 iavf_rx_scan_hw_ring_flex_rxd(struct iavf_rx_queue *rxq)
1411 volatile union iavf_rx_flex_desc *rxdp;
1412 struct rte_mbuf **rxep;
1413 struct rte_mbuf *mb;
1416 int32_t s[IAVF_LOOK_AHEAD], nb_dd;
1417 int32_t i, j, nb_rx = 0;
1419 const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
1421 rxdp = (volatile union iavf_rx_flex_desc *)&rxq->rx_ring[rxq->rx_tail];
1422 rxep = &rxq->sw_ring[rxq->rx_tail];
1424 stat_err0 = rte_le_to_cpu_16(rxdp->wb.status_error0);
1426 /* Make sure there is at least 1 packet to receive */
1427 if (!(stat_err0 & (1 << IAVF_RX_FLEX_DESC_STATUS0_DD_S)))
1430 /* Scan LOOK_AHEAD descriptors at a time to determine which
1431 * descriptors reference packets that are ready to be received.
1433 for (i = 0; i < IAVF_RX_MAX_BURST; i += IAVF_LOOK_AHEAD,
1434 rxdp += IAVF_LOOK_AHEAD, rxep += IAVF_LOOK_AHEAD) {
1435 /* Read desc statuses backwards to avoid race condition */
1436 for (j = IAVF_LOOK_AHEAD - 1; j >= 0; j--)
1437 s[j] = rte_le_to_cpu_16(rxdp[j].wb.status_error0);
1441 /* Compute how many status bits were set */
1442 for (j = 0, nb_dd = 0; j < IAVF_LOOK_AHEAD; j++)
1443 nb_dd += s[j] & (1 << IAVF_RX_FLEX_DESC_STATUS0_DD_S);
1447 /* Translate descriptor info to mbuf parameters */
1448 for (j = 0; j < nb_dd; j++) {
1449 IAVF_DUMP_RX_DESC(rxq, &rxdp[j],
1451 i * IAVF_LOOK_AHEAD + j);
1454 pkt_len = (rte_le_to_cpu_16(rxdp[j].wb.pkt_len) &
1455 IAVF_RX_FLX_DESC_PKT_LEN_M) - rxq->crc_len;
1456 mb->data_len = pkt_len;
1457 mb->pkt_len = pkt_len;
1460 mb->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
1461 rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
1462 iavf_flex_rxd_to_vlan_tci(mb, &rxdp[j]);
1463 iavf_rxd_to_pkt_fields(mb, &rxdp[j]);
1464 stat_err0 = rte_le_to_cpu_16(rxdp[j].wb.status_error0);
1465 pkt_flags = iavf_flex_rxd_error_to_pkt_flags(stat_err0);
1467 mb->ol_flags |= pkt_flags;
1470 for (j = 0; j < IAVF_LOOK_AHEAD; j++)
1471 rxq->rx_stage[i + j] = rxep[j];
1473 if (nb_dd != IAVF_LOOK_AHEAD)
1477 /* Clear software ring entries */
1478 for (i = 0; i < nb_rx; i++)
1479 rxq->sw_ring[rxq->rx_tail + i] = NULL;
1485 iavf_rx_scan_hw_ring(struct iavf_rx_queue *rxq)
1487 volatile union iavf_rx_desc *rxdp;
1488 struct rte_mbuf **rxep;
1489 struct rte_mbuf *mb;
1493 int32_t s[IAVF_LOOK_AHEAD], nb_dd;
1494 int32_t i, j, nb_rx = 0;
1496 const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
1498 rxdp = &rxq->rx_ring[rxq->rx_tail];
1499 rxep = &rxq->sw_ring[rxq->rx_tail];
1501 qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
1502 rx_status = (qword1 & IAVF_RXD_QW1_STATUS_MASK) >>
1503 IAVF_RXD_QW1_STATUS_SHIFT;
1505 /* Make sure there is at least 1 packet to receive */
1506 if (!(rx_status & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT)))
1509 /* Scan LOOK_AHEAD descriptors at a time to determine which
1510 * descriptors reference packets that are ready to be received.
1512 for (i = 0; i < IAVF_RX_MAX_BURST; i += IAVF_LOOK_AHEAD,
1513 rxdp += IAVF_LOOK_AHEAD, rxep += IAVF_LOOK_AHEAD) {
1514 /* Read desc statuses backwards to avoid race condition */
1515 for (j = IAVF_LOOK_AHEAD - 1; j >= 0; j--) {
1516 qword1 = rte_le_to_cpu_64(
1517 rxdp[j].wb.qword1.status_error_len);
1518 s[j] = (qword1 & IAVF_RXD_QW1_STATUS_MASK) >>
1519 IAVF_RXD_QW1_STATUS_SHIFT;
1524 /* Compute how many status bits were set */
1525 for (j = 0, nb_dd = 0; j < IAVF_LOOK_AHEAD; j++)
1526 nb_dd += s[j] & (1 << IAVF_RX_DESC_STATUS_DD_SHIFT);
1530 /* Translate descriptor info to mbuf parameters */
1531 for (j = 0; j < nb_dd; j++) {
1532 IAVF_DUMP_RX_DESC(rxq, &rxdp[j],
1533 rxq->rx_tail + i * IAVF_LOOK_AHEAD + j);
1536 qword1 = rte_le_to_cpu_64
1537 (rxdp[j].wb.qword1.status_error_len);
1538 pkt_len = ((qword1 & IAVF_RXD_QW1_LENGTH_PBUF_MASK) >>
1539 IAVF_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;
1540 mb->data_len = pkt_len;
1541 mb->pkt_len = pkt_len;
1543 iavf_rxd_to_vlan_tci(mb, &rxdp[j]);
1544 pkt_flags = iavf_rxd_to_pkt_flags(qword1);
1546 ptype_tbl[(uint8_t)((qword1 &
1547 IAVF_RXD_QW1_PTYPE_MASK) >>
1548 IAVF_RXD_QW1_PTYPE_SHIFT)];
1550 if (pkt_flags & PKT_RX_RSS_HASH)
1551 mb->hash.rss = rte_le_to_cpu_32(
1552 rxdp[j].wb.qword0.hi_dword.rss);
1554 if (pkt_flags & PKT_RX_FDIR)
1555 pkt_flags |= iavf_rxd_build_fdir(&rxdp[j], mb);
1557 mb->ol_flags |= pkt_flags;
1560 for (j = 0; j < IAVF_LOOK_AHEAD; j++)
1561 rxq->rx_stage[i + j] = rxep[j];
1563 if (nb_dd != IAVF_LOOK_AHEAD)
1567 /* Clear software ring entries */
1568 for (i = 0; i < nb_rx; i++)
1569 rxq->sw_ring[rxq->rx_tail + i] = NULL;
1574 static inline uint16_t
1575 iavf_rx_fill_from_stage(struct iavf_rx_queue *rxq,
1576 struct rte_mbuf **rx_pkts,
1580 struct rte_mbuf **stage = &rxq->rx_stage[rxq->rx_next_avail];
1582 nb_pkts = (uint16_t)RTE_MIN(nb_pkts, rxq->rx_nb_avail);
1584 for (i = 0; i < nb_pkts; i++)
1585 rx_pkts[i] = stage[i];
1587 rxq->rx_nb_avail = (uint16_t)(rxq->rx_nb_avail - nb_pkts);
1588 rxq->rx_next_avail = (uint16_t)(rxq->rx_next_avail + nb_pkts);
1594 iavf_rx_alloc_bufs(struct iavf_rx_queue *rxq)
1596 volatile union iavf_rx_desc *rxdp;
1597 struct rte_mbuf **rxep;
1598 struct rte_mbuf *mb;
1599 uint16_t alloc_idx, i;
1603 /* Allocate buffers in bulk */
1604 alloc_idx = (uint16_t)(rxq->rx_free_trigger -
1605 (rxq->rx_free_thresh - 1));
1606 rxep = &rxq->sw_ring[alloc_idx];
1607 diag = rte_mempool_get_bulk(rxq->mp, (void *)rxep,
1608 rxq->rx_free_thresh);
1609 if (unlikely(diag != 0)) {
1610 PMD_RX_LOG(ERR, "Failed to get mbufs in bulk");
1614 rxdp = &rxq->rx_ring[alloc_idx];
1615 for (i = 0; i < rxq->rx_free_thresh; i++) {
1616 if (likely(i < (rxq->rx_free_thresh - 1)))
1617 /* Prefetch next mbuf */
1618 rte_prefetch0(rxep[i + 1]);
1621 rte_mbuf_refcnt_set(mb, 1);
1623 mb->data_off = RTE_PKTMBUF_HEADROOM;
1625 mb->port = rxq->port_id;
1626 dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mb));
1627 rxdp[i].read.hdr_addr = 0;
1628 rxdp[i].read.pkt_addr = dma_addr;
1631 /* Update rx tail register */
1633 IAVF_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rxq->rx_free_trigger);
1635 rxq->rx_free_trigger =
1636 (uint16_t)(rxq->rx_free_trigger + rxq->rx_free_thresh);
1637 if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
1638 rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
1643 static inline uint16_t
1644 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
1646 struct iavf_rx_queue *rxq = (struct iavf_rx_queue *)rx_queue;
1652 if (rxq->rx_nb_avail)
1653 return iavf_rx_fill_from_stage(rxq, rx_pkts, nb_pkts);
1655 if (rxq->rxdid == IAVF_RXDID_COMMS_OVS_1)
1656 nb_rx = (uint16_t)iavf_rx_scan_hw_ring_flex_rxd(rxq);
1658 nb_rx = (uint16_t)iavf_rx_scan_hw_ring(rxq);
1659 rxq->rx_next_avail = 0;
1660 rxq->rx_nb_avail = nb_rx;
1661 rxq->rx_tail = (uint16_t)(rxq->rx_tail + nb_rx);
1663 if (rxq->rx_tail > rxq->rx_free_trigger) {
1664 if (iavf_rx_alloc_bufs(rxq) != 0) {
1667 /* TODO: count rx_mbuf_alloc_failed here */
1669 rxq->rx_nb_avail = 0;
1670 rxq->rx_tail = (uint16_t)(rxq->rx_tail - nb_rx);
1671 for (i = 0, j = rxq->rx_tail; i < nb_rx; i++, j++)
1672 rxq->sw_ring[j] = rxq->rx_stage[i];
1678 if (rxq->rx_tail >= rxq->nb_rx_desc)
1681 PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u, nb_rx=%u",
1682 rxq->port_id, rxq->queue_id,
1683 rxq->rx_tail, nb_rx);
1685 if (rxq->rx_nb_avail)
1686 return iavf_rx_fill_from_stage(rxq, rx_pkts, nb_pkts);
1692 iavf_recv_pkts_bulk_alloc(void *rx_queue,
1693 struct rte_mbuf **rx_pkts,
1696 uint16_t nb_rx = 0, n, count;
1698 if (unlikely(nb_pkts == 0))
1701 if (likely(nb_pkts <= IAVF_RX_MAX_BURST))
1702 return rx_recv_pkts(rx_queue, rx_pkts, nb_pkts);
1705 n = RTE_MIN(nb_pkts, IAVF_RX_MAX_BURST);
1706 count = rx_recv_pkts(rx_queue, &rx_pkts[nb_rx], n);
1707 nb_rx = (uint16_t)(nb_rx + count);
1708 nb_pkts = (uint16_t)(nb_pkts - count);
1717 iavf_xmit_cleanup(struct iavf_tx_queue *txq)
1719 struct iavf_tx_entry *sw_ring = txq->sw_ring;
1720 uint16_t last_desc_cleaned = txq->last_desc_cleaned;
1721 uint16_t nb_tx_desc = txq->nb_tx_desc;
1722 uint16_t desc_to_clean_to;
1723 uint16_t nb_tx_to_clean;
1725 volatile struct iavf_tx_desc *txd = txq->tx_ring;
1727 desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->rs_thresh);
1728 if (desc_to_clean_to >= nb_tx_desc)
1729 desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
1731 desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
1732 if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
1733 rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) !=
1734 rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE)) {
1735 PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
1736 "(port=%d queue=%d)", desc_to_clean_to,
1737 txq->port_id, txq->queue_id);
1741 if (last_desc_cleaned > desc_to_clean_to)
1742 nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) +
1745 nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
1748 txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
1750 txq->last_desc_cleaned = desc_to_clean_to;
1751 txq->nb_free = (uint16_t)(txq->nb_free + nb_tx_to_clean);
1756 /* Check if the context descriptor is needed for TX offloading */
1757 static inline uint16_t
1758 iavf_calc_context_desc(uint64_t flags)
1760 static uint64_t mask = PKT_TX_TCP_SEG;
1762 return (flags & mask) ? 1 : 0;
1766 iavf_txd_enable_checksum(uint64_t ol_flags,
1768 uint32_t *td_offset,
1769 union iavf_tx_offload tx_offload)
1772 *td_offset |= (tx_offload.l2_len >> 1) <<
1773 IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
1775 /* Enable L3 checksum offloads */
1776 if (ol_flags & PKT_TX_IP_CKSUM) {
1777 *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4_CSUM;
1778 *td_offset |= (tx_offload.l3_len >> 2) <<
1779 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
1780 } else if (ol_flags & PKT_TX_IPV4) {
1781 *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4;
1782 *td_offset |= (tx_offload.l3_len >> 2) <<
1783 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
1784 } else if (ol_flags & PKT_TX_IPV6) {
1785 *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV6;
1786 *td_offset |= (tx_offload.l3_len >> 2) <<
1787 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
1790 if (ol_flags & PKT_TX_TCP_SEG) {
1791 *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP;
1792 *td_offset |= (tx_offload.l4_len >> 2) <<
1793 IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
1797 /* Enable L4 checksum offloads */
1798 switch (ol_flags & PKT_TX_L4_MASK) {
1799 case PKT_TX_TCP_CKSUM:
1800 *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP;
1801 *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
1802 IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
1804 case PKT_TX_SCTP_CKSUM:
1805 *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP;
1806 *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
1807 IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
1809 case PKT_TX_UDP_CKSUM:
1810 *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP;
1811 *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
1812 IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
1819 /* set TSO context descriptor
1820 * support IP -> L4 and IP -> IP -> L4
1822 static inline uint64_t
1823 iavf_set_tso_ctx(struct rte_mbuf *mbuf, union iavf_tx_offload tx_offload)
1825 uint64_t ctx_desc = 0;
1826 uint32_t cd_cmd, hdr_len, cd_tso_len;
1828 if (!tx_offload.l4_len) {
1829 PMD_TX_LOG(DEBUG, "L4 length set to 0");
1833 hdr_len = tx_offload.l2_len +
1837 cd_cmd = IAVF_TX_CTX_DESC_TSO;
1838 cd_tso_len = mbuf->pkt_len - hdr_len;
1839 ctx_desc |= ((uint64_t)cd_cmd << IAVF_TXD_CTX_QW1_CMD_SHIFT) |
1840 ((uint64_t)cd_tso_len << IAVF_TXD_CTX_QW1_TSO_LEN_SHIFT) |
1841 ((uint64_t)mbuf->tso_segsz << IAVF_TXD_CTX_QW1_MSS_SHIFT);
1846 /* Construct the tx flags */
1847 static inline uint64_t
1848 iavf_build_ctob(uint32_t td_cmd, uint32_t td_offset, unsigned int size,
1851 return rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DATA |
1852 ((uint64_t)td_cmd << IAVF_TXD_QW1_CMD_SHIFT) |
1853 ((uint64_t)td_offset <<
1854 IAVF_TXD_QW1_OFFSET_SHIFT) |
1856 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT) |
1857 ((uint64_t)td_tag <<
1858 IAVF_TXD_QW1_L2TAG1_SHIFT));
1863 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
1865 volatile struct iavf_tx_desc *txd;
1866 volatile struct iavf_tx_desc *txr;
1867 struct iavf_tx_queue *txq;
1868 struct iavf_tx_entry *sw_ring;
1869 struct iavf_tx_entry *txe, *txn;
1870 struct rte_mbuf *tx_pkt;
1871 struct rte_mbuf *m_seg;
1882 uint64_t buf_dma_addr;
1883 union iavf_tx_offload tx_offload = {0};
1886 sw_ring = txq->sw_ring;
1888 tx_id = txq->tx_tail;
1889 txe = &sw_ring[tx_id];
1891 /* Check if the descriptor ring needs to be cleaned. */
1892 if (txq->nb_free < txq->free_thresh)
1893 iavf_xmit_cleanup(txq);
1895 for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
1900 tx_pkt = *tx_pkts++;
1901 RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
1903 ol_flags = tx_pkt->ol_flags;
1904 tx_offload.l2_len = tx_pkt->l2_len;
1905 tx_offload.l3_len = tx_pkt->l3_len;
1906 tx_offload.l4_len = tx_pkt->l4_len;
1907 tx_offload.tso_segsz = tx_pkt->tso_segsz;
1909 /* Calculate the number of context descriptors needed. */
1910 nb_ctx = iavf_calc_context_desc(ol_flags);
1912 /* The number of descriptors that must be allocated for
1913 * a packet equals to the number of the segments of that
1914 * packet plus 1 context descriptor if needed.
1916 nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
1917 tx_last = (uint16_t)(tx_id + nb_used - 1);
1920 if (tx_last >= txq->nb_tx_desc)
1921 tx_last = (uint16_t)(tx_last - txq->nb_tx_desc);
1923 PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u"
1924 " tx_first=%u tx_last=%u",
1925 txq->port_id, txq->queue_id, tx_id, tx_last);
1927 if (nb_used > txq->nb_free) {
1928 if (iavf_xmit_cleanup(txq)) {
1933 if (unlikely(nb_used > txq->rs_thresh)) {
1934 while (nb_used > txq->nb_free) {
1935 if (iavf_xmit_cleanup(txq)) {
1944 /* Descriptor based VLAN insertion */
1945 if (ol_flags & PKT_TX_VLAN_PKT) {
1946 td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
1947 td_tag = tx_pkt->vlan_tci;
1950 /* According to datasheet, the bit2 is reserved and must be
1955 /* Enable checksum offloading */
1956 if (ol_flags & IAVF_TX_CKSUM_OFFLOAD_MASK)
1957 iavf_txd_enable_checksum(ol_flags, &td_cmd,
1958 &td_offset, tx_offload);
1961 /* Setup TX context descriptor if required */
1962 uint64_t cd_type_cmd_tso_mss =
1963 IAVF_TX_DESC_DTYPE_CONTEXT;
1964 volatile struct iavf_tx_context_desc *ctx_txd =
1965 (volatile struct iavf_tx_context_desc *)
1968 txn = &sw_ring[txe->next_id];
1969 RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
1971 rte_pktmbuf_free_seg(txe->mbuf);
1976 if (ol_flags & PKT_TX_TCP_SEG)
1977 cd_type_cmd_tso_mss |=
1978 iavf_set_tso_ctx(tx_pkt, tx_offload);
1980 ctx_txd->type_cmd_tso_mss =
1981 rte_cpu_to_le_64(cd_type_cmd_tso_mss);
1983 IAVF_DUMP_TX_DESC(txq, &txr[tx_id], tx_id);
1984 txe->last_id = tx_last;
1985 tx_id = txe->next_id;
1992 txn = &sw_ring[txe->next_id];
1995 rte_pktmbuf_free_seg(txe->mbuf);
1998 /* Setup TX Descriptor */
1999 slen = m_seg->data_len;
2000 buf_dma_addr = rte_mbuf_data_iova(m_seg);
2001 txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
2002 txd->cmd_type_offset_bsz = iavf_build_ctob(td_cmd,
2007 IAVF_DUMP_TX_DESC(txq, txd, tx_id);
2008 txe->last_id = tx_last;
2009 tx_id = txe->next_id;
2011 m_seg = m_seg->next;
2014 /* The last packet data descriptor needs End Of Packet (EOP) */
2015 td_cmd |= IAVF_TX_DESC_CMD_EOP;
2016 txq->nb_used = (uint16_t)(txq->nb_used + nb_used);
2017 txq->nb_free = (uint16_t)(txq->nb_free - nb_used);
2019 if (txq->nb_used >= txq->rs_thresh) {
2020 PMD_TX_LOG(DEBUG, "Setting RS bit on TXD id="
2021 "%4u (port=%d queue=%d)",
2022 tx_last, txq->port_id, txq->queue_id);
2024 td_cmd |= IAVF_TX_DESC_CMD_RS;
2026 /* Update txq RS bit counters */
2030 txd->cmd_type_offset_bsz |=
2031 rte_cpu_to_le_64(((uint64_t)td_cmd) <<
2032 IAVF_TXD_QW1_CMD_SHIFT);
2033 IAVF_DUMP_TX_DESC(txq, txd, tx_id);
2039 PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
2040 txq->port_id, txq->queue_id, tx_id, nb_tx);
2042 IAVF_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id);
2043 txq->tx_tail = tx_id;
2048 /* TX prep functions */
2050 iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
2057 for (i = 0; i < nb_pkts; i++) {
2059 ol_flags = m->ol_flags;
2061 /* Check condition for nb_segs > IAVF_TX_MAX_MTU_SEG. */
2062 if (!(ol_flags & PKT_TX_TCP_SEG)) {
2063 if (m->nb_segs > IAVF_TX_MAX_MTU_SEG) {
2067 } else if ((m->tso_segsz < IAVF_MIN_TSO_MSS) ||
2068 (m->tso_segsz > IAVF_MAX_TSO_MSS)) {
2069 /* MSS outside the range are considered malicious */
2074 if (ol_flags & IAVF_TX_OFFLOAD_NOTSUP_MASK) {
2075 rte_errno = ENOTSUP;
2079 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2080 ret = rte_validate_tx_offload(m);
2086 ret = rte_net_intel_cksum_prepare(m);
2096 /* choose rx function*/
2098 iavf_set_rx_function(struct rte_eth_dev *dev)
2100 struct iavf_adapter *adapter =
2101 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
2102 struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
2104 struct iavf_rx_queue *rxq;
2106 bool use_avx2 = false;
2108 if (!iavf_rx_vec_dev_check(dev)) {
2109 for (i = 0; i < dev->data->nb_rx_queues; i++) {
2110 rxq = dev->data->rx_queues[i];
2111 (void)iavf_rxq_vec_setup(rxq);
2114 if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
2115 rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)
2118 if (dev->data->scattered_rx) {
2120 "Using %sVector Scattered Rx (port %d).",
2121 use_avx2 ? "avx2 " : "",
2122 dev->data->port_id);
2123 if (vf->vf_res->vf_cap_flags &
2124 VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
2125 dev->rx_pkt_burst = use_avx2 ?
2126 iavf_recv_scattered_pkts_vec_avx2_flex_rxd :
2127 iavf_recv_scattered_pkts_vec_flex_rxd;
2129 dev->rx_pkt_burst = use_avx2 ?
2130 iavf_recv_scattered_pkts_vec_avx2 :
2131 iavf_recv_scattered_pkts_vec;
2133 PMD_DRV_LOG(DEBUG, "Using %sVector Rx (port %d).",
2134 use_avx2 ? "avx2 " : "",
2135 dev->data->port_id);
2136 if (vf->vf_res->vf_cap_flags &
2137 VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
2138 dev->rx_pkt_burst = use_avx2 ?
2139 iavf_recv_pkts_vec_avx2_flex_rxd :
2140 iavf_recv_pkts_vec_flex_rxd;
2142 dev->rx_pkt_burst = use_avx2 ?
2143 iavf_recv_pkts_vec_avx2 :
2151 if (dev->data->scattered_rx) {
2152 PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
2153 dev->data->port_id);
2154 if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
2155 dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
2157 dev->rx_pkt_burst = iavf_recv_scattered_pkts;
2158 } else if (adapter->rx_bulk_alloc_allowed) {
2159 PMD_DRV_LOG(DEBUG, "Using bulk Rx callback (port=%d).",
2160 dev->data->port_id);
2161 dev->rx_pkt_burst = iavf_recv_pkts_bulk_alloc;
2163 PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
2164 dev->data->port_id);
2165 if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
2166 dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
2168 dev->rx_pkt_burst = iavf_recv_pkts;
2172 /* choose tx function*/
2174 iavf_set_tx_function(struct rte_eth_dev *dev)
2177 struct iavf_tx_queue *txq;
2179 bool use_avx2 = false;
2181 if (!iavf_tx_vec_dev_check(dev)) {
2182 for (i = 0; i < dev->data->nb_tx_queues; i++) {
2183 txq = dev->data->tx_queues[i];
2186 iavf_txq_vec_setup(txq);
2189 if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
2190 rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1)
2193 PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
2194 use_avx2 ? "avx2 " : "",
2195 dev->data->port_id);
2196 dev->tx_pkt_burst = use_avx2 ?
2197 iavf_xmit_pkts_vec_avx2 :
2199 dev->tx_pkt_prepare = NULL;
2205 PMD_DRV_LOG(DEBUG, "Using Basic Tx callback (port=%d).",
2206 dev->data->port_id);
2207 dev->tx_pkt_burst = iavf_xmit_pkts;
2208 dev->tx_pkt_prepare = iavf_prep_pkts;
2212 iavf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
2213 struct rte_eth_rxq_info *qinfo)
2215 struct iavf_rx_queue *rxq;
2217 rxq = dev->data->rx_queues[queue_id];
2219 qinfo->mp = rxq->mp;
2220 qinfo->scattered_rx = dev->data->scattered_rx;
2221 qinfo->nb_desc = rxq->nb_rx_desc;
2223 qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
2224 qinfo->conf.rx_drop_en = true;
2225 qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
2229 iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
2230 struct rte_eth_txq_info *qinfo)
2232 struct iavf_tx_queue *txq;
2234 txq = dev->data->tx_queues[queue_id];
2236 qinfo->nb_desc = txq->nb_tx_desc;
2238 qinfo->conf.tx_free_thresh = txq->free_thresh;
2239 qinfo->conf.tx_rs_thresh = txq->rs_thresh;
2240 qinfo->conf.offloads = txq->offloads;
2241 qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
2244 /* Get the number of used descriptors of a rx queue */
2246 iavf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id)
2248 #define IAVF_RXQ_SCAN_INTERVAL 4
2249 volatile union iavf_rx_desc *rxdp;
2250 struct iavf_rx_queue *rxq;
2253 rxq = dev->data->rx_queues[queue_id];
2254 rxdp = &rxq->rx_ring[rxq->rx_tail];
2256 while ((desc < rxq->nb_rx_desc) &&
2257 ((rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len) &
2258 IAVF_RXD_QW1_STATUS_MASK) >> IAVF_RXD_QW1_STATUS_SHIFT) &
2259 (1 << IAVF_RX_DESC_STATUS_DD_SHIFT)) {
2260 /* Check the DD bit of a rx descriptor of each 4 in a group,
2261 * to avoid checking too frequently and downgrading performance
2264 desc += IAVF_RXQ_SCAN_INTERVAL;
2265 rxdp += IAVF_RXQ_SCAN_INTERVAL;
2266 if (rxq->rx_tail + desc >= rxq->nb_rx_desc)
2267 rxdp = &(rxq->rx_ring[rxq->rx_tail +
2268 desc - rxq->nb_rx_desc]);
2275 iavf_dev_rx_desc_status(void *rx_queue, uint16_t offset)
2277 struct iavf_rx_queue *rxq = rx_queue;
2278 volatile uint64_t *status;
2282 if (unlikely(offset >= rxq->nb_rx_desc))
2285 if (offset >= rxq->nb_rx_desc - rxq->nb_rx_hold)
2286 return RTE_ETH_RX_DESC_UNAVAIL;
2288 desc = rxq->rx_tail + offset;
2289 if (desc >= rxq->nb_rx_desc)
2290 desc -= rxq->nb_rx_desc;
2292 status = &rxq->rx_ring[desc].wb.qword1.status_error_len;
2293 mask = rte_le_to_cpu_64((1ULL << IAVF_RX_DESC_STATUS_DD_SHIFT)
2294 << IAVF_RXD_QW1_STATUS_SHIFT);
2296 return RTE_ETH_RX_DESC_DONE;
2298 return RTE_ETH_RX_DESC_AVAIL;
2302 iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset)
2304 struct iavf_tx_queue *txq = tx_queue;
2305 volatile uint64_t *status;
2306 uint64_t mask, expect;
2309 if (unlikely(offset >= txq->nb_tx_desc))
2312 desc = txq->tx_tail + offset;
2313 /* go to next desc that has the RS bit */
2314 desc = ((desc + txq->rs_thresh - 1) / txq->rs_thresh) *
2316 if (desc >= txq->nb_tx_desc) {
2317 desc -= txq->nb_tx_desc;
2318 if (desc >= txq->nb_tx_desc)
2319 desc -= txq->nb_tx_desc;
2322 status = &txq->tx_ring[desc].cmd_type_offset_bsz;
2323 mask = rte_le_to_cpu_64(IAVF_TXD_QW1_DTYPE_MASK);
2324 expect = rte_cpu_to_le_64(
2325 IAVF_TX_DESC_DTYPE_DESC_DONE << IAVF_TXD_QW1_DTYPE_SHIFT);
2326 if ((*status & mask) == expect)
2327 return RTE_ETH_TX_DESC_DONE;
2329 return RTE_ETH_TX_DESC_FULL;
2333 iavf_get_default_ptype_table(void)
2335 static const uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE]
2336 __rte_cache_aligned = {
2339 [1] = RTE_PTYPE_L2_ETHER,
2340 [2] = RTE_PTYPE_L2_ETHER_TIMESYNC,
2341 /* [3] - [5] reserved */
2342 [6] = RTE_PTYPE_L2_ETHER_LLDP,
2343 /* [7] - [10] reserved */
2344 [11] = RTE_PTYPE_L2_ETHER_ARP,
2345 /* [12] - [21] reserved */
2347 /* Non tunneled IPv4 */
2348 [22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2350 [23] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2351 RTE_PTYPE_L4_NONFRAG,
2352 [24] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2355 [26] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2357 [27] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2359 [28] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2363 [29] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2364 RTE_PTYPE_TUNNEL_IP |
2365 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2366 RTE_PTYPE_INNER_L4_FRAG,
2367 [30] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2368 RTE_PTYPE_TUNNEL_IP |
2369 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2370 RTE_PTYPE_INNER_L4_NONFRAG,
2371 [31] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2372 RTE_PTYPE_TUNNEL_IP |
2373 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2374 RTE_PTYPE_INNER_L4_UDP,
2376 [33] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2377 RTE_PTYPE_TUNNEL_IP |
2378 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2379 RTE_PTYPE_INNER_L4_TCP,
2380 [34] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2381 RTE_PTYPE_TUNNEL_IP |
2382 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2383 RTE_PTYPE_INNER_L4_SCTP,
2384 [35] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2385 RTE_PTYPE_TUNNEL_IP |
2386 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2387 RTE_PTYPE_INNER_L4_ICMP,
2390 [36] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2391 RTE_PTYPE_TUNNEL_IP |
2392 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2393 RTE_PTYPE_INNER_L4_FRAG,
2394 [37] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2395 RTE_PTYPE_TUNNEL_IP |
2396 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2397 RTE_PTYPE_INNER_L4_NONFRAG,
2398 [38] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2399 RTE_PTYPE_TUNNEL_IP |
2400 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2401 RTE_PTYPE_INNER_L4_UDP,
2403 [40] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2404 RTE_PTYPE_TUNNEL_IP |
2405 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2406 RTE_PTYPE_INNER_L4_TCP,
2407 [41] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2408 RTE_PTYPE_TUNNEL_IP |
2409 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2410 RTE_PTYPE_INNER_L4_SCTP,
2411 [42] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2412 RTE_PTYPE_TUNNEL_IP |
2413 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2414 RTE_PTYPE_INNER_L4_ICMP,
2416 /* IPv4 --> GRE/Teredo/VXLAN */
2417 [43] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2418 RTE_PTYPE_TUNNEL_GRENAT,
2420 /* IPv4 --> GRE/Teredo/VXLAN --> IPv4 */
2421 [44] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2422 RTE_PTYPE_TUNNEL_GRENAT |
2423 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2424 RTE_PTYPE_INNER_L4_FRAG,
2425 [45] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2426 RTE_PTYPE_TUNNEL_GRENAT |
2427 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2428 RTE_PTYPE_INNER_L4_NONFRAG,
2429 [46] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2430 RTE_PTYPE_TUNNEL_GRENAT |
2431 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2432 RTE_PTYPE_INNER_L4_UDP,
2434 [48] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2435 RTE_PTYPE_TUNNEL_GRENAT |
2436 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2437 RTE_PTYPE_INNER_L4_TCP,
2438 [49] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2439 RTE_PTYPE_TUNNEL_GRENAT |
2440 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2441 RTE_PTYPE_INNER_L4_SCTP,
2442 [50] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2443 RTE_PTYPE_TUNNEL_GRENAT |
2444 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2445 RTE_PTYPE_INNER_L4_ICMP,
2447 /* IPv4 --> GRE/Teredo/VXLAN --> IPv6 */
2448 [51] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2449 RTE_PTYPE_TUNNEL_GRENAT |
2450 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2451 RTE_PTYPE_INNER_L4_FRAG,
2452 [52] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2453 RTE_PTYPE_TUNNEL_GRENAT |
2454 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2455 RTE_PTYPE_INNER_L4_NONFRAG,
2456 [53] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2457 RTE_PTYPE_TUNNEL_GRENAT |
2458 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2459 RTE_PTYPE_INNER_L4_UDP,
2461 [55] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2462 RTE_PTYPE_TUNNEL_GRENAT |
2463 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2464 RTE_PTYPE_INNER_L4_TCP,
2465 [56] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2466 RTE_PTYPE_TUNNEL_GRENAT |
2467 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2468 RTE_PTYPE_INNER_L4_SCTP,
2469 [57] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2470 RTE_PTYPE_TUNNEL_GRENAT |
2471 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2472 RTE_PTYPE_INNER_L4_ICMP,
2474 /* IPv4 --> GRE/Teredo/VXLAN --> MAC */
2475 [58] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2476 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER,
2478 /* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */
2479 [59] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2480 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2481 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2482 RTE_PTYPE_INNER_L4_FRAG,
2483 [60] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2484 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2485 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2486 RTE_PTYPE_INNER_L4_NONFRAG,
2487 [61] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2488 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2489 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2490 RTE_PTYPE_INNER_L4_UDP,
2492 [63] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2493 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2494 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2495 RTE_PTYPE_INNER_L4_TCP,
2496 [64] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2497 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2498 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2499 RTE_PTYPE_INNER_L4_SCTP,
2500 [65] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2501 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2502 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2503 RTE_PTYPE_INNER_L4_ICMP,
2505 /* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */
2506 [66] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2507 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2508 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2509 RTE_PTYPE_INNER_L4_FRAG,
2510 [67] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2511 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2512 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2513 RTE_PTYPE_INNER_L4_NONFRAG,
2514 [68] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2515 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2516 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2517 RTE_PTYPE_INNER_L4_UDP,
2519 [70] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2520 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2521 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2522 RTE_PTYPE_INNER_L4_TCP,
2523 [71] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2524 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2525 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2526 RTE_PTYPE_INNER_L4_SCTP,
2527 [72] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2528 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2529 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2530 RTE_PTYPE_INNER_L4_ICMP,
2531 /* [73] - [87] reserved */
2533 /* Non tunneled IPv6 */
2534 [88] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2536 [89] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2537 RTE_PTYPE_L4_NONFRAG,
2538 [90] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2541 [92] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2543 [93] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2545 [94] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2549 [95] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2550 RTE_PTYPE_TUNNEL_IP |
2551 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2552 RTE_PTYPE_INNER_L4_FRAG,
2553 [96] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2554 RTE_PTYPE_TUNNEL_IP |
2555 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2556 RTE_PTYPE_INNER_L4_NONFRAG,
2557 [97] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2558 RTE_PTYPE_TUNNEL_IP |
2559 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2560 RTE_PTYPE_INNER_L4_UDP,
2562 [99] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2563 RTE_PTYPE_TUNNEL_IP |
2564 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2565 RTE_PTYPE_INNER_L4_TCP,
2566 [100] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2567 RTE_PTYPE_TUNNEL_IP |
2568 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2569 RTE_PTYPE_INNER_L4_SCTP,
2570 [101] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2571 RTE_PTYPE_TUNNEL_IP |
2572 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2573 RTE_PTYPE_INNER_L4_ICMP,
2576 [102] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2577 RTE_PTYPE_TUNNEL_IP |
2578 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2579 RTE_PTYPE_INNER_L4_FRAG,
2580 [103] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2581 RTE_PTYPE_TUNNEL_IP |
2582 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2583 RTE_PTYPE_INNER_L4_NONFRAG,
2584 [104] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2585 RTE_PTYPE_TUNNEL_IP |
2586 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2587 RTE_PTYPE_INNER_L4_UDP,
2588 /* [105] reserved */
2589 [106] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2590 RTE_PTYPE_TUNNEL_IP |
2591 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2592 RTE_PTYPE_INNER_L4_TCP,
2593 [107] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2594 RTE_PTYPE_TUNNEL_IP |
2595 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2596 RTE_PTYPE_INNER_L4_SCTP,
2597 [108] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2598 RTE_PTYPE_TUNNEL_IP |
2599 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2600 RTE_PTYPE_INNER_L4_ICMP,
2602 /* IPv6 --> GRE/Teredo/VXLAN */
2603 [109] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2604 RTE_PTYPE_TUNNEL_GRENAT,
2606 /* IPv6 --> GRE/Teredo/VXLAN --> IPv4 */
2607 [110] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2608 RTE_PTYPE_TUNNEL_GRENAT |
2609 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2610 RTE_PTYPE_INNER_L4_FRAG,
2611 [111] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2612 RTE_PTYPE_TUNNEL_GRENAT |
2613 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2614 RTE_PTYPE_INNER_L4_NONFRAG,
2615 [112] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2616 RTE_PTYPE_TUNNEL_GRENAT |
2617 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2618 RTE_PTYPE_INNER_L4_UDP,
2619 /* [113] reserved */
2620 [114] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2621 RTE_PTYPE_TUNNEL_GRENAT |
2622 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2623 RTE_PTYPE_INNER_L4_TCP,
2624 [115] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2625 RTE_PTYPE_TUNNEL_GRENAT |
2626 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2627 RTE_PTYPE_INNER_L4_SCTP,
2628 [116] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2629 RTE_PTYPE_TUNNEL_GRENAT |
2630 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2631 RTE_PTYPE_INNER_L4_ICMP,
2633 /* IPv6 --> GRE/Teredo/VXLAN --> IPv6 */
2634 [117] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2635 RTE_PTYPE_TUNNEL_GRENAT |
2636 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2637 RTE_PTYPE_INNER_L4_FRAG,
2638 [118] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2639 RTE_PTYPE_TUNNEL_GRENAT |
2640 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2641 RTE_PTYPE_INNER_L4_NONFRAG,
2642 [119] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2643 RTE_PTYPE_TUNNEL_GRENAT |
2644 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2645 RTE_PTYPE_INNER_L4_UDP,
2646 /* [120] reserved */
2647 [121] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2648 RTE_PTYPE_TUNNEL_GRENAT |
2649 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2650 RTE_PTYPE_INNER_L4_TCP,
2651 [122] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2652 RTE_PTYPE_TUNNEL_GRENAT |
2653 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2654 RTE_PTYPE_INNER_L4_SCTP,
2655 [123] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2656 RTE_PTYPE_TUNNEL_GRENAT |
2657 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2658 RTE_PTYPE_INNER_L4_ICMP,
2660 /* IPv6 --> GRE/Teredo/VXLAN --> MAC */
2661 [124] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2662 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER,
2664 /* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */
2665 [125] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2666 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2667 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2668 RTE_PTYPE_INNER_L4_FRAG,
2669 [126] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2670 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2671 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2672 RTE_PTYPE_INNER_L4_NONFRAG,
2673 [127] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2674 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2675 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2676 RTE_PTYPE_INNER_L4_UDP,
2677 /* [128] reserved */
2678 [129] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2679 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2680 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2681 RTE_PTYPE_INNER_L4_TCP,
2682 [130] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2683 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2684 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2685 RTE_PTYPE_INNER_L4_SCTP,
2686 [131] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2687 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2688 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2689 RTE_PTYPE_INNER_L4_ICMP,
2691 /* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */
2692 [132] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2693 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2694 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2695 RTE_PTYPE_INNER_L4_FRAG,
2696 [133] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2697 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2698 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2699 RTE_PTYPE_INNER_L4_NONFRAG,
2700 [134] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2701 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2702 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2703 RTE_PTYPE_INNER_L4_UDP,
2704 /* [135] reserved */
2705 [136] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2706 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2707 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2708 RTE_PTYPE_INNER_L4_TCP,
2709 [137] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2710 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2711 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2712 RTE_PTYPE_INNER_L4_SCTP,
2713 [138] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2714 RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |
2715 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2716 RTE_PTYPE_INNER_L4_ICMP,
2717 /* [139] - [299] reserved */
2720 [300] = RTE_PTYPE_L2_ETHER_PPPOE,
2721 [301] = RTE_PTYPE_L2_ETHER_PPPOE,
2723 /* PPPoE --> IPv4 */
2724 [302] = RTE_PTYPE_L2_ETHER_PPPOE |
2725 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2727 [303] = RTE_PTYPE_L2_ETHER_PPPOE |
2728 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2729 RTE_PTYPE_L4_NONFRAG,
2730 [304] = RTE_PTYPE_L2_ETHER_PPPOE |
2731 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2733 [305] = RTE_PTYPE_L2_ETHER_PPPOE |
2734 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2736 [306] = RTE_PTYPE_L2_ETHER_PPPOE |
2737 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2739 [307] = RTE_PTYPE_L2_ETHER_PPPOE |
2740 RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2743 /* PPPoE --> IPv6 */
2744 [308] = RTE_PTYPE_L2_ETHER_PPPOE |
2745 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2747 [309] = RTE_PTYPE_L2_ETHER_PPPOE |
2748 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2749 RTE_PTYPE_L4_NONFRAG,
2750 [310] = RTE_PTYPE_L2_ETHER_PPPOE |
2751 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2753 [311] = RTE_PTYPE_L2_ETHER_PPPOE |
2754 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2756 [312] = RTE_PTYPE_L2_ETHER_PPPOE |
2757 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2759 [313] = RTE_PTYPE_L2_ETHER_PPPOE |
2760 RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2762 /* [314] - [324] reserved */
2764 /* IPv4/IPv6 --> GTPC/GTPU */
2765 [325] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2766 RTE_PTYPE_TUNNEL_GTPC,
2767 [326] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2768 RTE_PTYPE_TUNNEL_GTPC,
2769 [327] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2770 RTE_PTYPE_TUNNEL_GTPC,
2771 [328] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2772 RTE_PTYPE_TUNNEL_GTPC,
2773 [329] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2774 RTE_PTYPE_TUNNEL_GTPU,
2775 [330] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2776 RTE_PTYPE_TUNNEL_GTPU,
2778 /* IPv4 --> GTPU --> IPv4 */
2779 [331] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2780 RTE_PTYPE_TUNNEL_GTPU |
2781 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2782 RTE_PTYPE_INNER_L4_FRAG,
2783 [332] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2784 RTE_PTYPE_TUNNEL_GTPU |
2785 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2786 RTE_PTYPE_INNER_L4_NONFRAG,
2787 [333] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2788 RTE_PTYPE_TUNNEL_GTPU |
2789 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2790 RTE_PTYPE_INNER_L4_UDP,
2791 [334] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2792 RTE_PTYPE_TUNNEL_GTPU |
2793 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2794 RTE_PTYPE_INNER_L4_TCP,
2795 [335] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2796 RTE_PTYPE_TUNNEL_GTPU |
2797 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2798 RTE_PTYPE_INNER_L4_ICMP,
2800 /* IPv6 --> GTPU --> IPv4 */
2801 [336] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2802 RTE_PTYPE_TUNNEL_GTPU |
2803 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2804 RTE_PTYPE_INNER_L4_FRAG,
2805 [337] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2806 RTE_PTYPE_TUNNEL_GTPU |
2807 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2808 RTE_PTYPE_INNER_L4_NONFRAG,
2809 [338] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2810 RTE_PTYPE_TUNNEL_GTPU |
2811 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2812 RTE_PTYPE_INNER_L4_UDP,
2813 [339] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2814 RTE_PTYPE_TUNNEL_GTPU |
2815 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2816 RTE_PTYPE_INNER_L4_TCP,
2817 [340] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2818 RTE_PTYPE_TUNNEL_GTPU |
2819 RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
2820 RTE_PTYPE_INNER_L4_ICMP,
2822 /* IPv4 --> GTPU --> IPv6 */
2823 [341] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2824 RTE_PTYPE_TUNNEL_GTPU |
2825 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2826 RTE_PTYPE_INNER_L4_FRAG,
2827 [342] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2828 RTE_PTYPE_TUNNEL_GTPU |
2829 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2830 RTE_PTYPE_INNER_L4_NONFRAG,
2831 [343] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2832 RTE_PTYPE_TUNNEL_GTPU |
2833 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2834 RTE_PTYPE_INNER_L4_UDP,
2835 [344] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2836 RTE_PTYPE_TUNNEL_GTPU |
2837 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2838 RTE_PTYPE_INNER_L4_TCP,
2839 [345] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
2840 RTE_PTYPE_TUNNEL_GTPU |
2841 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2842 RTE_PTYPE_INNER_L4_ICMP,
2844 /* IPv6 --> GTPU --> IPv6 */
2845 [346] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2846 RTE_PTYPE_TUNNEL_GTPU |
2847 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2848 RTE_PTYPE_INNER_L4_FRAG,
2849 [347] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2850 RTE_PTYPE_TUNNEL_GTPU |
2851 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2852 RTE_PTYPE_INNER_L4_NONFRAG,
2853 [348] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2854 RTE_PTYPE_TUNNEL_GTPU |
2855 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2856 RTE_PTYPE_INNER_L4_UDP,
2857 [349] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2858 RTE_PTYPE_TUNNEL_GTPU |
2859 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2860 RTE_PTYPE_INNER_L4_TCP,
2861 [350] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
2862 RTE_PTYPE_TUNNEL_GTPU |
2863 RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
2864 RTE_PTYPE_INNER_L4_ICMP,
2865 /* All others reserved */