简体   繁体   English

UDP数据包从内核到Linux中用户空间的路径

[英]Path of the UDP packet from kernel to user-space in Linux

I'm maintaining some network driver and I've got some problems with lost of data. 我正在维护一些网络驱动程序,但是数据丢失有一些问题。 The effect is that when I send for example ICMP or UDP ping using ping or nping some of the udp/icmp packets are lost. 结果是,当我使用ping或nping发送ICMP或UDP ping时,某些udp / icmp数据包丢失了。

I'm sure that on ping/nping side of the transmission the ping reply is received by my driver and the kernel (tcpdump shows incoming udp or icmp packets as a reply). 我确定在传输的ping / nping端,驱动程序和内核会收到ping答复(tcpdump将传入的udp或icmp数据包显示为答复)。

But application ping/nping shows sometimes that for example 80% packets are lost. 但是应用程序ping / nping有时显示出例如80%的数据包丢失。 I suspect that those packets are lost somewhere between kernel and user space. 我怀疑这些数据包在内核空间和用户空间之间丢失了。

I know that for UDP there is procedure udp_rcv() for maintenance of UDP packets, but I don't know which procedure is next in the path of delivering of the packet to user space application. 我知道对于UDP,有维护UDP数据包的过程udp_rcv(),但是我不知道将数据包传递到用户空间应用程序的路径中的下一个过程是什么。

Linux kernel is in version 3.3.8. Linux内核的版本为3.3.8。

My question is - how to trace the whole path of transition of the packet from my driver to user space socket buffer? 我的问题是-如何跟踪从驱动程序到用户空间套接字缓冲区的数据包转换的整个路径?

udp_rcv() is a callback that is passed to struct net_protocol as a .handler . udp_rcv()是作为.handler传递到struct net_protocol .handler You may either look at usage of this handler field in the structure, or you can also see if some error occurs. 您可以查看结构中此处理程序字段的用法,也可以查看是否发生某些错误。 There is a callback err_handler . 有一个回调err_handler Maybe packet loss happens here and error handler will be called. 也许丢包在这里发生,错误处理程序将被调用。

PS Remember that UDP does not guarantee 100% transmit success, and one lost packet out of 100 might be expected behavior. PS请记住,UDP不能保证100%的传输成功,并且100个数据包中有一个丢失的数据包可能是预期的行为。 (: (:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM