Re: Sending UDP from within packet handler

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

 



Hi Claude....

Just trying to give you idea...

On Mon, May 18, 2009 at 4:35 AM, Claude Robitaille <clauder@xxxxxxxxxxxx> wrote:
> Hi all,
>
> i am trying to create a module that will receive frames from a physical
> interface, using a packet handler registered via dev_add_pack, mangle the
> frame content and send it over a UDP socket. To transmit over UDP I created
> a socket and I am sending the frame using sock_sendmsg. It is mostly working
> except that I am getting some error and, above all, the kernel is crashing
> :-(
>
> The error message that I get the most is "scheduling while atomic". This
> leads me to believe that sock_sendmsg cannot be used while in softirq
> context, which, as per my understanding, is the context when the packet
> handlers are called.
>
> So, I am a little puzzled as to what are my options. Should I use some
> queuing and then dispatch something that will execute in the proper context?
> Or try to find a lower entry point into UDP that would work in softirq
> context? Any suggestions?

As you know, the tcp/ip code path is quite long, IIRC it could reach
10-15 level deep. So, I think you'll agree we can call it "fast path".
Furthermore, we shouldn't make it slower with unnecessary work.

Therefore, IMO, if you could somehow copy or move your mangled frame
into separate queue and process it in process context (probably using
workqueue), I think it's the way to go.

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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