Callback to handle sending packets from the tap interface */
| 656 | /* Callback to handle sending packets from the tap interface |
| 657 | */ |
| 658 | static uint16_t |
| 659 | pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) |
| 660 | { |
| 661 | struct tx_queue *txq = queue; |
| 662 | uint16_t num_tx = 0; |
| 663 | uint16_t num_packets = 0; |
| 664 | unsigned long num_tx_bytes = 0; |
| 665 | uint32_t max_size; |
| 666 | int i; |
| 667 | |
| 668 | if (unlikely(nb_pkts == 0)) |
| 669 | return 0; |
| 670 | |
| 671 | struct rte_mbuf *gso_mbufs[MAX_GSO_MBUFS]; |
| 672 | max_size = *txq->mtu + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4); |
| 673 | for (i = 0; i < nb_pkts; i++) { |
| 674 | struct rte_mbuf *mbuf_in = bufs[num_tx]; |
| 675 | struct rte_mbuf **mbuf; |
| 676 | uint16_t num_mbufs = 0; |
| 677 | uint16_t tso_segsz = 0; |
| 678 | int ret; |
| 679 | int num_tso_mbufs; |
| 680 | uint16_t hdrs_len; |
| 681 | uint64_t tso; |
| 682 | |
| 683 | tso = mbuf_in->ol_flags & RTE_MBUF_F_TX_TCP_SEG; |
| 684 | if (tso) { |
| 685 | struct rte_gso_ctx *gso_ctx = &txq->gso_ctx; |
| 686 | |
| 687 | /* TCP segmentation implies TCP checksum offload */ |
| 688 | mbuf_in->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; |
| 689 | |
| 690 | /* gso size is calculated without RTE_ETHER_CRC_LEN */ |
| 691 | hdrs_len = mbuf_in->l2_len + mbuf_in->l3_len + |
| 692 | mbuf_in->l4_len; |
| 693 | tso_segsz = mbuf_in->tso_segsz + hdrs_len; |
| 694 | if (unlikely(tso_segsz == hdrs_len) || |
| 695 | tso_segsz > *txq->mtu) { |
| 696 | txq->stats.errs++; |
| 697 | break; |
| 698 | } |
| 699 | gso_ctx->gso_size = tso_segsz; |
| 700 | /* 'mbuf_in' packet to segment */ |
| 701 | num_tso_mbufs = rte_gso_segment(mbuf_in, |
| 702 | gso_ctx, /* gso control block */ |
| 703 | (struct rte_mbuf **)&gso_mbufs, /* out mbufs */ |
| 704 | RTE_DIM(gso_mbufs)); /* max tso mbufs */ |
| 705 | |
| 706 | /* ret contains the number of new created mbufs */ |
| 707 | if (num_tso_mbufs < 0) |
| 708 | break; |
| 709 | |
| 710 | if (num_tso_mbufs >= 1) { |
| 711 | mbuf = gso_mbufs; |
| 712 | num_mbufs = num_tso_mbufs; |
| 713 | } else { |
| 714 | /* 0 means it can be transmitted directly |
| 715 | * without gso. |
nothing calls this directly
no test coverage detected