From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: 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>,
"Sarkar, Tirthendu" <tirthendu.sarkar@intel.com>,
"Simon Horman" <simon.horman@corigine.com>,
"Toke Høiland-Jørgensen" <toke@kernel.org>
Subject: Re: [PATCH v5 bpf-next 10/24] xsk: add new netlink attribute dedicated for ZC max frags
Date: Thu, 13 Jul 2023 20:58:53 +0200 [thread overview]
Message-ID: <ZLBJbWqT4Ej8bHfx@boxer> (raw)
In-Reply-To: <CAADnVQLKDratBrgvwHzXZBW9chH9SBXPhnXpExYwu0BbRVFPjQ@mail.gmail.com>
On Mon, Jul 10, 2023 at 06:09:28PM -0700, Alexei Starovoitov wrote:
> On Thu, Jul 6, 2023 at 1:47 PM Maciej Fijalkowski
> <maciej.fijalkowski@intel.com> wrote:
> >
> > Introduce new netlink attribute NETDEV_A_DEV_XDP_ZC_MAX_SEGS that will
> > carry maximum fragments that underlying ZC driver is able to handle on
> > TX side. It is going to be included in netlink response only when driver
> > supports ZC. Any value higher than 1 implies multi-buffer ZC support on
> > underlying device.
> >
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>
> I suspect something in this patch makes XDP bonding test fail.
> See BPF CI.
>
> I can reproduce the failure locally as well.
> test_progs -t bond
> works without the series and fails with them.
Hi Alexei,
this fails on second bpf_xdp_query() call due to non-zero (?) contents at the
end of bpf_xdp_query_opts struct - currently it looks as following:
$ pahole -C bpf_xdp_query_opts libbpf.so
struct bpf_xdp_query_opts {
size_t sz; /* 0 8 */
__u32 prog_id; /* 8 4 */
__u32 drv_prog_id; /* 12 4 */
__u32 hw_prog_id; /* 16 4 */
__u32 skb_prog_id; /* 20 4 */
__u8 attach_mode; /* 24 1 */
/* XXX 7 bytes hole, try to pack */
__u64 feature_flags; /* 32 8 */
__u32 xdp_zc_max_segs; /* 40 4 */
/* size: 48, cachelines: 1, members: 8 */
/* sum members: 37, holes: 1, sum holes: 7 */
/* padding: 4 */
/* last cacheline: 48 bytes */
};
Fix is either to move xdp_zc_max_segs up to existing hole or to zero out
struct before bpf_xdp_query() calls, like:
memset(&query_opts, 0, sizeof(struct bpf_xdp_query_opts));
query_opts.sz = sizeof(struct bpf_xdp_query_opts);
I am kinda confused as this is happening due to two things. First off
bonding driver sets its xdp_features to NETDEV_XDP_ACT_MASK and in turn
this implies ZC feature enabled which makes xdp_zc_max_segs being included
in the response (it's value is 1 as it's the default).
Then, offsetofend(struct type, type##__last_field) that is used as one of
libbpf_validate_opts() args gives me 40 but bpf_xdp_query_opts::sz has
stored 48, so in the end we go through the last 8 bytes in
libbpf_is_mem_zeroed() and we hit the '1' from xdp_zc_max_segs.
So, (silly) questions:
- why bonding driver defaults to all features enabled?
- why __last_field does not recognize xdp_zc_max_segs at the end?
Besides, I think i'll move xdp_zc_max_segs above to the hole. This fixes
the bonding test for me.
next prev parent reply other threads:[~2023-07-13 18:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 20:46 [PATCH v5 bpf-next 00/24] xsk: multi-buffer support Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 01/24] xsk: prepare 'options' in xdp_desc for multi-buffer use Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 02/24] xsk: introduce XSK_USE_SG bind flag for xsk socket Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 03/24] xsk: prepare both copy and zero-copy modes to co-exist Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 04/24] xsk: move xdp_buff's data length check to xsk_rcv_check Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 05/24] xsk: add support for AF_XDP multi-buffer on Rx path Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 06/24] xsk: introduce wrappers and helpers for supporting multi-buffer in Tx path Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 07/24] xsk: allow core/drivers to test EOP bit Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 08/24] xsk: add support for AF_XDP multi-buffer on Tx path Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 09/24] xsk: discard zero length descriptors in " Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 10/24] xsk: add new netlink attribute dedicated for ZC max frags Maciej Fijalkowski
2023-07-11 1:09 ` Alexei Starovoitov
2023-07-13 18:58 ` Maciej Fijalkowski [this message]
2023-07-13 23:02 ` Alexei Starovoitov
2023-07-14 9:17 ` Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 11/24] xsk: support mbuf on ZC RX Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 12/24] ice: xsk: add RX multi-buffer support Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 13/24] i40e: " Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 14/24] xsk: support ZC Tx multi-buffer in batch API Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 15/24] ice: xsk: Tx multi-buffer support Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 16/24] i40e: xsk: add TX " Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 17/24] xsk: add multi-buffer documentation Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 18/24] selftests/xsk: transmit and receive multi-buffer packets Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 19/24] selftests/xsk: add basic multi-buffer test Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 20/24] selftests/xsk: add unaligned mode test for multi-buffer Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 21/24] selftests/xsk: add invalid descriptor " Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 22/24] selftests/xsk: add metadata copy test for multi-buff Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 23/24] selftests/xsk: add test for too many frags Maciej Fijalkowski
2023-07-06 20:46 ` [PATCH v5 bpf-next 24/24] 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=ZLBJbWqT4Ej8bHfx@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=simon.horman@corigine.com \
--cc=tirthendu.sarkar@intel.com \
--cc=toke@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;
as well as URLs for NNTP newsgroup(s).