confused with if_baudrate

YongHyeon PYUN pyunyh at gmail.com
Thu Nov 17 22:03:06 UTC 2011


On Thu, Nov 17, 2011 at 01:39:24PM -0800, Juli Mallett wrote:
> On Thu, Nov 17, 2011 at 13:12, Maksim Yevmenkin
> <maksim.yevmenkin at gmail.com> wrote:
> > hello,
> >
> > i'm a little bit confused about if_baudrate. from system headers
> >
> > #define if_baudrate ?? ?? if_data.ifi_baudrate
> >
> > and
> >
> > u_long ??ifi_baudrate; ?? ?? ?? ?? ?? /* linespeed */
> >
> > so, i'm taking this as if_baudrate really should be an interface line
> > speed in megabits per second. am i correct? if so, then it appears
> > that at least some drivers lie about true line speed. for example from
> > ixgbe(4)
> >
> > ?? ?? ?? ??ifp->if_baudrate = 1000000000;
> >
> > it looks like its order of magnitude lower (i.e. 1 gigabit per second
> > instead of 10 gigabits per second). am i missing something here or its
> > just a typo?
> 
> ixgbe's developer is excessively concerned about overflow on 32-bit
> hosts (and unwilling to correct it under a preprocessor conditional),
> unlike several of the other 10GbE driver developers, although I think
> one 10GbE driver opts to omit if_baudrate entirely.
> 

Probably the driver could have used something like this.
ifp->if_baudrate = IF_Gbps(10UL);

I think the driver should update if_baudrate depending on
resolved speed(lost link, resolved speed etc).
And if we really care about overflowing if_baudrate on 32bit
machines, the IF_Gbps macro could be conditionally defined.

> Thanks,
> Juli.


More information about the freebsd-net mailing list