]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/if_vlan.h
scm: lower SCM_MAX_FD
[net-next-2.6.git] / include / linux / if_vlan.h
index 4047781da727858983a98264a279f6859cd049aa..635e1faec412db465a429a626da4c373510f2d98 100644 (file)
@@ -132,7 +132,7 @@ 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 void vlan_hwaccel_do_receive(struct sk_buff *skb);
+extern bool 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);
@@ -166,8 +166,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
        return NET_XMIT_SUCCESS;
 }
 
-static inline void vlan_hwaccel_do_receive(struct sk_buff *skb)
+static inline bool vlan_hwaccel_do_receive(struct sk_buff **skb)
 {
+       if ((*skb)->vlan_tci & VLAN_VID_MASK)
+               (*skb)->pkt_type = PACKET_OTHERHOST;
+       return false;
 }
 
 static inline gro_result_t
@@ -336,6 +339,31 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
        }
 }
 
+/**
+ * vlan_get_protocol - get protocol EtherType.
+ * @skb: skbuff to query
+ *
+ * Returns the EtherType of the packet, regardless of whether it is
+ * vlan encapsulated (normal or hardware accelerated) or not.
+ */
+static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
+{
+       __be16 protocol = 0;
+
+       if (vlan_tx_tag_present(skb) ||
+            skb->protocol != cpu_to_be16(ETH_P_8021Q))
+               protocol = skb->protocol;
+       else {
+               __be16 proto, *protop;
+               protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr,
+                                               h_vlan_encapsulated_proto),
+                                               sizeof(proto), &proto);
+               if (likely(protop))
+                       protocol = *protop;
+       }
+
+       return protocol;
+}
 #endif /* __KERNEL__ */
 
 /* VLAN IOCTLs are found in sockios.h */