diff options
Diffstat (limited to 'src/vnet/devices')
-rw-r--r-- | src/vnet/devices/af_packet/device.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/vnet/devices/af_packet/device.c b/src/vnet/devices/af_packet/device.c index 822dcdc7c22..4e4913a071a 100644 --- a/src/vnet/devices/af_packet/device.c +++ b/src/vnet/devices/af_packet/device.c @@ -243,8 +243,7 @@ fill_gso_offload (vlib_buffer_t *b0, vnet_virtio_net_hdr_t *vnet_hdr) vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; vnet_hdr->csum_start = vnet_buffer (b0)->l4_hdr_offset; // 0x22; vnet_hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); - ip4 = (ip4_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l3_hdr_offset); + ip4 = (ip4_header_t *) (b0->data + vnet_buffer (b0)->l3_hdr_offset); if (oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM) ip4->checksum = ip4_header_checksum (ip4); } @@ -267,8 +266,7 @@ fill_cksum_offload (vlib_buffer_t *b0, vnet_virtio_net_hdr_t *vnet_hdr) if (b0->flags & VNET_BUFFER_F_IS_IP4) { ip4_header_t *ip4; - ip4 = (ip4_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l3_hdr_offset); + ip4 = (ip4_header_t *) (b0->data + vnet_buffer (b0)->l3_hdr_offset); if (oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM) ip4->checksum = ip4_header_checksum (ip4); vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; @@ -276,16 +274,14 @@ fill_cksum_offload (vlib_buffer_t *b0, vnet_virtio_net_hdr_t *vnet_hdr) if (oflags & VNET_BUFFER_OFFLOAD_F_TCP_CKSUM) { tcp_header_t *tcp = - (tcp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l4_hdr_offset); + (tcp_header_t *) (b0->data + vnet_buffer (b0)->l4_hdr_offset); tcp->checksum = ip4_pseudo_header_cksum (ip4); vnet_hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); } else if (oflags & VNET_BUFFER_OFFLOAD_F_UDP_CKSUM) { udp_header_t *udp = - (udp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l4_hdr_offset); + (udp_header_t *) (b0->data + vnet_buffer (b0)->l4_hdr_offset); udp->checksum = ip4_pseudo_header_cksum (ip4); vnet_hdr->csum_offset = STRUCT_OFFSET_OF (udp_header_t, checksum); } @@ -295,21 +291,18 @@ fill_cksum_offload (vlib_buffer_t *b0, vnet_virtio_net_hdr_t *vnet_hdr) ip6_header_t *ip6; vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; vnet_hdr->csum_start = 0x36; - ip6 = (ip6_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l3_hdr_offset); + ip6 = (ip6_header_t *) (b0->data + vnet_buffer (b0)->l3_hdr_offset); if (oflags & VNET_BUFFER_OFFLOAD_F_TCP_CKSUM) { tcp_header_t *tcp = - (tcp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l4_hdr_offset); + (tcp_header_t *) (b0->data + vnet_buffer (b0)->l4_hdr_offset); tcp->checksum = ip6_pseudo_header_cksum (ip6); vnet_hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); } else if (oflags & VNET_BUFFER_OFFLOAD_F_UDP_CKSUM) { udp_header_t *udp = - (udp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer (b0)->l4_hdr_offset); + (udp_header_t *) (b0->data + vnet_buffer (b0)->l4_hdr_offset); udp->checksum = ip6_pseudo_header_cksum (ip6); vnet_hdr->csum_offset = STRUCT_OFFSET_OF (udp_header_t, checksum); } |