[ovs-dev] [PATCH 4/4] datapath: Uses the OVS_CORE_UNSPEC instead of magic numbers.
nickcooper-zhangtonghao
nic at opencloud.tech
Mon Jan 9 01:30:22 UTC 2017
This patch uses OVS_CORE_UNSPEC for the queue unpinned instead
of "-1". More important, the "-1" casted to unsigned int is
equal to NON_PMD_CORE_ID. We make the distinction between them.
Signed-off-by: nickcooper-zhangtonghao <nic at opencloud.tech>
---
lib/dpif-netdev.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0b73056..99e4d35 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1293,7 +1293,7 @@ port_create(const char *devname, const char *type,
devname, ovs_strerror(errno));
goto out_rxq_close;
}
- port->rxqs[i].core_id = -1;
+ port->rxqs[i].core_id = OVS_CORE_UNSPEC;
n_open_rxqs++;
}
@@ -1517,7 +1517,7 @@ has_pmd_rxq_for_numa(struct dp_netdev *dp, int numa_id)
for (i = 0; i < port->n_rxq; i++) {
unsigned core_id = port->rxqs[i].core_id;
- if (core_id != -1
+ if (core_id != OVS_CORE_UNSPEC
&& ovs_numa_get_numa_id(core_id) == numa_id) {
return true;
}
@@ -2704,7 +2704,7 @@ parse_affinity_list(const char *affinity_list, unsigned *core_ids, int n_rxq)
int error = 0;
for (i = 0; i < n_rxq; i++) {
- core_ids[i] = -1;
+ core_ids[i] = OVS_CORE_UNSPEC;
}
if (!affinity_list) {
@@ -3617,7 +3617,7 @@ dp_netdev_add_port_rx_to_pmds(struct dp_netdev *dp,
for (i = 0; i < port->n_rxq; i++) {
if (pinned) {
- if (port->rxqs[i].core_id == -1) {
+ if (port->rxqs[i].core_id == OVS_CORE_UNSPEC) {
continue;
}
pmd = dp_netdev_get_pmd(dp, port->rxqs[i].core_id);
@@ -3631,7 +3631,7 @@ dp_netdev_add_port_rx_to_pmds(struct dp_netdev *dp,
pmd->isolated = true;
dp_netdev_pmd_unref(pmd);
} else {
- if (port->rxqs[i].core_id != -1) {
+ if (port->rxqs[i].core_id != OVS_CORE_UNSPEC) {
continue;
}
pmd = dp_netdev_less_loaded_pmd_on_numa(dp, numa_id);
@@ -3760,7 +3760,7 @@ dp_netdev_reset_pmd_threads(struct dp_netdev *dp)
for (i = 0; i < port->n_rxq; i++) {
unsigned core_id = port->rxqs[i].core_id;
- if (core_id != -1) {
+ if (core_id != OVS_CORE_UNSPEC) {
numa_id = ovs_numa_get_numa_id(core_id);
hmapx_add(&numas, (void *) numa_id);
}
--
1.8.3.1
More information about the dev
mailing list