loop_counter.c \
table.c \
tunnel.c \
+ vlan.c \
vport.c \
vport-capwap.c \
vport-generic.c \
loop_counter.h \
table.h \
tunnel.h \
+ vlan.h \
vport.h \
vport-generic.h \
vport-internal_dev.h \
#include "checksum.h"
#include "flow.h"
#include "dp_sysfs.h"
+#include "vlan.h"
struct vport;
* kernel versions.
* @tun_id: ID of the tunnel that encapsulated this packet. It is 0 if the
* packet was not received on a tunnel.
+ * @vlan_tci: Provides a substitute for the skb->vlan_tci field on kernels
+ * before 2.6.27.
*/
struct ovs_skb_cb {
struct vport *vport;
enum csum_type ip_summed;
#endif
__be64 tun_id;
+#ifdef NEED_VLAN_FIELD
+ u16 vlan_tci;
+#endif
};
#define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb)
--- /dev/null
+/*
+ * Copyright (c) 2011 Nicira Networks.
+ * Distributed under the terms of the GNU GPL version 2.
+ *
+ * Significant portions of this file may be copied from parts of the Linux
+ * kernel, by Linus Torvalds and others.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/if_vlan.h>
+#include <linux/skbuff.h>
+
+#include "datapath.h"
+#include "vlan.h"
+
+#ifdef NEED_VLAN_FIELD
+void vlan_copy_skb_tci(struct sk_buff *skb)
+{
+ OVS_CB(skb)->vlan_tci = 0;
+}
+
+u16 vlan_get_tci(struct sk_buff *skb)
+{
+ return OVS_CB(skb)->vlan_tci;
+}
+
+void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
+{
+ OVS_CB(skb)->vlan_tci = vlan_tci;
+}
+
+bool vlan_tx_tag_present(struct sk_buff *skb)
+{
+ return OVS_CB(skb)->vlan_tci & VLAN_TAG_PRESENT;
+}
+
+u16 vlan_tx_tag_get(struct sk_buff *skb)
+{
+ return OVS_CB(skb)->vlan_tci & ~VLAN_TAG_PRESENT;
+}
+
+struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci)
+{
+ OVS_CB(skb)->vlan_tci = vlan_tci | VLAN_TAG_PRESENT;
+ return skb;
+}
+#endif /* NEED_VLAN_FIELD */
--- /dev/null
+/*
+ * Copyright (c) 2011 Nicira Networks.
+ * Distributed under the terms of the GNU GPL version 2.
+ *
+ * Significant portions of this file may be copied from parts of the Linux
+ * kernel, by Linus Torvalds and others.
+ */
+
+#ifndef VLAN_H
+#define VLAN_H 1
+
+#include <linux/if_vlan.h>
+#include <linux/skbuff.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+#define NEED_VLAN_FIELD
+#endif
+
+#ifndef NEED_VLAN_FIELD
+static inline void vlan_copy_skb_tci(struct sk_buff *skb) { }
+
+static inline u16 vlan_get_tci(struct sk_buff *skb)
+{
+ return skb->vlan_tci;
+}
+
+static inline void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
+{
+ skb->vlan_tci = vlan_tci;
+}
+#else
+void vlan_copy_skb_tci(struct sk_buff *skb);
+u16 vlan_get_tci(struct sk_buff *skb);
+void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci);
+
+#undef vlan_tx_tag_present
+bool vlan_tx_tag_present(struct sk_buff *skb);
+
+#undef vlan_tx_tag_get
+u16 vlan_tx_tag_get(struct sk_buff *skb);
+
+#define __vlan_hwaccel_put_tag rpl__vlan_hwaccel_put_tag
+struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci);
+#endif /* NEED_VLAN_FIELD */
+#endif /* vlan.h */
#include "checksum.h"
#include "datapath.h"
+#include "vlan.h"
#include "vport-generic.h"
#include "vport-internal_dev.h"
#include "vport-netdev.h"
static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev)
{
compute_ip_summed(skb, true);
+ vlan_copy_skb_tci(skb);
OVS_CB(skb)->flow = NULL;
vport_receive(internal_dev_priv(netdev)->vport, skb);
#include "checksum.h"
#include "datapath.h"
+#include "vlan.h"
#include "vport-internal_dev.h"
#include "vport-netdev.h"
skb_push(skb, ETH_HLEN);
compute_ip_summed(skb, false);
+ vlan_copy_skb_tci(skb);
vport_receive(vport, skb);
}