From owner-freebsd-current@FreeBSD.ORG Wed Sep 19 21:16:18 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 C32C610656A3; Wed, 19 Sep 2012 21:16:18 +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 9514A8FC18; Wed, 19 Sep 2012 21:16:18 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so3837882pbb.13 for ; Wed, 19 Sep 2012 14:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=vS7oOq7zErV2l4rpEWnlsVwd/dBpwNRy0Fbp2FOcb+I=; b=E6w0VESdyrbe1W/B2FZIL/m2piyvrg4HnGJ6BS2GgMLzPNki2/W8yVZH03jHYSaLis EVFJn6r15mCyOP4N6agaZAIp/Kyz3oducmVFa3EtNBxSD2094WcGDNiM7lsqIjPBJIsq Sbea37LA2WxEZ/eSUznX26KBpHog7GJtK3+1Wia83SvGOsPnN4W9dwmz0IE0oXZ7dWhA 70Dg15Yg2J+djBkB6LeJATasRO1emQ0/lmK5dgifyliPUfSC3nbWoNZolUMwsyHNk46J 24j7sKwoe0Vp4noQpMH2w1n5WwbEMGgSVPRf+PHgR1bDwVp4bwUXPLH0yktMQNb/cJyy Ujzg== MIME-Version: 1.0 Received: by 10.66.85.70 with SMTP id f6mr465954paz.7.1348089378071; Wed, 19 Sep 2012 14:16:18 -0700 (PDT) Received: by 10.68.240.38 with HTTP; Wed, 19 Sep 2012 14:16:17 -0700 (PDT) Date: Wed, 19 Sep 2012 14:16:17 -0700 Message-ID: From: Maksim Yevmenkin To: FreeBSD Current Content-Type: text/plain; charset=ISO-8859-1 Cc: Scott Long Subject: [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: Wed, 19 Sep 2012 21:16:18 -0000 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