Re: Userspace <-> communication

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

 



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.

   regards,
   Girish

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