As per the requirement of rte_mbuf_raw_reset_bulk(), the mbuf's
'next' and 'nb_segs' fields are required to be reset.
This reset these field for multi-segment mbufs on cn9k platform.

Signed-off-by: Rahul Bhansali <[email protected]>
---
 drivers/net/cnxk/cn9k_rx.h |  8 --------
 drivers/net/cnxk/cn9k_tx.h | 42 ++++++++++++++++++--------------------
 2 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index 79b56fe160..5ccdc5dee1 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -410,8 +410,6 @@ cn9k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const 
uint32_t tag,
                 * Hence, flag argument is not required.
                 */
                nix_cqe_xtract_mseg(rx, mbuf, val, 0);
-       else
-               mbuf->next = NULL;
 }
 
 static inline uint16_t
@@ -826,12 +824,6 @@ cn9k_nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf 
**rx_pkts,
                        nix_cqe_xtract_mseg((union nix_rx_parse_u *)
                                                (cq0 + CQE_SZ(3) + 8), mbuf3,
                                            mbuf_initializer, flags);
-               } else {
-                       /* Update that no more segments */
-                       mbuf0->next = NULL;
-                       mbuf1->next = NULL;
-                       mbuf2->next = NULL;
-                       mbuf3->next = NULL;
                }
 
                /* Store the mbufs to rx_pkts */
diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h
index 32665d2050..0ec448e36c 100644
--- a/drivers/net/cnxk/cn9k_tx.h
+++ b/drivers/net/cnxk/cn9k_tx.h
@@ -665,14 +665,14 @@ cn9k_nix_prepare_mseg(struct cn9k_eth_txq *txq, struct 
rte_mbuf *m, struct rte_m
 #else
        RTE_SET_USED(cookie);
 #endif
-#ifdef RTE_ENABLE_ASSERT
-       m->next = NULL;
-       m->nb_segs = 1;
-#endif
-       m = m_next;
-       if (!m)
+       if (likely(!m_next))
                goto done;
 
+       if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)) {
+               m->next = NULL;
+               m->nb_segs = 1;
+       }
+       m = m_next;
        /* Fill mbuf segments */
        do {
                m_next = m->next;
@@ -704,12 +704,13 @@ cn9k_nix_prepare_mseg(struct cn9k_eth_txq *txq, struct 
rte_mbuf *m, struct rte_m
                        sg_u = sg->u;
                        slist++;
                }
-#ifdef RTE_ENABLE_ASSERT
-               m->next = NULL;
-#endif
+               if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+                       m->next = NULL;
                m = m_next;
        } while (nb_segs);
 
+       if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+               rte_io_wmb();
 done:
        sg->u = sg_u;
        sg->segs = i;
@@ -720,9 +721,6 @@ cn9k_nix_prepare_mseg(struct cn9k_eth_txq *txq, struct 
rte_mbuf *m, struct rte_m
        segdw += (off >> 1) + 1 + !!(flags & NIX_TX_OFFLOAD_TSTAMP_F);
        send_hdr->w0.sizem1 = segdw - 1;
 
-#ifdef RTE_ENABLE_ASSERT
-       rte_io_wmb();
-#endif
        return segdw;
 }
 
@@ -950,10 +948,10 @@ cn9k_nix_prepare_mseg_vec_list(struct cn9k_eth_txq *txq,
        RTE_SET_USED(cookie);
 #endif
 
-#ifdef RTE_ENABLE_ASSERT
-       m->next = NULL;
-       m->nb_segs = 1;
-#endif
+       if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)) {
+               m->next = NULL;
+               m->nb_segs = 1;
+       }
        m = m_next;
        /* Fill mbuf segments */
        do {
@@ -984,9 +982,8 @@ cn9k_nix_prepare_mseg_vec_list(struct cn9k_eth_txq *txq,
                        sg_u = sg->u;
                        slist++;
                }
-#ifdef RTE_ENABLE_ASSERT
-               m->next = NULL;
-#endif
+               if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+                       m->next = NULL;
                m = m_next;
        } while (nb_segs);
 
@@ -1002,9 +999,6 @@ cn9k_nix_prepare_mseg_vec_list(struct cn9k_eth_txq *txq,
                 !!(flags & NIX_TX_OFFLOAD_TSTAMP_F);
        send_hdr->w0.sizem1 = segdw - 1;
 
-#ifdef RTE_ENABLE_ASSERT
-       rte_io_wmb();
-#endif
        return segdw;
 }
 
@@ -1089,6 +1083,10 @@ cn9k_nix_xmit_pkts_mseg_vector(uint64x2_t *cmd0, 
uint64x2_t *cmd1,
                }
        }
 
+       /* Multi segment mbufs */
+       if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+               rte_io_wmb();
+
        for (j = 0; j < NIX_DESCS_PER_LOOP;) {
                /* Fit consecutive packets in same LMTLINE. */
                if ((segdw[j] + segdw[j + 1]) <= 8) {
-- 
2.34.1

Reply via email to