Re: create a kernel socket from interrupt context

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

 



Hi,

Thanks, Topi.

I tried two things:
 First , create a work queue and calling it from the interrupt.
 what happens is that  queue_work() fails. (The return value from
queue_work()  is NOT 1 ).

So I looked into it and found that the problem is that I am in fact in
software interrupt context, not in hw interrupt context.
After looking for solutions and reading about this,I found out that
what I should use for software interrupts is a  tasklet.
So I inserted taskets and the tasklet function is indeed called from
the software interrupt context.
The problem is that when I try to send a packet from a tasklet I have the same
error; "sleeping function called from invalid context".
Is there some way out of this ? I mean, to send packets from software
interrupt context ?

Regards,
Mark




On 2/22/07, Mark Ryden <markryde@xxxxxxxxx> wrote:
Hello,

Is it possible somehow to create a TCP socket from kernel and to send
a message when you are in interrupt context ?
I made a test : I created a kernel socket with
sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock)
and then connected it with:
sock->ops->connect(sock,
                                                                         (struct sockaddr*)&addr,
                                                                         sizeof(struct sockaddr), 0)

When working NOT in interrupt context,it works OK;  I called :
kernel_sendmsg(sock, &msg, &iov, 1, length);
and a TCP packet WAS sent (I verified it with a sniffer)

BUT, in interrupt context, I called :
kernel_sendmsg(sock, &msg, &iov, 1, length);

I got:
Feb 22 12:02:54 markhost kernel: BUG: sleeping function called from
invalid context
Feb 22 12:02:54 markhost: in_atomic():1, irqs_disabled():0

Why is it so ? is there another way create a kernel TCP socket
and to send a packet?

Regards,
Mark


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