[RFC] how to get real ifi_baudrate from network interface

From: Maksim Yevmenkin <maksim.yevmenkin_at_gmail.com>
Date: Wed, 19 Sep 2012 14:16:17 -0700
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
Received on Wed Sep 19 2012 - 19:16:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:30 UTC