瀏覽代碼

[8021Q]: Add endian annotations.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alexey Dobriyan 20 年之前
父節點
當前提交
3c3f8f25c1
共有 2 個文件被更改,包括 5 次插入5 次删除
  1. 4 4
      include/linux/if_vlan.h
  2. 1 1
      net/8021q/vlan_dev.c

+ 4 - 4
include/linux/if_vlan.h

@@ -42,8 +42,8 @@ struct hlist_node;
 struct vlan_ethhdr {
 struct vlan_ethhdr {
    unsigned char	h_dest[ETH_ALEN];	   /* destination eth addr	*/
    unsigned char	h_dest[ETH_ALEN];	   /* destination eth addr	*/
    unsigned char	h_source[ETH_ALEN];	   /* source ether addr	*/
    unsigned char	h_source[ETH_ALEN];	   /* source ether addr	*/
-   unsigned short       h_vlan_proto;              /* Should always be 0x8100 */
-   unsigned short       h_vlan_TCI;                /* Encapsulates priority and VLAN ID */
+   __be16               h_vlan_proto;              /* Should always be 0x8100 */
+   __be16               h_vlan_TCI;                /* Encapsulates priority and VLAN ID */
    unsigned short	h_vlan_encapsulated_proto; /* packet type ID field (or len) */
    unsigned short	h_vlan_encapsulated_proto; /* packet type ID field (or len) */
 };
 };
 
 
@@ -55,8 +55,8 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
 }
 }
 
 
 struct vlan_hdr {
 struct vlan_hdr {
-   unsigned short       h_vlan_TCI;                /* Encapsulates priority and VLAN ID */
-   unsigned short       h_vlan_encapsulated_proto; /* packet type ID field (or len) */
+   __be16               h_vlan_TCI;                /* Encapsulates priority and VLAN ID */
+   __be16               h_vlan_encapsulated_proto; /* packet type ID field (or len) */
 };
 };
 
 
 #define VLAN_VID_MASK	0xfff
 #define VLAN_VID_MASK	0xfff

+ 1 - 1
net/8021q/vlan_dev.c

@@ -120,7 +120,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	unsigned short vid;
 	unsigned short vid;
 	struct net_device_stats *stats;
 	struct net_device_stats *stats;
 	unsigned short vlan_TCI;
 	unsigned short vlan_TCI;
-	unsigned short proto;
+	__be16 proto;
 
 
 	/* vlan_TCI = ntohs(get_unaligned(&vhdr->h_vlan_TCI)); */
 	/* vlan_TCI = ntohs(get_unaligned(&vhdr->h_vlan_TCI)); */
 	vlan_TCI = ntohs(vhdr->h_vlan_TCI);
 	vlan_TCI = ntohs(vhdr->h_vlan_TCI);