From 7d31ab2a5cc2124ddd973ac5dfac2219619f345a Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 8 May 2019 19:18:18 -0400 Subject: add mactime plugin unit / code coverage tests The unit and code coverage tests are boring. The rest of the patch involves test and packet-generator infra cleanups. Teach the "make test-xxx" family of targets to set the api test plugin path correctly, to make "binary-api " debug CLI commands work correctly in the "make test" environment. Unfortunately involves both the top-level and test Makefiles. Add a minor pg cli feature, a CLI to manually set s->sw_if_index[VLIB_TX]. Consider the case where one configures an interface with both a device-input and an output feature. To test the output feature using the pg, it's necessary to inject packets into the interface output node with both b->sw_if_index[VLIB_TX] and b->sw_if_index[VLIB_RX] set correctly. For example: packet-generator new { name tx limit 15 size 128-128 interface local0 # rx: device input feature not configured on local0 tx-interface loop0 # tx: output node requires b->sw_if_index[VLIB_TX] node loop0-output data { hex 0x01005e7ffffa000dead0000008000102030405060708090a0b0c0d0e0f0102030405 } } Fix a longstanding bug in the packet generator stream setup. Remove kludges which set b->sw_if_index[VLIB_TX] to ~0 [in multiple places] instead of using the stream value s->sw_if_index[VLIB_TX], and setting THAT datum correctly. Change-Id: I1097a18e8db73661ded6b822c1d718f7e5cf36ed Signed-off-by: Dave Barach --- src/vnet/pg/input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/vnet/pg/input.c') diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c index 39f06923072..7171bbdda65 100644 --- a/src/vnet/pg/input.c +++ b/src/vnet/pg/input.c @@ -1108,7 +1108,7 @@ init_buffers_inline (vlib_main_t * vm, vnet_buffer (b1)->sw_if_index[VLIB_RX] = s->sw_if_index[VLIB_RX]; vnet_buffer (b0)->sw_if_index[VLIB_TX] = - vnet_buffer (b1)->sw_if_index[VLIB_TX] = (u32) ~ 0; + vnet_buffer (b1)->sw_if_index[VLIB_TX] = s->sw_if_index[VLIB_TX]; if (set_data) { @@ -1133,8 +1133,7 @@ init_buffers_inline (vlib_main_t * vm, b0 = vlib_get_buffer (vm, bi0); vnet_buffer (b0)->sw_if_index[VLIB_RX] = s->sw_if_index[VLIB_RX]; - /* s->sw_if_index[VLIB_TX]; */ - vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0; + vnet_buffer (b0)->sw_if_index[VLIB_TX] = s->sw_if_index[VLIB_TX]; if (set_data) clib_memcpy_fast (b0->data, data, n_data); @@ -1266,7 +1265,7 @@ pg_stream_fill_replay (pg_main_t * pg, pg_stream_t * s, u32 n_alloc) b = vlib_get_buffer (vm, buffers[current_buffer_index]); clib_memcpy_fast (b->data, d0 + data_offset, bytes_this_chunk); vnet_buffer (b)->sw_if_index[VLIB_RX] = s->sw_if_index[VLIB_RX]; - vnet_buffer (b)->sw_if_index[VLIB_TX] = (u32) ~ 0; + vnet_buffer (b)->sw_if_index[VLIB_TX] = s->sw_if_index[VLIB_TX]; b->flags = 0; b->next_buffer = 0; b->current_data = 0; -- cgit 1.2.3-korg