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/gso/gso.h | |
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/gso/gso.h')
-rw-r--r-- | src/vnet/gso/gso.h | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/vnet/gso/gso.h b/src/vnet/gso/gso.h index 0e46c36f74d..8e174dfd1f6 100644 --- a/src/vnet/gso/gso.h +++ b/src/vnet/gso/gso.h @@ -16,25 +16,10 @@ #ifndef included_gso_h #define included_gso_h -#include <vnet/ethernet/ethernet.h> -#include <vnet/ip/ip4_packet.h> -#include <vnet/ip/ip6_packet.h> -#include <vnet/udp/udp_packet.h> #include <vnet/vnet.h> typedef struct { - i16 l2_hdr_offset; - i16 l3_hdr_offset; - i16 l4_hdr_offset; - u16 l4_hdr_sz; - i16 outer_l2_hdr_offset; - i16 outer_l3_hdr_offset; - i16 outer_l4_hdr_offset; -} gso_header_offset_t; - -typedef struct -{ vlib_main_t *vlib_main; vnet_main_t *vnet_main; u16 msg_id_base; @@ -44,84 +29,6 @@ extern gso_main_t gso_main; int vnet_sw_interface_gso_enable_disable (u32 sw_if_index, u8 enable); -static_always_inline gso_header_offset_t -vnet_gso_header_offset_parser (vlib_buffer_t * b0, int is_ip6) -{ - gso_header_offset_t gho = { 0 }; - u8 l4_proto = 0; - u8 l4_hdr_sz = 0; - - if (PREDICT_TRUE ((b0->flags & (VNET_BUFFER_F_L2_HDR_OFFSET_VALID | - VNET_BUFFER_F_L3_HDR_OFFSET_VALID | - VNET_BUFFER_F_L4_HDR_OFFSET_VALID)) == - (VNET_BUFFER_F_L2_HDR_OFFSET_VALID | - VNET_BUFFER_F_L3_HDR_OFFSET_VALID | - VNET_BUFFER_F_L4_HDR_OFFSET_VALID))) - { - gho.l2_hdr_offset = vnet_buffer (b0)->l2_hdr_offset; - gho.l3_hdr_offset = vnet_buffer (b0)->l3_hdr_offset; - gho.l4_hdr_offset = vnet_buffer (b0)->l4_hdr_offset; - gho.l4_hdr_sz = vnet_buffer2 (b0)->gso_l4_hdr_sz; - return gho; - } - - ethernet_header_t *eh = (ethernet_header_t *) vlib_buffer_get_current (b0); - u16 ethertype = clib_net_to_host_u16 (eh->type); - u16 l2hdr_sz = sizeof (ethernet_header_t); - - if (ethernet_frame_is_tagged (ethertype)) - { - ethernet_vlan_header_t *vlan = (ethernet_vlan_header_t *) (eh + 1); - - ethertype = clib_net_to_host_u16 (vlan->type); - l2hdr_sz += sizeof (*vlan); - if (ethertype == ETHERNET_TYPE_VLAN) - { - vlan++; - ethertype = clib_net_to_host_u16 (vlan->type); - l2hdr_sz += sizeof (*vlan); - } - } - - gho.l2_hdr_offset = b0->current_data; - gho.l3_hdr_offset = l2hdr_sz; - - if (PREDICT_TRUE (is_ip6 == 0)) - { - ip4_header_t *ip4 = - (ip4_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz); - gho.l4_hdr_offset = l2hdr_sz + ip4_header_bytes (ip4); - l4_proto = ip4->protocol; - } - else if (PREDICT_TRUE (is_ip6)) - { - ip6_header_t *ip6 = - (ip6_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz); - /* FIXME IPv6 EH traversal */ - gho.l4_hdr_offset = l2hdr_sz + sizeof (ip6_header_t); - l4_proto = ip6->protocol; - } - if (l4_proto == IP_PROTOCOL_TCP) - { - tcp_header_t *tcp = (tcp_header_t *) (vlib_buffer_get_current (b0) + - gho.l4_hdr_offset); - l4_hdr_sz = tcp_header_bytes (tcp); - } - else if (l4_proto == IP_PROTOCOL_UDP) - { - udp_header_t *udp = (udp_header_t *) (vlib_buffer_get_current (b0) + - gho.l4_hdr_offset); - l4_hdr_sz = sizeof (*udp); - } - - if (b0->flags & (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_IS_IP6)) - { - gho.l4_hdr_sz = l4_hdr_sz; - } - - return gho; -} - #endif /* included_gso_h */ /* |