summaryrefslogtreecommitdiff
path: root/drivers/net/8139cp.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-08-23 05:18:56 +0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-11 03:51:57 +0400
commitcf9830195a3f35b1248425b69a01ee43f5b68221 (patch)
treea6ecdb00a710318c4807602141a5e55cee0a3f91 /drivers/net/8139cp.c
parentd3bb52b0948cf118131c951c5a34a2d4d0246171 (diff)
downloadlinux-cf9830195a3f35b1248425b69a01ee43f5b68221.tar.xz
fix vlan in 8139cp on big-endian
Layout of opts2 is : MSB(vlan_tag) : LSB(vlan_tag) : flags : 0 : regardless of the host endianness. On little-endian the current code ends up with the right values, but on big-endian it blows. In r8169.c the same bug had been fixed in commit d35da12a40426184b1d0844104b1d464753eba19 (r8169: endianness fixes). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/8139cp.c')
-rw-r--r--drivers/net/8139cp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index abb2a3471087..a453eda834d5 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -78,7 +78,7 @@
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define CP_VLAN_TAG_USED 1
#define CP_VLAN_TX_TAG(tx_desc,vlan_tag_value) \
- do { (tx_desc)->opts2 = (vlan_tag_value); } while (0)
+ do { (tx_desc)->opts2 = cpu_to_le32(vlan_tag_value); } while (0)
#else
#define CP_VLAN_TAG_USED 0
#define CP_VLAN_TX_TAG(tx_desc,vlan_tag_value) \
@@ -304,7 +304,7 @@ static const unsigned int cp_rx_config =
struct cp_desc {
__le32 opts1;
- u32 opts2;
+ __le32 opts2;
__le64 addr;
};
@@ -462,9 +462,9 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
cp->dev->last_rx = jiffies;
#if CP_VLAN_TAG_USED
- if (cp->vlgrp && (desc->opts2 & RxVlanTagged)) {
+ if (cp->vlgrp && (desc->opts2 & cpu_to_le32(RxVlanTagged))) {
vlan_hwaccel_receive_skb(skb, cp->vlgrp,
- be16_to_cpu(desc->opts2 & 0xffff));
+ swab16(le32_to_cpu(desc->opts2) & 0xffff));
} else
#endif
netif_receive_skb(skb);
@@ -765,7 +765,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
#if CP_VLAN_TAG_USED
if (cp->vlgrp && vlan_tx_tag_present(skb))
- vlan_tag = TxVlanTag | cpu_to_be16(vlan_tx_tag_get(skb));
+ vlan_tag = TxVlanTag | swab16(vlan_tx_tag_get(skb));
#endif
entry = cp->tx_head;