AW: Why does my AF-XDP Socket lose packets whereas a generic linux socket doesn't?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Mar 2020 09:38, <brouer@xxxxxxxxxx> wrote:

>On Sun, 15 Mar 2020 15:36:13 +0000
>"Gaul, Maximilian" <maximilian.gaul@xxxxxx> wrote:
>
>
>You say that you are sleeping for a specified time around 1 - 2ms.
>
>Have you considered if in the time your programs sleeps, if the
>RX-queue can be overflowed?
>
>You say at 390,000 pps drops happen.  At this speed a packets arrive
>every 2.564 usec (1/390000*10^9 = 2564 ns = 2.564 usec).
>
>What NIC hardware/driver are you using?
>And what is the RX-queue size? (ethtool -g)
>On Intel's XL710 driver i40e, the default RX-ring size is 512.
>
>The "good-queue" effect is that a queue functions as a shock absorber,
>to handle that the OS/CPU is busy doing something else.  If I have 512
>RX-queue slots, and packets arriving every 2.564 usec, then I must
>return and empty the queue (and re-fill slots) every 1.3 ms
>(512 * 2.564 usec = 1312.768 usec = 1.3127 ms).
>

Thank you so much for your answer Jesper!

regarding the size of the RX-Queue: it is 1024.
I am able to increase it up to 8192 but my tests are showing that the RX-Queue size doesn't change anything on the lost packet rate unless it is lower than 512 (lost packets increase very minimally if set to 512 from 1024).
I also decreased the sleeping time of the process from 1ms to 500µs - this also didn't change anything.
I am using a *Mellanox Technologies MT27800 Family [ConnectX-5]*. I did some further tests with the generic linux socket and it worked fine without any packet loss (but of course I want to use the extended packet processing capability by AF-XDP).
I am not sure but is it possible that some "side traffic" comes up to userspace (for example some ping-packages or IGMP-queries) thus messing up my RTP-Sequencenumber tracking? Even though I am filtering packets by whether they are all four: IP, UDP, have valid dest-ip and valid dest-port:

                            const struct pckt_idntfy_raw raw = {
                                .src_ip = 0, /*not used at the moment */
                                .dst_ip = iph->daddr,
                                .dst_port = udh->dest,
                                .pad = 0
                            };

                            const int *idx = bpf_map_lookup_elem(&xdp_packet_mapping, &raw);
                            
                            if(idx != NULL) {
                                if (bpf_map_lookup_elem(&xsks_map, idx)) {
                                    return bpf_redirect_map(&xsks_map, *idx, 0);
                                }
                            }

Best regards

Max



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux