Skip to content

Commit 759d095

Browse files
hkallweitdavem330
authored andcommitted
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: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3099c59 commit 759d095

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,15 +1528,16 @@ static int rtl8169_set_features(struct net_device *dev,
15281528
static inline u32 rtl8169_tx_vlan_tag(struct sk_buff *skb)
15291529
{
15301530
return (skb_vlan_tag_present(skb)) ?
1531-
TxVlanTag | swab16(skb_vlan_tag_get(skb)) : 0x00;
1531+
TxVlanTag | htons(skb_vlan_tag_get(skb)) : 0x00;
15321532
}
15331533

15341534
static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
15351535
{
15361536
u32 opts2 = le32_to_cpu(desc->opts2);
15371537

15381538
if (opts2 & RxVlanTag)
1539-
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
1539+
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
1540+
ntohs(opts2 & 0xffff));
15401541
}
15411542

15421543
static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,

0 commit comments

Comments
 (0)