diff options
Diffstat (limited to 'src/vnet/vxlan-gbp/encap.c')
-rw-r--r-- | src/vnet/vxlan-gbp/encap.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/vnet/vxlan-gbp/encap.c b/src/vnet/vxlan-gbp/encap.c index 4514fdae7a7..2a4e8a8e312 100644 --- a/src/vnet/vxlan-gbp/encap.c +++ b/src/vnet/vxlan-gbp/encap.c @@ -102,14 +102,14 @@ vxlan_gbp_encap_inline (vlib_main_t * vm, u8 const underlay_hdr_len = is_ip4 ? sizeof (ip4_vxlan_gbp_header_t) : sizeof (ip6_vxlan_gbp_header_t); u16 const l3_len = is_ip4 ? sizeof (ip4_header_t) : sizeof (ip6_header_t); - u32 const csum_flags = is_ip4 ? VNET_BUFFER_F_OFFLOAD_IP_CKSUM | - VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_OFFLOAD_UDP_CKSUM | - VNET_BUFFER_F_L3_HDR_OFFSET_VALID | VNET_BUFFER_F_L4_HDR_OFFSET_VALID : - VNET_BUFFER_F_IS_IP6 | VNET_BUFFER_F_OFFLOAD_UDP_CKSUM | - VNET_BUFFER_F_L3_HDR_OFFSET_VALID | VNET_BUFFER_F_L4_HDR_OFFSET_VALID; - u32 const inner_packet_csum_offload_flags = - VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_OFFLOAD_UDP_CKSUM | - VNET_BUFFER_F_OFFLOAD_TCP_CKSUM; + u32 const csum_flags = + is_ip4 ? VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L3_HDR_OFFSET_VALID | + VNET_BUFFER_F_L4_HDR_OFFSET_VALID : + VNET_BUFFER_F_IS_IP6 | VNET_BUFFER_F_L3_HDR_OFFSET_VALID | + VNET_BUFFER_F_L4_HDR_OFFSET_VALID; + u32 const outer_packet_csum_offload_flags = + is_ip4 ? VNET_BUFFER_OFFLOAD_F_IP_CKSUM | VNET_BUFFER_OFFLOAD_F_UDP_CKSUM : + VNET_BUFFER_OFFLOAD_F_UDP_CKSUM; u32 const inner_packet_removed_flags = VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_IS_IP6 | VNET_BUFFER_F_L2_HDR_OFFSET_VALID | VNET_BUFFER_F_L3_HDR_OFFSET_VALID | @@ -147,7 +147,7 @@ vxlan_gbp_encap_inline (vlib_main_t * vm, n_left_from -= 2; u32 or_flags = b[0]->flags | b[1]->flags; - if (csum_offload && (or_flags & inner_packet_csum_offload_flags)) + if (csum_offload && (or_flags & VNET_BUFFER_F_OFFLOAD)) { /* Only calculate the non-GSO packet csum offload */ if ((b[0]->flags & VNET_BUFFER_F_GSO) == 0) @@ -300,9 +300,13 @@ vxlan_gbp_encap_inline (vlib_main_t * vm, b[0]->flags |= csum_flags; vnet_buffer (b[0])->l3_hdr_offset = l3_0 - b[0]->data; vnet_buffer (b[0])->l4_hdr_offset = (u8 *) udp0 - b[0]->data; + vnet_buffer_offload_flags_set (b[0], + outer_packet_csum_offload_flags); b[1]->flags |= csum_flags; vnet_buffer (b[1])->l3_hdr_offset = l3_1 - b[1]->data; vnet_buffer (b[1])->l4_hdr_offset = (u8 *) udp1 - b[1]->data; + vnet_buffer_offload_flags_set (b[1], + outer_packet_csum_offload_flags); } /* IPv4 UDP checksum only if checksum offload is used */ else if (is_ip4) @@ -387,7 +391,7 @@ vxlan_gbp_encap_inline (vlib_main_t * vm, n_left_from -= 1; n_left_to_next -= 1; - if (csum_offload && (b[0]->flags & inner_packet_csum_offload_flags)) + if (csum_offload && (b[0]->flags & VNET_BUFFER_F_OFFLOAD)) { /* Only calculate the non-GSO packet csum offload */ if ((b[0]->flags & VNET_BUFFER_F_GSO) == 0) @@ -477,6 +481,8 @@ vxlan_gbp_encap_inline (vlib_main_t * vm, b[0]->flags |= csum_flags; vnet_buffer (b[0])->l3_hdr_offset = l3_0 - b[0]->data; vnet_buffer (b[0])->l4_hdr_offset = (u8 *) udp0 - b[0]->data; + vnet_buffer_offload_flags_set (b[0], + outer_packet_csum_offload_flags); } /* IPv4 UDP checksum only if checksum offload is used */ else if (is_ip4) |