From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 0B45A9C5A72 for ; Thu, 24 Nov 2022 15:39:26 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AfElupYd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669300765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+3FowlCkscYvKLx4wTFMB8o1uGfVIz6IqPvvH3GNMtQ=; b=AfElupYdJ4GAp7KVJ9c+u5eqlCs2x0Meh97zcd5GOK174xc5FYDX74T+6LGYKVaS+LNPBe iZPXplayoBxsajyez07uuAhoUghXao3yAzHvX7c5kZT4ALkCKVaaz/ksmk5Xdd+7tB28Of n6TmxMoF+3G/FSoKPdBEpMcudwgAdlk= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-373-k4FHf4prOUqHd5Mihn2sGg-1; Thu, 24 Nov 2022 09:39:23 -0500 X-MC-Unique: k4FHf4prOUqHd5Mihn2sGg-1 Received: by mail-ej1-f72.google.com with SMTP id hs34-20020a1709073ea200b007ad86f91d39so1282822ejc.10 for ; Thu, 24 Nov 2022 06:39:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8mJnFbVs40A7D4ZzDs8Lc+Kdvts8cL8H9xlqZ07soV0=; b=e4KIKS0ujcAAAkStJigcshOQnQkh6nSuC9JGPruNcT8ZfJp8rhLUaMLMYP+oqVi0Zf J/RiVQn1UYaEpyj7ezBEs5qIe/onQhtEXkkvmth17EVhb57XvGdaDkc8qFcZltlRxmC3 YQA+gw+3s32ZejWW3wrobr7DNGKMNn0ygkn4wTMu8gkt2N3hG2hdM6LPwbsp72T2DV2Q T3ibhDxCNHnV+EBut34oNZVGHqg623/U70eih8r2LfOI/P742UgtMwoeEuc5ID1RSTNU R1ZN/vfqZ5SNVkQYQRW7TGfYXsiWuxPWqrCQEqRECv1/h6zL3bNkThJaWsjaifx5DUA/ TAcA== X-Gm-Message-State: ANoB5pmes3XW+hT7EJzqaH0kHKhKoA52FEOz6wTP2eeLS6ZcUT6IHzKK oL7kNSSqn0/zLlA+baChAyXUKqNNI5mI5Ug8xW/QIPCXo5LYi1lP6JX+0COelJq/UvnAVoJdktg XDUI180JGat+vKto+RCqZ X-Received: by 2002:a17:906:c56:b0:78d:b8ab:9a5a with SMTP id t22-20020a1709060c5600b0078db8ab9a5amr28088769ejf.454.1669300762372; Thu, 24 Nov 2022 06:39:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fZ5Oxr0fBQt/B7kIaDLbn9fUvoou028z3SN62lTwDvqwBr2BEhV/Zkmc3Y7kmH1EV/wI24Q== X-Received: by 2002:a17:906:c56:b0:78d:b8ab:9a5a with SMTP id t22-20020a1709060c5600b0078db8ab9a5amr28088733ejf.454.1669300762035; Thu, 24 Nov 2022 06:39:22 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id 11-20020a170906300b00b00781e7d364ebsm483760ejz.144.2022.11.24.06.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 06:39:21 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id C14317EB634; Thu, 24 Nov 2022 15:39:20 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Jakub Kicinski In-Reply-To: <20221123174746.418920e5@kernel.org> 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> <20221123174746.418920e5@kernel.org> X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 24 Nov 2022 15:39:20 +0100 Message-ID: <87edts2z8n.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: E6VK5TGMRD26RAHBJI4GW4KIQOCZHIOB X-Message-ID-Hash: E6VK5TGMRD26RAHBJI4GW4KIQOCZHIOB X-MailFrom: toke@redhat.com 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: Jakub Kicinski writes: > 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 { >> > =09struct xdp_buff xdp; /* 0 56 */ >> > =09u8 cb[16]; /* 56 16 */ >> > =09/* --- 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. Well, then you allocate a separate struct and point to that? Like I did in mlx5: +=09struct mlx5_xdp_ctx mlctx =3D { .cqe =3D cqe, .rq =3D rq }; +=09struct xdp_buff xdp =3D { .drv_priv =3D &mlctx }; but yeah, this does give an extra pointer deref on access. I'm not really opposed to the cb field either, I just think it's a bit odd to put it in struct xdp_buff_xsk; that basically requires the driver to keep the layouts in sync. Instead, why not but a cb field into xdp_buff itself so it can be used for both the XSK and the non-XSK paths? Then the driver can just typecast the xdp_buff into its own struct that has whatever data it wants in place of the cb field? -Toke