Skip to content

Commit

Permalink
dpif-netdev: Make 'static_tx_qid' const.
Browse files Browse the repository at this point in the history
Since previous commit, 'static_tx_qid' doesn't need to be atomic and is
actually never touched (except for initialization), so it can be made
const.

Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Ilya Maximets <[email protected]>
  • Loading branch information
ddiproietto committed Jan 16, 2017
1 parent b9584f2 commit 82d765f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ struct dp_netdev_pmd_thread {
/* Queue id used by this pmd thread to send packets on all netdevs if
* XPS disabled for this netdev. All static_tx_qid's are unique and less
* than 'ovs_numa_get_n_cores() + 1'. */
atomic_int static_tx_qid;
const int static_tx_qid;

struct ovs_mutex port_mutex; /* Mutex for 'poll_list' and 'tx_ports'. */
/* List of rx queues to poll. */
Expand Down Expand Up @@ -3302,10 +3302,9 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, struct dp_netdev *dp,
pmd->numa_id = numa_id;
pmd->poll_cnt = 0;

atomic_init(&pmd->static_tx_qid,
(core_id == NON_PMD_CORE_ID)
? ovs_numa_get_n_cores()
: get_n_pmd_threads(dp));
*CONST_CAST(int *, &pmd->static_tx_qid) = (core_id == NON_PMD_CORE_ID)
? ovs_numa_get_n_cores()
: get_n_pmd_threads(dp);

ovs_refcount_init(&pmd->ref_cnt);
latch_init(&pmd->exit_latch);
Expand Down Expand Up @@ -4410,7 +4409,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
if (dynamic_txqs) {
tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p, now);
} else {
atomic_read_relaxed(&pmd->static_tx_qid, &tx_qid);
tx_qid = pmd->static_tx_qid;
}

netdev_send(p->port->netdev, tx_qid, packets_, may_steal,
Expand Down

0 comments on commit 82d765f

Please sign in to comment.