From owner-freebsd-net@FreeBSD.ORG Thu Nov 17 22:03:06 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53AD0106566B; Thu, 17 Nov 2011 22:03:06 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id C94E68FC17; Thu, 17 Nov 2011 22:03:05 +0000 (UTC) Received: by iakl21 with SMTP id l21so3961779iak.13 for ; Thu, 17 Nov 2011 14:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ibA6mXmq5CV7a5OPve8XEGH+W+cHF3yaInPPh24ep4Y=; b=i8iJ6HK80UGgb7eP2TruEJsaLiPdw5o4xaU1Sb4BduXQWuMcLEcPVwgW0A7r6R128a rOs+LE8dWzToFLh2tdJzPCaagcVaX4iVXdXrQoVwedvdqcD/6eyy9Og4Vx0N08BADZ6t O3uyRRRu8M0wbKqPubhsptHrAxI8R+AsnLNY8= Received: by 10.43.53.1 with SMTP id vo1mr558icb.2.1321567385175; Thu, 17 Nov 2011 14:03:05 -0800 (PST) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id ew6sm34403854igc.4.2011.11.17.14.03.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 14:03:04 -0800 (PST) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Thu, 17 Nov 2011 14:01:04 -0800 From: YongHyeon PYUN Date: Thu, 17 Nov 2011 14:01:04 -0800 To: Juli Mallett Message-ID: <20111117220104.GD11828@michelle.cdnetworks.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-net , Maksim Yevmenkin Subject: Re: confused with if_baudrate X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 22:03:06 -0000 On Thu, Nov 17, 2011 at 01:39:24PM -0800, Juli Mallett wrote: > On Thu, Nov 17, 2011 at 13:12, Maksim Yevmenkin > wrote: > > hello, > > > > i'm a little bit confused about if_baudrate. from system headers > > > > #define if_baudrate ?? ?? if_data.ifi_baudrate > > > > and > > > > u_long ??ifi_baudrate; ?? ?? ?? ?? ?? /* linespeed */ > > > > so, i'm taking this as if_baudrate really should be an interface line > > speed in megabits per second. am i correct? if so, then it appears > > that at least some drivers lie about true line speed. for example from > > ixgbe(4) > > > > ?? ?? ?? ??ifp->if_baudrate = 1000000000; > > > > it looks like its order of magnitude lower (i.e. 1 gigabit per second > > instead of 10 gigabits per second). am i missing something here or its > > just a typo? > > ixgbe's developer is excessively concerned about overflow on 32-bit > hosts (and unwilling to correct it under a preprocessor conditional), > unlike several of the other 10GbE driver developers, although I think > one 10GbE driver opts to omit if_baudrate entirely. > Probably the driver could have used something like this. ifp->if_baudrate = IF_Gbps(10UL); I think the driver should update if_baudrate depending on resolved speed(lost link, resolved speed etc). And if we really care about overflowing if_baudrate on 32bit machines, the IF_Gbps macro could be conditionally defined. > Thanks, > Juli.