Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Apr 2002 16:19:23 -0400
From:      Andrew Heybey <ath@niksun.com>
To:        freebsd-stable@freebsd.org, re@freebsd.org
Cc:        paul@freebsd.org
Subject:   Can this le NIC bug fix go in before 4.6?
Message-ID:  <200204302019.g3UKJNu35486@stiegl.mj.niksun.com>

next in thread | raw e-mail | index | archive | help
I sent the following to freebsd-stable a while ago; could it please go
into 4.6?  It has been tested (according to feedback in PR 18641) by
at least two people besides me.  Sorry if this is an inappropriate
mail to send to re@freebsd, but I am not sure who to send this to...

When you ifconfig an "le" NIC card with an address, it makes
4.5-RELEASE crash.  This problem is discussed in PRs 25650 and PR
18641, though PR 25650 is marked as "closed: fixed".

Presumably, it would also panic a -CURRENT kernel though I do not
currently run CURRENT.

I have fixed the problem (at least it works for me) using the included
patch (against RELENG_4_5_0_RELEASE src/sys/i386/isa/if_le.c).  I
followed-up PR 18641 with the patch, and PR 25650 with a pointer to
18641.

I know this hardware is ancient, but there is no particular reason to
have it not work.  I have tested the patch with:

le0 at port 0x300-0x31f iomem 0xd0000-0xd07ff irq 5 on isa0
le0: DE205-AC ethernet address 08:00:2b:9f:39:d4

Index: if_le.c
===================================================================
RCS file: /usr/local/repos/fbsdcvs/src/sys/i386/isa/if_le.c,v
retrieving revision 1.56.2.3
diff -u -u -r1.56.2.3 if_le.c
--- if_le.c	2001/11/02 17:48:00	1.56.2.3
+++ if_le.c	2002/03/26 15:29:44
@@ -191,7 +191,6 @@
  */
 struct le_softc {
     struct arpcom le_ac;		/* Common Ethernet/ARP Structure */
-    void (*if_init) __P((le_softc_t *));/* Interface init routine */
     void (*if_reset) __P((le_softc_t *));/* Interface reset routine */
     caddr_t le_membase;			/* Starting memory address (virtual) */
     unsigned le_iobase;			/* Starting I/O base address */
@@ -336,19 +335,23 @@
     struct ifnet *ifp = &sc->le_if;
 
     dvp->id_ointr = le_intr;
-    ifp->if_softc = sc;
-    ifp->if_mtu = ETHERMTU;
+
     printf("%s%d: %s ethernet address %6D\n",
 	   ifp->if_name, ifp->if_unit,
 	   sc->le_prodname,
 	   sc->le_ac.ac_enaddr, ":");
 
+    ifp->if_softc = sc;
+    ifp->if_mtu = ETHERMTU;
     ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+    ifp->if_timer = 0;
     ifp->if_output = ether_output;
     ifp->if_ioctl = le_ioctl;
+    ifp->if_watchdog = 0;
     ifp->if_type = IFT_ETHER;
-    ifp->if_addrlen = 6;
-    ifp->if_hdrlen = 14;
+    ifp->if_addrlen = ETHER_ADDR_LEN;
+    ifp->if_hdrlen = ETHER_HDR_LEN;
+    ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 
     ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
 
@@ -446,7 +449,7 @@
                 break;
 
 	case SIOCSIFFLAGS: {
-	    sc->if_init(sc);
+	    sc->le_if.if_init(sc);
 	    break;
 	}
 
@@ -455,7 +458,7 @@
 	    /*
 	     * Update multicast listeners
 	     */
-		sc->if_init(sc);
+		sc->le_if.if_init(sc);
 		error = 0;
 		break;
 
@@ -613,7 +616,7 @@
 #define LEMAC_32K_MODE(mbase)	(((mbase) >= 0x14) && ((mbase) <= 0x1F))
 #define LEMAC_2K_MODE(mbase)	( (mbase) >= 0x40)
 
-static void lemac_init(le_softc_t *sc);
+static void lemac_init(void *xsc);
 static void lemac_start(struct ifnet *ifp);
 static void lemac_reset(le_softc_t *sc);
 static void lemac_intr(le_softc_t *sc);
@@ -688,7 +691,7 @@
     /*
      * Try to reset the unit
      */
-    sc->if_init = lemac_init;
+    sc->le_if.if_init = lemac_init;
     sc->le_if.if_start = lemac_start;
     sc->if_reset = lemac_reset;
     sc->lemac_memmode = 2;
@@ -778,8 +781,9 @@
 
 static void
 lemac_init(
-    le_softc_t *sc)
+    void  *xsc)
 {
+    le_softc_t *sc = (le_softc_t *)xsc;
     int s;
 
     if ((sc->le_flags & IFF_UP) == 0)
@@ -1138,7 +1142,7 @@
 static int  lance_init_ring(le_softc_t *sc, ln_ring_t *rp, lance_ring_t *ri,
 			    unsigned ndescs, unsigned bufoffset,
 			    unsigned descoffset);
-static void lance_init(le_softc_t *sc);
+static void lance_init(void *xsc);
 static void lance_reset(le_softc_t *sc);
 static void lance_intr(le_softc_t *sc);
 static int  lance_rx_intr(le_softc_t *sc);
@@ -1360,7 +1364,7 @@
 	return 0;
 
     sc->if_reset = lance_reset;
-    sc->if_init = lance_init;
+    sc->le_if.if_init = lance_init;
     sc->le_if.if_start = lance_start;
     DEPCA_WRNICSR(sc, DEPCA_NICSR_SHE | DEPCA_NICSR_ENABINTR);
     sc->if_reset(sc);
@@ -1580,8 +1584,9 @@
 
 static void
 lance_init(
-    le_softc_t *sc)
+    void *xsc)
 {
+    le_softc_t *sc = (le_softc_t *)xsc;
     lance_ring_t *ri;
     lance_descinfo_t *di;
     ln_desc_t desc;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204302019.g3UKJNu35486>