From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mail.toke.dk (Postfix) with ESMTPS id 9F27B9C5545 for ; Thu, 24 Nov 2022 02:47:54 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=oEe5viow Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7D6A4CE28E9; Thu, 24 Nov 2022 01:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A981BC433C1; Thu, 24 Nov 2022 01:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669254468; bh=30ui81BtWYvqNiwbcHBYCVSLtpLbzcn6sCg8Zp8V7Jo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oEe5viowAw+qqXHjHLZOI3bJmd9UUa2iZ8orYnG8d3+11zp+iXPMshFRNyiOXMfUn tqyysTJ3VXzU7ulxsBwH8pbW4oqNo0vAIDGdMiJ9igI6s4almt20oltaWnfAUVGxcc skHqmA07JezUiFQKazgD6zLJdhZNWWsye7qquH9eM9ZvQbPiP2udUbHmPHlV1H7dQu MiMgUFZ82EDOJFC1RrzDrklgJK1QA3mhxaKhlCYr2ZnTVmui7jTMkHDU8DK54fhs/a Klj+YmtuEt486GVvcJ32QP9R4g99DPNA181l4Uwwl98TbJsd3UXInY7bx5Y9uxWLZJ 9u7nCGmQi8NwQ== Date: Wed, 23 Nov 2022 17:47:46 -0800 From: Jakub Kicinski To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Message-ID: <20221123174746.418920e5@kernel.org> In-Reply-To: <871qptuyie.fsf@toke.dk> References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-7-sdf@google.com> <874jupviyc.fsf@toke.dk> <20221123111431.7b54668e@kernel.org> <871qptuyie.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FWAKNRIT4UUT6E2KVZIYKCLA7XANZVBD X-Message-ID-Hash: FWAKNRIT4UUT6E2KVZIYKCLA7XANZVBD X-MailFrom: kuba@kernel.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: sdf@google.com, bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, Tariq Toukan , David Ahern , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 6/8] mlx4: Introduce mlx4_xdp_buff wrapper for xdp_buff List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, 23 Nov 2022 22:55:21 +0100 Toke H=C3=B8iland-J=C3=B8rgensen 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 --- */ =20 >=20 > 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.