net/bnxt: fix getting burst mode for Arm
authorLance Richardson <lance.richardson@broadcom.com>
Wed, 9 Sep 2020 15:52:54 +0000 (11:52 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:09 +0000 (18:55 +0200)
Transmit and receive burst mode get operations incorrectly return
"Vector SSE" on ARM64 platforms, change to return "Vector Neon"
instead.

Fixes: 398358341419 ("net/bnxt: support NEON")
Cc: stable@dpdk.org
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 8c959ac..7f9329e 100644 (file)
@@ -2615,46 +2615,62 @@ bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
        qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
 }
 
+static const struct {
+       eth_rx_burst_t pkt_burst;
+       const char *info;
+} bnxt_rx_burst_info[] = {
+       {bnxt_recv_pkts,        "Scalar"},
+#if defined(RTE_ARCH_X86)
+       {bnxt_recv_pkts_vec,    "Vector SSE"},
+#elif defined(RTE_ARCH_ARM64)
+       {bnxt_recv_pkts_vec,    "Vector Neon"},
+#endif
+};
+
 static int
 bnxt_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
                       struct rte_eth_burst_mode *mode)
 {
        eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
+       size_t i;
 
-       if (pkt_burst == bnxt_recv_pkts) {
-               snprintf(mode->info, sizeof(mode->info), "%s",
-                        "Scalar");
-               return 0;
-       }
-#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
-       if (pkt_burst == bnxt_recv_pkts_vec) {
-               snprintf(mode->info, sizeof(mode->info), "%s",
-                        "Vector SSE");
-               return 0;
+       for (i = 0; i < RTE_DIM(bnxt_rx_burst_info); i++) {
+               if (pkt_burst == bnxt_rx_burst_info[i].pkt_burst) {
+                       snprintf(mode->info, sizeof(mode->info), "%s",
+                                bnxt_rx_burst_info[i].info);
+                       return 0;
+               }
        }
-#endif
 
        return -EINVAL;
 }
 
+static const struct {
+       eth_tx_burst_t pkt_burst;
+       const char *info;
+} bnxt_tx_burst_info[] = {
+       {bnxt_xmit_pkts,        "Scalar"},
+#if defined(RTE_ARCH_X86)
+       {bnxt_xmit_pkts_vec,    "Vector SSE"},
+#elif defined(RTE_ARCH_ARM64)
+       {bnxt_xmit_pkts_vec,    "Vector Neon"},
+#endif
+};
+
 static int
 bnxt_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
                       struct rte_eth_burst_mode *mode)
 {
        eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
+       size_t i;
 
-       if (pkt_burst == bnxt_xmit_pkts) {
-               snprintf(mode->info, sizeof(mode->info), "%s",
-                        "Scalar");
-               return 0;
-       }
-#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
-       if (pkt_burst == bnxt_xmit_pkts_vec) {
-               snprintf(mode->info, sizeof(mode->info), "%s",
-                        "Vector SSE");
-               return 0;
+       for (i = 0; i < RTE_DIM(bnxt_tx_burst_info); i++) {
+               if (pkt_burst == bnxt_tx_burst_info[i].pkt_burst) {
+                       snprintf(mode->info, sizeof(mode->info), "%s",
+                                bnxt_tx_burst_info[i].info);
+                       return 0;
+               }
        }
-#endif
 
        return -EINVAL;
 }