Re: Userspace <-> communication

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

 



On 10/11/06, Girish Venkatachalam <girishvenkatachalam@xxxxxxxxx> wrote:
On Wed, Oct 11, 2006 at 06:28:46PM +0530, Jinesh K J wrote:
> This is my requirement. I need to capture the data from an NIC.
> Instead of pushing it into the network stack, I'll make it to store
> them in a kernel ring buffer. From that buffer, a user space
> application will read the raw packet, do the necessary processing and
> send it back. As you can see I'm looking towards to transfer chunks of
> data to and from userspace.
>
> So, which method does suit well here?
>
> Jinesh.
My God,

   This is  very stringent reqmt. :-)

   If you dont process the packets fast enuf u end up dropping packets and several wicked things happen.

   But the good news is that what you trying to do has been attempted by several folks before.

   First and most important thing u have to ensure is avoid copying memory. That is what mbufs in BSD and skbuffs in linux attempt to do...

   You can store the packets in a kernel queue in such a way that the user space reads from it instead of copying it to and fro. It simply won't work in your case.

   Avoid memcpy() at al costs.

   I am guessing that mmap() is a good fit though I am not quite sure.

   Unless you are doing too many things, the best thing to do would be to move your processing into the kernel...

   I am sure this is not what you want.
You are right. I want to do the entire stuff in user space. So, let me
add one more requirement. I need to get the packets from the NIC, move
them to some other device memory (which can do its own processing upon
it) and get it back from there. The data thus received will be given
to userspace. The case with transmission also remains the same.

The other thing is that I won't be moving the data again to the
network stack. Any kind of processing would be done in userspace.
Since, I do not have anything to do in network stack, that overhead
can be avoided right?

Jinesh.

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