summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2022-04-11 12:52:28 +0000
committerBeno�t Ganne <bganne@cisco.com>2022-04-19 12:39:12 +0000
commite0c875551fa0cd49131671be0f521801e06764f8 (patch)
tree8b05869819c79dae96d6d2cf8bf9df07ca8ae0fd /src/vnet/devices
parent8c2bdf86199729e2a7c0564f989690e3e076a19c (diff)
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 <sykazmi@cisco.com> Change-Id: I538d8c04e24c758155b3f8d6a1532472ef549459
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/af_packet/node.c10
1 files changed, 5 insertions, 5 deletions
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)