aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dm9000.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-04 19:02:00 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:05:15 -0500
commit931165739a75f88530d5b02cafaacf9bb6b66d87 (patch)
tree68bc8dfb4a0d89c106ae6462384088fb8f7f171c /drivers/net/dm9000.c
parenta8cc21f64648073e443365d113c55755b92622a6 (diff)
DM9000: Fix endian-ness of data accesses.
Patch from: Laurent Pinchart <laurentp@cse-semaphore.com> This patch splits the receive status in 8bit wide fields and convert the packet length from little endian to CPU byte order. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r--drivers/net/dm9000.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 6a20a5491a96..e4390d917b81 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -867,7 +867,8 @@ dm9000_timer(unsigned long data)
867} 867}
868 868
869struct dm9000_rxhdr { 869struct dm9000_rxhdr {
870 u16 RxStatus; 870 u8 RxPktReady;
871 u8 RxStatus;
871 u16 RxLen; 872 u16 RxLen;
872} __attribute__((__packed__)); 873} __attribute__((__packed__));
873 874
@@ -908,7 +909,7 @@ dm9000_rx(struct net_device *dev)
908 909
909 (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr)); 910 (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr));
910 911
911 RxLen = rxhdr.RxLen; 912 RxLen = le16_to_cpu(rxhdr.RxLen);
912 913
913 /* Packet Status check */ 914 /* Packet Status check */
914 if (RxLen < 0x40) { 915 if (RxLen < 0x40) {
@@ -920,17 +921,17 @@ dm9000_rx(struct net_device *dev)
920 PRINTK1("RST: RX Len:%x\n", RxLen); 921 PRINTK1("RST: RX Len:%x\n", RxLen);
921 } 922 }
922 923
923 if (rxhdr.RxStatus & 0xbf00) { 924 if (rxhdr.RxStatus & 0xbf) {
924 GoodPacket = false; 925 GoodPacket = false;
925 if (rxhdr.RxStatus & 0x100) { 926 if (rxhdr.RxStatus & 0x01) {
926 PRINTK1("fifo error\n"); 927 PRINTK1("fifo error\n");
927 dev->stats.rx_fifo_errors++; 928 dev->stats.rx_fifo_errors++;
928 } 929 }
929 if (rxhdr.RxStatus & 0x200) { 930 if (rxhdr.RxStatus & 0x02) {
930 PRINTK1("crc error\n"); 931 PRINTK1("crc error\n");
931 dev->stats.rx_crc_errors++; 932 dev->stats.rx_crc_errors++;
932 } 933 }
933 if (rxhdr.RxStatus & 0x8000) { 934 if (rxhdr.RxStatus & 0x80) {
934 PRINTK1("length error\n"); 935 PRINTK1("length error\n");
935 dev->stats.rx_length_errors++; 936 dev->stats.rx_length_errors++;
936 } 937 }