Expand ethernet-input node speed-path for non-L2 paths

Improve ethernet-input speed path for untagged packets to also handle
L3 and other forwarding paths. In the IP4 forwarding path for untagged
IP4 packets, per packet clock count in ethernet-input node is reduced
to ~14 clocks from ~43 clocks.

Change-Id: I8e6f121820e056d6085dff3eb95d6913fc422f99
Signed-off-by: John Lo <loj@cisco.com>
This commit is contained in:
John Lo
2016-12-14 15:42:45 -05:00
committed by Dave Barach
parent fb9931ff16
commit cc53285baf

View File

@ -369,7 +369,7 @@ ethernet_input_inline (vlib_main_t * vm,
e1 = vlib_buffer_get_current (b1);
type1 = clib_net_to_host_u16 (e1->type);
/* Speed-path for the untagged L2 case */
/* Speed-path for the untagged case */
if (PREDICT_TRUE (variant == ETHERNET_INPUT_VARIANT_ETHERNET
&& !ethernet_frame_is_tagged (type0)
&& !ethernet_frame_is_tagged (type1)))
@ -404,12 +404,21 @@ ethernet_input_inline (vlib_main_t * vm,
vnet_buffer (b1)->l2.l2_len = sizeof (ethernet_header_t);
vnet_buffer (b1)->ethernet.start_of_ethernet_header =
b1->current_data;
goto ship_it01;
}
/* FALLTHROUGH into the general case */
else
{
determine_next_node (em, variant, 0, type0, b0,
&error0, &next0);
vlib_buffer_advance (b0, sizeof (ethernet_header_t));
determine_next_node (em, variant, 0, type1, b1,
&error1, &next1);
vlib_buffer_advance (b1, sizeof (ethernet_header_t));
}
goto ship_it01;
}
slowpath:
/* Slow-path for the tagged case */
slowpath:
parse_header (variant,
b0,
&type0,
@ -578,7 +587,7 @@ ethernet_input_inline (vlib_main_t * vm,
e0 = vlib_buffer_get_current (b0);
type0 = clib_net_to_host_u16 (e0->type);
/* Speed-path for the untagged L2 case */
/* Speed-path for the untagged case */
if (PREDICT_TRUE (variant == ETHERNET_INPUT_VARIANT_ETHERNET
&& !ethernet_frame_is_tagged (type0)))
{
@ -603,11 +612,17 @@ ethernet_input_inline (vlib_main_t * vm,
vnet_buffer (b0)->l2.l2_len = sizeof (ethernet_header_t);
vnet_buffer (b0)->ethernet.start_of_ethernet_header =
b0->current_data;
goto ship_it0;
}
/* FALLTHROUGH into the general case */
else
{
determine_next_node (em, variant, 0, type0, b0,
&error0, &next0);
vlib_buffer_advance (b0, sizeof (ethernet_header_t));
}
goto ship_it0;
}
/* Slow-path for the tagged case */
parse_header (variant,
b0,
&type0,