This splits up the looping through each PMD thread core on a numa node with the check to compare cycles or rxqs.
This is done so in future the compare could be reused with any group of PMD thread cores. There is no user visibile change in behaviour. Signed-off-by: Kevin Traynor <[email protected]> --- lib/dpif-netdev.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 88a5459cc..40a62fd9f 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -5751,13 +5751,34 @@ compare_rxq_cycles(const void *a, const void *b) } +static bool +sched_pmd_new_lowest(struct sched_pmd *current_lowest, struct sched_pmd *pmd, + bool has_proc) { + uint64_t current_num, pmd_num; + + if (current_lowest == NULL) { + return true; + } + + if (has_proc) { + current_num = current_lowest->pmd_proc_cycles; + pmd_num = pmd->pmd_proc_cycles; + } else { + current_num = current_lowest->n_rxq; + pmd_num = pmd->n_rxq; + } + + if (pmd_num < current_num) { + return true; + } + return false; +} + static struct sched_pmd * sched_pmd_get_lowest(struct sched_numa *numa, bool has_cyc) { struct sched_pmd *lowest_sched_pmd = NULL; - uint64_t lowest_num = UINT64_MAX; for (unsigned i = 0; i < numa->n_pmds; i++) { struct sched_pmd *sched_pmd; - uint64_t pmd_num; sched_pmd = &numa->pmds[i]; @@ -5765,12 +5786,5 @@ sched_pmd_get_lowest(struct sched_numa *numa, bool has_cyc) continue; } - if (has_cyc) { - pmd_num = sched_pmd->pmd_proc_cycles; - } else { - pmd_num = sched_pmd->n_rxq; - } - - if (pmd_num < lowest_num) { - lowest_num = pmd_num; + if (sched_pmd_new_lowest(lowest_sched_pmd, sched_pmd, has_cyc)) { lowest_sched_pmd = sched_pmd; } -- 2.34.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
