diff options
author | 2016-03-29 11:56:41 -0400 | |
---|---|---|
committer | 2016-03-29 11:56:55 -0400 | |
commit | 13f3c450ccd03ed00a6a114061faedd1fc553ddd (patch) | |
tree | 8f0cb7a363a8fdc88f0556fa34a3c7a4dc8a9172 /vnet | |
parent | dab123ba697ecd9c2310b524d37509649fbcb173 (diff) |
Support per-interface packet rx redirection
Change-Id: I8bb6124efa5665053620b48d11c8160472103c29
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/devices/af_packet/af_packet.c | 1 | ||||
-rw-r--r-- | vnet/vnet/devices/af_packet/node.c | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c index bbaabad2..1b07e890 100644 --- a/vnet/vnet/devices/af_packet/af_packet.c +++ b/vnet/vnet/devices/af_packet/af_packet.c @@ -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}; diff --git a/vnet/vnet/devices/af_packet/node.c b/vnet/vnet/devices/af_packet/node.c index efe0e1c2..bc0ab8c6 100644 --- a/vnet/vnet/devices/af_packet/node.c +++ b/vnet/vnet/devices/af_packet/node.c @@ -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); |