diff options
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/pg/cli.c | 27 | ||||
-rw-r--r-- | src/vnet/pg/input.c | 7 | ||||
-rw-r--r-- | src/vnet/pg/stream.c | 16 |
3 files changed, 30 insertions, 20 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c index 4526986d1ff..9c42d70a383 100644 --- a/src/vnet/pg/cli.c +++ b/src/vnet/pg/cli.c @@ -109,19 +109,26 @@ static clib_error_t * enable_disable_stream (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + unformat_input_t _line_input, *line_input = &_line_input; pg_main_t *pg = &pg_main; int is_enable = cmd->function_arg != 0; u32 stream_index = ~0; - if (unformat (input, "%U", unformat_eof)) - ; - else if (unformat (input, "%U", unformat_hash_vec_string, - pg->stream_index_by_name, &stream_index)) - ; - else - return clib_error_create ("unknown input `%U'", - format_unformat_error, input); + if (!unformat_user (input, unformat_line_input, line_input)) + goto doit; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "%U", unformat_hash_vec_string, + pg->stream_index_by_name, &stream_index)) + ; + else + return clib_error_create ("unknown input `%U'", + format_unformat_error, line_input); + } + unformat_free (line_input); +doit: pg_enable_disable (stream_index, is_enable); return 0; @@ -374,6 +381,10 @@ new_stream (vlib_main_t * vm, unformat_vnet_sw_interface, vnm, &s.sw_if_index[VLIB_RX])) ; + else if (unformat (input, "tx-interface %U", + unformat_vnet_sw_interface, vnm, + &s.sw_if_index[VLIB_TX])) + ; else if (unformat (input, "pcap %s", &pcap_file_name)) ; 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; diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c index c60c5845af6..64fe7c859ae 100644 --- a/src/vnet/pg/stream.c +++ b/src/vnet/pg/stream.c @@ -447,16 +447,16 @@ pg_stream_add (pg_main_t * pg, pg_stream_t * s_init) /* Find an interface to use. */ s->pg_if_index = pg_interface_add_or_get (pg, s->if_id); - { - pg_interface_t *pi = pool_elt_at_index (pg->interfaces, s->pg_if_index); - vlib_rx_or_tx_t rx_or_tx; - - vlib_foreach_rx_tx (rx_or_tx) + if (s->sw_if_index[VLIB_RX] == ~0) { - if (s->sw_if_index[rx_or_tx] == ~0) - s->sw_if_index[rx_or_tx] = pi->sw_if_index; + pg_interface_t *pi = pool_elt_at_index (pg->interfaces, s->pg_if_index); + /* + * Default the RX interface if unset. It's a bad mistake to + * set [VLIB_TX] prior to ip lookup, since the ip lookup code + * interprets [VLIB_TX] as a fib index... + */ + s->sw_if_index[VLIB_RX] = pi->sw_if_index; } - } /* Connect the graph. */ s->next_index = vlib_node_add_next (vm, device_input_node.index, |