Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 00:24:44 +0100
From:      Marko Zec <zec@tel.fer.hr>
To:        "jlemon@freebsd.org" <jlemon@freebsd.org>
Cc:        Jun Kuriyama <kuriyama@imgsrc.co.jp>, freebsd-stable@freebsd.org
Subject:   Re: if_fxp.c typo?
Message-ID:  <3C4CA33C.BAD0F33B@tel.fer.hr>
References:  <86y9kzqjlr.wl@keiichi01.osaka.iij.ad.jp> <7mn10ebxbp.wl@waterblue.imgsrc.co.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------654D904BCA9115C5478D5450
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hope this patch properly resolves the problem of unwanted resets of mcast
filters. However, when unloading the microcode, it is unavoidable to  clear
the mcast filters, without making the code really complicated. This should
be probably stated in man-page as a kind of disclaimer...
Also, by this diff I suggest imposing a little bit more sane range limits
for int_delay and bundle_max.

Marko

Jun Kuriyama wrote:

> I noticed this fixes my problem, but I don't know this patch is
> logically correct or not.
>
> I think we should commit this before 4.5-RELEASE if this is correct
> way.  Can someone comment this?
>
> At Thu, 22 Nov 2001 08:47:09 +0000 (UTC),
> Keiichi SHIMA / 島慶一 wrote:
> > fxp_stop() of the latest fxp driver do SOFTWARE_RESET when called.
> > Shouldn't this be SELECTIVE_RESET?
> >
> > As I'm not familiar with fxp, would someone check and commit it to the
> > repositry?  The current code clears all the hardware mc filters
> > already set, as a result, the box can't receive any multicast packets
> > (this is a serious problem especially when using ipv6).
> ...
> > --- orig/if_fxp.c     Thu Nov  8 18:30:10 2001
> > +++ if_fxp.c  Thu Nov 22 17:22:38 2001
> > @@ -1429,7 +1429,7 @@
> >        * Issue software reset, which also unloads the microcode.
> >        */
> >       sc->flags &= ~FXP_FLAG_UCODE;
> > -     CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
> > +     CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);
> >       DELAY(50);
> >
> >       /*
>
> --
> Jun Kuriyama <kuriyama@imgsrc.co.jp> // IMG SRC, Inc.
>              <kuriyama@FreeBSD.org> // FreeBSD Project
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message

--------------654D904BCA9115C5478D5450
Content-Type: text/plain; charset=us-ascii;
 name="fxp-diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fxp-diff"

--- if_fxp.c.orig	Wed Jan  9 18:17:12 2002
+++ if_fxp.c	Tue Jan 22 00:11:02 2002
@@ -1411,10 +1411,9 @@ fxp_stop(struct fxp_softc *sc)
 	untimeout(fxp_tick, sc, sc->stat_ch);
 
 	/*
-	 * Issue software reset, which also unloads the microcode.
+	 * Issue a selective reset (a full reset would clear mcast filters!)
 	 */
-	sc->flags &= ~FXP_FLAG_UCODE;
-	CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
+	CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);
 	DELAY(50);
 
 	/*
@@ -1484,6 +1483,16 @@ fxp_init(void *xsc)
 	 */
 	fxp_stop(sc);
 
+	/*
+	 * If requested to unload microcode, we just do a full reset.
+	 */
+	if (~ifp->if_flags & IFF_LINK0 && sc->flags & FXP_FLAG_UCODE) {
+		sc->flags &= ~FXP_FLAG_UCODE;
+		CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
+		DELAY(50);
+		device_printf(sc->dev, "Microcode unloaded\n");
+		}
+
 	prm = (ifp->if_flags & IFF_PROMISC) ? 1 : 0;
 
 	/*
@@ -2185,11 +2194,11 @@ sysctl_int_range(SYSCTL_HANDLER_ARGS, in
 static int
 sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS)
 {
-	return (sysctl_int_range(oidp, arg1, arg2, req, 300, 3000));
+	return (sysctl_int_range(oidp, arg1, arg2, req, 100, 1000));
 }
 
 static int
 sysctl_hw_fxp_bundle_max(SYSCTL_HANDLER_ARGS)
 {
-	return (sysctl_int_range(oidp, arg1, arg2, req, 1, 0xffff));
+	return (sysctl_int_range(oidp, arg1, arg2, req, 1, FXP_NRFABUFS>>1));
 }



--------------654D904BCA9115C5478D5450--


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?3C4CA33C.BAD0F33B>