Skip to contentSkip to conversation

Fix dm9000 receive status and len little endian issue

PATCH New Tsi-Chung Liew 2 participants 2 messages Jun 25, 2008 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix dm9000 receive status and len little endian issue

From: TsiChung Liew <[email protected]>

The received status and len was in little endian format and caused the ethernet unable to proceed further. Add define CFG_DM9000_BYTESWAP_STATUS_LEN in dm9000_rx_status_16bit() to byte swap RxStatus and RxLen

---
 drivers/net/dm9000x.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/dm9000x.c +4 -0
index 844fb76..eff676c 100644
@@ -224,6 +224,10 @@ static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen)
 
 	*RxStatus = DM9000_inw(DM9000_DATA);
 	*RxLen = DM9000_inw(DM9000_DATA);
+#ifdef CFG_DM9000_BYTESWAP_STATUS_LEN
+	*RxStatus = __sw16(*RxStatus);
+	*RxLen = __sw16(*RxLen);
+#endif
 }
 
 static void dm9000_rx_status_8bit(u16 *RxStatus, u16 *RxLen)
Signature · 1 line
1.5.4.1
#1 lore raw

PATCH 1/1 Fix dm9000 receive status and len little endian issue

Hi Tsi-Chung,

Quoted 17 lines · Tsi-Chung Liew

From: TsiChung Liew <[email protected]>

The received status and len was in little endian format and caused the ethernet unable to proceed further. Add define CFG_DM9000_BYTESWAP_STATUS_LEN in dm9000_rx_status_16bit() to byte swap RxStatus and RxLen

---
 drivers/net/dm9000x.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/dm9000x.c +0 -0
index 844fb76..eff676c 100644

drivers/net/dm9000x.c static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen) · line 232

Quoted 9 lines
drivers/net/dm9000x.c +4 -0
@@ -224,6 +224,10 @@ static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen)
 
 	*RxStatus = DM9000_inw(DM9000_DATA);
 	*RxLen = DM9000_inw(DM9000_DATA);
+#ifdef CFG_DM9000_BYTESWAP_STATUS_LEN
+	*RxStatus = __sw16(*RxStatus);
+	*RxLen = __sw16(*RxLen);
+#endif
 }
 

Instead of adding yet another kludgy CONFIG option, please consider changing the accessors to le16_to_cpu() or whatever is appropriate. The definitions of DM9000_inX() are not very portable as it is and we should be striving to make the code better, not worse.

regards,
Ben