From owner-freebsd-net@FreeBSD.ORG Thu Oct 13 21:55:53 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 4A0EA106566B for ; Thu, 13 Oct 2011 21:55:53 +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 CADC88FC08 for ; Thu, 13 Oct 2011 21:55:52 +0000 (UTC) Received: by wyj26 with SMTP id 26so3377560wyj.13 for ; Thu, 13 Oct 2011 14:55:51 -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=IKruggogk1N0EZSvAoa0sUN1aghbkSJaIlVPEyVYjFA=; b=SUomTb/ewpejWsoltoyTLtXH8Hck6Z/RVEXGonKfJwj2QAnFMS+00cwbGbXln2F26I NOeWaSs/mHbzmYo6LyfASt14LrU/NYM6gPREUyf9R5gXwUoXlQy0hCUpQKY+Phm/fBq5 FtVyLcM+65oloWru+ZoSOo/TLL4VnfoIlXkw0= Received: by 10.216.230.83 with SMTP id i61mr2105263weq.54.1318542951682; Thu, 13 Oct 2011 14:55:51 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id ek13sm9633604wbb.3.2011.10.13.14.55.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 14:55:50 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Thu, 13 Oct 2011 14:54:05 -0700 From: YongHyeon PYUN Date: Thu, 13 Oct 2011 14:54:05 -0700 To: Arnaud Lacombe Message-ID: <20111013215405.GB13219@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> <20111013204747.GA13219@michelle.cdnetworks.com> 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: fodillemlinkarim@gmail.com, freebsd-net@freebsd.org, perryh@pluto.rain.com, 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 21:55:53 -0000 On Thu, Oct 13, 2011 at 05:02:58PM -0400, Arnaud Lacombe wrote: > Hi, > > On Thu, Oct 13, 2011 at 4:47 PM, YongHyeon PYUN wrote: > > 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. > > > What about other architecture (especially i386) ? which optimization Don't use i386 so I don't know. > level did you use ? which compiler version ? CURRENT, default optimization(O2). > > About the last question, I know for sure that there has been change in > FreeBSD's gcc between 7-STABLE, and FreeBSD -CURRENT. > > I agree with perryh@ than such hardware requirement _requires_ being > explicit in the code, ie proper `volatile' marking. > I'm not saying adding more safe belt is bad idea. If you have a patch please submit it. I don't like touching every PHY drivers. > - Arnaud >