[realtek] Optimising the rtl8139 driver for low latency!

Donald Becker becker@scyld.com
Sat, 30 Jun 2001 13:30:37 -0400 (EDT)


On Sat, 30 Jun 2001 korahs@vsnl.com wrote:

> Thanks a lot for that. A lot of my doubts have been cleared up and I feel
> more confident now. But there are still a few grey areas which I am sure you
> can clarify?
> 
> 
> > >  How do I discard/pop the top packet in the rx_ring.
> >
> > Move the ring-write-block pointer "RxBufPtr".
>
> I am not sure I follow this. What does RxBufPtr point to?

The RxBufPtr register is a hardware register that sets the Rx ring
limit.  When the hardware ring counter equals this register, the chip
turns off the reciever.

> Assuming that it
> points to the beginning of the just received packet, would this macro work
> pop off that packet.

No, you have to let the hardware know that the driver has a copy of the
packet and chip may reuse the ring buffer space.  You do that by writing
RxBufPtr.

The current driver does the write after each Rx packet removed.  An
alternate design might avoid extra PCI operation by deferring the write
until after all packets are removed, but this would risk dropping
Rx packets when there is actually space available.

> 2. How do I disable the Tx IRQ? Is it ok to do this?
> What I basically want
> is to copy the int handling part to the rlt8129_xmit to eliminate the
> overhead of Tx interrupt. Thus the xmit routine can become "blocking until
> Tx complete".

Errmm, the rtl8139 isn't a high performance chip to begin with.  I think
that you are trying a little too hard.

Unless you are doing mostly transmits, I don't believe that you will
notice a performance advantage from this.  Disabling Tx interrupts makes
more sense when you have a long Tx queue.

> 3. Will the following two statements suspend and resume the operation of the
> NIC?
>             /*Disable interrupts by clearing the interrupt mask.*/
>             outw(0x0000, ioaddr + IntrMask);

No.  This will leave the receiver enabled and just cause the Rx ring to
overrun.

> 4. I have written a macro to enque a packet for transmission. Could you
> check if this is right.

It might be right, depending on what other code you have.

Note that you don't always need a Tx bounce buffer, only if the Tx data
is misaligned.

> In case you are wondering, I am trying to get the realtek driver to work
> with GAMMA for a cluster we are setting up in our department. These are
> early days, but we hope we can show some performance improvement for
> parallel programs.


Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993