Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sun2/dev Sometimes the ec board reports a packet le...



details:   https://anonhg.NetBSD.org/src/rev/e4caa09646c4
branches:  trunk
changeset: 513922:e4caa09646c4
user:      fredette <fredette%NetBSD.org@localhost>
date:      Fri Aug 17 20:27:12 2001 +0000

description:
Sometimes the ec board reports a packet length that's too large.
Try to deal with this by clipping the packet length, and, under
DEBUG, printf when we do.  Also zero out the packet status in
the buffer before we give it back to the board.

diffstat:

 sys/arch/sun2/dev/if_ec.c    |  13 ++++++++++++-
 sys/arch/sun2/dev/if_ecreg.h |   4 ++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 07d135d376ad -r e4caa09646c4 sys/arch/sun2/dev/if_ec.c
--- a/sys/arch/sun2/dev/if_ec.c Fri Aug 17 19:56:51 2001 +0000
+++ b/sys/arch/sun2/dev/if_ec.c Fri Aug 17 20:27:12 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ec.c,v 1.1 2001/06/27 17:24:35 fredette Exp $       */
+/*     $NetBSD: if_ec.c,v 1.2 2001/08/17 20:27:12 fredette Exp $       */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -494,6 +494,15 @@
                total_length = doff - EC_PKT_RDOFF;
                buf += EC_PKT_RDOFF;
 
+               /* XXX - sometimes the card reports a large data offset. */
+               if (total_length > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
+#ifdef DEBUG
+                       printf("%s: fixing too-large length of %d\n",
+                           sc->sc_dev.dv_xname, total_length);
+#endif
+                       total_length = (ETHER_MAX_LEN - ETHER_CRC_LEN);
+               }
+
                MGETHDR(m0, M_DONTWAIT, MT_DATA);
                if (m0 == 0)
                        break;
@@ -548,6 +557,8 @@
        }
 
        /* Give the receive buffer back to the card. */
+       buf = EC_CSR_INT_BUF(intbit);
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh, buf, 0);
        ECREG_CSR_WR((ECREG_CSR_RD & EC_CSR_INTPA) | EC_CSR_INT_BSW(intbit) | intbit);
 }
 
diff -r 07d135d376ad -r e4caa09646c4 sys/arch/sun2/dev/if_ecreg.h
--- a/sys/arch/sun2/dev/if_ecreg.h      Fri Aug 17 19:56:51 2001 +0000
+++ b/sys/arch/sun2/dev/if_ecreg.h      Fri Aug 17 20:27:12 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ecreg.h,v 1.2 2001/08/14 03:57:16 fredette Exp $    */
+/*     $NetBSD: if_ecreg.h,v 1.3 2001/08/17 20:27:12 fredette Exp $    */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -112,4 +112,4 @@
 #define        EC_PKT_MAXTDOFF (EC_BUF_SZ - (ETHER_MIN_LEN - ETHER_CRC_LEN))   /* max xmit doff (min size) */
 #define        EC_PKT_RDOFF    2                       /* packet offset in buffer */
 #define        EC_PKT_MINRDOFF (EC_PKT_RDOFF + (ETHER_MIN_LEN - ETHER_CRC_LEN))        /* min packet doff (min size) */
-#define        EC_PKT_MAXRDOFF (EC_PKT_RDOFF + (ETHER_MAX_LEN - ETHER_CRC_LEN))        /* max packet doff (max size) */
+#define        EC_PKT_MAXRDOFF (EC_BUF_SZ - EC_PKT_RDOFF)      /* max packet doff (max size) */



Home | Main Index | Thread Index | Old Index