Subject: smc91cxx send routine
To: None <tech-kern@netbsd.org>
From: Antti Kantee <pooka@cs.hut.fi>
List: tech-kern
Date: 06/05/2005 22:45:34
Currently the smc91cxx driver writes the 16bit packet length to the chip
in two 8bit pieces.  On an arm evb I've been playing with, this results
in the chip thinking that it's getting two 16bit writes, hence the latter
part of the packet length is stuffed on the wire.  Not surprisingly this
breaks all kinds of networking protocols ...

This fixes the problem for me:

Index: smc91cxx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/smc91cxx.c,v
retrieving revision 1.51
diff -p -u -r1.51 smc91cxx.c
--- smc91cxx.c  27 Feb 2005 00:27:02 -0000      1.51
+++ smc91cxx.c  5 Jun 2005 19:38:45 -0000
@@ -737,8 +737,7 @@ smc91cxx_start(ifp)
         * and the status word (set to zeros).
         */
        bus_space_write_2(bst, bsh, DATA_REG_W, 0);
-       bus_space_write_1(bst, bsh, DATA_REG_B, (length + 6) & 0xff);
-       bus_space_write_1(bst, bsh, DATA_REG_B, ((length + 6) >> 8) & 0xff);
+       bus_space_write_2(bst, bsh, DATA_REG_W, length + 6);
 
        /*
         * Get the packet from the kernel.  This will include the Ethernet

Is that patch ok to commit, or was there a reason for doing two writes
in the first place?

-- 
Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
                        "The dish washer returns!"