realtime problem

John Polstra jdp at polstra.com
Thu Apr 10 08:56:57 PDT 2003


In article <20030409211302.S1322 at beagle.fokus.fraunhofer.de>,
Harti Brandt  <harti at freebsd.org> wrote:
> 
> The problem is, that the access to the MII registers is very slow. It
> needs to shift out and in data and addresses into a serial line with
> defined timings. The timings are in the sub-usec range and therefor
> DELAY(1) are used. Because a DELAY(1) actually delays several microseconds
> this may sum up to several milliseconds. This mii status code is called
> from a callout and that means it botches your timing if HZ is 1ms or less.
[...]
> There are basically two solutions to the problem:
> 
> 1. a nanodelay() function in the kernel
> 2. do all the status polling via a kernel thread

And a possible third solution for some NICs: Don't poll the PHY at
all.  Several modern Ethernet chips, including the em and bge
gigabit chips, monitor the PHY themselves and can interrupt on link
state changes.  With these chips there should be no need at all for
periodic polling of the PHY.  Our bge driver polls it anyway, but
that could be fixed.  The em driver also seems to poll the PHY, but
I don't see why it's necessary.

With that change, the large delays would happen only when the link
state actually changed.  That would be a big improvement.

John
-- 
  John Polstra
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



More information about the freebsd-hackers mailing list