2017-01-08 17:30 GMT-08:00 nickcooper-zhangtonghao <n...@opencloud.tech>: > 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 <n...@opencloud.tech>
Thanks, this bothered me as well. In fact I sent a patch for it in the past as part of a series: https://mail.openvswitch.org/pipermail/ovs-dev/2016-December/325692.html. This shouldn't fix any problems, because I think we only compared core_id with pmd threads (not why the non-pmd), but I agree that using -1 for an unsigned is not pretty. I fixed the title and applied this to master, thanks > --- > 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 > > > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev