diff options
author | Zhiyong Yang <zhiyong.yang@intel.com> | 2020-03-27 17:12:35 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-04-22 13:03:44 +0000 |
commit | 703128816ff8504340dcb512ff05935dab6b2e40 (patch) | |
tree | b1acbd4f112eb9d269f00f33675419d321c70748 /src/vnet | |
parent | 08d01376de5abf2e93c562ee5e24cf62ce1be3ff (diff) |
ethernet: put vlib_get_buffers together
The patch brings 0.8 clocks saved per pkt in IPv4 l3fwd case on Skylake.
Type: improvement
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Change-Id: Ia8d3a27773bf959433380d7c219602b1e4a8e5bd
Diffstat (limited to 'src/vnet')
-rwxr-xr-x | src/vnet/ethernet/node.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c index 29c0a5b9dee..cc27b6f5da9 100755 --- a/src/vnet/ethernet/node.c +++ b/src/vnet/ethernet/node.c @@ -842,18 +842,15 @@ eth_input_process_frame (vlib_main_t * vm, vlib_node_runtime_t * node, u16 et_vlan = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN); u16 et_dot1ad = clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD); i32 n_left = n_packets; - vlib_buffer_t *b[20]; - u32 *from; + vlib_buffer_t *bufs[VLIB_FRAME_SIZE]; + vlib_buffer_t **b = bufs; ethernet_interface_t *ei = ethernet_get_interface (em, hi->hw_if_index); - from = buffer_indices; + vlib_get_buffers (vm, buffer_indices, b, n_left); while (n_left >= 20) { vlib_buffer_t **ph = b + 16, **pd = b + 8; - vlib_get_buffers (vm, from, b, 4); - vlib_get_buffers (vm, from + 8, pd, 4); - vlib_get_buffers (vm, from + 16, ph, 4); vlib_prefetch_buffer_header (ph[0], LOAD); vlib_prefetch_buffer_data (pd[0], LOAD); @@ -874,15 +871,14 @@ eth_input_process_frame (vlib_main_t * vm, vlib_node_runtime_t * node, eth_input_adv_and_flags_x4 (b, main_is_l3); /* next */ + b += 4; n_left -= 4; etype += 4; tag += 4; dmac += 4; - from += 4; } while (n_left >= 4) { - vlib_get_buffers (vm, from, b, 4); eth_input_get_etype_and_tags (b, etype, tag, dmac, 0, dmac_check); eth_input_get_etype_and_tags (b, etype, tag, dmac, 1, dmac_check); eth_input_get_etype_and_tags (b, etype, tag, dmac, 2, dmac_check); @@ -890,24 +886,23 @@ eth_input_process_frame (vlib_main_t * vm, vlib_node_runtime_t * node, eth_input_adv_and_flags_x4 (b, main_is_l3); /* next */ + b += 4; n_left -= 4; etype += 4; tag += 4; dmac += 4; - from += 4; } while (n_left) { - vlib_get_buffers (vm, from, b, 1); eth_input_get_etype_and_tags (b, etype, tag, dmac, 0, dmac_check); eth_input_adv_and_flags_x1 (b, main_is_l3); /* next */ + b += 1; n_left -= 1; etype += 1; tag += 1; dmac += 4; - from += 1; } if (dmac_check) |