summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/device.c8
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h8
-rwxr-xr-xsrc/plugins/dpdk/device/init.c2
-rw-r--r--src/plugins/dpdk/device/node.c32
4 files changed, 26 insertions, 24 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 50b2668977f..91661246ebc 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -243,7 +243,7 @@ static_always_inline
ASSERT (ring->tx_tail == 0);
n_retry = 16;
- queue_id = vm->cpu_index;
+ queue_id = vm->thread_index;
do
{
@@ -266,7 +266,7 @@ static_always_inline
{
/* no wrap, transmit in one burst */
dpdk_device_hqos_per_worker_thread_t *hqos =
- &xd->hqos_wt[vm->cpu_index];
+ &xd->hqos_wt[vm->thread_index];
ASSERT (hqos->swq != NULL);
@@ -332,7 +332,7 @@ dpdk_buffer_recycle (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_buffer_t * b, u32 bi, struct rte_mbuf **mbp)
{
dpdk_main_t *dm = &dpdk_main;
- u32 my_cpu = vm->cpu_index;
+ u32 my_cpu = vm->thread_index;
struct rte_mbuf *mb_new;
if (PREDICT_FALSE (b->flags & VLIB_BUFFER_RECYCLE) == 0)
@@ -376,7 +376,7 @@ dpdk_interface_tx (vlib_main_t * vm,
tx_ring_hdr_t *ring;
u32 n_on_ring;
- my_cpu = vm->cpu_index;
+ my_cpu = vm->thread_index;
queue_id = my_cpu;
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index dd40ff48510..52b4ca4b303 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -79,7 +79,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
{
vlib_simple_counter_main_t *cm;
vnet_main_t *vnm = vnet_get_main ();
- u32 my_cpu = os_get_cpu_number ();
+ u32 thread_index = vlib_get_thread_index ();
u64 rxerrors, last_rxerrors;
/* only update counters for PMD interfaces */
@@ -96,7 +96,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_NO_BUF);
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ vlib_increment_simple_counter (cm, thread_index, xd->vlib_sw_if_index,
xd->stats.rx_nombuf -
xd->last_stats.rx_nombuf);
}
@@ -107,7 +107,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_MISS);
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ vlib_increment_simple_counter (cm, thread_index, xd->vlib_sw_if_index,
xd->stats.imissed -
xd->last_stats.imissed);
}
@@ -119,7 +119,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_ERROR);
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ vlib_increment_simple_counter (cm, thread_index, xd->vlib_sw_if_index,
rxerrors - last_rxerrors);
}
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 538db6cb94e..7eaf8da7992 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -324,7 +324,7 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
int rv;
int j;
- ASSERT (os_get_cpu_number () == 0);
+ ASSERT (vlib_get_thread_index () == 0);
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index e740fd18422..b10e0fadb6f 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -283,7 +283,7 @@ dpdk_buffer_init_from_template (void *d0, void *d1, void *d2, void *d3,
*/
static_always_inline u32
dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
- vlib_node_runtime_t * node, u32 cpu_index, u16 queue_id,
+ vlib_node_runtime_t * node, u32 thread_index, u16 queue_id,
int maybe_multiseg)
{
u32 n_buffers;
@@ -294,7 +294,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
uword n_rx_bytes = 0;
u32 n_trace, trace_cnt __attribute__ ((unused));
vlib_buffer_free_list_t *fl;
- vlib_buffer_t *bt = vec_elt_at_index (dm->buffer_templates, cpu_index);
+ vlib_buffer_t *bt = vec_elt_at_index (dm->buffer_templates, thread_index);
if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
return 0;
@@ -306,7 +306,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
return 0;
}
- vec_reset_length (xd->d_trace_buffers[cpu_index]);
+ vec_reset_length (xd->d_trace_buffers[thread_index]);
trace_cnt = n_trace = vlib_get_trace_count (vm, node);
if (n_trace > 0)
@@ -318,7 +318,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
{
struct rte_mbuf *mb = xd->rx_vectors[queue_id][mb_index++];
vlib_buffer_t *b = vlib_buffer_from_rte_mbuf (mb);
- vec_add1 (xd->d_trace_buffers[cpu_index],
+ vec_add1 (xd->d_trace_buffers[thread_index],
vlib_get_buffer_index (vm, b));
}
}
@@ -546,20 +546,22 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- if (PREDICT_FALSE (vec_len (xd->d_trace_buffers[cpu_index]) > 0))
+ if (PREDICT_FALSE (vec_len (xd->d_trace_buffers[thread_index]) > 0))
{
- dpdk_rx_trace (dm, node, xd, queue_id, xd->d_trace_buffers[cpu_index],
- vec_len (xd->d_trace_buffers[cpu_index]));
- vlib_set_trace_count (vm, node, n_trace -
- vec_len (xd->d_trace_buffers[cpu_index]));
+ dpdk_rx_trace (dm, node, xd, queue_id,
+ xd->d_trace_buffers[thread_index],
+ vec_len (xd->d_trace_buffers[thread_index]));
+ vlib_set_trace_count (vm, node,
+ n_trace -
+ vec_len (xd->d_trace_buffers[thread_index]));
}
vlib_increment_combined_counter
(vnet_get_main ()->interface_main.combined_sw_if_counters
+ VNET_INTERFACE_COUNTER_RX,
- cpu_index, xd->vlib_sw_if_index, mb_index, n_rx_bytes);
+ thread_index, xd->vlib_sw_if_index, mb_index, n_rx_bytes);
- vnet_device_increment_rx_packets (cpu_index, mb_index);
+ vnet_device_increment_rx_packets (thread_index, mb_index);
return mb_index;
}
@@ -630,19 +632,19 @@ dpdk_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f)
dpdk_device_t *xd;
uword n_rx_packets = 0;
dpdk_device_and_queue_t *dq;
- u32 cpu_index = os_get_cpu_number ();
+ u32 thread_index = vlib_get_thread_index ();
/*
* Poll all devices on this cpu for input/interrupts.
*/
/* *INDENT-OFF* */
- vec_foreach (dq, dm->devices_by_cpu[cpu_index])
+ vec_foreach (dq, dm->devices_by_cpu[thread_index])
{
xd = vec_elt_at_index(dm->devices, dq->device);
if (xd->flags & DPDK_DEVICE_FLAG_MAYBE_MULTISEG)
- n_rx_packets += dpdk_device_input (dm, xd, node, cpu_index, dq->queue_id, /* maybe_multiseg */ 1);
+ n_rx_packets += dpdk_device_input (dm, xd, node, thread_index, dq->queue_id, /* maybe_multiseg */ 1);
else
- n_rx_packets += dpdk_device_input (dm, xd, node, cpu_index, dq->queue_id, /* maybe_multiseg */ 0);
+ n_rx_packets += dpdk_device_input (dm, xd, node, thread_index, dq->queue_id, /* maybe_multiseg */ 0);
}
/* *INDENT-ON* */