public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Gadbois <martin.gadbois@colubris.com>
To: Adam Khan <adam.khan@cavium.com>
Cc: linux-kernel@vger.kernel.org, design@lists.freeswan.org
Subject: Re: [Design] suggestions for parallel processing of input and output    packets
Date: Mon, 08 Apr 2002 08:29:59 -0400	[thread overview]
Message-ID: <3CB18D47.777EC3A3@colubris.com> (raw)
In-Reply-To: <000001c1dd01$f83d0960$4310a8c0@Adamspc>

Adam Khan wrote:

> 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.




      reply	other threads:[~2002-04-08 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3CAD9CDB.1F0C5D2F@colubris.com>
2002-04-06  0:28 ` [Design] suggestions for parallel processing of input and output packets Adam Khan
2002-04-08 12:29   ` Martin Gadbois [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CB18D47.777EC3A3@colubris.com \
    --to=martin.gadbois@colubris.com \
    --cc=adam.khan@cavium.com \
    --cc=design@lists.freeswan.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox