mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +00:00
dpif-netdev: Uses the OVS_CORE_UNSPEC instead of magic numbers.
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@opencloud.tech> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
committed by
Daniele Di Proietto
parent
cce57f8daa
commit
51c37a56d7
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,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;
|
||||
}
|
||||
@@ -2707,7 +2707,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) {
|
||||
@@ -3620,7 +3620,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);
|
||||
@@ -3634,7 +3634,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);
|
||||
@@ -3763,7 +3763,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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user