aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-10-22 13:33:13 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-12-05 00:44:06 +0000
commit72e7312af04bf8f6ecbc8ce70fe1a6e2ad8852ec (patch)
tree67343be3386884743d6a079a9b9d54738971f420 /src/vnet
parent1043fd38d83434d6c4e002c5354a30027988fbfa (diff)
gso: add protocol header parser
Type: feature Change-Id: I7c6be2b96d19f82be237f6159944f3164ea512d0 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/virtio/node.c43
-rw-r--r--src/vnet/gso/gso.c1
-rw-r--r--src/vnet/gso/gso.h95
-rw-r--r--src/vnet/gso/node.c49
-rw-r--r--src/vnet/interface_output.c13
-rw-r--r--src/vnet/pg/input.c38
6 files changed, 149 insertions, 90 deletions
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index ec28fbb5e08..fc2317ecc69 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -145,11 +145,11 @@ static_always_inline void
fill_gso_buffer_flags (vlib_buffer_t * b0, struct virtio_net_hdr_v1 *hdr)
{
u8 l4_proto = 0;
- u8 l4_hdr_sz = 0;
if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM)
{
- ethernet_header_t *eh = (ethernet_header_t *) b0->data;
+ 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);
@@ -167,47 +167,29 @@ fill_gso_buffer_flags (vlib_buffer_t * b0, struct virtio_net_hdr_v1 *hdr)
}
}
- vnet_buffer (b0)->l2_hdr_offset = 0;
- vnet_buffer (b0)->l3_hdr_offset = l2hdr_sz;
if (PREDICT_TRUE (ethertype == ETHERNET_TYPE_IP4))
{
- ip4_header_t *ip4 = (ip4_header_t *) (b0->data + l2hdr_sz);
- vnet_buffer (b0)->l4_hdr_offset = l2hdr_sz + ip4_header_bytes (ip4);
+ ip4_header_t *ip4 =
+ (ip4_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz);
l4_proto = ip4->protocol;
b0->flags |=
- (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L2_HDR_OFFSET_VALID
- | VNET_BUFFER_F_L3_HDR_OFFSET_VALID |
- VNET_BUFFER_F_L4_HDR_OFFSET_VALID);
- b0->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM;
+ (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_OFFLOAD_IP_CKSUM);
}
else if (PREDICT_TRUE (ethertype == ETHERNET_TYPE_IP6))
{
- ip6_header_t *ip6 = (ip6_header_t *) (b0->data + l2hdr_sz);
+ ip6_header_t *ip6 =
+ (ip6_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz);
/* FIXME IPv6 EH traversal */
- vnet_buffer (b0)->l4_hdr_offset = l2hdr_sz + sizeof (ip6_header_t);
l4_proto = ip6->protocol;
- b0->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);
+ b0->flags |= VNET_BUFFER_F_IS_IP6;
}
if (l4_proto == IP_PROTOCOL_TCP)
{
b0->flags |= VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
- tcp_header_t *tcp = (tcp_header_t *) (b0->data +
- vnet_buffer
- (b0)->l4_hdr_offset);
- l4_hdr_sz = tcp_header_bytes (tcp);
- tcp->checksum = 0;
}
else if (l4_proto == IP_PROTOCOL_UDP)
{
b0->flags |= VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
- udp_header_t *udp = (udp_header_t *) (b0->data +
- vnet_buffer
- (b0)->l4_hdr_offset);
- l4_hdr_sz = sizeof (*udp);
- udp->checksum = 0;
}
}
@@ -215,21 +197,16 @@ fill_gso_buffer_flags (vlib_buffer_t * b0, struct virtio_net_hdr_v1 *hdr)
{
ASSERT (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM);
vnet_buffer2 (b0)->gso_size = hdr->gso_size;
- vnet_buffer2 (b0)->gso_l4_hdr_sz = l4_hdr_sz;
- b0->flags |= VNET_BUFFER_F_GSO;
- b0->flags |= VNET_BUFFER_F_IS_IP4;
+ b0->flags |= VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP4;
}
if (hdr->gso_type == VIRTIO_NET_HDR_GSO_TCPV6)
{
ASSERT (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM);
vnet_buffer2 (b0)->gso_size = hdr->gso_size;
- vnet_buffer2 (b0)->gso_l4_hdr_sz = l4_hdr_sz;
- b0->flags |= VNET_BUFFER_F_GSO;
- b0->flags |= VNET_BUFFER_F_IS_IP6;
+ b0->flags |= VNET_BUFFER_F_GSO | VNET_BUFFER_F_IS_IP6;
}
}
-
static_always_inline uword
virtio_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame, virtio_if_t * vif, u16 qid,
diff --git a/src/vnet/gso/gso.c b/src/vnet/gso/gso.c
index c741b17bdd4..cf90d22696d 100644
--- a/src/vnet/gso/gso.c
+++ b/src/vnet/gso/gso.c
@@ -16,7 +16,6 @@
#include <vlib/vlib.h>
#include <vnet/vnet.h>
#include <vppinfra/error.h>
-#include <vnet/ethernet/ethernet.h>
#include <vnet/feature/feature.h>
#include <vnet/l2/l2_in_out_feat_arc.h>
#include <vnet/gso/gso.h>
diff --git a/src/vnet/gso/gso.h b/src/vnet/gso/gso.h
index 8e174dfd1f6..79869c2644b 100644
--- a/src/vnet/gso/gso.h
+++ b/src/vnet/gso/gso.h
@@ -16,10 +16,25 @@
#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;
@@ -29,6 +44,86 @@ 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);
+ tcp->checksum = 0;
+ }
+ 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);
+ udp->checksum = 0;
+ }
+
+ 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 */
/*
diff --git a/src/vnet/gso/node.c b/src/vnet/gso/node.c
index 069016147d4..548189ee04c 100644
--- a/src/vnet/gso/node.c
+++ b/src/vnet/gso/node.c
@@ -90,7 +90,8 @@ static_always_inline void
tso_init_buf_from_template (vlib_main_t * vm, vlib_buffer_t * nb0,
vlib_buffer_t * b0, u16 template_data_sz,
u16 gso_size, u8 ** p_dst_ptr, u16 * p_dst_left,
- u32 next_tcp_seq, u32 flags)
+ u32 next_tcp_seq, u32 flags,
+ gso_header_offset_t * gho)
{
tso_init_buf_from_template_base (nb0, b0, flags, template_data_sz);
@@ -101,29 +102,31 @@ tso_init_buf_from_template (vlib_main_t * vm, vlib_buffer_t * nb0,
*p_dst_ptr = vlib_buffer_get_current (nb0) + template_data_sz;
tcp_header_t *tcp =
- (tcp_header_t *) (nb0->data + vnet_buffer (nb0)->l4_hdr_offset);
+ (tcp_header_t *) (vlib_buffer_get_current (nb0) + gho->l4_hdr_offset);
tcp->seq_number = clib_host_to_net_u32 (next_tcp_seq);
}
static_always_inline void
-tso_fixup_segmented_buf (vlib_buffer_t * b0, u8 tcp_flags, int is_ip6)
+tso_fixup_segmented_buf (vlib_buffer_t * b0, u8 tcp_flags, int is_ip6,
+ gso_header_offset_t * gho)
{
- u16 l3_hdr_offset = vnet_buffer (b0)->l3_hdr_offset;
- u16 l4_hdr_offset = vnet_buffer (b0)->l4_hdr_offset;
- ip4_header_t *ip4 = (ip4_header_t *) (b0->data + l3_hdr_offset);
- ip6_header_t *ip6 = (ip6_header_t *) (b0->data + l3_hdr_offset);
- tcp_header_t *tcp = (tcp_header_t *) (b0->data + l4_hdr_offset);
+ ip4_header_t *ip4 =
+ (ip4_header_t *) (vlib_buffer_get_current (b0) + gho->l3_hdr_offset);
+ ip6_header_t *ip6 =
+ (ip6_header_t *) (vlib_buffer_get_current (b0) + gho->l3_hdr_offset);
+ tcp_header_t *tcp =
+ (tcp_header_t *) (vlib_buffer_get_current (b0) + gho->l4_hdr_offset);
tcp->flags = tcp_flags;
if (is_ip6)
ip6->payload_length =
clib_host_to_net_u16 (b0->current_length -
- (l4_hdr_offset - b0->current_data));
+ (gho->l4_hdr_offset - gho->l2_hdr_offset));
else
ip4->length =
clib_host_to_net_u16 (b0->current_length -
- (l3_hdr_offset - b0->current_data));
+ (gho->l3_hdr_offset - gho->l2_hdr_offset));
}
/**
@@ -137,21 +140,19 @@ tso_fixup_segmented_buf (vlib_buffer_t * b0, u8 tcp_flags, int is_ip6)
static_always_inline u32
tso_segment_buffer (vlib_main_t * vm, vnet_interface_per_thread_data_t * ptd,
- u32 sbi0, vlib_buffer_t * sb0, u32 n_bytes_b0, int is_ip6)
+ u32 sbi0, vlib_buffer_t * sb0, gso_header_offset_t * gho,
+ u32 n_bytes_b0, int is_ip6)
{
u32 n_tx_bytes = 0;
- ASSERT (sb0->flags & VNET_BUFFER_F_L2_HDR_OFFSET_VALID);
- ASSERT (sb0->flags & VNET_BUFFER_F_L3_HDR_OFFSET_VALID);
- ASSERT (sb0->flags & VNET_BUFFER_F_L4_HDR_OFFSET_VALID);
u16 gso_size = vnet_buffer2 (sb0)->gso_size;
- int l4_hdr_sz = vnet_buffer2 (sb0)->gso_l4_hdr_sz;
+ int l4_hdr_sz = gho->l4_hdr_sz;
u8 save_tcp_flags = 0;
u8 tcp_flags_no_fin_psh = 0;
u32 next_tcp_seq = 0;
tcp_header_t *tcp =
- (tcp_header_t *) (sb0->data + vnet_buffer (sb0)->l4_hdr_offset);
+ (tcp_header_t *) (vlib_buffer_get_current (sb0) + gho->l4_hdr_offset);
next_tcp_seq = clib_net_to_host_u32 (tcp->seq_number);
/* store original flags for last packet and reset FIN and PSH */
save_tcp_flags = tcp->flags;
@@ -160,8 +161,7 @@ tso_segment_buffer (vlib_main_t * vm, vnet_interface_per_thread_data_t * ptd,
u32 default_bflags =
sb0->flags & ~(VNET_BUFFER_F_GSO | VLIB_BUFFER_NEXT_PRESENT);
- u16 l234_sz = vnet_buffer (sb0)->l4_hdr_offset + l4_hdr_sz
- - sb0->current_data;
+ u16 l234_sz = gho->l4_hdr_offset + l4_hdr_sz - gho->l2_hdr_offset;
int first_data_size = clib_min (gso_size, sb0->current_length - l234_sz);
next_tcp_seq += first_data_size;
@@ -189,13 +189,14 @@ tso_segment_buffer (vlib_main_t * vm, vnet_interface_per_thread_data_t * ptd,
src_ptr = vlib_buffer_get_current (sb0) + l234_sz + first_data_size;
src_left = sb0->current_length - l234_sz - first_data_size;
- tso_fixup_segmented_buf (b0, tcp_flags_no_fin_psh, is_ip6);
+ tso_fixup_segmented_buf (b0, tcp_flags_no_fin_psh, is_ip6, gho);
/* grab a second buffer and prepare the loop */
ASSERT (dbi < vec_len (ptd->split_buffers));
cdb0 = vlib_get_buffer (vm, ptd->split_buffers[dbi++]);
tso_init_buf_from_template (vm, cdb0, b0, l234_sz, gso_size, &dst_ptr,
- &dst_left, next_tcp_seq, default_bflags);
+ &dst_left, next_tcp_seq, default_bflags,
+ gho);
/* an arbitrary large number to catch the runaway loops */
int nloops = 2000;
@@ -241,11 +242,11 @@ tso_segment_buffer (vlib_main_t * vm, vnet_interface_per_thread_data_t * ptd,
cdb0 = vlib_get_buffer (vm, ptd->split_buffers[dbi++]);
tso_init_buf_from_template (vm, cdb0, b0, l234_sz,
gso_size, &dst_ptr, &dst_left,
- next_tcp_seq, default_bflags);
+ next_tcp_seq, default_bflags, gho);
}
}
- tso_fixup_segmented_buf (cdb0, save_tcp_flags, is_ip6);
+ tso_fixup_segmented_buf (cdb0, save_tcp_flags, is_ip6, gho);
n_tx_bytes += cdb0->current_length;
}
@@ -446,11 +447,13 @@ vnet_gso_node_inline (vlib_main_t * vm,
to_next -= 1;
n_left_to_next += 1;
/* undo the counting. */
+ gso_header_offset_t gho;
u32 n_bytes_b0 = vlib_buffer_length_in_chain (vm, b[0]);
u32 n_tx_bytes = 0;
+ gho = vnet_gso_header_offset_parser (b[0], is_ip6);
n_tx_bytes =
- tso_segment_buffer (vm, ptd, bi0, b[0], n_bytes_b0,
+ tso_segment_buffer (vm, ptd, bi0, b[0], &gho, n_bytes_b0,
is_ip6);
if (PREDICT_FALSE (n_tx_bytes == 0))
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 49775d58d80..73c7a31f010 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -38,6 +38,7 @@
*/
#include <vnet/vnet.h>
+#include <vnet/gso/gso.h>
#include <vnet/ip/icmp46_packet.h>
#include <vnet/ip/ip4.h>
#include <vnet/ip/ip6.h>
@@ -163,20 +164,23 @@ calc_checksums (vlib_main_t * vm, vlib_buffer_t * b)
{
tcp_header_t *th;
udp_header_t *uh;
+ gso_header_offset_t gho = { 0 };
int is_ip4 = (b->flags & VNET_BUFFER_F_IS_IP4) != 0;
int is_ip6 = (b->flags & VNET_BUFFER_F_IS_IP6) != 0;
ASSERT (!(is_ip4 && is_ip6));
- th = (tcp_header_t *) (b->data + vnet_buffer (b)->l4_hdr_offset);
- uh = (udp_header_t *) (b->data + vnet_buffer (b)->l4_hdr_offset);
+ gho = vnet_gso_header_offset_parser (b, is_ip6);
+ th = (tcp_header_t *) (vlib_buffer_get_current (b) + gho.l4_hdr_offset);
+ uh = (udp_header_t *) (vlib_buffer_get_current (b) + gho.l4_hdr_offset);
if (is_ip4)
{
ip4_header_t *ip4;
- ip4 = (ip4_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset);
+ ip4 =
+ (ip4_header_t *) (vlib_buffer_get_current (b) + gho.l3_hdr_offset);
if (b->flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM)
ip4->checksum = ip4_header_checksum (ip4);
if (b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM)
@@ -192,7 +196,8 @@ calc_checksums (vlib_main_t * vm, vlib_buffer_t * b)
int bogus;
ip6_header_t *ip6;
- ip6 = (ip6_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset);
+ ip6 =
+ (ip6_header_t *) (vlib_buffer_get_current (b) + gho.l3_hdr_offset);
if (b->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM)
{
th->checksum = 0;
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index c47dfe270e7..f4f6bd46fe7 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1535,9 +1535,9 @@ fill_gso_buffer_flags (vlib_main_t * vm, u32 * buffers, u32 n_buffers,
{
vlib_buffer_t *b0 = vlib_get_buffer (vm, buffers[i]);
u8 l4_proto = 0;
- u8 l4_hdr_sz = 0;
- ethernet_header_t *eh = (ethernet_header_t *) b0->data;
+ 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);
@@ -1555,50 +1555,30 @@ fill_gso_buffer_flags (vlib_main_t * vm, u32 * buffers, u32 n_buffers,
}
}
- vnet_buffer (b0)->l2_hdr_offset = 0;
- vnet_buffer (b0)->l3_hdr_offset = l2hdr_sz;
if (PREDICT_TRUE (ethertype == ETHERNET_TYPE_IP4))
{
- ip4_header_t *ip4 = (ip4_header_t *) (b0->data + l2hdr_sz);
- vnet_buffer (b0)->l4_hdr_offset = l2hdr_sz + ip4_header_bytes (ip4);
+ ip4_header_t *ip4 =
+ (ip4_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz);
l4_proto = ip4->protocol;
b0->flags |=
- (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L2_HDR_OFFSET_VALID
- | VNET_BUFFER_F_L3_HDR_OFFSET_VALID |
- VNET_BUFFER_F_L4_HDR_OFFSET_VALID);
- b0->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM;
+ (VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_OFFLOAD_IP_CKSUM);
}
else if (PREDICT_TRUE (ethertype == ETHERNET_TYPE_IP6))
{
- ip6_header_t *ip6 = (ip6_header_t *) (b0->data + l2hdr_sz);
+ ip6_header_t *ip6 =
+ (ip6_header_t *) (vlib_buffer_get_current (b0) + l2hdr_sz);
/* FIXME IPv6 EH traversal */
- vnet_buffer (b0)->l4_hdr_offset = l2hdr_sz + sizeof (ip6_header_t);
l4_proto = ip6->protocol;
- b0->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);
+ b0->flags |= VNET_BUFFER_F_IS_IP6;
}
if (l4_proto == IP_PROTOCOL_TCP)
{
- b0->flags |= VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
- tcp_header_t *tcp = (tcp_header_t *) (b0->data +
- vnet_buffer
- (b0)->l4_hdr_offset);
- l4_hdr_sz = tcp_header_bytes (tcp);
- tcp->checksum = 0;
- vnet_buffer2 (b0)->gso_l4_hdr_sz = l4_hdr_sz;
+ b0->flags |= (VNET_BUFFER_F_OFFLOAD_TCP_CKSUM | VNET_BUFFER_F_GSO);
vnet_buffer2 (b0)->gso_size = packet_data_size;
- b0->flags |= VNET_BUFFER_F_GSO;
}
else if (l4_proto == IP_PROTOCOL_UDP)
{
b0->flags |= VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
- udp_header_t *udp = (udp_header_t *) (b0->data +
- vnet_buffer
- (b0)->l4_hdr_offset);
- vnet_buffer2 (b0)->gso_l4_hdr_sz = sizeof (*udp);
- udp->checksum = 0;
}
}
}