Does the linux kernel in the SMP system guarantee that UDP packets coming from the network in order are read from the socket in order?

in the project I'm working on, we see problems with a non-standard order in certain circumstances in the SMP system when we read a UDP stream from the network. We see that it is coming from the network in order, sniffing the hub connected between the sender and receiver. However, sometimes, apparently, it crashes when reading from a socket. Is there any guarantee for UDP packets in this case or should the application implement a reorder buffer? We do not establish the proximity of the processor here, I suspect that this may help, but ideally I would like all CPU / hw threads to handle network traffic.

+6
linux linux-kernel udp smp
source share
2 answers

UDP does not guarantee any order. This is the responsibility of the application. In fact, it does not even guarantee that packets will not be repeated / discarded, etc. I suggest you read: http://en.wikipedia.org/wiki/User_Datagram_Protocol

It does not make sense for the kernel to make such guarantees, especially if the incoming packets themselves may be out of order, since the kernel can (reasonably) expect the application to work with it if the application requires ordering,

+9
source share

You cannot guarantee that the UDP packet will not be deleted during transmission, so you cannot receive any orders. When the system receives, for example, packet # 14 and packet # 16, he does not know if he should wait until packet No. 15 comes in before delivery of packet No. 16, or if packet No. 15 has been discarded and will never be in. The system will just give you a bunch of packages, and it's up to you to tidy them up.

0
source share

All Articles