11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * VLAN An implementation of 802.1Q VLAN tagging. 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Authors: Ben Greear <greearb@candelatech.com> 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or 71da177e4SLinus Torvalds * modify it under the terms of the GNU General Public License 81da177e4SLinus Torvalds * as published by the Free Software Foundation; either version 91da177e4SLinus Torvalds * 2 of the License, or (at your option) any later version. 101da177e4SLinus Torvalds * 111da177e4SLinus Torvalds */ 121da177e4SLinus Torvalds #ifndef _LINUX_IF_VLAN_H_ 131da177e4SLinus Torvalds #define _LINUX_IF_VLAN_H_ 141da177e4SLinus Torvalds 151da177e4SLinus Torvalds #include <linux/netdevice.h> 160610d11bSStephen Hemminger #include <linux/etherdevice.h> 1765ac6a5fSJesse Gross #include <linux/rtnetlink.h> 18187f1882SPaul Gortmaker #include <linux/bug.h> 19607ca46eSDavid Howells #include <uapi/linux/if_vlan.h> 201da177e4SLinus Torvalds 21a3f671b3SJoe Perches #define VLAN_HLEN 4 /* The additional bytes required by VLAN 22a3f671b3SJoe Perches * (in addition to the Ethernet header) 231da177e4SLinus Torvalds */ 241da177e4SLinus Torvalds #define VLAN_ETH_HLEN 18 /* Total octets in header. */ 251da177e4SLinus Torvalds #define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds /* 281da177e4SLinus Torvalds * According to 802.3ac, the packet can be 4 bytes longer. --Klika Jan 291da177e4SLinus Torvalds */ 301da177e4SLinus Torvalds #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ 311da177e4SLinus Torvalds #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ 321da177e4SLinus Torvalds 33740c15d0SPatrick McHardy /* 34740c15d0SPatrick McHardy * struct vlan_hdr - vlan header 35740c15d0SPatrick McHardy * @h_vlan_TCI: priority and VLAN ID 36740c15d0SPatrick McHardy * @h_vlan_encapsulated_proto: packet type ID or len 37740c15d0SPatrick McHardy */ 38740c15d0SPatrick McHardy struct vlan_hdr { 39740c15d0SPatrick McHardy __be16 h_vlan_TCI; 40740c15d0SPatrick McHardy __be16 h_vlan_encapsulated_proto; 41740c15d0SPatrick McHardy }; 42740c15d0SPatrick McHardy 43740c15d0SPatrick McHardy /** 44740c15d0SPatrick McHardy * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr) 45740c15d0SPatrick McHardy * @h_dest: destination ethernet address 46740c15d0SPatrick McHardy * @h_source: source ethernet address 47740c15d0SPatrick McHardy * @h_vlan_proto: ethernet protocol (always 0x8100) 48740c15d0SPatrick McHardy * @h_vlan_TCI: priority and VLAN ID 49740c15d0SPatrick McHardy * @h_vlan_encapsulated_proto: packet type ID or len 50740c15d0SPatrick McHardy */ 511da177e4SLinus Torvalds struct vlan_ethhdr { 52740c15d0SPatrick McHardy unsigned char h_dest[ETH_ALEN]; 53740c15d0SPatrick McHardy unsigned char h_source[ETH_ALEN]; 54740c15d0SPatrick McHardy __be16 h_vlan_proto; 55740c15d0SPatrick McHardy __be16 h_vlan_TCI; 56740c15d0SPatrick McHardy __be16 h_vlan_encapsulated_proto; 571da177e4SLinus Torvalds }; 581da177e4SLinus Torvalds 591da177e4SLinus Torvalds #include <linux/skbuff.h> 601da177e4SLinus Torvalds 611da177e4SLinus Torvalds static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) 621da177e4SLinus Torvalds { 6398e399f8SArnaldo Carvalho de Melo return (struct vlan_ethhdr *)skb_mac_header(skb); 641da177e4SLinus Torvalds } 651da177e4SLinus Torvalds 6605423b24SEric Dumazet #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ 6705423b24SEric Dumazet #define VLAN_PRIO_SHIFT 13 6805423b24SEric Dumazet #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ 6905423b24SEric Dumazet #define VLAN_TAG_PRESENT VLAN_CFI_MASK 7005423b24SEric Dumazet #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ 71b738127dSJesse Gross #define VLAN_N_VID 4096 721da177e4SLinus Torvalds 731da177e4SLinus Torvalds /* found in socket.c */ 74881d966bSEric W. Biederman extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 751da177e4SLinus Torvalds 766dcbbe25SNeil Horman static inline int is_vlan_dev(struct net_device *dev) 776dcbbe25SNeil Horman { 786dcbbe25SNeil Horman return dev->priv_flags & IFF_802_1Q_VLAN; 796dcbbe25SNeil Horman } 806dcbbe25SNeil Horman 8105423b24SEric Dumazet #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 8248cc32d3SFlorian Zumbiehl #define vlan_tx_nonzero_tag_present(__skb) \ 8348cc32d3SFlorian Zumbiehl (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK)) 8405423b24SEric Dumazet #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 851da177e4SLinus Torvalds 867750f403SPatrick McHardy #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 8765ac6a5fSJesse Gross 88cec9c133SJiri Pirko extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, 891fd9b1fcSPatrick McHardy __be16 vlan_proto, u16 vlan_id); 9022d1ba74SPatrick McHardy extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 9122d1ba74SPatrick McHardy extern u16 vlan_dev_vlan_id(const struct net_device *dev); 9222d1ba74SPatrick McHardy 9348cc32d3SFlorian Zumbiehl extern bool vlan_do_receive(struct sk_buff **skb); 94bcc6d479SJiri Pirko extern struct sk_buff *vlan_untag(struct sk_buff *skb); 959b22ea56SPatrick McHardy 9680d5c368SPatrick McHardy extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); 9780d5c368SPatrick McHardy extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); 9887002b03SJiri Pirko 99348a1443SJiri Pirko extern int vlan_vids_add_by_dev(struct net_device *dev, 100348a1443SJiri Pirko const struct net_device *by_dev); 101348a1443SJiri Pirko extern void vlan_vids_del_by_dev(struct net_device *dev, 102348a1443SJiri Pirko const struct net_device *by_dev); 1039b361c13SJiri Pirko 1049b361c13SJiri Pirko extern bool vlan_uses_dev(const struct net_device *dev); 1057750f403SPatrick McHardy #else 106cec9c133SJiri Pirko static inline struct net_device * 107*9fae27b3SPatrick McHardy __vlan_find_dev_deep(struct net_device *real_dev, 108*9fae27b3SPatrick McHardy __be16 vlan_proto, u16 vlan_id) 109cec9c133SJiri Pirko { 110cec9c133SJiri Pirko return NULL; 111cec9c133SJiri Pirko } 112cec9c133SJiri Pirko 11322d1ba74SPatrick McHardy static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 11422d1ba74SPatrick McHardy { 11522d1ba74SPatrick McHardy BUG(); 11622d1ba74SPatrick McHardy return NULL; 11722d1ba74SPatrick McHardy } 11822d1ba74SPatrick McHardy 11922d1ba74SPatrick McHardy static inline u16 vlan_dev_vlan_id(const struct net_device *dev) 12022d1ba74SPatrick McHardy { 12122d1ba74SPatrick McHardy BUG(); 12222d1ba74SPatrick McHardy return 0; 12322d1ba74SPatrick McHardy } 12422d1ba74SPatrick McHardy 12548cc32d3SFlorian Zumbiehl static inline bool vlan_do_receive(struct sk_buff **skb) 1269b22ea56SPatrick McHardy { 1273701e513SJesse Gross return false; 1289b22ea56SPatrick McHardy } 129e1c096e2SHerbert Xu 1306139e75fSDavid S. Miller static inline struct sk_buff *vlan_untag(struct sk_buff *skb) 131bcc6d479SJiri Pirko { 132bcc6d479SJiri Pirko return skb; 133bcc6d479SJiri Pirko } 13487002b03SJiri Pirko 135*9fae27b3SPatrick McHardy static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) 13687002b03SJiri Pirko { 13787002b03SJiri Pirko return 0; 13887002b03SJiri Pirko } 13987002b03SJiri Pirko 140*9fae27b3SPatrick McHardy static inline void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid) 14187002b03SJiri Pirko { 14287002b03SJiri Pirko } 143348a1443SJiri Pirko 144348a1443SJiri Pirko static inline int vlan_vids_add_by_dev(struct net_device *dev, 145348a1443SJiri Pirko const struct net_device *by_dev) 146348a1443SJiri Pirko { 147348a1443SJiri Pirko return 0; 148348a1443SJiri Pirko } 149348a1443SJiri Pirko 150348a1443SJiri Pirko static inline void vlan_vids_del_by_dev(struct net_device *dev, 151348a1443SJiri Pirko const struct net_device *by_dev) 152348a1443SJiri Pirko { 153348a1443SJiri Pirko } 1549b361c13SJiri Pirko 1559b361c13SJiri Pirko static inline bool vlan_uses_dev(const struct net_device *dev) 1569b361c13SJiri Pirko { 1579b361c13SJiri Pirko return false; 1589b361c13SJiri Pirko } 1597750f403SPatrick McHardy #endif 1601da177e4SLinus Torvalds 16186a9bad3SPatrick McHardy static inline bool vlan_hw_offload_capable(netdev_features_t features, 16286a9bad3SPatrick McHardy __be16 proto) 16386a9bad3SPatrick McHardy { 16486a9bad3SPatrick McHardy if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX) 16586a9bad3SPatrick McHardy return true; 1668ad227ffSPatrick McHardy if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX) 1678ad227ffSPatrick McHardy return true; 16886a9bad3SPatrick McHardy return false; 16986a9bad3SPatrick McHardy } 17086a9bad3SPatrick McHardy 1719bb8582eSPatrick McHardy /** 1720b5c9db1SJiri Pirko * vlan_insert_tag - regular VLAN tag inserting 1731da177e4SLinus Torvalds * @skb: skbuff to tag 17486a9bad3SPatrick McHardy * @vlan_proto: VLAN encapsulation protocol 1759bb8582eSPatrick McHardy * @vlan_tci: VLAN TCI to insert 1761da177e4SLinus Torvalds * 1771da177e4SLinus Torvalds * Inserts the VLAN tag into @skb as part of the payload 1781da177e4SLinus Torvalds * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. 1791da177e4SLinus Torvalds * 1801da177e4SLinus Torvalds * Following the skb_unshare() example, in case of error, the calling function 1811da177e4SLinus Torvalds * doesn't have to worry about freeing the original skb. 1820b5c9db1SJiri Pirko * 1830b5c9db1SJiri Pirko * Does not change skb->protocol so this function can be used during receive. 1841da177e4SLinus Torvalds */ 18586a9bad3SPatrick McHardy static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, 18686a9bad3SPatrick McHardy __be16 vlan_proto, u16 vlan_tci) 1871da177e4SLinus Torvalds { 1881da177e4SLinus Torvalds struct vlan_ethhdr *veth; 1891da177e4SLinus Torvalds 19011a100f8SPatrick McHardy if (skb_cow_head(skb, VLAN_HLEN) < 0) { 19111a100f8SPatrick McHardy kfree_skb(skb); 1921da177e4SLinus Torvalds return NULL; 1931da177e4SLinus Torvalds } 1941da177e4SLinus Torvalds veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 1951da177e4SLinus Torvalds 1961da177e4SLinus Torvalds /* Move the mac addresses to the beginning of the new header. */ 197a3f671b3SJoe Perches memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); 198e4dd6188SJarek Poplawski skb->mac_header -= VLAN_HLEN; 1991da177e4SLinus Torvalds 2001da177e4SLinus Torvalds /* first, the ethernet type */ 20186a9bad3SPatrick McHardy veth->h_vlan_proto = vlan_proto; 2021da177e4SLinus Torvalds 2039bb8582eSPatrick McHardy /* now, the TCI */ 2049bb8582eSPatrick McHardy veth->h_vlan_TCI = htons(vlan_tci); 2051da177e4SLinus Torvalds 2060b5c9db1SJiri Pirko return skb; 2070b5c9db1SJiri Pirko } 2081da177e4SLinus Torvalds 2090b5c9db1SJiri Pirko /** 2100b5c9db1SJiri Pirko * __vlan_put_tag - regular VLAN tag inserting 2110b5c9db1SJiri Pirko * @skb: skbuff to tag 2120b5c9db1SJiri Pirko * @vlan_tci: VLAN TCI to insert 2130b5c9db1SJiri Pirko * 2140b5c9db1SJiri Pirko * Inserts the VLAN tag into @skb as part of the payload 2150b5c9db1SJiri Pirko * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. 2160b5c9db1SJiri Pirko * 2170b5c9db1SJiri Pirko * Following the skb_unshare() example, in case of error, the calling function 2180b5c9db1SJiri Pirko * doesn't have to worry about freeing the original skb. 2190b5c9db1SJiri Pirko */ 22086a9bad3SPatrick McHardy static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, 22186a9bad3SPatrick McHardy __be16 vlan_proto, u16 vlan_tci) 2220b5c9db1SJiri Pirko { 22386a9bad3SPatrick McHardy skb = vlan_insert_tag(skb, vlan_proto, vlan_tci); 2240b5c9db1SJiri Pirko if (skb) 22586a9bad3SPatrick McHardy skb->protocol = vlan_proto; 2261da177e4SLinus Torvalds return skb; 2271da177e4SLinus Torvalds } 2281da177e4SLinus Torvalds 2291da177e4SLinus Torvalds /** 2301da177e4SLinus Torvalds * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 2311da177e4SLinus Torvalds * @skb: skbuff to tag 23286a9bad3SPatrick McHardy * @vlan_proto: VLAN encapsulation protocol 2339bb8582eSPatrick McHardy * @vlan_tci: VLAN TCI to insert 2341da177e4SLinus Torvalds * 2356aa895b0SPatrick McHardy * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest 2361da177e4SLinus Torvalds */ 2379bb8582eSPatrick McHardy static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, 23886a9bad3SPatrick McHardy __be16 vlan_proto, 2399bb8582eSPatrick McHardy u16 vlan_tci) 2401da177e4SLinus Torvalds { 24186a9bad3SPatrick McHardy skb->vlan_proto = vlan_proto; 24205423b24SEric Dumazet skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; 2431da177e4SLinus Torvalds return skb; 2441da177e4SLinus Torvalds } 2451da177e4SLinus Torvalds 2461da177e4SLinus Torvalds #define HAVE_VLAN_PUT_TAG 2471da177e4SLinus Torvalds 2481da177e4SLinus Torvalds /** 2491da177e4SLinus Torvalds * vlan_put_tag - inserts VLAN tag according to device features 2501da177e4SLinus Torvalds * @skb: skbuff to tag 2519bb8582eSPatrick McHardy * @vlan_tci: VLAN TCI to insert 2521da177e4SLinus Torvalds * 2531da177e4SLinus Torvalds * Assumes skb->dev is the target that will xmit this frame. 2541da177e4SLinus Torvalds * Returns a VLAN tagged skb. 2551da177e4SLinus Torvalds */ 25686a9bad3SPatrick McHardy static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, 25786a9bad3SPatrick McHardy __be16 vlan_proto, u16 vlan_tci) 2581da177e4SLinus Torvalds { 25986a9bad3SPatrick McHardy if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { 26086a9bad3SPatrick McHardy return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); 2611da177e4SLinus Torvalds } else { 26286a9bad3SPatrick McHardy return __vlan_put_tag(skb, vlan_proto, vlan_tci); 2631da177e4SLinus Torvalds } 2641da177e4SLinus Torvalds } 2651da177e4SLinus Torvalds 2661da177e4SLinus Torvalds /** 2671da177e4SLinus Torvalds * __vlan_get_tag - get the VLAN ID that is part of the payload 2681da177e4SLinus Torvalds * @skb: skbuff to query 2699bb8582eSPatrick McHardy * @vlan_tci: buffer to store vlaue 2701da177e4SLinus Torvalds * 2711da177e4SLinus Torvalds * Returns error if the skb is not of VLAN type 2721da177e4SLinus Torvalds */ 2739bb8582eSPatrick McHardy static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) 2741da177e4SLinus Torvalds { 2751da177e4SLinus Torvalds struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 2761da177e4SLinus Torvalds 2778ad227ffSPatrick McHardy if (veth->h_vlan_proto != htons(ETH_P_8021Q) && 2788ad227ffSPatrick McHardy veth->h_vlan_proto != htons(ETH_P_8021AD)) 2791da177e4SLinus Torvalds return -EINVAL; 2801da177e4SLinus Torvalds 2819bb8582eSPatrick McHardy *vlan_tci = ntohs(veth->h_vlan_TCI); 2821da177e4SLinus Torvalds return 0; 2831da177e4SLinus Torvalds } 2841da177e4SLinus Torvalds 2851da177e4SLinus Torvalds /** 2861da177e4SLinus Torvalds * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[] 2871da177e4SLinus Torvalds * @skb: skbuff to query 2889bb8582eSPatrick McHardy * @vlan_tci: buffer to store vlaue 2891da177e4SLinus Torvalds * 2906aa895b0SPatrick McHardy * Returns error if @skb->vlan_tci is not set correctly 2911da177e4SLinus Torvalds */ 29218149935SPatrick McHardy static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, 2939bb8582eSPatrick McHardy u16 *vlan_tci) 2941da177e4SLinus Torvalds { 2956aa895b0SPatrick McHardy if (vlan_tx_tag_present(skb)) { 29605423b24SEric Dumazet *vlan_tci = vlan_tx_tag_get(skb); 2971da177e4SLinus Torvalds return 0; 2981da177e4SLinus Torvalds } else { 2999bb8582eSPatrick McHardy *vlan_tci = 0; 3001da177e4SLinus Torvalds return -EINVAL; 3011da177e4SLinus Torvalds } 3021da177e4SLinus Torvalds } 3031da177e4SLinus Torvalds 3041da177e4SLinus Torvalds #define HAVE_VLAN_GET_TAG 3051da177e4SLinus Torvalds 3061da177e4SLinus Torvalds /** 3071da177e4SLinus Torvalds * vlan_get_tag - get the VLAN ID from the skb 3081da177e4SLinus Torvalds * @skb: skbuff to query 3099bb8582eSPatrick McHardy * @vlan_tci: buffer to store vlaue 3101da177e4SLinus Torvalds * 3111da177e4SLinus Torvalds * Returns error if the skb is not VLAN tagged 3121da177e4SLinus Torvalds */ 3139bb8582eSPatrick McHardy static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) 3141da177e4SLinus Torvalds { 315f646968fSPatrick McHardy if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { 3169bb8582eSPatrick McHardy return __vlan_hwaccel_get_tag(skb, vlan_tci); 3171da177e4SLinus Torvalds } else { 3189bb8582eSPatrick McHardy return __vlan_get_tag(skb, vlan_tci); 3191da177e4SLinus Torvalds } 3201da177e4SLinus Torvalds } 3211da177e4SLinus Torvalds 3220a85df00SHao Zheng /** 3230a85df00SHao Zheng * vlan_get_protocol - get protocol EtherType. 3240a85df00SHao Zheng * @skb: skbuff to query 3250a85df00SHao Zheng * 3260a85df00SHao Zheng * Returns the EtherType of the packet, regardless of whether it is 3270a85df00SHao Zheng * vlan encapsulated (normal or hardware accelerated) or not. 3280a85df00SHao Zheng */ 3290a85df00SHao Zheng static inline __be16 vlan_get_protocol(const struct sk_buff *skb) 3300a85df00SHao Zheng { 3310a85df00SHao Zheng __be16 protocol = 0; 3320a85df00SHao Zheng 3330a85df00SHao Zheng if (vlan_tx_tag_present(skb) || 3340a85df00SHao Zheng skb->protocol != cpu_to_be16(ETH_P_8021Q)) 3350a85df00SHao Zheng protocol = skb->protocol; 3360a85df00SHao Zheng else { 3370a85df00SHao Zheng __be16 proto, *protop; 3380a85df00SHao Zheng protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr, 3390a85df00SHao Zheng h_vlan_encapsulated_proto), 3400a85df00SHao Zheng sizeof(proto), &proto); 3410a85df00SHao Zheng if (likely(protop)) 3420a85df00SHao Zheng protocol = *protop; 3430a85df00SHao Zheng } 3440a85df00SHao Zheng 3450a85df00SHao Zheng return protocol; 3460a85df00SHao Zheng } 347396cf943SPravin B Shelar 348396cf943SPravin B Shelar static inline void vlan_set_encap_proto(struct sk_buff *skb, 349396cf943SPravin B Shelar struct vlan_hdr *vhdr) 350396cf943SPravin B Shelar { 351396cf943SPravin B Shelar __be16 proto; 352da8c8724SCong Wang unsigned short *rawp; 353396cf943SPravin B Shelar 354396cf943SPravin B Shelar /* 355396cf943SPravin B Shelar * Was a VLAN packet, grab the encapsulated protocol, which the layer 356396cf943SPravin B Shelar * three protocols care about. 357396cf943SPravin B Shelar */ 358396cf943SPravin B Shelar 359396cf943SPravin B Shelar proto = vhdr->h_vlan_encapsulated_proto; 360e5c5d22eSSimon Horman if (ntohs(proto) >= ETH_P_802_3_MIN) { 361396cf943SPravin B Shelar skb->protocol = proto; 362396cf943SPravin B Shelar return; 363396cf943SPravin B Shelar } 364396cf943SPravin B Shelar 365da8c8724SCong Wang rawp = (unsigned short *)(vhdr + 1); 366da8c8724SCong Wang if (*rawp == 0xFFFF) 367396cf943SPravin B Shelar /* 368396cf943SPravin B Shelar * This is a magic hack to spot IPX packets. Older Novell 369396cf943SPravin B Shelar * breaks the protocol design and runs IPX over 802.3 without 370396cf943SPravin B Shelar * an 802.2 LLC layer. We look for FFFF which isn't a used 371396cf943SPravin B Shelar * 802.2 SSAP/DSAP. This won't work for fault tolerant netware 372396cf943SPravin B Shelar * but does for the rest. 373396cf943SPravin B Shelar */ 374396cf943SPravin B Shelar skb->protocol = htons(ETH_P_802_3); 375396cf943SPravin B Shelar else 376396cf943SPravin B Shelar /* 377396cf943SPravin B Shelar * Real 802.2 LLC 378396cf943SPravin B Shelar */ 379396cf943SPravin B Shelar skb->protocol = htons(ETH_P_802_2); 380396cf943SPravin B Shelar } 3811da177e4SLinus Torvalds #endif /* !(_LINUX_IF_VLAN_H_) */ 382