Linux上可以进行零拷贝UDP打包接收吗?
我希望将 UDP 数据包直接从以太网适配器复制到我的用户空间缓冲区中
我的设置的一些详细信息:
我正在从一对千兆位以太网摄像头接收数据。我每秒接收 28800 个 UDP 数据包(每行 1 个数据包 * 30FPS * 2 个摄像头 * 480 行)。我无法切换到巨型帧,并且我已经在研究调整驱动程序级别中断以降低 CPU 利用率。我在这里追求的是减少复制这个 ~40MB/s 数据流的次数。
I would like to have UDP packets copied directly from the ethernet adapter into my userspace buffer
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本文可能有用:
http://yusufonlinux.blogspot.com/ 2010/11/data-link-access-and-zero-copy.html
This article may be useful:
http://yusufonlinux.blogspot.com/2010/11/data-link-access-and-zero-copy.html
最好的途径是
recvmmsg
和增加 RX 中断合并。http://lwn.net/Articles/334532/
你可以往下移动,匹配Wireshark/tcpdump的方式操作,但尝试在其之上进行任何严肃的处理都是徒劳的,必须自己解码所有内容。
在每秒只有 30,000 个数据包的情况下,我不会太担心复制数据包,这些问题在每秒处理 3,000,000 个消息时就会出现。
Your best avenues are
recvmmsg
and increasing RX interrupt coalescing.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.
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.