public inbox for xdp-newbies@vger.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Henning Fehrmann <henning.fehrmann@aei.mpg.de>,
	"xdp-newbies@vger.kernel.org" <xdp-newbies@vger.kernel.org>
Subject: Re: make XDP program aware of multi buffer
Date: Tue, 29 Nov 2022 14:24:32 +0100	[thread overview]
Message-ID: <87cz95zyen.fsf@toke.dk> (raw)
In-Reply-To: <Y4X3u39irCVmVxZx@mephisto.aei.uni-hannover.de>

Henning Fehrmann <henning.fehrmann@aei.mpg.de> writes:

> Hello,
>
> we use XDP/BPF programs to redirect and record network data.
> We run the 6.0.9 vanilla kernel with the delivered Mellanox driver.
> We mounted MT28800 NICs.
>
> As this scheme seems to work reliably we'd like to step forward and
> enable multi buffer packets. We get the following message from the driver:
>
> mlx5_core 0000:01:00.0 enp1s0f0np0: XDP is not allowed with striding RQ and MTU(9000) > 3498
>
> We turned striding off and now we get:
>
> mlx5_core 0000:01:00.0 enp1s0f0np0: MTU(9000) > 3498, too big for an XDP program not aware of multi buffer
>
> It seems that we have to make the XDP program aware of multi buffer.
> What would be the correct way to do it?

You just replace:

SEC("xdp")

with

SEC("xdp.frags")

in your source file and, assuming your libbpf version is up-to-date,
that should be it as far as the kernel is concerned.

However, you obviously also need to make sure there are no semantic
issues in your program before doing this. I.e., data_end is no longer
the end of your packet, so if you are using data_end-data to calculate
the packet len, that will no longer be accurate. If you need to access
data beyond the first frag you'll need to use the
xdp_{load,store}_bytes() helpers.

Note that if you're using libxdp you also need to wait for this to be
resolved: https://github.com/xdp-project/xdp-tools/issues/235 - I'm
halfway through a fix for it, so hopefully that should land before too
long.

-Toke


  reply	other threads:[~2022-11-29 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 12:14 make XDP program aware of multi buffer Henning Fehrmann
2022-11-29 13:24 ` Toke Høiland-Jørgensen [this message]
2022-11-30  8:54   ` Henning Fehrmann
2022-11-30 13:11     ` Toke Høiland-Jørgensen

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=87cz95zyen.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=henning.fehrmann@aei.mpg.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox