Re: Sending UDP from within packet handler

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

 



Can i make a direct/quick guess?   did u use spin lock in your codes?
 if yes, that could be the problem:

caller of sock_sendmsg() must be able to sleep:

1945                 if (copy_from_user(ctl_buf, (void __user
*)msg_sys.msg_control,
........

1954         err = sock_sendmsg(sock, &msg_sys, total_len);

and caller of copy_from_user() must be able to sleep:

120  *
121  * Context: User context only.  This function may sleep.
122  *
123  * Copy data from user space to kernel space.  Caller must check
124  * the specified block with access_ok() before calling this function.
136  */
137 static __always_inline unsigned long
138 __copy_from_user(void *to, const void __user *from, unsigned long n)
139 {
140         might_fault();


On Mon, May 18, 2009 at 5: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?
>
> Thanks
>



-- 
Regards,
Peter Teoh

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