> Martin,
>
> Thanks for the info, extremely helpful. I have a couple more questions.
> The ipsec_tunnel_start_xmit() and ipsec_rcv() routines run as tasklets.
> In tasklets there is no sleeping or scheduling, From your notes
> I can use a kernel thread (BTW, a timer routine would sleep -
> I don't think thats allowed in this context?)
Why would it sleep?
setup_timer(callback_check_hw);
...
void callback_check_hw(...)
{
while (packet available from h/w)
{
take packet;
decide where to send it from packet's context;
if(tx)
ipsec_tunnel_send()
else
ipsec_rcv()
}
}
or something like that...
>
>
> Kernel thread - Is this considered a separate context? Concerns -does
> the thread sleep - how often is the thread run?
> Pointers on with kernel threads and sample code will be appreciated.
Kernel threads are a normal process, but the processes' memory pages are
those of the kernel. No memory context switch required when the kernel
schedule those processes. They run as often as any other process with the
same priority. Since a kernel thread is a process, it can sleep on events
(timer, signals).
But in your situation, I would not use kernel threads - the time it takes
to schedule() a process is too much time to wait PER PACKET. Use a timer
instead, poll the H/W (or whatever) and if available, call the right
function with the completed packet. After all, if you use H/W crypto, you
want performance.
for 2.4.x, grep kernel_thread to find example of stock kernel threads.
(RTFC)
I also suggest Understanding the Linux Kernel, from O'reilly. A great book
on the current topics. (RTFM)
-- ============== Martin Gadbois S/W Developper Colubris Networks Inc.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/