Within the scalar packets, add a shortcut path for packets that don't
use TSO and have only a single data descriptor.

Signed-off-by: Bruce Richardson <[email protected]>
---
 drivers/net/intel/common/tx_scalar_fns.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/intel/common/tx_scalar_fns.h 
b/drivers/net/intel/common/tx_scalar_fns.h
index 27791cf138..55502b46ed 100644
--- a/drivers/net/intel/common/tx_scalar_fns.h
+++ b/drivers/net/intel/common/tx_scalar_fns.h
@@ -304,6 +304,28 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
                        ci_txd_enable_checksum(ol_flags, &td_cmd,
                                                &td_offset, tx_offload);
 
+               /* special case for single descriptor packet, without TSO 
offload */
+               if (nb_used == 1 && (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | 
RTE_MBUF_F_TX_UDP_SEG)) == 0) {
+                       txd = &ci_tx_ring[tx_id];
+                       tx_id = txe->next_id;
+
+                       if (txe->mbuf)
+                               rte_pktmbuf_free_seg(txe->mbuf);
+                       *txe = (struct ci_tx_entry){ .mbuf = tx_pkt, .last_id = 
tx_last, .next_id = tx_id };
+
+                       /* Setup TX Descriptor */
+                       td_cmd |= CI_TX_DESC_CMD_EOP;
+                       const uint64_t cmd_type_offset_bsz = 
CI_TX_DESC_DTYPE_DATA |
+                               ((uint64_t)td_cmd << CI_TXD_QW1_CMD_S) |
+                               ((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+                               ((uint64_t)tx_pkt->data_len << 
CI_TXD_QW1_TX_BUF_SZ_S) |
+                               ((uint64_t)td_tag << CI_TXD_QW1_L2TAG1_S);
+                       write_txd(txd, rte_mbuf_data_iova(tx_pkt), 
cmd_type_offset_bsz);
+
+                       txe = &sw_ring[tx_id];
+                       goto end_pkt;
+               }
+
                if (nb_ctx) {
                        /* Setup TX context descriptor if required */
                        uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, 
&ci_tx_ring[tx_id]);
@@ -395,6 +417,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
                        txe = txn;
                        m_seg = m_seg->next;
                } while (m_seg);
+end_pkt:
                txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
                txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
-- 
2.51.0

Reply via email to