aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/af_packet/af_packet.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-04-28 12:29:15 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-05-02 16:34:32 +0000
commit4403690cda44134af3b9ea78d33a5cbf78a5acc9 (patch)
tree14d79f4342d1ec0ee993db2bacdd0eb9abcc2c63 /src/vnet/devices/af_packet/af_packet.c
parentc12311b86fb27114cdd3fa4ad9a5897a98448184 (diff)
Add interface rx mode commands, unify rx mode and placement CLI
Change-Id: Ib506c3e9d66170f29e3266ad6dc4d32b829befba Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/af_packet/af_packet.c')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 92bd109296c..cb52e6daa04 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -195,6 +195,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
u8 hw_addr[6];
clib_error_t *error;
vnet_sw_interface_t *sw;
+ vnet_hw_interface_t *hw;
vlib_thread_main_t *tm = vlib_get_thread_main ();
vnet_main_t *vnm = vnet_get_main ();
uword *p;
@@ -294,17 +295,21 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
}
sw = vnet_get_hw_sw_interface (vnm, apif->hw_if_index);
+ hw = vnet_get_hw_interface (vnm, apif->hw_if_index);
apif->sw_if_index = sw->sw_if_index;
- vnet_set_device_input_node (vnm, apif->hw_if_index,
- af_packet_input_node.index);
- vnet_device_input_assign_thread (vnm, apif->hw_if_index, 0, /* queue */
- ~0 /* any cpu */ );
- vnet_device_input_set_mode (vnm, apif->hw_if_index, 0,
- VNET_DEVICE_INPUT_MODE_INTERRUPT);
+ vnet_hw_interface_set_input_node (vnm, apif->hw_if_index,
+ af_packet_input_node.index);
+ vnet_hw_interface_assign_rx_thread (vnm, apif->hw_if_index, 0, /* queue */
+ ~0 /* any cpu */ );
+
+ hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
vnet_hw_interface_set_flags (vnm, apif->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
+ vnet_hw_interface_set_rx_mode (vnm, apif->hw_if_index, 0,
+ VNET_HW_INTERFACE_RX_MODE_INTERRUPT);
+
mhash_set_mem (&apm->if_index_by_host_if_name, host_if_name_dup, &if_index,
0);
if (sw_if_index)
@@ -340,6 +345,7 @@ af_packet_delete_if (vlib_main_t * vm, u8 * host_if_name)
/* bring down the interface */
vnet_hw_interface_set_flags (vnm, apif->hw_if_index, 0);
+ vnet_hw_interface_unassign_rx_thread (vnm, apif->hw_if_index, 0);
/* clean up */
if (apif->unix_file_index != ~0)