Commit d35da12a authored by François Romieu's avatar François Romieu Committed by Jeff Garzik

[PATCH] r8169: endianness fixes

Endianness fixes

- rtl8169_rx_csum() forgot to convert the descriptor to cpu order,
- same thing for rtl8169_rx_vlan_skb() but this one is more tricky as
  the layout of the (u32) word in the 8169 descriptor calls for a
  second level of swap at the vlan tag level (u16). The old code only
  did the second part (in an endian-dependant way, how fun).
- rtl8169_tx_vlan_tag(): this time the (u32 descriptor level) cpu_to_le32
  is issued in rtl8169_start_xmit but the (u16 vlan tag level) cpu_to_be16
  is not right any more.

Summary: avoid even calls to cpu_to_{b/l}eXX on a given piece of data.

The change has no effect on x86. Now sparc64 talks to x86.
Pinpointed-by: default avatarJon Mason <jdmason@us.ibm.com>
Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 735a58f4
...@@ -698,7 +698,7 @@ static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, ...@@ -698,7 +698,7 @@ static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
return (tp->vlgrp && vlan_tx_tag_present(skb)) ? return (tp->vlgrp && vlan_tx_tag_present(skb)) ?
TxVlanTag | cpu_to_be16(vlan_tx_tag_get(skb)) : 0x00; TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00;
} }
static void rtl8169_vlan_rx_register(struct net_device *dev, static void rtl8169_vlan_rx_register(struct net_device *dev,
...@@ -733,12 +733,12 @@ static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) ...@@ -733,12 +733,12 @@ static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc, static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc,
struct sk_buff *skb) struct sk_buff *skb)
{ {
u32 opts2 = desc->opts2; u32 opts2 = le32_to_cpu(desc->opts2);
int ret; int ret;
if (tp->vlgrp && (opts2 & RxVlanTag)) { if (tp->vlgrp && (opts2 & RxVlanTag)) {
rtl8169_rx_hwaccel_skb(skb, tp->vlgrp, rtl8169_rx_hwaccel_skb(skb, tp->vlgrp,
be16_to_cpu(opts2 & 0xffff)); swab16(opts2 & 0xffff));
ret = 0; ret = 0;
} else } else
ret = -1; ret = -1;
...@@ -2084,7 +2084,7 @@ rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp, ...@@ -2084,7 +2084,7 @@ rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc)
{ {
u32 opts1 = desc->opts1; u32 opts1 = le32_to_cpu(desc->opts1);
u32 status = opts1 & RxProtoMask; u32 status = opts1 & RxProtoMask;
if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
......
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