qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann via <qemu-devel@nongnu.org>
To: Ilya Maximets <i.maximets@ovn.org>, qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, Anton Protopopov <aspsk@isovalent.com>
Subject: Re: [PATCH v3 1/2] net/af-xdp: Support pinned map path for AF_XDP sockets
Date: Tue, 17 Jun 2025 14:43:28 +0200	[thread overview]
Message-ID: <2e420055-3a1c-46fe-afac-4a15577f44fd@iogearbox.net> (raw)
In-Reply-To: <36baa0a5-43ac-44c1-bf30-34f34ddfceba@ovn.org>

On 6/17/25 1:59 PM, Ilya Maximets wrote:
> On 6/4/25 1:29 PM, Daniel Borkmann wrote:
>> Extend 'inhibit=on' setting with the option to specify a pinned XSK map
>> path along with a starting index (default 0) to push the created XSK
>> sockets into. Example usage:
>>
>>    # ./build/qemu-system-x86_64 [...] \
>>     -netdev af-xdp,ifname=enp2s0f0np0,id=net0,mode=native,queues=2,start-queue=14,inhibit=on,map-path=/sys/fs/bpf/xsks_map,map-start-index=14 \
>>     -device virtio-net-pci,netdev=net0 [...]
>>
>> This is useful for the case where an existing XDP program with XSK map
>> is present on the AF_XDP supported phys device and the XSK map is not
>> yet populated. For example, the former could have been pre-loaded onto
>> the netdevice by a control plane, which later launches qemu to populate
>> it with XSK sockets.
>>
>> Normally, the main idea behind 'inhibit=on' is that the qemu instance
>> doesn't need to have a lot of privileges to use the pre-loaded program
>> and the pre-created sockets, but this mentioned use-case here is different
>> where qemu still needs privileges to create the sockets.
>>
>> The 'map-start-index' parameter is optional and defaults to 0. It allows
>> flexible placement of the XSK sockets, and is up to the user to specify
>> when the XDP program with XSK map was already preloaded. In the simplest
>> case the queue-to-map-slot mapping is just 1:1 based on ctx->rx_queue_index
>> but the user might as well have a different scheme (or smaller map size,
>> e.g. ctx->rx_queue_index % max_size) to push the inbound traffic to one
>> of the XSK sockets.
>>
>> Note that the bpf_xdp_query_id() is now only tested for 'inhibit=off'
>> since only in the latter case the libxdp takes care of installing the
>> XDP program which was installed based on the s->xdp_flags pointing to
>> either driver or skb mode. For 'inhibit=on' we don't make any assumptions
>> and neither go down the path of probing all possible options in which
>> way the user installed the XDP program.
>>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>> Cc: Ilya Maximets <i.maximets@ovn.org>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Cc: Anton Protopopov <aspsk@isovalent.com>
>> ---
>>   net/af-xdp.c    | 80 +++++++++++++++++++++++++++++++++++++++++++++----
>>   qapi/net.json   | 29 +++++++++++-------
>>   qemu-options.hx | 23 ++++++++++++--
>>   3 files changed, 114 insertions(+), 18 deletions(-)
> 
> Hi, Daniel.  Thanks for v3!
> 
> checkpatch complains about 2 issues in the patch - a missing braces and
> onle too long line that can be wrapped.

Thanks for review, I wasn't aware of this, will fix these two in v4!

> There also seems to be some issue on a cleanup path that you attempt to
> fix in the second patch, so I reply about it there.
> 
> Best regards, Ilya Maximets.



      reply	other threads:[~2025-06-17 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 11:29 [PATCH v3 1/2] net/af-xdp: Support pinned map path for AF_XDP sockets Daniel Borkmann via
2025-06-04 11:29 ` [PATCH v3 2/2] net/af-xdp: Fix up cleanup path upon failure in queue creation Daniel Borkmann via
2025-06-17 11:59   ` Ilya Maximets
2025-06-17 13:03     ` Daniel Borkmann via
2025-06-17 21:41       ` Ilya Maximets
2025-06-18  8:00         ` Ilya Maximets
2025-06-17 11:59 ` [PATCH v3 1/2] net/af-xdp: Support pinned map path for AF_XDP sockets Ilya Maximets
2025-06-17 12:43   ` Daniel Borkmann via [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=2e420055-3a1c-46fe-afac-4a15577f44fd@iogearbox.net \
    --to=qemu-devel@nongnu.org \
    --cc=aspsk@isovalent.com \
    --cc=daniel@iogearbox.net \
    --cc=i.maximets@ovn.org \
    --cc=jasowang@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).