Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2012 14:16:17 -0700
From:      Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Cc:        Scott Long <scottl@freebsd.org>
Subject:   [RFC] how to get real ifi_baudrate from network interface
Message-ID:  <CAFPOs6oCot3Bt8S9KUoC-cELw5reP5jmwWnwxS21h=Zq3Q0d-A@mail.gmail.com>

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

for sometime now i've been repeatedly annoyed by the fact that 10G
interfaces lie about their ifi_baudrate. i would like to propose
simple (hopefuly) change to address this.

quick summary of the problem:

struct if_data {
...
        u_char  ifi_spare_char1;        /* spare byte */
        u_char  ifi_spare_char2;        /* spare byte */
...
        u_long  ifi_baudrate;           /* linespeed */
...
};

as you can see ifi_baudrate is an u_long which is an arch specific
type. on 32-bit arch it does not have enough bits to hold 10G line
speed value (in bits per second)

proposal

we reuse one of the ifi_spare_char1 or ifi_spare_char2 bytes and
re-purpose it as power factor to be applied to ifi_baudrate, i.e.

real_ifi_baudrate = ifi_baudrate * 10 ** ifi_spare_char1

obviously, 10G nic drivers will have to set ifi_spare_char1 to
appropriate value, but it should not be a big deal. also, legacy tools
that do not know about ifi_spare_char1 would continue to report
"wrong" ifi_baudrate as they used to.

any objections?

thanks,
max



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFPOs6oCot3Bt8S9KUoC-cELw5reP5jmwWnwxS21h=Zq3Q0d-A>