From e0c875551fa0cd49131671be0f521801e06764f8 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Mon, 11 Apr 2022 12:52:28 +0000 Subject: devices: remove redundant access in af-packet input Type: fix current_data is set to 0 for each packet in af-packet input node. It is not required to include it to calculate the headers offset. Signed-off-by: Mohsin Kazmi Change-Id: I538d8c04e24c758155b3f8d6a1532472ef549459 --- src/vnet/devices/af_packet/node.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/vnet/devices/af_packet') diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c index 239c781a76f..1fc061982c1 100644 --- a/src/vnet/devices/af_packet/node.c +++ b/src/vnet/devices/af_packet/node.c @@ -149,7 +149,7 @@ fill_cksum_offload (vlib_buffer_t *b, u8 *l4_hdr_sz, u8 is_ip) } else { - ethernet_header_t *eth = vlib_buffer_get_current (b); + ethernet_header_t *eth = (ethernet_header_t *) b->data; ethertype = clib_net_to_host_u16 (eth->type); l2hdr_sz = sizeof (ethernet_header_t); if (ethernet_frame_is_tagged (ethertype)) @@ -172,7 +172,7 @@ fill_cksum_offload (vlib_buffer_t *b, u8 *l4_hdr_sz, u8 is_ip) if (ethertype == ETHERNET_TYPE_IP4) { - ip4_header_t *ip4 = (vlib_buffer_get_current (b) + l2hdr_sz); + ip4_header_t *ip4 = (ip4_header_t *) (b->data + l2hdr_sz); vnet_buffer (b)->l4_hdr_offset = l2hdr_sz + ip4_header_bytes (ip4); b->flags |= (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L2_HDR_OFFSET_VALID | VNET_BUFFER_F_L3_HDR_OFFSET_VALID | @@ -182,7 +182,7 @@ fill_cksum_offload (vlib_buffer_t *b, u8 *l4_hdr_sz, u8 is_ip) } else if (ethertype == ETHERNET_TYPE_IP6) { - ip6_header_t *ip6 = (vlib_buffer_get_current (b) + l2hdr_sz); + ip6_header_t *ip6 = (ip6_header_t *) (b->data + l2hdr_sz); b->flags |= (VNET_BUFFER_F_IS_IP6 | VNET_BUFFER_F_L2_HDR_OFFSET_VALID | VNET_BUFFER_F_L3_HDR_OFFSET_VALID | VNET_BUFFER_F_L4_HDR_OFFSET_VALID); @@ -207,8 +207,8 @@ fill_cksum_offload (vlib_buffer_t *b, u8 *l4_hdr_sz, u8 is_ip) if (l4_proto == IP_PROTOCOL_TCP) { oflags |= VNET_BUFFER_OFFLOAD_F_TCP_CKSUM; - tcp_header_t *tcp = (tcp_header_t *) (vlib_buffer_get_current (b) + - vnet_buffer (b)->l4_hdr_offset); + tcp_header_t *tcp = + (tcp_header_t *) (b->data + vnet_buffer (b)->l4_hdr_offset); *l4_hdr_sz = tcp_header_bytes (tcp); } else if (l4_proto == IP_PROTOCOL_UDP) -- cgit 1.2.3-korg