Re: fast ethernet driver MII phy serial clock rates

From: David Burns (david.burns_at_dugeem.net)
Date: 04/26/04

  • Next message: Eugene Grosbein: "BGP MD5: compatibility for STABLE?"
    Date: Mon, 26 Apr 2004 14:25:57 +1000
    To: Bruce Evans <bde@zeta.org.au>
    
    

    Bruce Evans wrote:

    > On Sun, 25 Apr 2004, David Burns wrote:
    >
    >>Mike Silbersack wrote:
    >>
    >>>On Sat, 24 Apr 2004, David Burns wrote:
    >>>
    >>>>NB this assumes that a DELAY(1) is really a delay of 1?s! Which I don't
    >>>>think it is ... :-(
    >>>
    >>>Correct, DELAY takes far longer than it should.
    >
    > Actually, it takes at least as long as it should (normally a few
    > microseconds longer than the specified delay, but hundreds or thousands
    > of microseconds longer if it is interrupted). The bus ISA accesses in
    > it can also be delayed by (PCI) bus activity (I've measured 170 usec for
    > the 3 accesses in getit() which normally take 3-4 usec).
    >
    No argument that a DELAY(x) delays for a minimum of x microseconds -
    this is what we're seeing. The fact that we're using a DELAY() which can
    be interrupted inside locked code seems problematic - although I guess
    it just slows driver operation down.
    >
    >>>If you're really interested in fixing the problem and not inadvertantly
    >>>breaking older cards, what you should do is implement a nanodelay function
    >>>that actually delays for the time it's supposed to and then delay the
    >>>rated amount. Removing all delays will probably break something
    >>>somewhere.
    >>
    >>We could probably build a driver specific nanodelay function based on
    >>dummy PCI operations. Some will say this sucks but then I'd argue it's
    >>better than the current DELAY implementation.
    >
    >
    > No, it would be considerably worse. DELAY() has a poor resolution
    > because non-dummy ISA operations that it uses to read the time are
    > slow. Dummy PCI operations aren't much faster, depending on which
    > address they are at. They would be at least 3 times faster in practice
    > since the current implementation of DELAY() needs 3 ISA operations.
    > DELAY() could probably use only the low byte of an unlatched counter
    > if its efficiency were important. I think it is unimportant, since
    > only broken code uses busy-wait.

    Sorry I should have made myself clearer. Given the evidence that a
    DELAY(1) delays for far more than 1 microsecond we just need some other
    kind of known delay which will allow us to wait a few hundred
    nanoseconds (the MDIO clock period of most 100Mb/s PHYs) instead of a
    DELAY which is an order of magnitude higher (and is subject to
    interrupts). A dummy PCI operation would achieve this.
    >
    > Anyway, you won't get near nansoseconds reasolution or PCI clock
    > resolution (30 nsec) using PCI i/o instructions. rdtsc on i386's and
    > delay loops on all machines can easily do better provided the CPU
    > doesn't get throttled.
    >
    Yes the term nanosecond delay is inappropriate - when it is only a
    submicrosecond delay we need.
    >
    >>Of course just sending one bit of data on the MDIO will take us about
    >>600 nanoseconds - resulting in a 1.6MHz clock.
    >
    >
    > Except some machines add lots of wait states. I have a PCI card which
    > can usually be accessed in 467 nsec (write) and 150 nsec (read) on one
    > machine, but on a newer machine which is otherwise 6 times faster but
    > appears to have a slow PCI bugs (ASUS A7N8X-E), the access times
    > increase to 943 nsec (write) and 290 nsec (read).
    >

    A PCI implementation built from ISA components perhaps ... :-)

    It still comes back to slowing down PHY accesses without using DELAY().
    The fact that ste DELAY() removal provided a small but non-trivial
    improvement in network performance (including other network cards on the
    same PCI bus) underlines how horrible the use of DELAY() is.

    I'm only after a simple fix - experiment with removal of MII code
    DELAY() on the affected drivers and commit the change only where testing
    results are good.

    David
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Eugene Grosbein: "BGP MD5: compatibility for STABLE?"

    Relevant Pages

    • Re: fast ethernet driver MII phy serial clock rates
      ... DELAY takes far longer than it should. ... > dummy PCI operations. ... Except some machines add lots of wait states. ...
      (freebsd-net)
    • Re: [PATCH] x86_64: fix problems due to use of "outb" to port 80 on some AMD64x2 laptops, etc.
      ... with udelay based time delay on x86_64 architecture machines. ... wow, cool fix! ... static void* memset ...
      (Linux-Kernel)
    • Network delay for one client machine only?!
      ... client systems. ... there is a long delay ... other machines' shared files, with no issues. ... We had disabled Folder Redirection ...
      (microsoft.public.windows.server.sbs)
    • Re: [linux-kernel] Re: [PATCH] x86: provide a DMI based port 0x80 I/O delay override.
      ... The last time I heard of a 12 MHz bus in a PC system was in the days of the PC-AT, when some clone makers sped up their buses in an attempt to allow adapter card *memory* to run at the 12 MHz speed. ... This caused so many industry-wide problems with adapter cards that couldn't be installed in certain machines and still run reliably that the industry learned a lesson. ... Perhaps the rational solution here is to declare x86 the architecture for "relics" and develop a merged architecture called "modern machines" to include only those PCs that have been made to work since, say, the release of WIndows 2000? ... to the longer delay, the delay will be too long for more than 99,99 % of all systems, not counting i586+. ...
      (Linux-Kernel)
    • Re: New XP machines intermittent delays on Domain
      ... > has been running fine until we purchased some new Dell machines. ... > After the first delay, everything moves quickly enough, but after 10 ... > mapped drive to our primary Win2k file server/domain controller. ... the only common denominator is the model of ...
      (microsoft.public.windowsxp.network_web)

  • Quantcast