@@ -258,7 +258,7 @@ struct dp_netdev_port {
struct netdev_saved_flags *sf;
unsigned n_rxq; /* Number of elements in 'rxq' */
struct netdev_rxq **rxq;
- atomic_bool dynamic_txqs; /* If true XPS will be used. */
+ bool dynamic_txqs; /* If true XPS will be used. */
unsigned *txq_used; /* Number of threads that uses each tx queue. */
struct ovs_mutex txq_used_mutex;
char *type; /* Port type as requested by user. */
@@ -1151,6 +1151,7 @@ port_create(const char *devname, const char *open_type, const char *type,
enum netdev_flags flags;
struct netdev *netdev;
int n_open_rxqs = 0;
+ int n_cores = 0;
int i, error;
bool dynamic_txqs = false;
@@ -1171,7 +1172,7 @@ port_create(const char *devname, const char *open_type, const char *type,
}
if (netdev_is_pmd(netdev)) {
- int n_cores = ovs_numa_get_n_cores();
+ n_cores = ovs_numa_get_n_cores();
if (n_cores == OVS_CORE_UNSPEC) {
VLOG_ERR("%s, cannot get cpu core info", devname);
@@ -1186,9 +1187,6 @@ port_create(const char *devname, const char *open_type, const char *type,
VLOG_ERR("%s, cannot set multiq", devname);
goto out;
}
- if (netdev_n_txq(netdev) < n_cores + 1) {
- dynamic_txqs = true;
- }
}
if (netdev_is_reconf_required(netdev)) {
@@ -1198,6 +1196,12 @@ port_create(const char *devname, const char *open_type, const char *type,
}
}
+ if (netdev_is_pmd(netdev)) {
+ if (netdev_n_txq(netdev) < n_cores + 1) {
+ dynamic_txqs = true;
+ }
+ }
+
port = xzalloc(sizeof *port);
port->port_no = port_no;
port->netdev = netdev;
@@ -1206,7 +1210,7 @@ port_create(const char *devname, const char *open_type, const char *type,
port->txq_used = xcalloc(netdev_n_txq(netdev), sizeof *port->txq_used);
port->type = xstrdup(type);
ovs_mutex_init(&port->txq_used_mutex);
- atomic_init(&port->dynamic_txqs, dynamic_txqs);
+ port->dynamic_txqs = dynamic_txqs;
for (i = 0; i < port->n_rxq; i++) {
error = netdev_rxq_open(netdev, &port->rxq[i], i);
@@ -2718,8 +2722,7 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
seq_change(dp->port_seq);
port_destroy(port);
} else {
- atomic_init(&port->dynamic_txqs,
- netdev_n_txq(port->netdev) < n_cores + 1);
+ port->dynamic_txqs = netdev_n_txq(port->netdev) < n_cores + 1;
}
}
/* Restores the non-pmd. */
@@ -4015,11 +4018,9 @@ dpif_netdev_xps_revalidate_pmd(const struct dp_netdev_pmd_thread *pmd,
struct tx_port *tx;
struct dp_netdev_port *port;
long long interval;
- bool dynamic_txqs;
HMAP_FOR_EACH (tx, node, &pmd->port_cache) {
- atomic_read_relaxed(&tx->port->dynamic_txqs, &dynamic_txqs);
- if (dynamic_txqs) {
+ if (tx->port->dynamic_txqs) {
continue;
}
interval = now - tx->last_used;
@@ -4156,7 +4157,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
int tx_qid;
bool dynamic_txqs;
- atomic_read_relaxed(&p->port->dynamic_txqs, &dynamic_txqs);
+ dynamic_txqs = p->port->dynamic_txqs;
if (dynamic_txqs) {
tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p, now);
} else {