[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221123174746.418920e5@kernel.org>
Date: Wed, 23 Nov 2022 17:47:46 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: sdf@...gle.com, bpf@...r.kernel.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, martin.lau@...ux.dev,
song@...nel.org, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, haoluo@...gle.com, jolsa@...nel.org,
Tariq Toukan <tariqt@...dia.com>,
David Ahern <dsahern@...il.com>,
Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org
Subject: Re: [xdp-hints] Re: [PATCH bpf-next v2 6/8] mlx4: Introduce
mlx4_xdp_buff wrapper for xdp_buff
On Wed, 23 Nov 2022 22:55:21 +0100 Toke Høiland-Jørgensen wrote:
> > Good idea, prototyped below, lmk if it that's not what you had in mind.
> >
> > struct xdp_buff_xsk {
> > struct xdp_buff xdp; /* 0 56 */
> > u8 cb[16]; /* 56 16 */
> > /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
>
> As pahole helpfully says here, xdp_buff is actually only 8 bytes from
> being a full cache line. I thought about adding a 'cb' field like this
> to xdp_buff itself, but figured that since there's only room for a
> single pointer, why not just add that and let the driver point it to
> where it wants to store the extra context data?
What if the driver wants to store multiple pointers or an integer or
whatever else? The single pointer seems quite arbitrary and not
strictly necessary.
> I am not suggesting to make anything variable-size; the 'void *drv_priv'
> is just a normal pointer. There's no changes to any typing; not sure
> where you got that from, Jakub?
Often the descriptor pointer is in the same stack frame as the xdp_buff
(or close enough). The point of adding the wrapping structure is to be
able to move the descriptor pointer into a known place and then there's
no extra store copying the descriptor pointer from one place on the
stack to another.
Powered by blists - more mailing lists