Date: Tue, 14 Feb 2006 13:27:08 +0100 From: Anders Nordby <anders@FreeBSD.org> To: Gleb Smirnoff <glebius@FreeBSD.org>, Oleg Polyakov <opolyakov@yahoo.com>, Harti Brandt <harti@FreeBSD.org>, freebsd-net@FreeBSD.org, kuriyama@FreeBSD.org, demon@FreeBSD.org Subject: Re: 64-bit SNMP counters for FreeBSD && graphing bandwidth usage Message-ID: <20060214122708.GA51048@totem.fix.no> In-Reply-To: <20060214110217.GD68308@cell.sick.ru> References: <20060214092456.97708.qmail@web35309.mail.mud.yahoo.com> <20060214102023.97798.qmail@web35305.mail.mud.yahoo.com> <20060214110217.GD68308@cell.sick.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Done. On system with bge and 100 mbps link speed, I get: IF-MIB::ifName.1 = STRING: bge0 IF-MIB::ifName.2 = STRING: bge1 IF-MIB::ifName.3 = STRING: lo0 IF-MIB::ifHighSpeed.1 = Gauge32: 100 IF-MIB::ifHighSpeed.2 = Gauge32: 0 IF-MIB::ifHighSpeed.3 = Gauge32: 0 On system with bge and gigabit link speed, I get: IF-MIB::ifName.1 = STRING: bge0 IF-MIB::ifName.2 = STRING: bge1 IF-MIB::ifName.3 = STRING: lo0 IF-MIB::ifHighSpeed.1 = Gauge32: 1000 IF-MIB::ifHighSpeed.2 = Gauge32: 0 IF-MIB::ifHighSpeed.3 = Gauge32: 0 The second NIC, bge1, is not configured. Seems fine to me. I still get ifHCInOctets/ifHCOutOctets for both systems mentioned. On Tue, Feb 14, 2006 at 02:02:17PM +0300, Gleb Smirnoff wrote: > Oleg, Anders, > > can you please remove all your changes to if_bge.c and test the > attached patch. Awaiting for feedback and thanks. > > -- > Totus tuus, Glebius. > GLEBIUS-RIPN GLEB-RIPE > Index: net/if_media.c > =================================================================== > RCS file: /home/ncvs/src/sys/net/if_media.c,v > retrieving revision 1.22 > diff -u -r1.22 if_media.c > --- net/if_media.c 25 Dec 2005 23:28:23 -0000 1.22 > +++ net/if_media.c 14 Feb 2006 09:51:09 -0000 > @@ -385,6 +385,28 @@ > return match; > } > > +/* > + * Compute the interface `baudrate' from the media, for the interface > + * metrics (used by routing daemons). > + */ > +static const struct ifmedia_baudrate ifmedia_baudrate_descriptions[] = > + IFM_BAUDRATE_DESCRIPTIONS; > + > +uint64_t > +ifmedia_baudrate(int mword) > +{ > + int i; > + > + for (i = 0; ifmedia_baudrate_descriptions[i].ifmb_word != 0; i++) { > + if ((mword & (IFM_NMASK|IFM_TMASK)) == > + ifmedia_baudrate_descriptions[i].ifmb_word) > + return (ifmedia_baudrate_descriptions[i].ifmb_baudrate); > + } > + > + /* Not known. */ > + return (0); > +} > + > #ifdef IFMEDIA_DEBUG > struct ifmedia_description ifm_type_descriptions[] = > IFM_TYPE_DESCRIPTIONS; > Index: net/if_media.h > =================================================================== > RCS file: /home/ncvs/src/sys/net/if_media.h,v > retrieving revision 1.30 > diff -u -r1.30 if_media.h > --- net/if_media.h 22 Feb 2005 13:04:03 -0000 1.30 > +++ net/if_media.h 14 Feb 2006 10:29:59 -0000 > @@ -104,6 +104,9 @@ > int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, > struct ifmedia *ifm, u_long cmd); > > +/* Compute baudrate for a given media. */ > +uint64_t ifmedia_baudrate(int); > + > #endif /*_KERNEL */ > > /* > @@ -138,8 +141,8 @@ > #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ > #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ > #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ > -#define IFM_10GBASE_SR 18 /* 10GBASE-SR 850nm Multi-mode Fiber */ > -#define IFM_10GBASE_LR 19 /* 10GBASE-LR 1310nm Single-mode Fiber */ > +#define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ > +#define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ > > /* note 31 is the max! */ > > @@ -543,4 +546,59 @@ > { 0, NULL }, \ > } > > +/* > + * Baudrate descriptions for the various media types. > + */ > +struct ifmedia_baudrate { > + int ifmb_word; /* media word */ > + uint64_t ifmb_baudrate; /* corresponding baudrate */ > +}; > + > +#define IFM_BAUDRATE_DESCRIPTIONS { \ > + { IFM_ETHER | IFM_10_T, IF_Mbps(10) }, \ > + { IFM_ETHER | IFM_10_2, IF_Mbps(10) }, \ > + { IFM_ETHER | IFM_10_5, IF_Mbps(10) }, \ > + { IFM_ETHER | IFM_100_TX, IF_Mbps(100) }, \ > + { IFM_ETHER | IFM_100_FX, IF_Mbps(100) }, \ > + { IFM_ETHER | IFM_100_T4, IF_Mbps(100) }, \ > + { IFM_ETHER | IFM_100_VG, IF_Mbps(100) }, \ > + { IFM_ETHER | IFM_100_T2, IF_Mbps(100) }, \ > + { IFM_ETHER | IFM_1000_SX, IF_Mbps(1000) }, \ > + { IFM_ETHER | IFM_10_STP, IF_Mbps(10) }, \ > + { IFM_ETHER | IFM_10_FL, IF_Mbps(10) }, \ > + { IFM_ETHER | IFM_1000_LX, IF_Mbps(1000) }, \ > + { IFM_ETHER | IFM_1000_CX, IF_Mbps(1000) }, \ > + { IFM_ETHER | IFM_1000_T, IF_Mbps(1000) }, \ > + { IFM_ETHER | IFM_HPNA_1, IF_Mbps(1) }, \ > + { IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \ > + \ > + { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ > + { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ > + { IFM_TOKEN | IFM_TOK_UTP4, IF_Mbps(4) }, \ > + { IFM_TOKEN | IFM_TOK_UTP16, IF_Mbps(16) }, \ > + \ > + { IFM_FDDI | IFM_FDDI_SMF, IF_Mbps(100) }, \ > + { IFM_FDDI | IFM_FDDI_MMF, IF_Mbps(100) }, \ > + { IFM_FDDI | IFM_FDDI_UTP, IF_Mbps(100) }, \ > + \ > + { IFM_IEEE80211 | IFM_IEEE80211_FH1, IF_Mbps(1) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_FH2, IF_Mbps(2) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_DS2, IF_Mbps(2) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_DS5, IF_Kbps(5500) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_DS11, IF_Mbps(11) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_DS1, IF_Mbps(1) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_DS22, IF_Mbps(22) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM6, IF_Mbps(6) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM9, IF_Mbps(9) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM12, IF_Mbps(12) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM18, IF_Mbps(18) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM24, IF_Mbps(24) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM36, IF_Mbps(36) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM48, IF_Mbps(48) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM54, IF_Mbps(54) }, \ > + { IFM_IEEE80211 | IFM_IEEE80211_OFDM72, IF_Mbps(72) }, \ > + \ > + { 0, 0 }, \ > +} > + > #endif /* _NET_IF_MEDIA_H_ */ > Index: dev/mii/mii.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/mii/mii.c,v > retrieving revision 1.26 > diff -u -r1.26 mii.c > --- dev/mii/mii.c 11 Jun 2005 00:20:38 -0000 1.26 > +++ dev/mii/mii.c 14 Feb 2006 10:24:21 -0000 > @@ -240,9 +240,20 @@ > miibus_statchg(device_t dev) > { > device_t parent; > + struct mii_data *mii; > + struct ifnet *ifp; > > parent = device_get_parent(dev); > MIIBUS_STATCHG(parent); > + > + mii = device_get_softc(dev); > + > + /* > + * Note that each NIC's softc must start with an ifnet pointer. > + * XXX: EVIL HACK! > + */ > + ifp = *(struct ifnet **)device_get_softc(parent); > + ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active); > return; > } > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" -- Anders.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060214122708.GA51048>