是否可以在Linux上接收零拷贝UDP打包?

时间:2022-12-31 12:34:52

I would like to have UDP packets copied directly from the ethernet adapter into my userspace buffer

我想将UDP数据包直接从以太网适配器复制到我的用户空间缓冲区

Some details on my setup:

我的设置的一些细节:

I am receiving data from a pair of gigabit ethernet cameras. Combined I am receiving 28800 UDP packets per second (1 packet per line * 30FPS * 2 cameras * 480 lines). There is no way for me to switch to jumbo frames, and I am already looking into tuning driver level interrupts for reduced CPU utilization. What I am after here is reducing the number of times I am copying this ~40MB/s data stream.

我从一对千兆以太网摄像头接收数据。合并我每秒接收28800个UDP数据包(每行1个数据包* 30FPS * 2个摄像头* 480行)。我无法切换到巨型帧,我已经在调整驱动程序级别中断以降低CPU利用率。我在这里的是减少复制这个~40MB / s数据流的次数。

This is the best source I have found on this, but I was hoping there was a more complete reference or proof that such an approach worked out in practice.

这是我在此发现的最佳来源,但我希望有更完整的参考或证据证明这种方法在实践中得到了解决。

2 个解决方案

#1


5  

This article may be useful:

本文可能有用:

http://yusufonlinux.blogspot.com/2010/11/data-link-access-and-zero-copy.html

#2


2  

Your best avenues are recvmmsg and increasing RX interrupt coalescing.

你最好的途径是recvmmsg和增加RX中断合并。

http://lwn.net/Articles/334532/

You can move lower and match how Wireshark/tcpdump operate but it becomes futile to attempt any serious processing above it having to decode everything yourself.

你可以向下移动并匹配Wireshark / tcpdump的运行方式,但是尝试任何严重的处理都必须自己解码所有内容。

At only 30,000 packets per second I wouldn't worry too much about copying packets, those problems arise when dealing with 3,000,000 messages per second.

每秒只有30,000个数据包,我不会太担心复制数据包,这些问题在每秒处理3,000,000个消息时会出现。

#1


5  

This article may be useful:

本文可能有用:

http://yusufonlinux.blogspot.com/2010/11/data-link-access-and-zero-copy.html

#2


2  

Your best avenues are recvmmsg and increasing RX interrupt coalescing.

你最好的途径是recvmmsg和增加RX中断合并。

http://lwn.net/Articles/334532/

You can move lower and match how Wireshark/tcpdump operate but it becomes futile to attempt any serious processing above it having to decode everything yourself.

你可以向下移动并匹配Wireshark / tcpdump的运行方式,但是尝试任何严重的处理都必须自己解码所有内容。

At only 30,000 packets per second I wouldn't worry too much about copying packets, those problems arise when dealing with 3,000,000 messages per second.

每秒只有30,000个数据包,我不会太担心复制数据包,这些问题在每秒处理3,000,000个消息时会出现。