* [PATCH] [DM9000] Add support for big-endian hosts
@ 2007-08-14 11:22 Laurent Pinchart
2007-08-14 18:25 ` Ben Dooks
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2007-08-14 11:22 UTC (permalink / raw)
To: netdev; +Cc: Ben Dooks
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>
---
drivers/net/dm9000.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 264fa0e..ee578d9 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -879,7 +879,8 @@ dm9000_timer(unsigned long data)
}
struct dm9000_rxhdr {
- u16 RxStatus;
+ u8 RxPktReady;
+ u8 RxStatus;
u16 RxLen;
} __attribute__((__packed__));
@@ -920,7 +921,7 @@ dm9000_rx(struct net_device *dev)
(db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr));
- RxLen = rxhdr.RxLen;
+ RxLen = le16_to_cpu(rxhdr.RxLen);
/* Packet Status check */
if (RxLen < 0x40) {
@@ -932,17 +933,17 @@ dm9000_rx(struct net_device *dev)
PRINTK1("RST: RX Len:%x\n", RxLen);
}
- if (rxhdr.RxStatus & 0xbf00) {
+ if (rxhdr.RxStatus & 0xbf) {
GoodPacket = false;
- if (rxhdr.RxStatus & 0x100) {
+ if (rxhdr.RxStatus & 0x01) {
PRINTK1("fifo error\n");
db->stats.rx_fifo_errors++;
}
- if (rxhdr.RxStatus & 0x200) {
+ if (rxhdr.RxStatus & 0x02) {
PRINTK1("crc error\n");
db->stats.rx_crc_errors++;
}
- if (rxhdr.RxStatus & 0x8000) {
+ if (rxhdr.RxStatus & 0x80) {
PRINTK1("length error\n");
db->stats.rx_length_errors++;
}
--
1.5.0
--
Laurent Pinchart
CSE Semaphore Belgium
Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium
T +32 (2) 387 42 59
F +32 (2) 387 42 75
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [DM9000] Add support for big-endian hosts
2007-08-14 11:22 [PATCH] [DM9000] Add support for big-endian hosts Laurent Pinchart
@ 2007-08-14 18:25 ` Ben Dooks
2007-08-16 8:10 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks @ 2007-08-14 18:25 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: netdev
On Tue, Aug 14, 2007 at 01:22:32PM +0200, Laurent Pinchart wrote:
> This patch splits the receive status in 8bit wide fields and convert the
> packet length from little endian to CPU byte order.
Which version of the the kernel was this against, it applies with
fuzz to 2.6.23-rc3:
$ patch -p1 < ~/dm9000-fix-endianness.patch
patching file drivers/net/dm9000.c
Hunk #1 succeeded at 894 (offset 15 lines).
Hunk #2 succeeded at 936 (offset 15 lines).
Hunk #3 succeeded at 948 (offset 15 lines).
> Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
> ---
> drivers/net/dm9000.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> index 264fa0e..ee578d9 100644
> --- a/drivers/net/dm9000.c
> +++ b/drivers/net/dm9000.c
> @@ -879,7 +879,8 @@ dm9000_timer(unsigned long data)
> }
>
> struct dm9000_rxhdr {
> - u16 RxStatus;
> + u8 RxPktReady;
> + u8 RxStatus;
> u16 RxLen;
> } __attribute__((__packed__));
>
> @@ -920,7 +921,7 @@ dm9000_rx(struct net_device *dev)
>
> (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr));
>
> - RxLen = rxhdr.RxLen;
> + RxLen = le16_to_cpu(rxhdr.RxLen);
>
> /* Packet Status check */
> if (RxLen < 0x40) {
> @@ -932,17 +933,17 @@ dm9000_rx(struct net_device *dev)
> PRINTK1("RST: RX Len:%x\n", RxLen);
> }
>
> - if (rxhdr.RxStatus & 0xbf00) {
> + if (rxhdr.RxStatus & 0xbf) {
> GoodPacket = false;
> - if (rxhdr.RxStatus & 0x100) {
> + if (rxhdr.RxStatus & 0x01) {
> PRINTK1("fifo error\n");
> db->stats.rx_fifo_errors++;
> }
> - if (rxhdr.RxStatus & 0x200) {
> + if (rxhdr.RxStatus & 0x02) {
> PRINTK1("crc error\n");
> db->stats.rx_crc_errors++;
> }
> - if (rxhdr.RxStatus & 0x8000) {
> + if (rxhdr.RxStatus & 0x80) {
> PRINTK1("length error\n");
> db->stats.rx_length_errors++;
> }
> --
> 1.5.0
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [DM9000] Add support for big-endian hosts
2007-08-14 18:25 ` Ben Dooks
@ 2007-08-16 8:10 ` Laurent Pinchart
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2007-08-16 8:10 UTC (permalink / raw)
To: Ben Dooks; +Cc: netdev
On Tuesday 14 August 2007 20:25, Ben Dooks wrote:
> On Tue, Aug 14, 2007 at 01:22:32PM +0200, Laurent Pinchart wrote:
> > This patch splits the receive status in 8bit wide fields and convert the
> > packet length from little endian to CPU byte order.
>
> Which version of the the kernel was this against, it applies with
> fuzz to 2.6.23-rc3:
>
> $ patch -p1 < ~/dm9000-fix-endianness.patch
> patching file drivers/net/dm9000.c
> Hunk #1 succeeded at 894 (offset 15 lines).
> Hunk #2 succeeded at 936 (offset 15 lines).
> Hunk #3 succeeded at 948 (offset 15 lines).
That was against 2.6.22. Sorry. I'll post updated patches against 2.6.23-rc3.
Best regards.
--
Laurent Pinchart
CSE Semaphore Belgium
Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium
T +32 (2) 387 42 59
F +32 (2) 387 42 75
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-16 8:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 11:22 [PATCH] [DM9000] Add support for big-endian hosts Laurent Pinchart
2007-08-14 18:25 ` Ben Dooks
2007-08-16 8:10 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).