From owner-freebsd-current@FreeBSD.ORG Thu Sep 20 15:07:58 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 5ADB7106566B; Thu, 20 Sep 2012 15:07:58 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 20CCA8FC14; Thu, 20 Sep 2012 15:07:57 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so5833902pbb.13 for ; Thu, 20 Sep 2012 08:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FaB2VFE+sKbiY/DpHsSC1Riox1wWqQ+YcTZTTs4MNng=; b=MFW/ITNakyusZfwx8+mVoy9dyQHcw2WvfgN2HUVqxZRuCbBOin6odlbuBHEeF50O6Z QC921FVU9Dd4XgDnQYw4rMDmpTJVlKEBKuAH1B88YUk0siLXnktq4TgOS1V//Zgay8Pz CtDMu0NP+m3vAOumVFt+YwNph4CFMPHOM5FaJgyU5Rh9a1aPMQ5zhaMjIoV9vL3tYMqg TS5pGk2ThvLopFg+D9UFcgHZ2r860MChd0A9heiYKbT8W3/RJoVMXeQS+oxujfE3JrZY S2d/qjo4gylEXh9Rfw4soJ5kx1lUiBPnSGUSSTHVLwRKL76i5q+bFsGDOoB0TlPTQKvd oQ3w== MIME-Version: 1.0 Received: by 10.68.224.71 with SMTP id ra7mr7366867pbc.154.1348153677671; Thu, 20 Sep 2012 08:07:57 -0700 (PDT) Received: by 10.68.240.38 with HTTP; Thu, 20 Sep 2012 08:07:57 -0700 (PDT) In-Reply-To: <20120920083409.GW37286@deviant.kiev.zoral.com.ua> References: <20120920021554.GP85604@FreeBSD.org> <20120920083409.GW37286@deviant.kiev.zoral.com.ua> Date: Thu, 20 Sep 2012 08:07:57 -0700 Message-ID: From: Maksim Yevmenkin To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: Gleb Smirnoff , Scott Long , FreeBSD Current 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 15:07:58 -0000 On Thu, Sep 20, 2012 at 1:34 AM, Konstantin Belousov wrote: > 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> >> 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. > > 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. thanks. so, i take it there is no objections to the proposed hack-ish workaround? i understand that there is a desire to fix thing "the right way", but it involves breaking ABI. at least proposed hack-ish workaround gets us somewhere. if no one objects, then i will put workaround in. thanks, max