IF_HANDOFF vs. IFQ_HANDOFF

John Polstra jdp at polstra.com
Mon Jun 19 23:22:42 UTC 2006


On 18-Jun-2006 John-Mark Gurney wrote:
> John Polstra wrote this message on Thu, Jun 15, 2006 at 09:18 -0700:
>> in the HW but have not yet completed.  When the completion interrupt
>> comes in, the driver is supposed to check the if_snd queue for more
>> mbufs and process them.  Only when the transmit side of the HW goes
>> totally idle should IFF_OACTIVE be cleared again.  Most of our drivers
>> set the flag only when they run out of transmit descriptors (i.e.,
>> practically never), which is just plain wrong.
> 
> But the problem is that for small packets, this can mean that there
> will be a delay in handling the ring if we wait to process packets
> once the tx ring is empty.. if we ever want to max out gige w/ 64byte
> packets, we have to clear OACTIVE whenever tx approches running out
> of packets before we can send this..

Yes, I see your point.

> In most cases we don't know how long that is (since we don't keep
> track of packet sizes, etc), so it's easiest/best to clear it
> whenever the tx ring is not full...

I guess it depends on when you get interrupts from the particular
network adapter.  If you're taking an interrupt on every transmit
completion, it's best to check the if_snd queue at that point, when
you've already entered the driver anyway.  In that case, you might as
well leave OACTIVE set until the adapter goes idle, to suppress the
redundant calls to if_start.  (The transmitter won't go idle if there
is enough traffic to max out the link capacity.)

But if you only get an interrupt when the transmitter has gone idle
then I agree, if_start needs to be called in order to keep the
descriptor ring full enough.

John


More information about the freebsd-net mailing list