The list of PMDs is round robined through for the selection
when assigning an rxq to a PMD. The list is based on a
hash map, so there is no defined order.

It means the same set of PMDs may get assigned different rxqs
on different runs for no reason other than how the PMDs are stored
in the hash map.

This can be easily changed by sorting the PMDs by core id after
they are extracted, so the PMDs will be used in a consistent order.

Signed-off-by: Kevin Traynor <ktray...@redhat.com>
Acked-by: Sunil Pai G <sunil.pa...@intel.com>
Acked-by: David Marchand <david.march...@redhat.com>
---
 lib/dpif-netdev.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 76667b5f1..7fa7c2a9d 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4593,4 +4593,28 @@ sched_numa_list_lookup(struct sched_numa_list 
*numa_list, int numa_id)
 }
 
+static int
+compare_sched_pmd_list(const void *a_, const void *b_)
+{
+    struct sched_pmd *a, *b;
+
+    a = (struct sched_pmd *) a_;
+    b = (struct sched_pmd *) b_;
+
+    return compare_poll_thread_list(&a->pmd, &b->pmd);
+}
+
+static void
+sort_numa_list_pmds(struct sched_numa_list *numa_list)
+{
+    struct sched_numa *numa;
+
+    HMAP_FOR_EACH (numa, node, &numa_list->numas) {
+        if (numa->n_pmds > 1) {
+            qsort(numa->pmds, numa->n_pmds, sizeof *numa->pmds,
+                  compare_sched_pmd_list);
+        }
+    }
+}
+
 /* Populate numas and pmds on those numas. */
 static void
@@ -4631,4 +4655,5 @@ sched_numa_list_populate(struct sched_numa_list 
*numa_list,
         numa->rr_idx_inc = true;
     }
+    sort_numa_list_pmds(numa_list);
 }
 
-- 
2.31.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to