aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/interface.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-09-29 15:38:51 +0000
committerDamjan Marion <dmarion@me.com>2020-10-08 08:51:59 +0000
commit47a3d9975fa3af7a7537b565d6511dadc0df61fb (patch)
treefa33e3360af84239615f48b164b239ee3b660ee6 /src/vnet/ethernet/interface.c
parent83143710e80c8df703fe1ebc0e513aa37971d295 (diff)
l2: input performance
Type: improvement - cache the values form the BD on the input config to avoid loading - avoid the short write long read on the sequence number - use vlib_buffer_enqueue_to_next Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I33442b9104b457e4c638d26e9ad3bc965687a0bc
Diffstat (limited to 'src/vnet/ethernet/interface.c')
-rw-r--r--src/vnet/ethernet/interface.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c
index 7b11fdad8b1..b09e2b02256 100644
--- a/src/vnet/ethernet/interface.c
+++ b/src/vnet/ethernet/interface.c
@@ -496,10 +496,10 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
/* Ordinarily, this is the only config lookup. */
config = l2input_intf_config (vnet_buffer (b[0])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
while (n_left_from >= 4)
@@ -579,10 +579,10 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
{
config = l2input_intf_config
(vnet_buffer (b[0])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
}
next[0] = next_index;
@@ -602,11 +602,11 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
{
config = l2input_intf_config
(vnet_buffer (b[1])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
new_rx_sw_if_index = vnet_buffer (b[1])->sw_if_index[VLIB_TX];
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
}
next[1] = next_index;
vnet_buffer (b[1])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
@@ -625,11 +625,11 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
{
config = l2input_intf_config
(vnet_buffer (b[2])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
new_rx_sw_if_index = vnet_buffer (b[2])->sw_if_index[VLIB_TX];
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
}
next[2] = next_index;
vnet_buffer (b[2])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
@@ -648,11 +648,11 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
{
config = l2input_intf_config
(vnet_buffer (b[3])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
new_rx_sw_if_index = vnet_buffer (b[3])->sw_if_index[VLIB_TX];
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
}
next[3] = next_index;
vnet_buffer (b[3])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
@@ -676,10 +676,10 @@ simulated_ethernet_interface_tx (vlib_main_t * vm,
{
config = l2input_intf_config
(vnet_buffer (b[0])->sw_if_index[VLIB_TX]);
- next_index =
- config->bridge ? VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
- VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT;
- new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
+ next_index = (l2_input_is_bridge (config) ?
+ VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT :
+ VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT);
+ new_tx_sw_if_index = l2_input_is_bvi (config) ? L2INPUT_BVI : ~0;
new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
}
next[0] = next_index;