summaryrefslogtreecommitdiff
path: root/lib/csum.c
diff options
context:
space:
mode:
authorSharo, Randall A CIV SPAWARSYSCEN-ATLANTIC, 55200 <randall.sharo@navy.mil>2014-12-23 23:42:05 +0000
committerBen Pfaff <blp@nicira.com>2015-01-13 16:22:44 -0800
commite60e935b1f37058e8a3e1a57d6a8fdd566df304c (patch)
tree74babda432851a4bf3481ad031ea07229850d13d /lib/csum.c
parented5c51108ce7f809da953a74fd07d5c30b271972 (diff)
downloadopenvswitch-e60e935b1f37058e8a3e1a57d6a8fdd566df304c.tar.gz
Implement set-field for IPv6 ND fields (nd_target, nd_sll, and nd_tll).
This patch adds set-field operations for nd_target, nd_sll, and nd_tll fields, with and without masks, using Nicira extensions and OpenFlow 1.2 protocol. Signed-off-by: Randall A Sharo <randall.sharo at navy.mil> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/csum.c')
-rw-r--r--lib/csum.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/csum.c b/lib/csum.c
index a9334fec8..155ae85c8 100644
--- a/lib/csum.c
+++ b/lib/csum.c
@@ -113,6 +113,26 @@ recalc_csum32(ovs_be16 old_csum, ovs_be32 old_u32, ovs_be32 new_u32)
}
/* Returns the new checksum for a packet in which the checksum field previously
+ * contained 'old_csum' and in which a field that contained the 6 bytes at
+ * 'old_bytes' was changed to contain the 6 bytes at 'new_bytes'. */
+ovs_be16
+recalc_csum48(ovs_be16 old_csum, const void *old_bytes,
+ const void *new_bytes)
+{
+ ovs_be16 new_csum = old_csum;
+ const uint16_t *p16_old = old_bytes,
+ *p16_new = new_bytes;
+ int i;
+
+ for (i = 0; i < 3; ++i) {
+ new_csum = recalc_csum16(new_csum, get_unaligned_be16(&p16_old[i]),
+ get_unaligned_be16(&p16_new[i]));
+ }
+
+ return new_csum;
+}
+
+/* Returns the new checksum for a packet in which the checksum field previously
* contained 'old_csum' and in which a field that contained 'old_u32[4]' was
* changed to contain 'new_u32[4]'. */
ovs_be16