Andrew Boyd(deleted)
|
Re: Network driver events that are not interrupts
|
Andrew Boyd(deleted)
01/05/2011 4:05 PM
post81265
|
Re: Network driver events that are not interrupts
In the io-net world, drivers created their own (usually priority 21)
threads to service their interrupts.
You're not supposed to do that in io-pkt. The stack is supposed
to be in charge of threading and execution. Ideally, an io-pkt
driver should be just a collection of callback functions, which
the stack executes.
In an io-pkt driver's _attach function, you will see it stuffing
various function callbacks in the driver ifp structure, such
as _ioctl, _start (tx), _init, and _stop.
Additionally, io-pkt drivers also attach to hardware interrupts
but the driver handlers actually kick io-pkt, which in turn call
the driver.
The other common way that a driver can do stuff (eg start
execution) is via the callback_msec() function, where it asks
the stack to make a callback function into the driver after a
certain amount of time has elapsed. This is often used by
a driver for link monitoring, tx packet harvesting, etc.
However. You may encounter a situation where you really
really need your own driver thread. This occasionally happens,
but is discouraged unless really necessary. It can be done if you
code carefull, because there are things you simply cannot do if
you are not "the stack thread".
Seanb or Patrik can explain further if need be.
|
|
|