summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/interface.h12
-rw-r--r--src/vnet/interface_output.c1
-rw-r--r--src/vnet/interface_output.h30
3 files changed, 43 insertions, 0 deletions
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 0a30239e982..fe42e5d33a1 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -561,6 +561,14 @@ typedef enum vnet_hw_interface_capabilities_t_
VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | \
VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM)
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_OUTER_CKSUM \
+ (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_OUTER_CKSUM | \
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_OUTER_CKSUM)
+
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM_MASK \
+ (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM | \
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_OUTER_CKSUM)
+
#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_RX_CKSUM \
(VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \
VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
@@ -570,6 +578,10 @@ typedef enum vnet_hw_interface_capabilities_t_
VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \
VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_TNL_GSO_MASK \
+ VNET_HW_INTERFACE_CAP_SUPPORTS_VXLAN_TNL_GSO | \
+ VNET_HW_INTERFACE_CAP_SUPPORTS_IPIP_TNL_GSO
+
#define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1
#define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3
#define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 5b43f7ef3ff..72ceb95132d 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -170,6 +170,7 @@ vnet_interface_output_handle_offload (vlib_main_t *vm, vlib_buffer_t *b)
{
vnet_calc_checksums_inline (vm, b, b->flags & VNET_BUFFER_F_IS_IP4,
b->flags & VNET_BUFFER_F_IS_IP6);
+ vnet_calc_outer_checksums_inline (vm, b);
}
static_always_inline uword
diff --git a/src/vnet/interface_output.h b/src/vnet/interface_output.h
index 15b0a1d3ccc..786b0ff8e21 100644
--- a/src/vnet/interface_output.h
+++ b/src/vnet/interface_output.h
@@ -114,6 +114,36 @@ vnet_calc_checksums_inline (vlib_main_t * vm, vlib_buffer_t * b,
VNET_BUFFER_OFFLOAD_F_TCP_CKSUM));
}
+static_always_inline void
+vnet_calc_outer_checksums_inline (vlib_main_t *vm, vlib_buffer_t *b)
+{
+
+ if (!(b->flags & VNET_BUFFER_F_OFFLOAD))
+ return;
+
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
+ if (oflags & VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM)
+ {
+ ip4_header_t *ip4;
+ ip4 = (ip4_header_t *) (b->data + vnet_buffer2 (b)->outer_l3_hdr_offset);
+ ip4->checksum = ip4_header_checksum (ip4);
+ vnet_buffer_offload_flags_clear (b,
+ VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM);
+ }
+ else if (oflags & VNET_BUFFER_OFFLOAD_F_OUTER_UDP_CKSUM)
+ {
+ int bogus;
+ ip6_header_t *ip6;
+ udp_header_t *uh;
+
+ ip6 = (ip6_header_t *) (b->data + vnet_buffer2 (b)->outer_l3_hdr_offset);
+ uh = (udp_header_t *) (b->data + vnet_buffer2 (b)->outer_l4_hdr_offset);
+ uh->checksum = 0;
+ uh->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b, ip6, &bogus);
+ vnet_buffer_offload_flags_clear (b,
+ VNET_BUFFER_OFFLOAD_F_OUTER_UDP_CKSUM);
+ }
+}
#endif
/*