distributor: add SIMD flow matching
[dpdk.git] / lib / librte_distributor / rte_distributor.c
index 75b0d47..6158fa6 100644 (file)
@@ -391,7 +391,13 @@ rte_distributor_process_v1705(struct rte_distributor_v1705 *d,
                for (; i < RTE_DIST_BURST_SIZE; i++)
                        flows[i] = 0;
 
-               find_match_scalar(d, &flows[0], &matches[0]);
+               switch (d->dist_match_fn) {
+               case RTE_DIST_MATCH_VECTOR:
+                       find_match_vec(d, &flows[0], &matches[0]);
+                       break;
+               default:
+                       find_match_scalar(d, &flows[0], &matches[0]);
+               }
 
                /*
                 * Matches array now contain the intended worker ID (+1) of
@@ -607,7 +613,13 @@ rte_distributor_create_v1705(const char *name,
        snprintf(d->name, sizeof(d->name), "%s", name);
        d->num_workers = num_workers;
        d->alg_type = alg_type;
-       d->dist_match_fn = RTE_DIST_MATCH_SCALAR;
+
+#if defined(RTE_ARCH_X86)
+       if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2))
+               d->dist_match_fn = RTE_DIST_MATCH_VECTOR;
+       else
+#endif
+               d->dist_match_fn = RTE_DIST_MATCH_SCALAR;
 
        /*
         * Set up the backog tags so they're pointing at the second cache