Commit 759d0957 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

r8169: improve handling VLAN tag

The VLAN tag is stored in the descriptor in network byte order.
Using swab16 works on little endian host systems only. Better play safe
and use ntohs or htons respectively.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3099c59d
...@@ -1528,7 +1528,7 @@ static int rtl8169_set_features(struct net_device *dev, ...@@ -1528,7 +1528,7 @@ static int rtl8169_set_features(struct net_device *dev,
static inline u32 rtl8169_tx_vlan_tag(struct sk_buff *skb) static inline u32 rtl8169_tx_vlan_tag(struct sk_buff *skb)
{ {
return (skb_vlan_tag_present(skb)) ? return (skb_vlan_tag_present(skb)) ?
TxVlanTag | swab16(skb_vlan_tag_get(skb)) : 0x00; TxVlanTag | htons(skb_vlan_tag_get(skb)) : 0x00;
} }
static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb) static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
...@@ -1536,7 +1536,8 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb) ...@@ -1536,7 +1536,8 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
u32 opts2 = le32_to_cpu(desc->opts2); u32 opts2 = le32_to_cpu(desc->opts2);
if (opts2 & RxVlanTag) if (opts2 & RxVlanTag)
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff)); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
ntohs(opts2 & 0xffff));
} }
static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment