From owner-freebsd-net@FreeBSD.ORG Thu Oct 13 20:49:37 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 1BCF8106566C for ; Thu, 13 Oct 2011 20:49:37 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9EBC98FC08 for ; Thu, 13 Oct 2011 20:49:36 +0000 (UTC) Received: by wyj26 with SMTP id 26so3302420wyj.13 for ; Thu, 13 Oct 2011 13:49:35 -0700 (PDT) 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=yB5b+1S6mAUBWQUDpIUeBiokNcyoW7IJrYNDomWxQM4=; b=wQxzML7Cru/HpbG54zXJJRsaHv4ga6h1ywBOKn21/hHLlkrmmF2lRLO/N/MMp9kLi/ i0yZ2gsjgRopjVvsfA0YycQkKjS+sYrnmCBnDVd88glqF8+23PpLb3C/mQYByy0V25r/ hHyaXHnEcR6Z+5Od2xIzVs1MvFucVUPrXPDg8= Received: by 10.216.135.145 with SMTP id u17mr449218wei.85.1318538975342; Thu, 13 Oct 2011 13:49:35 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id a12sm9150301wbo.9.2011.10.13.13.49.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 13:49:32 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Thu, 13 Oct 2011 13:47:47 -0700 From: YongHyeon PYUN Date: Thu, 13 Oct 2011 13:47:47 -0700 To: perryh@pluto.rain.com Message-ID: <20111013204747.GA13219@michelle.cdnetworks.com> References: <4E94637A.5090607@gmail.com> <20111011171029.GA5661@michelle.cdnetworks.com> <4E959F06.6040906@gmail.com> <20111012170347.GA9138@michelle.cdnetworks.com> <4e969a67.YJyWMt0xI7pFL+xJ%perryh@pluto.rain.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e969a67.YJyWMt0xI7pFL+xJ%perryh@pluto.rain.com> User-Agent: Mutt/1.4.2.3i Cc: fodillemlinkarim@gmail.com, freebsd-net@freebsd.org, kob6558@gmail.com Subject: Re: if_msk.c link negotiation / packet drops 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, 13 Oct 2011 20:49:37 -0000 On Thu, Oct 13, 2011 at 12:59:35AM -0700, perryh@pluto.rain.com wrote: > YongHyeon PYUN wrote: > > On Wed, Oct 12, 2011 at 10:07:02AM -0400, Karim wrote: > > > ... why are we ORing the same call twice isn't the same thing > > > as calling it once: > > > > > > bmsr = PHY_READ(sc, E1000_SR) | PHY_READ(sc, E1000_SR); > > > > The E1000_SR_LINK_STATUS bit is latched low so it should be read > > twice. > > It might not be a bad idea to check the generated code to be sure > that the read _is_ being done twice. An optimizer might well come > to the same conclusion as Karim, and discard the "redundant" second > instance (unless there's a "volatile" declaration somewhere in the > expansion of PHY_READ, to explicitly indicate that it has side > effects). Last time I checked it, compiler generated correct code. Tried again on amd64 and I can still see the code is there.