From owner-freebsd-net@FreeBSD.ORG Thu Oct 13 01:13:14 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 66D57106564A for ; Thu, 13 Oct 2011 01:13:14 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [IPv6:2607:f678:1010::34]) by mx1.freebsd.org (Postfix) with ESMTP id 4443F8FC12 for ; Thu, 13 Oct 2011 01:13:14 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id p9D1DCrk000270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Oct 2011 18:13:13 -0700 (PDT) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id p9D1DCFx000269; Wed, 12 Oct 2011 18:13:12 -0700 (PDT) Received: from fbsd81 ([192.168.200.81]) by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA23391; Wed, 12 Oct 11 18:00:39 PDT Date: Thu, 13 Oct 2011 00:59:35 -0700 From: perryh@pluto.rain.com To: pyunyh@gmail.com Message-Id: <4e969a67.YJyWMt0xI7pFL+xJ%perryh@pluto.rain.com> References: <4E94637A.5090607@gmail.com> <20111011171029.GA5661@michelle.cdnetworks.com> <4E959F06.6040906@gmail.com> <20111012170347.GA9138@michelle.cdnetworks.com> In-Reply-To: <20111012170347.GA9138@michelle.cdnetworks.com> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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 01:13:14 -0000 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).