Re: How to post a message to a kernel thread

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

 




    Thanks for your mail. I basically want to send the packets
    received by the synchronous ppp tty module (ppp_synctty.c)
    to a socket application. Since the ppp transmit function is called
    from interrupt context, i am not able to invoke the sock_sendmsg
    call.

i don't know much about the ppp core, so i assume the above statement is correct

So i thought of creating a new kernel thread which will have a queue
so that from the sync ppp tty module i will post the packets to this
queue. From this kernel thread i can write the message to the socket.


well looks like all you need is a static data structure like: buffer / linked list. They both need
to be protected by a spinlock (due to the interrupt context issues).


My idea is:
the kernel_thread goes to sleep (in a wait queue) waiting for a packet.
When a packet is received from the ppp core you enqueue it in the choosen data structre (buffer/linked list), and wake the kernel_thread.


If you're working against the 2.6, take a look at the workqueue ... maybe you
can simplify your code by using on of such queue.


Hope these helps.





--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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