net/mlx5: support Rx buffer split on datapath
authorViacheslav Ovsiienko <viacheslavo@nvidia.com>
Mon, 26 Oct 2020 11:55:03 +0000 (11:55 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:35:02 +0000 (23:35 +0100)
Only the regular rx_burst routine is updated to support split,
because the vectorized ones does not support scatter and MPRQ
does not support split at all.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_rxq.c
drivers/net/mlx5/mlx5_rxtx.c

index f35ffe2..1e0f7a6 100644 (file)
@@ -212,9 +212,10 @@ rxq_alloc_elts_sprq(struct mlx5_rxq_ctrl *rxq_ctrl)
 
        /* Iterate on segments. */
        for (i = 0; (i != elts_n); ++i) {
+               struct mlx5_eth_rxseg *seg = &rxq_ctrl->rxq.rxseg[i % sges_n];
                struct rte_mbuf *buf;
 
-               buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
+               buf = rte_pktmbuf_alloc(seg->mp);
                if (buf == NULL) {
                        DRV_LOG(ERR, "port %u empty mbuf pool",
                                PORT_ID(rxq_ctrl->priv));
@@ -227,12 +228,10 @@ rxq_alloc_elts_sprq(struct mlx5_rxq_ctrl *rxq_ctrl)
                MLX5_ASSERT(rte_pktmbuf_data_len(buf) == 0);
                MLX5_ASSERT(rte_pktmbuf_pkt_len(buf) == 0);
                MLX5_ASSERT(!buf->next);
-               /* Only the first segment keeps headroom. */
-               if (i % sges_n)
-                       SET_DATA_OFF(buf, 0);
+               SET_DATA_OFF(buf, seg->offset);
                PORT(buf) = rxq_ctrl->rxq.port_id;
-               DATA_LEN(buf) = rte_pktmbuf_tailroom(buf);
-               PKT_LEN(buf) = DATA_LEN(buf);
+               DATA_LEN(buf) = seg->length;
+               PKT_LEN(buf) = seg->length;
                NB_SEGS(buf) = 1;
                (*rxq_ctrl->rxq.elts)[i] = buf;
        }
index f121ed7..88402ef 100644 (file)
@@ -1356,7 +1356,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                rte_prefetch0(seg);
                rte_prefetch0(cqe);
                rte_prefetch0(wqe);
-               rep = rte_mbuf_raw_alloc(rxq->mp);
+               /* Allocate the buf from the same pool. */
+               rep = rte_mbuf_raw_alloc(seg->pool);
                if (unlikely(rep == NULL)) {
                        ++rxq->stats.rx_nombuf;
                        if (!pkt) {