Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
[safe/jmp/linux-2.6] / include / linux / if_vlan.h
index d36515d..3d870fd 100644 (file)
@@ -63,7 +63,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
        return (struct vlan_ethhdr *)skb_mac_header(skb);
 }
 
-#define VLAN_VID_MASK  0xfff
+#define VLAN_PRIO_MASK         0xe000 /* Priority Code Point */
+#define VLAN_PRIO_SHIFT                13
+#define VLAN_CFI_MASK          0x1000 /* Canonical Format Indicator */
+#define VLAN_TAG_PRESENT       VLAN_CFI_MASK
+#define VLAN_VID_MASK          0x0fff /* VLAN Identifier */
 
 /* found in socket.c */
 extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
@@ -81,6 +85,7 @@ struct vlan_group {
                                            * the vlan is attached to.
                                            */
        unsigned int            nr_vlans;
+       int                     killall;
        struct hlist_node       hlist;  /* linked list */
        struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
        struct rcu_head         rcu;
@@ -105,17 +110,8 @@ static inline void vlan_group_set_device(struct vlan_group *vg,
        array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
 }
 
-/* VLAN tx hw acceleration helpers. */
-struct vlan_skb_tx_cookie {
-       u32     magic;
-       u32     vlan_tag;
-};
-
-#define VLAN_TX_COOKIE_MAGIC   0x564c414e      /* "VLAN" in ascii. */
-#define VLAN_TX_SKB_CB(__skb)  ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0]))
-#define vlan_tx_tag_present(__skb) \
-       (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
-#define vlan_tx_tag_get(__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag)
+#define vlan_tx_tag_present(__skb)     ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
+#define vlan_tx_tag_get(__skb)         ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
 
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
@@ -123,6 +119,14 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
 
 extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
                             u16 vlan_tci, int polling);
+extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
+extern gro_result_t
+vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
+                unsigned int vlan_tci, struct sk_buff *skb);
+extern gro_result_t
+vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
+              unsigned int vlan_tci);
+
 #else
 static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
 {
@@ -142,6 +146,25 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
        BUG();
        return NET_XMIT_SUCCESS;
 }
+
+static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
+{
+       return 0;
+}
+
+static inline gro_result_t
+vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
+                unsigned int vlan_tci, struct sk_buff *skb)
+{
+       return GRO_DROP;
+}
+
+static inline gro_result_t
+vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
+              unsigned int vlan_tci)
+{
+       return GRO_DROP;
+}
 #endif
 
 /**
@@ -185,26 +208,15 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
 {
        struct vlan_ethhdr *veth;
 
-       if (skb_headroom(skb) < VLAN_HLEN) {
-               struct sk_buff *sk_tmp = skb;
-               skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN);
-               kfree_skb(sk_tmp);
-               if (!skb) {
-                       printk(KERN_ERR "vlan: failed to realloc headroom\n");
-                       return NULL;
-               }
-       } else {
-               skb = skb_unshare(skb, GFP_ATOMIC);
-               if (!skb) {
-                       printk(KERN_ERR "vlan: failed to unshare skbuff\n");
-                       return NULL;
-               }
+       if (skb_cow_head(skb, VLAN_HLEN) < 0) {
+               kfree_skb(skb);
+               return NULL;
        }
-
        veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
 
        /* Move the mac addresses to the beginning of the new header. */
        memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
+       skb->mac_header -= VLAN_HLEN;
 
        /* first, the ethernet type */
        veth->h_vlan_proto = htons(ETH_P_8021Q);
@@ -222,17 +234,12 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
  * @skb: skbuff to tag
  * @vlan_tci: VLAN TCI to insert
  *
- * Puts the VLAN TCI in @skb->cb[] and lets the device do the rest
+ * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
  */
 static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
                                                     u16 vlan_tci)
 {
-       struct vlan_skb_tx_cookie *cookie;
-
-       cookie = VLAN_TX_SKB_CB(skb);
-       cookie->magic = VLAN_TX_COOKIE_MAGIC;
-       cookie->vlan_tag = vlan_tci;
-
+       skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
        return skb;
 }
 
@@ -279,16 +286,13 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
  * @skb: skbuff to query
  * @vlan_tci: buffer to store vlaue
  *
- * Returns error if @skb->cb[] is not set correctly
+ * Returns error if @skb->vlan_tci is not set correctly
  */
 static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
                                         u16 *vlan_tci)
 {
-       struct vlan_skb_tx_cookie *cookie;
-
-       cookie = VLAN_TX_SKB_CB(skb);
-       if (cookie->magic == VLAN_TX_COOKIE_MAGIC) {
-               *vlan_tci = cookie->vlan_tag;
+       if (vlan_tx_tag_present(skb)) {
+               *vlan_tci = vlan_tx_tag_get(skb);
                return 0;
        } else {
                *vlan_tci = 0;
@@ -335,6 +339,7 @@ enum vlan_ioctl_cmds {
 enum vlan_flags {
        VLAN_FLAG_REORDER_HDR   = 0x1,
        VLAN_FLAG_GVRP          = 0x2,
+       VLAN_FLAG_LOOSE_BINDING = 0x4,
 };
 
 enum vlan_name_types {