trace: fixup CTF event description at registration
[dpdk.git] / lib / librte_distributor / rte_distributor.c
index 6e3eae5..07e385a 100644 (file)
@@ -14,6 +14,7 @@
 #include <rte_eal_memconfig.h>
 #include <rte_pause.h>
 #include <rte_tailq.h>
+#include <rte_vect.h>
 
 #include "rte_distributor.h"
 #include "rte_distributor_single.h"
@@ -259,13 +260,13 @@ find_match_scalar(struct rte_distributor *d,
 
                for (j = 0; j < RTE_DIST_BURST_SIZE ; j++)
                        for (w = 0; w < RTE_DIST_BURST_SIZE; w++)
-                               if (d->in_flight_tags[i][j] == data_ptr[w]) {
+                               if (d->in_flight_tags[i][w] == data_ptr[j]) {
                                        output_ptr[j] = i+1;
                                        break;
                                }
                for (j = 0; j < RTE_DIST_BURST_SIZE; j++)
                        for (w = 0; w < RTE_DIST_BURST_SIZE; w++)
-                               if (bl->tags[j] == data_ptr[w]) {
+                               if (bl->tags[w] == data_ptr[j]) {
                                        output_ptr[j] = i+1;
                                        break;
                                }
@@ -465,6 +466,7 @@ rte_distributor_process(struct rte_distributor *d,
                        /* Sync with worker on GET_BUF flag. */
                        if (__atomic_load_n(&(d->bufs[wid].bufptr64[0]),
                                __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) {
+                               d->bufs[wid].count = 0;
                                release(d, wid);
                                handle_returns(d, wid);
                        }
@@ -479,11 +481,6 @@ rte_distributor_process(struct rte_distributor *d,
                uint16_t matches[RTE_DIST_BURST_SIZE];
                unsigned int pkts;
 
-               /* Sync with worker on GET_BUF flag. */
-               if (__atomic_load_n(&(d->bufs[wkr].bufptr64[0]),
-                       __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)
-                       d->bufs[wkr].count = 0;
-
                if ((num_mbufs - next_idx) < RTE_DIST_BURST_SIZE)
                        pkts = num_mbufs - next_idx;
                else
@@ -603,8 +600,10 @@ rte_distributor_process(struct rte_distributor *d,
        for (wid = 0 ; wid < d->num_workers; wid++)
                /* Sync with worker on GET_BUF flag. */
                if ((__atomic_load_n(&(d->bufs[wid].bufptr64[0]),
-                       __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF))
+                       __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) {
+                       d->bufs[wid].count = 0;
                        release(d, wid);
+               }
 
        return num_mbufs;
 }
@@ -647,7 +646,7 @@ total_outstanding(const struct rte_distributor *d)
        unsigned int wkr, total_outstanding = 0;
 
        for (wkr = 0; wkr < d->num_workers; wkr++)
-               total_outstanding += d->backlog[wkr].count;
+               total_outstanding += d->backlog[wkr].count + d->bufs[wkr].count;
 
        return total_outstanding;
 }
@@ -704,6 +703,8 @@ rte_distributor_clear_returns(struct rte_distributor *d)
                /* Sync with worker. Release retptrs. */
                __atomic_store_n(&(d->bufs[wkr].retptr64[0]), 0,
                                __ATOMIC_RELEASE);
+
+       d->returns.start = d->returns.count = 0;
 }
 
 /* creates a distributor instance */
@@ -762,7 +763,8 @@ rte_distributor_create(const char *name,
 
        d->dist_match_fn = RTE_DIST_MATCH_SCALAR;
 #if defined(RTE_ARCH_X86)
-       d->dist_match_fn = RTE_DIST_MATCH_VECTOR;
+       if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
+               d->dist_match_fn = RTE_DIST_MATCH_VECTOR;
 #endif
 
        /*