From owner-freebsd-net@FreeBSD.ORG Thu Apr 6 14:43:40 2006 Return-Path: X-Original-To: net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E853516A426 for ; Thu, 6 Apr 2006 14:43:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDE4D43D76 for ; Thu, 6 Apr 2006 14:43:36 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.4/8.13.3) with ESMTP id k36EhUwc001552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 6 Apr 2006 18:43:31 +0400 (MSD) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.4/8.13.1/Submit) id k36EhUVF001551 for net@FreeBSD.org; Thu, 6 Apr 2006 18:43:30 +0400 (MSD) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 6 Apr 2006 18:43:30 +0400 From: Gleb Smirnoff To: net@FreeBSD.org Message-ID: <20060406144330.GJ84736@bestcom.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZoaI/ZTpAVc4A5k6" Content-Disposition: inline User-Agent: Mutt/1.5.6i Cc: Subject: testing required: ti(4) NIC X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 14:43:41 -0000 --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--