Bottom half for network drivers

Vadim Lebedev (vlebedev@aplio.fr)
Fri, 10 Sep 1999 17:51:02 +0200


Hello,

I'm working on ucLinux for motorolla mc68en302 microcontroller.
This MCU has a sofisticated built-in ethernet interface and i wrote a
driver for it.
The sofistcication come from the fact that the ethernet contoller gives you
a possibility to setup recieve and transmit buffer descriptor rings where
you can simply store the pointers to you incoming/outgoing packets in your
main RAM. The controller then handles all the DMA by itself modifiying the
status bits in the buffer descriptors
as it walks them recieving/transmitting data... It also generates
interrupts at the transmission/reception of the packet or an error
condition.
My driver takes advantage of this by NOT copying data from/to SKBs to a
special packet buffer but
instead filling recieve/transmit ring pointers to pointdirectly to SKB
buffers.
When the ETH controller generates a let's say RECEIVE COMPLETE interrupt
I have to scan the receieve ring for all descriptors saying to hold a good
received packet, for each such
descriptor i find corresponding skb adjust the length, call netif_rx(skb),
then i allocate a new skb
and set the recieve ring pointer to the new skb data buffer.... If for some
reason i've missed couple if
RECEIVE COMPLETE interrupts, no problem i'll catch up all the packets on
the one which í actually handle.
The problem is that in case when i'm handling multiple packets it can take
some time, all the
netif_rx, dev_alloc_skb calls, inside the interrupt handler.
I think that it would be better that the interrupt handler would simply
position an BH bit and the packet handling
loop would be done in the bh handler... of course a can simply allocate a BH
bit and declare a bh handler for my
particular driver, but i sought that more generic solution would be
interesting... I was thinking about adding
a bh pointer to the device structure which will contain a pointer to device
specific bh routine... and modifiying
net_bh to call this pointer when it's not NULL....

Any opinions?
-----------------------------------------------------------------
Vadim Lebedev
Chief software engineer
Aplio S.A.
http://www.aplio.com
-----------------------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/