From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: "Sarkar, Tirthendu" <tirthendu.sarkar@intel.com>
Cc: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
"Stanislav Fomichev" <sdf@google.com>, bpf <bpf@vger.kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Network Development" <netdev@vger.kernel.org>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
"Björn Töpel" <bjorn@kernel.org>
Subject: Re: [PATCH bpf-next 01/21] xsk: prepare 'options' in xdp_desc for multi-buffer use
Date: Wed, 24 May 2023 12:27:30 +0200 [thread overview]
Message-ID: <ZG3mkn3gvLmXDUZE@boxer> (raw)
In-Reply-To: <SN7PR11MB66554BA6BE57F4CBB407B88290419@SN7PR11MB6655.namprd11.prod.outlook.com>
On Wed, May 24, 2023 at 10:56:21AM +0200, Sarkar, Tirthendu wrote:
> > -----Original Message-----
> > From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> > Sent: Friday, May 19, 2023 10:44 PM
> > To: Stanislav Fomichev <sdf@google.com>
> > Cc: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>; bpf
> > <bpf@vger.kernel.org>; Alexei Starovoitov <ast@kernel.org>; Daniel
> > Borkmann <daniel@iogearbox.net>; Andrii Nakryiko <andrii@kernel.org>;
> > Network Development <netdev@vger.kernel.org>; Karlsson, Magnus
> > <magnus.karlsson@intel.com>; Sarkar, Tirthendu
> > <tirthendu.sarkar@intel.com>; Björn Töpel <bjorn@kernel.org>
> > Subject: Re: [PATCH bpf-next 01/21] xsk: prepare 'options' in xdp_desc for
> > multi-buffer use
> >
> > On Thu, May 18, 2023 at 12:22 PM Stanislav Fomichev <sdf@google.com>
> > wrote:
> > >
> > > On 05/18, Maciej Fijalkowski wrote:
> > > > From: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> > > >
> > > > Use the 'options' field in xdp_desc as a packet continuity marker. Since
> > > > 'options' field was unused till now and was expected to be set to 0, the
> > > > 'eop' descriptor will have it set to 0, while the non-eop descriptors
> > > > will have to set it to 1. This ensures legacy applications continue to
> > > > work without needing any change for single-buffer packets.
> > > >
> > > > Add helper functions and extend xskq_prod_reserve_desc() to use the
> > > > 'options' field.
> > > >
> > > > Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> > > > ---
> > > > include/uapi/linux/if_xdp.h | 16 ++++++++++++++++
> > > > net/xdp/xsk.c | 8 ++++----
> > > > net/xdp/xsk_queue.h | 12 +++++++++---
> > > > 3 files changed, 29 insertions(+), 7 deletions(-)
> > > >
> > > > diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h
> > > > index a78a8096f4ce..4acc3a9430f3 100644
> > > > --- a/include/uapi/linux/if_xdp.h
> > > > +++ b/include/uapi/linux/if_xdp.h
> > > > @@ -108,4 +108,20 @@ struct xdp_desc {
> > > >
> > > > /* UMEM descriptor is __u64 */
> > > >
> > > > +/* Flag indicating that the packet continues with the buffer pointed out
> > by the
> > > > + * next frame in the ring. The end of the packet is signalled by setting
> > this
> > > > + * bit to zero. For single buffer packets, every descriptor has 'options'
> > set
> > > > + * to 0 and this maintains backward compatibility.
> > > > + */
> > > > +#define XDP_PKT_CONTD (1 << 0)
> > > > +
> > > > +/* Maximum number of descriptors supported as frags for a packet. So
> > the total
> > > > + * number of descriptors supported for a packet is
> > XSK_DESC_MAX_FRAGS + 1. The
> > > > + * max frags supported by skb is 16 for page sizes greater than 4K and 17
> > or
> > >
> > > This is now a config option CONFIG_MAX_SKB_FRAGS. Can we use it
> > > directly?
> >
> > Also it doesn't look right to expose kernel internal config in uapi
> > especially since XSK_DESC_MAX_FRAGS is not guaranteed to be 16.
>
> Ok, we have couple of options here:
>
> Option 1: We will define XSK_DESC_MAX_FRAGS to 17 now. This will ensure AF_XDP
> applications will work on any system without any change since the MAX_SKB_FRAGS
> is guaranteed to be at least 17.
>
> Option 2: Instead of defining a new macro, we say max frags supported is same as
> MAX_SKB_FRAGS as configured in your system. So use 17 or less frags if you want
> your app to work everywhere but you can go larger if you control the system.
>
> Any suggestions ?
>
> Also Alexei could you please clarify what you meant by ".. since XSK_DESC_MAX_FRAGS
> is not guaranteed to be 16." ?
Maybe it would be better to put this define onto patch 08 so people would
see how it is used and get a feeling of it? Although it has a description
nothing says about it in commit message.
FWIW i'm voting for option 2, but also Alexei's comment is a bit unclear
to me, would be nice to hear more about it.
next prev parent reply other threads:[~2023-05-24 10:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 18:05 [PATCH bpf-next 00/21] xsk: multi-buffer support Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 01/21] xsk: prepare 'options' in xdp_desc for multi-buffer use Maciej Fijalkowski
2023-05-18 19:22 ` Stanislav Fomichev
2023-05-19 17:13 ` Alexei Starovoitov
2023-05-24 8:56 ` Sarkar, Tirthendu
2023-05-24 10:27 ` Maciej Fijalkowski [this message]
2023-05-24 14:12 ` Alexei Starovoitov
2023-05-24 16:20 ` Stanislav Fomichev
2023-05-24 16:27 ` Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 02/21] xsk: introduce XSK_USE_SG bind flag for xsk socket Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 03/21] xsk: prepare both copy and zero-copy modes to co-exist Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 04/21] xsk: move xdp_buff's data length check to xsk_rcv_check Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 05/21] xsk: add support for AF_XDP multi-buffer on Rx path Maciej Fijalkowski
2023-05-19 9:42 ` Simon Horman
2023-05-24 10:28 ` Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 06/21] xsk: introduce wrappers and helpers for supporting multi-buffer in Tx path Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 07/21] xsk: allow core/drivers to test EOP bit Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 08/21] xsk: add support for AF_XDP multi-buffer on Tx path Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 09/21] xsk: discard zero length descriptors in " Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 10/21] xsk: support mbuf on ZC RX Maciej Fijalkowski
2023-05-18 21:06 ` kernel test robot
2023-05-18 18:05 ` [PATCH bpf-next 11/21] ice: xsk: add RX multi-buffer support Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 12/21] xsk: support ZC Tx multi-buffer in batch API Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 13/21] xsk: report ZC multi-buffer capability via xdp_features Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 14/21] ice: xsk: Tx multi-buffer support Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 15/21] selftests/xsk: transmit and receive multi-buffer packets Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 16/21] selftests/xsk: add basic multi-buffer test Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 17/21] selftests/xsk: add unaligned mode test for multi-buffer Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 18/21] selftests/xsk: add invalid descriptor " Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 19/21] selftests/xsk: add metadata copy test for multi-buff Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 20/21] selftests/xsk: add test for too many frags Maciej Fijalkowski
2023-05-18 18:05 ` [PATCH bpf-next 21/21] selftests/xsk: reset NIC settings to default after running test suite Maciej Fijalkowski
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=ZG3mkn3gvLmXDUZE@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=tirthendu.sarkar@intel.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).