datapath: make skb->csum consistent with rest of networking stack.
[sliver-openvswitch.git] / datapath / vlan.h
index 7e1084e..46d0db3 100644 (file)
@@ -1,9 +1,19 @@
 /*
- * Copyright (c) 2011 Nicira Networks.
- * Distributed under the terms of the GNU GPL version 2.
+ * Copyright (c) 2007-2011 Nicira, Inc.
  *
- * Significant portions of this file may be copied from parts of the Linux
- * kernel, by Linus Torvalds and others.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
  */
 
 #ifndef VLAN_H
@@ -83,6 +93,11 @@ static inline int vlan_deaccel_tag(struct sk_buff *skb)
        if (unlikely(!skb))
                return -ENOMEM;
 
+       if (get_ip_summed(skb) == OVS_CSUM_COMPLETE)
+               skb->csum = csum_add(skb->csum,
+                                    csum_partial(skb->data + (2 * ETH_ALEN),
+                                                 VLAN_HLEN, 0));
+
        vlan_set_tci(skb, 0);
        return 0;
 }