diff options
author | Damjan Marion <damarion@cisco.com> | 2016-11-07 22:19:55 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2016-11-08 12:01:00 +0100 |
commit | 64034367e32e3636cfb764a9140d28d5715799a2 (patch) | |
tree | 603199935161b41dceed17be8c1c32c7c597f91f /vnet/vnet/pg/output.c | |
parent | 80e8816b41282ad705aa64790f1e9652f8f36f14 (diff) |
pg: support for packet generator on different worker threads
New Debug CLI:
packet-generator new {
worker X
}
Change-Id: I71499733a29b49cd36d753d54846d2553af6d024
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/pg/output.c')
-rw-r--r-- | vnet/vnet/pg/output.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vnet/vnet/pg/output.c b/vnet/vnet/pg/output.c index 2de06acaea5..64a0b7b9d92 100644 --- a/vnet/vnet/pg/output.c +++ b/vnet/vnet/pg/output.c @@ -52,6 +52,10 @@ pg_output (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_interface_output_runtime_t *rd = (void *) node->runtime_data; pg_interface_t *pif = pool_elt_at_index (pg->interfaces, rd->dev_instance); + if (PREDICT_FALSE (pif->lockp != 0)) + while (__sync_lock_test_and_set (pif->lockp, 1)) + ; + if (pif->pcap_file_name != 0) { while (n_left > 0) @@ -67,6 +71,8 @@ pg_output (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } vlib_buffer_free_no_next (vm, vlib_frame_args (frame), n_buffers); + if (PREDICT_FALSE (pif->lockp != 0)) + *pif->lockp = 0; return n_buffers; } |