Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 2006 18:43:30 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        net@FreeBSD.org
Subject:   testing required: ti(4) NIC
Message-ID:  <20060406144330.GJ84736@bestcom.ru>

next in thread | raw e-mail | index | archive | help

--ZoaI/ZTpAVc4A5k6
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

  Dear colleagues,

  together with Pyun we have prepared a patch, that should make
ti(4) interface announce its link status to upper network
layers. This is important for some network protocols, e.g.
routing daemons and CARP. The patch also fixes driver to
change if_baudrate status when link speed changes. This is important
for correct operation of bsnmpd.

  We need to find a volunteer, who can spend some time and test the
patch. If you can help, please reply. The patch is attached to
this message.

-- 
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE

--ZoaI/ZTpAVc4A5k6
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename="ti.diff"

Index: if_ti.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ti/if_ti.c,v
retrieving revision 1.122
diff -u -r1.122 if_ti.c
--- if_ti.c	3 Jan 2006 06:14:07 -0000	1.122
+++ if_ti.c	6 Apr 2006 14:33:29 -0000
@@ -949,6 +949,7 @@
 	struct ti_softc		*sc;
 {
 	struct ti_event_desc	*e;
+	struct ifnet		*ifp = sc->ti_ifp;
 
 	if (sc->ti_rdata->ti_event_ring == NULL)
 		return;
@@ -958,12 +959,32 @@
 		switch (TI_EVENT_EVENT(e)) {
 		case TI_EV_LINKSTAT_CHANGED:
 			sc->ti_linkstat = TI_EVENT_CODE(e);
-			if (sc->ti_linkstat == TI_EV_CODE_LINK_UP)
-				if_printf(sc->ti_ifp, "10/100 link up\n");
-			else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP)
-				if_printf(sc->ti_ifp, "gigabit link up\n");
-			else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN)
-				if_printf(sc->ti_ifp, "link down\n");
+			switch (sc->ti_linkstat) {
+			case TI_EV_CODE_LINK_UP:
+			case TI_EV_CODE_GIG_LINK_UP:
+			    {
+				struct ifmediareq ifmr;
+
+				if (bootverbose)
+					if_printf(ifp, "%s link up\n",
+					    sc->ti_linkstat ==
+					    TI_EV_CODE_LINK_UP ? "10/100" :
+					    "gigabit");
+				bzero(&ifmr, sizeof(ifmr));
+				ti_ifmedia_sts(ifp, &ifmr);
+				ifp->if_baudrate =
+				    ifmedia_baudrate(ifmr.ifm_active);
+				if_link_state_change(ifp, LINK_STATE_UP);
+				break;
+			    }
+			case TI_EV_CODE_LINK_DOWN:
+				ifp->if_baudrate = 0;
+				if_link_state_change(ifp, LINK_STATE_DOWN);
+				break;
+			default:
+				if_printf(ifp, "unknown link state code %d\n",
+				    sc->ti_linkstat);
+			}
 			break;
 		case TI_EV_ERROR:
 			if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD)

--ZoaI/ZTpAVc4A5k6--



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