summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2017-07-19 08:48:09 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-07-19 16:01:44 +0000
commitc4423229e2ed51084fb277570bfde097abaf7c97 (patch)
tree9c77c21970ecce183521cc780e978d59abac320e /src
parent60c1223acb21d9cc5925b14da3cb186155941624 (diff)
Fix IP checksum offload metadata setup
Change-Id: Idf4f8b02337551670d6b7ce1a03799de9c53d19a Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip4.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h
index 19198bcb66b..872b516cfa9 100644
--- a/src/vnet/ip/ip4.h
+++ b/src/vnet/ip/ip4.h
@@ -347,8 +347,18 @@ vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b,
ih->src_address.as_u32 = src->as_u32;
ih->dst_address.as_u32 = dst->as_u32;
- ih->checksum = 0;
- b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4;
+ /* Offload ip4 header checksum generation */
+ if (1)
+ {
+ ih->checksum = 0;
+ b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4;
+ vnet_buffer (b)->l3_hdr_offset = (u8 *) ih - b->data;
+ vnet_buffer (b)->l4_hdr_offset = vnet_buffer (b)->l3_hdr_offset +
+ sizeof (*ih);
+ }
+ else
+ ih->checksum = ip4_header_checksum (ih);
+
return ih;
}
#endif /* included_ip_ip4_h */