net/mlx5: add fallback in Tx for multi-segment packet
[dpdk.git] / drivers / net / mlx5 / mlx5_rxtx_vec.c
index edc6638..8d23dae 100644 (file)
 #include "mlx5_defs.h"
 #include "mlx5_prm.h"
 
-#ifdef RTE_ARCH_X86_64
+#if defined RTE_ARCH_X86_64
 #include "mlx5_rxtx_vec_sse.h"
+#elif defined RTE_ARCH_ARM64
+#include "mlx5_rxtx_vec_neon.h"
 #else
 #error "This should not be compiled if SIMD instructions are not supported."
 #endif
 
-/**
- * Count the number of continuous single segment packets.
- *
- * @param pkts
- *   Pointer to array of packets.
- * @param pkts_n
- *   Number of packets.
- *
- * @return
- *   Number of continuous single segment packets.
- */
-static inline unsigned int
-txq_check_multiseg(struct rte_mbuf **pkts, uint16_t pkts_n)
-{
-       unsigned int pos;
-
-       if (!pkts_n)
-               return 0;
-       /* Count the number of continuous single segment packets. */
-       for (pos = 0; pos < pkts_n; ++pos)
-               if (NB_SEGS(pkts[pos]) > 1)
-                       break;
-       return pos;
-}
-
 /**
  * Count the number of packets having same ol_flags and calculate cs_flags.
  *
@@ -121,24 +98,7 @@ txq_calc_offload(struct mlx5_txq_data *txq, struct rte_mbuf **pkts,
        for (pos = 1; pos < pkts_n; ++pos)
                if ((pkts[pos]->ol_flags ^ pkts[0]->ol_flags) & ol_mask)
                        break;
-       /* Should open another MPW session for the rest. */
-       if (pkts[0]->ol_flags &
-           (PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)) {
-               const uint64_t is_tunneled =
-                       pkts[0]->ol_flags &
-                       (PKT_TX_TUNNEL_GRE |
-                        PKT_TX_TUNNEL_VXLAN);
-
-               if (is_tunneled && txq->tunnel_en) {
-                       *cs_flags = MLX5_ETH_WQE_L3_INNER_CSUM |
-                                   MLX5_ETH_WQE_L4_INNER_CSUM;
-                       if (pkts[0]->ol_flags & PKT_TX_OUTER_IP_CKSUM)
-                               *cs_flags |= MLX5_ETH_WQE_L3_CSUM;
-               } else {
-                       *cs_flags = MLX5_ETH_WQE_L3_CSUM |
-                                   MLX5_ETH_WQE_L4_CSUM;
-               }
-       }
+       *cs_flags = txq_ol_cksum_to_cs(txq, pkts[0]);
        return pos;
 }
 
@@ -207,7 +167,7 @@ mlx5_tx_burst_vec(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
                                               pkts_n - nb_tx);
                n = RTE_MIN((uint16_t)(pkts_n - nb_tx), MLX5_VPMD_TX_MAX_BURST);
                if (!(txq->flags & ETH_TXQ_FLAGS_NOMULTSEGS))
-                       n = txq_check_multiseg(&pkts[nb_tx], n);
+                       n = txq_count_contig_single_seg(&pkts[nb_tx], n);
                if (!(txq->flags & ETH_TXQ_FLAGS_NOOFFLOADS))
                        n = txq_calc_offload(txq, &pkts[nb_tx], n, &cs_flags);
                ret = txq_burst_v(txq, &pkts[nb_tx], n, cs_flags);