All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaul, Maximilian" <maximilian.gaul@hm.edu>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Xdp <xdp-newbies@vger.kernel.org>, "Björn Töpel" <bjorn.topel@intel.com>
Subject: AW: Why does my AF-XDP Socket lose packets whereas a generic linux socket doesn't?
Date: Thu, 19 Mar 2020 14:15:44 +0000	[thread overview]
Message-ID: <bd692ff951cb41cfbd5397203f3a3ef0@hm.edu> (raw)
In-Reply-To: <20200316093819.65c24cdd@carbon>

On Mon, 16 Mar 2020 09:38, <brouer@redhat.com> wrote:

>On Sun, 15 Mar 2020 15:36:13 +0000
>"Gaul, Maximilian" <maximilian.gaul@hm.edu> 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

      reply	other threads:[~2020-03-19 14:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-15 15:36 Why does my AF-XDP Socket lose packets whereas a generic linux socket doesn't? Gaul, Maximilian
2020-03-16  8:38 ` Jesper Dangaard Brouer
2020-03-19 14:15   ` Gaul, Maximilian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd692ff951cb41cfbd5397203f3a3ef0@hm.edu \
    --to=maximilian.gaul@hm.edu \
    --cc=bjorn.topel@intel.com \
    --cc=brouer@redhat.com \
    --cc=xdp-newbies@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.