Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2]: src/sys/arch/mac68k/dev Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/3892605193db
branches:  netbsd-2
changeset: 564521:3892605193db
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Sep 11 21:26:54 2006 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #10692):
        sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.

diffstat:

 sys/arch/mac68k/dev/if_ae.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r 547c6caf8091 -r 3892605193db sys/arch/mac68k/dev/if_ae.c
--- a/sys/arch/mac68k/dev/if_ae.c       Sun Sep 10 14:55:57 2006 +0000
+++ b/sys/arch/mac68k/dev/if_ae.c       Mon Sep 11 21:26:54 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ae.c,v 1.75 2003/07/15 02:43:16 lukem Exp $ */
+/*     $NetBSD: if_ae.c,v 1.75.6.1 2006/09/11 21:26:54 tron Exp $      */
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.75 2003/07/15 02:43:16 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.75.6.1 2006/09/11 21:26:54 tron Exp $");
 
 #include "bpfilter.h"
 
@@ -34,6 +34,8 @@
 #include <dev/ic/dp8390var.h>
 #include <mac68k/dev/if_aevar.h>
 
+#define ETHER_PAD_LEN  (ETHER_MIN_LEN - ETHER_CRC_LEN)
+
 int
 ae_size_card_memory(bst, bsh, ofs)
        bus_space_tag_t bst;
@@ -172,16 +174,21 @@
                }
        }
 
+       len = ETHER_PAD_LEN - totlen;
        if (wantbyte) {
                savebyte[1] = 0;
                bus_space_write_region_2(sc->sc_buft, sc->sc_bufh,
                    buf, (u_int16_t *)savebyte, 1);
-                   buf += 2;
+               buf += 2;
+               if (len > 0)
+                       totlen++;
+               len--;
        }
-       if (totlen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
+       /* if sent data is shorter than EHTER_PAD_LEN, put 0 to padding */
+       if (len > 0) {
                bus_space_set_region_2(sc->sc_buft, sc->sc_bufh, buf, 0,
-                   (ETHER_MIN_LEN - ETHER_CRC_LEN - totlen) >> 1);
-               totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
+                   len >> 1);
+               totlen = ETHER_PAD_LEN;
        }
        return (totlen);
 }



Home | Main Index | Thread Index | Old Index