From owner-freebsd-current@FreeBSD.ORG Thu Sep 20 08:34:23 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48C3B1065672; Thu, 20 Sep 2012 08:34:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id C667B8FC0C; Thu, 20 Sep 2012 08:34:22 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8K8YQgt038877; Thu, 20 Sep 2012 11:34:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8K8YCtY049805; Thu, 20 Sep 2012 11:34:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8K8YBiR049804; Thu, 20 Sep 2012 11:34:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 20 Sep 2012 11:34:11 +0300 From: Konstantin Belousov To: Gleb Smirnoff Message-ID: <20120920083409.GW37286@deviant.kiev.zoral.com.ua> References: <20120920021554.GP85604@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3KuOF28IUdRLDDb3" Content-Disposition: inline In-Reply-To: <20120920021554.GP85604@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: FreeBSD Current , Scott Long , Maksim Yevmenkin Subject: Re: [RFC] how to get real ifi_baudrate from network interface X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2012 08:34:23 -0000 --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--