Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Oct 2011 00:59:35 -0700
From:      perryh@pluto.rain.com
To:        pyunyh@gmail.com
Cc:        fodillemlinkarim@gmail.com, freebsd-net@freebsd.org, kob6558@gmail.com
Subject:   Re: if_msk.c link negotiation / packet drops
Message-ID:  <4e969a67.YJyWMt0xI7pFL%2BxJ%perryh@pluto.rain.com>
In-Reply-To: <20111012170347.GA9138@michelle.cdnetworks.com>
References:  <4E94637A.5090607@gmail.com> <20111011171029.GA5661@michelle.cdnetworks.com> <CAN6yY1tWQZwdqgYdN3uBBdXiGQ2OFDMYbSjhEUeTimHjBnR9iA@mail.gmail.com> <4E959F06.6040906@gmail.com> <20111012170347.GA9138@michelle.cdnetworks.com>

next in thread | previous in thread | raw e-mail | index | archive | help
YongHyeon PYUN <pyunyh@gmail.com> 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).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4e969a67.YJyWMt0xI7pFL%2BxJ%perryh>