net/bnxt: disable vector Rx for mark action
authorLance Richardson <lance.richardson@broadcom.com>
Tue, 7 Jul 2020 22:22:23 +0000 (15:22 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 11 Jul 2020 04:18:52 +0000 (06:18 +0200)
The bnxt vector mode receive handler does not support the rte_flow
'mark' action. Since we cannot know in advance whether this action
will be required, add support for dynamically switching from vector
to non-vector receive when the first flow create request with a
mark action is processed.

Fixes: 94eb699bc82e ("net/bnxt: support flow mark action")
Cc: stable@dpdk.org
Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_flow.c
drivers/net/bnxt/bnxt_rxr.c

index 84a21db..19bc66a 100644 (file)
@@ -18,6 +18,7 @@
 #include "bnxt_hwrm.h"
 #include "bnxt_ring.h"
 #include "bnxt_rxq.h"
+#include "bnxt_rxr.h"
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 
@@ -1403,18 +1404,6 @@ vnic_found:
                bnxt_update_filter_flags_en(filter, filter1, use_ntuple);
                break;
        case RTE_FLOW_ACTION_TYPE_MARK:
-               if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
-                       PMD_DRV_LOG(DEBUG,
-                                   "Disable vector processing for mark\n");
-                       rte_flow_error_set(error,
-                                          ENOTSUP,
-                                          RTE_FLOW_ERROR_TYPE_ACTION,
-                                          act,
-                                          "Disable vector processing for mark");
-                       rc = -rte_errno;
-                       goto ret;
-               }
-
                if (bp->mark_table == NULL) {
                        rte_flow_error_set(error,
                                           ENOMEM,
@@ -1425,6 +1414,13 @@ vnic_found:
                        goto ret;
                }
 
+               if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
+                       PMD_DRV_LOG(DEBUG,
+                                   "Disabling vector processing for mark\n");
+                       bp->eth_dev->rx_pkt_burst = bnxt_recv_pkts;
+                       bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
+               }
+
                filter->valid_flags |= BNXT_FLOW_MARK_FLAG;
                filter->mark = ((const struct rte_flow_action_mark *)
                                act->conf)->id;
index 6405887..eb6f33c 100644 (file)
@@ -782,6 +782,24 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                     !rte_spinlock_trylock(&rxq->lock)))
                return 0;
 
+#if defined(RTE_ARCH_X86)
+       /*
+        * Replenish buffers if needed when a transition has been made from
+        * vector- to non-vector- receive processing.
+        */
+       while (unlikely(rxq->rxrearm_nb)) {
+               if (!bnxt_alloc_rx_data(rxq, rxr, rxq->rxrearm_start)) {
+                       rxr->rx_prod = rxq->rxrearm_start;
+                       bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+                       rxq->rxrearm_start++;
+                       rxq->rxrearm_nb--;
+               } else {
+                       /* Retry allocation on next call. */
+                       break;
+               }
+       }
+#endif
+
        /* Handle RX burst request */
        while (1) {
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);