LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Send/Receive multiple raw packets in one system call (https://www.linuxquestions.org/questions/linux-networking-3/send-receive-multiple-raw-packets-in-one-system-call-828848/)

coreykasten 08-27-2010 12:05 PM

Send/Receive multiple raw packets in one system call
 
Hello all,

I need to receive a number of raw ethernet packets (say, 100 packets) into a user-mode accessible buffer large enough to hold all the packets. The way I have done this so far is by looping over the recvfrom() system call 100 times, passing an incremented pointer addressing the location in my buffer to store the packet.

Is there a way to receive the 100 packets into my buffer with one system call, perhaps by instructing the kernel to DMA the 100 packets into my buffer?

Thanks in advance!

Corey

Mara 08-29-2010 11:52 AM

Without modifying the kernel, AFAIK no. The socket API is designed under the assumption that you either receive data (then one read() may get data from many packets) or packets one by one.

You can think about writing a syscall that will internally loop and perform more recv() operations.


All times are GMT -5. The time now is 08:42 AM.