Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 11:34:11 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, Scott Long <scottl@freebsd.org>, Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Subject:   Re: [RFC] how to get real ifi_baudrate from network interface
Message-ID:  <20120920083409.GW37286@deviant.kiev.zoral.com.ua>
In-Reply-To: <20120920021554.GP85604@FreeBSD.org>
References:  <CAFPOs6oCot3Bt8S9KUoC-cELw5reP5jmwWnwxS21h=Zq3Q0d-A@mail.gmail.com> <20120920021554.GP85604@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--3KuOF28IUdRLDDb3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 20, 2012 at 06:15:54AM +0400, Gleb Smirnoff wrote:
> On Wed, Sep 19, 2012 at 02:16:17PM -0700, Maksim Yevmenkin wrote:
> M> hello,
> M>=20
> M> for sometime now i've been repeatedly annoyed by the fact that 10G
> M> interfaces lie about their ifi_baudrate. i would like to propose
> M> simple (hopefuly) change to address this.
> M>=20
> M> quick summary of the problem:
> M>=20
> M> struct if_data {
> M> ...
> M>         u_char  ifi_spare_char1;        /* spare byte */
> M>         u_char  ifi_spare_char2;        /* spare byte */
> M> ...
> M>         u_long  ifi_baudrate;           /* linespeed */
> M> ...
> M> };
> M>=20
> M> as you can see ifi_baudrate is an u_long which is an arch specific
> M> type. on 32-bit arch it does not have enough bits to hold 10G line
> M> speed value (in bits per second)
> M>=20
> M> proposal
> M>=20
> M> we reuse one of the ifi_spare_char1 or ifi_spare_char2 bytes and
> M> re-purpose it as power factor to be applied to ifi_baudrate, i.e.
> M>=20
> M> real_ifi_baudrate =3D ifi_baudrate * 10 ** ifi_spare_char1
> M>=20
> M> obviously, 10G nic drivers will have to set ifi_spare_char1 to
> M> appropriate value, but it should not be a big deal. also, legacy tools
> M> that do not know about ifi_spare_char1 would continue to report
> M> "wrong" ifi_baudrate as they used to.
> M>=20
> M> any objections?
>=20
> IMO, this is way to go for stable branches. In head it'll be better just
> have uint64_t without any crutches.

You cannot do this in head either. It would break the libc exported ABI,
at least for getifaddrs(3). At least, the compat shims need to be provided,
but I suppose that breakage is much deeper.

--3KuOF28IUdRLDDb3
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAlBa1QEACgkQC3+MBN1Mb4jSFgCgmGwYA3aHbNsUhCWReZmLVkya
+yAAoJtXtR77w2XBw1WnvUGjqLAyxF/H
=B2gH
-----END PGP SIGNATURE-----

--3KuOF28IUdRLDDb3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120920083409.GW37286>