From owner-freebsd-current@FreeBSD.ORG Thu Sep 20 02:15:56 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F0887106564A; Thu, 20 Sep 2012 02:15:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 6908F8FC15; Thu, 20 Sep 2012 02:15:55 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q8K2Fs4q044041; Thu, 20 Sep 2012 06:15:54 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q8K2FsoC044040; Thu, 20 Sep 2012 06:15:54 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 20 Sep 2012 06:15:54 +0400 From: Gleb Smirnoff To: Maksim Yevmenkin Message-ID: <20120920021554.GP85604@FreeBSD.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD Current , Scott Long 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 02:15:56 -0000 On Wed, Sep 19, 2012 at 02:16:17PM -0700, Maksim Yevmenkin wrote: M> hello, M> 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> M> quick summary of the problem: M> 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> 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> M> proposal M> 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> M> real_ifi_baudrate = ifi_baudrate * 10 ** ifi_spare_char1 M> 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> M> any objections? IMO, this is way to go for stable branches. In head it'll be better just have uint64_t without any crutches. -- Totus tuus, Glebius.