Wake up and sleep procedures for a function in a module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I need some advice on coding a kernel module which acts as a wrapper
to a network device driver.

This new module sit's on top of a device driver and intercepts all
incoming packets. The module has a function, say "myTx()", which
intercepts the packet, and after mangling the packet, add's it a queue
"myQ". Another function does the actual "delivery" of the packet to
the network driver, let's say this is "myDeliver()".

On receiving the first packet, myTx() has to add it to myQ, check if
myDeliver() is "awake/active", if NOT, wake it up and return. Once
myDeliver() is woken up, it iteratively delivers the packet to the
actual driver until myQ is empty, and once done, it has to "sleep".
Again at a later point, when myTx() has packet(s) to deliver, the
above procedure repeats.

I wanted to know what might be the best way of performing the wakeup
and sleep procedure, for the myDeliver() function. Intial
investigation revealed a few possible ways..., wait_queues? tasklets?
timers (which can be expired immediately)? etc., but nothing seemed
like an obvious choice. I am short of any expertise/experience here,
any help would be much appreciated.

Regards,
- CCK./

-- 
Chandrakanth Chereddi.
Elec. & Comp. Engg, Univ. of Illinois at U-C.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux