From pm@zin.lublin.pl  Fri Aug 29 16:53:46 2003
Return-Path: <pm@zin.lublin.pl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 02E8316A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Aug 2003 16:53:46 -0700 (PDT)
Received: from shellma.zin.lublin.pl (shellma.zin.lublin.pl [212.182.126.68])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E906B43FDD
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Aug 2003 16:53:44 -0700 (PDT)
	(envelope-from pm@zin.lublin.pl)
Received: by shellma.zin.lublin.pl (Postfix, from userid 1018)
	id C71045F103; Sat, 30 Aug 2003 02:01:46 +0200 (CEST)
Message-Id: <20030830000146.C71045F103@shellma.zin.lublin.pl>
Date: Sat, 30 Aug 2003 02:01:46 +0200 (CEST)
From: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
Reply-To: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: if_baudrate is not correct for rl, xl, dc and some other network interfaces
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         56165
>Category:       kern
>Synopsis:       if_baudrate is not correct for rl, xl, dc and some other network interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 29 17:00:28 PDT 2003
>Closed-Date:    Mon Apr 03 11:13:09 GMT 2006
>Last-Modified:  Mon Apr 03 11:13:09 GMT 2006
>Originator:     Pawe Maachowski
>Release:        FreeBSD 4.7-RELEASE-p13 i386
>Organization:
ZiN
>Environment:
FreeBSD 4.9-PRERELASE

	
>Description:
if_baudrate is set to 10000000 (10M) for some 100Mbit network interfaces.

This inconsistency will for example result in not valid ifSpeed value in
snmpd, causing not valid MaxBytes and malformed MRTG graphs:

# snmpwalk -c zzz xxx interfaces.ifTable.ifEntry.ifDescr.3
interfaces.ifTable.ifEntry.ifDescr.3 = xl0
# snmpwalk -c zzz xxx interfaces.ifTable.ifEntry.ifSpeed.3
interfaces.ifTable.ifEntry.ifSpeed.3 = Gauge32: 10000000
# ifconfig xl0 | grep media
        media: Ethernet autoselect (100baseTX <full-duplex>)

This problem was previously noted by me at freebsd-questions:
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=2401273+0+archive/2002/freebsd-questions/20021117.freebsd-questions

It looks that, for example, latest rl(4) supporting 1GigE NICs still
sets 10M baudrate for them.

I can see this with my rl, dc and xl network devices, seems others
(like sis, ste, vr, wb) are affected, too.
	
>How-To-Repeat:
cd /usr/src/sys/pci && grep -H 'baudrate =' *.c | awk '{printf "%s\t%s\n", $1,$4}'
cd /usr/src/sys/dev && grep -HR 'baudrate = ' * | awk '{printf "%s\t%s\n", $1,$4}'

	
>Fix:
Set if_baudrate=10M for 10Mbit devices, 100M for 100Mbit devices and 1000M
for 1GigE devices.
Take a look at /usr/src/sys/dev/my/if_my.c to see, how this could be done. ;)

Workaround for snmpd purposes:
override interfaces.ifTable.ifEntry.ifSpeed.3 gauge "100000000"

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bms 
Responsible-Changed-By: bms 
Responsible-Changed-When: Mon Jul 5 22:53:30 GMT 2004 
Responsible-Changed-Why:  
I'll take this. 

This is harder than it sounds on the face of it because miibus 
autonegotiation can change the effective baud rate and this would 
have to be handled elsewhere... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56165 

From: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To: Bruce M Simpson <bms@freebsd.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/56165: if_baudrate is not correct for rl, xl, dc and some other network interfaces
Date: Tue, 6 Jul 2004 12:34:16 +0200

 On Mon, Jul 05, 2004 at 10:54:20PM +0000, Bruce M Simpson wrote:
 
 Hello,
 
 > This is harder than it sounds on the face of it because miibus
 > autonegotiation can change the effective baud rate and this would
 > have to be handled elsewhere...
 
 There may be some software outside that relies on gauge value,
 the best and the safest method is to report maximum rate which
 particular interface is capable to deal with, IMHO.
 Changing gauge value to currently autonegotiated speed gives
 nothing special (I guess), but may break things outside.
 
 
 -- 
 Pawe Maachowski
State-Changed-From-To: open->closed 
State-Changed-By: glebius 
State-Changed-When: Mon Apr 3 11:10:56 UTC 2006 
State-Changed-Why:  
This problem has vanished after import of ifmedia_baudrate() from NetBSD. 


Responsible-Changed-From-To: bms->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon Apr 3 11:10:56 UTC 2006 
Responsible-Changed-Why:  
I've fixed this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56165 
>Unformatted:
