summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/pg/input.c12
-rw-r--r--vnet/vnet/pg/pg.h2
-rw-r--r--vnet/vnet/pg/stream.c9
3 files changed, 13 insertions, 10 deletions
diff --git a/vnet/vnet/pg/input.c b/vnet/vnet/pg/input.c
index 46c8f4fa2f7..735a85e2416 100644
--- a/vnet/vnet/pg/input.c
+++ b/vnet/vnet/pg/input.c
@@ -1683,15 +1683,15 @@ pg_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
uword i;
pg_main_t *pg = &pg_main;
uword n_packets = 0;
- u32 num_workers = vlib_num_workers ();
- u32 cpu_index = os_get_cpu_number ();
+ u32 worker_index = 0;
+
+ if (vlib_num_workers ())
+ worker_index = vlib_get_current_worker_index ();
/* *INDENT-OFF* */
- clib_bitmap_foreach (i, pg->enabled_streams, ({
+ clib_bitmap_foreach (i, pg->enabled_streams[worker_index], ({
pg_stream_t *s = vec_elt_at_index (pg->streams, i);
- if (num_workers == 0 ||
- vlib_get_worker_cpu_index (s->worker_index) == cpu_index)
- n_packets += pg_input_stream (node, pg, s);
+ n_packets += pg_input_stream (node, pg, s);
}));
/* *INDENT-ON* */
diff --git a/vnet/vnet/pg/pg.h b/vnet/vnet/pg/pg.h
index 1cd42229882..a4027834035 100644
--- a/vnet/vnet/pg/pg.h
+++ b/vnet/vnet/pg/pg.h
@@ -313,7 +313,7 @@ typedef struct pg_main_t
pg_stream_t *streams;
/* Bitmap indicating which streams are currently enabled. */
- uword *enabled_streams;
+ uword **enabled_streams;
/* Hash mapping name -> stream index. */
uword *stream_index_by_name;
diff --git a/vnet/vnet/pg/stream.c b/vnet/vnet/pg/stream.c
index eba99419b5a..7c865e13222 100644
--- a/vnet/vnet/pg/stream.c
+++ b/vnet/vnet/pg/stream.c
@@ -65,8 +65,10 @@ pg_stream_enable_disable (pg_main_t * pg, pg_stream_t * s, int want_enabled)
ASSERT (!pool_is_free (pg->streams, s));
- pg->enabled_streams
- = clib_bitmap_set (pg->enabled_streams, s - pg->streams, want_enabled);
+ vec_validate (pg->enabled_streams, s->worker_index);
+ pg->enabled_streams[s->worker_index] =
+ clib_bitmap_set (pg->enabled_streams[s->worker_index], s - pg->streams,
+ want_enabled);
if (want_enabled)
{
@@ -83,7 +85,8 @@ pg_stream_enable_disable (pg_main_t * pg, pg_stream_t * s, int want_enabled)
vm = vlib_get_main ();
vlib_node_set_state (vm, pg_input_node.index,
- (clib_bitmap_is_zero (pg->enabled_streams) ?
+ (clib_bitmap_is_zero
+ (pg->enabled_streams[s->worker_index]) ?
VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_POLLING));
s->packet_accumulator = 0;