Support per-interface packet rx redirection

Change-Id: I8bb6124efa5665053620b48d11c8160472103c29
Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:
Dave Barach
2016-03-29 11:56:41 -04:00
parent dab123ba69
commit 13f3c450cc
2 changed files with 5 additions and 1 deletions

View File

@ -209,6 +209,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
apif->rx_req = rx_req;
apif->tx_req = tx_req;
apif->host_if_name = host_if_name;
apif->per_interface_next_index = ~0;
{
unix_file_t template = {0};

View File

@ -140,6 +140,9 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
u32 min_bufs = apif->rx_req->tp_frame_size / n_buffer_bytes;
if (apif->per_interface_next_index != ~0)
next_index = apif->per_interface_next_index;
n_free_bufs = vec_len (apm->rx_buffers);
if (PREDICT_FALSE(n_free_bufs < VLIB_FRAME_SIZE))
{
@ -153,7 +156,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
while ((tph->tp_status & TP_STATUS_USER) && (n_free_bufs > min_bufs))
{
vlib_buffer_t * b0, * first_b0 = 0;
u32 next0 = AF_PACKET_INPUT_NEXT_ETHERNET_INPUT;
u32 next0 = next_index;
u32 n_left_to_next;
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);