diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-04-17 16:50:56 +0000 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-04-22 15:03:34 +0000 |
commit | 0b04209edac55487c108ff5f2faf51cbd4c2cee7 (patch) | |
tree | 4628b2c65f15bc9b4c628046c72a3c77fadfbab5 /src/vnet/devices/virtio | |
parent | 6440b7a602fdeb41674911cc3baf0b39a7521b96 (diff) |
gso: add vxlan tunnel support
Type: feature
Change-Id: I85f6ec77187a4983c66c5e22fd39fbb2cef82902
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r-- | src/vnet/devices/virtio/device.c | 18 | ||||
-rw-r--r-- | src/vnet/devices/virtio/vhost_user_output.c | 6 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index 367372fa29a..d110946dede 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -23,7 +23,7 @@ #include <vlib/unix/unix.h> #include <vnet/vnet.h> #include <vnet/ethernet/ethernet.h> -#include <vnet/gso/gso.h> +#include <vnet/gso/hdr_offset_parser.h> #include <vnet/ip/ip4_packet.h> #include <vnet/ip/ip6_packet.h> #include <vnet/tcp/tcp_packet.h> @@ -173,7 +173,8 @@ set_checksum_offsets (vlib_buffer_t * b, struct virtio_net_hdr_v1 *hdr) if (b->flags & VNET_BUFFER_F_IS_IP4) { ip4_header_t *ip4; - gso_header_offset_t gho = vnet_gso_header_offset_parser (b, 0); + generic_header_offset_t gho = { 0 }; + vnet_generic_header_offset_parser (b, &gho); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; hdr->csum_start = gho.l4_hdr_offset; // 0x22; if (b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM) @@ -196,7 +197,8 @@ set_checksum_offsets (vlib_buffer_t * b, struct virtio_net_hdr_v1 *hdr) } else if (b->flags & VNET_BUFFER_F_IS_IP6) { - gso_header_offset_t gho = vnet_gso_header_offset_parser (b, 1); + generic_header_offset_t gho = { 0 }; + vnet_generic_header_offset_parser (b, &gho); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; hdr->csum_start = gho.l4_hdr_offset; // 0x36; if (b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM) @@ -216,10 +218,11 @@ set_gso_offsets (vlib_buffer_t * b, struct virtio_net_hdr_v1 *hdr) if (b->flags & VNET_BUFFER_F_IS_IP4) { ip4_header_t *ip4; - gso_header_offset_t gho = vnet_gso_header_offset_parser (b, 0); + generic_header_offset_t gho = { 0 }; + vnet_generic_header_offset_parser (b, &gho); hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; hdr->gso_size = vnet_buffer2 (b)->gso_size; - hdr->hdr_len = gho.l4_hdr_offset + gho.l4_hdr_sz; + hdr->hdr_len = gho.hdr_sz; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; hdr->csum_start = gho.l4_hdr_offset; // 0x22; hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); @@ -234,10 +237,11 @@ set_gso_offsets (vlib_buffer_t * b, struct virtio_net_hdr_v1 *hdr) } else if (b->flags & VNET_BUFFER_F_IS_IP6) { - gso_header_offset_t gho = vnet_gso_header_offset_parser (b, 1); + generic_header_offset_t gho = { 0 }; + vnet_generic_header_offset_parser (b, &gho); hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; hdr->gso_size = vnet_buffer2 (b)->gso_size; - hdr->hdr_len = gho.l4_hdr_offset + gho.l4_hdr_sz; + hdr->hdr_len = gho.hdr_sz; hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; hdr->csum_start = gho.l4_hdr_offset; // 0x36; hdr->csum_offset = STRUCT_OFFSET_OF (tcp_header_t, checksum); diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c index e1f42ce1559..b6abe36d972 100644 --- a/src/vnet/devices/virtio/vhost_user_output.c +++ b/src/vnet/devices/virtio/vhost_user_output.c @@ -44,7 +44,7 @@ #include <vnet/devices/virtio/vhost_user.h> #include <vnet/devices/virtio/vhost_user_inline.h> -#include <vnet/gso/gso.h> +#include <vnet/gso/hdr_offset_parser.h> /* * On the transmit side, we keep processing the buffers from vlib in the while * loop and prepare the copy order to be executed later. However, the static @@ -236,8 +236,8 @@ static_always_inline void vhost_user_handle_tx_offload (vhost_user_intf_t * vui, vlib_buffer_t * b, virtio_net_hdr_t * hdr) { - gso_header_offset_t gho = - vnet_gso_header_offset_parser (b, b->flags & VNET_BUFFER_F_IS_IP6); + generic_header_offset_t gho = { 0 }; + vnet_generic_header_offset_parser (b, &gho); if (b->flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM) { ip4_header_t *ip4; |