net/ice/base: add helper function to redirect flags
[dpdk.git] / drivers / net / cnxk / cn9k_rx.c
index 0acedd0..7d9f1bd 100644 (file)
@@ -29,6 +29,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,
                [!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
                [!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)]
                [!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_RSS_F)];
+
+       rte_atomic_thread_fence(__ATOMIC_RELEASE);
 }
 
 void
@@ -60,20 +62,26 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
        };
 
-       /* For PTP enabled, scalar rx function should be chosen as most of the
-        * PTP apps are implemented to rx burst 1 pkt.
-        */
-       if (dev->scalar_ena || dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
-               pick_rx_func(eth_dev, nix_eth_rx_burst);
-       else
-               pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
+       const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
+       [f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_mseg_##name,
 
-       if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
-               pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+               NIX_RX_FASTPATH_MODES
+#undef R
+       };
 
        /* Copy multi seg version with no offload for tear down sequence */
        if (rte_eal_process_type() == RTE_PROC_PRIMARY)
                dev->rx_pkt_burst_no_offload =
                        nix_eth_rx_burst_mseg[0][0][0][0][0][0];
-       rte_mb();
+
+       if (dev->scalar_ena) {
+               if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+                       return pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+               return pick_rx_func(eth_dev, nix_eth_rx_burst);
+       }
+
+       if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+               return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_mseg);
+       return pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
 }