From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by mail.toke.dk (Postfix) with ESMTPS id 4E0639DC6E0 for ; Thu, 12 Jan 2023 01:32:57 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=MNN9w+Nk Received: by mail-pg1-x549.google.com with SMTP id 38-20020a630b26000000b004773803dda1so7397033pgl.17 for ; Wed, 11 Jan 2023 16:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=rfJO+GQYze9TOg5vw18ss4rmZmF2LBjdqaB1j+Nx9Ls=; b=MNN9w+Nkh/ZccIep7WExqmWKm+6gGKyRw6rZXDLYMoWswZMxph+Kc0KzWPHUYOzEnW j/+mgIJDuluXpGJ5osuIQ8wks6r9lwI6DbmVqXJlXdkVP4tvWLuTQo7eOtd9xPQ4ODRN MY63d7Cda6rUC+fenbutfJ4MbAevtXT6DZD6PlBSIv42oT9fXO3F/3jnQg+RW4hMYazE krz4QNn+QXzIN/OgRcsUK3DSwBHhUsxsbUIz7QqHxMKjQY4ULTkxBh2Y0Wu3dqnPnL9a H83ZDsxBXa76J1N1OJPrA8lvW1JNftxkPD38kd6oYU1Hbi9LPAmWmnQNMn1DH81/qxrc RlsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=rfJO+GQYze9TOg5vw18ss4rmZmF2LBjdqaB1j+Nx9Ls=; b=roBGDEyiIn9Z+7eRqt3WO5yDCte7xEPxD8kzrdYg/Ffyz4PnoeAao87HVlbfaw7Njt ouavTE55GsSKvbKCtHZnD7LdiPzaH1ouFckzHz9cnCjSHbRTaStvE+w/qLC36cxFPAc5 OnTZhDAue9/9gxyBtETnjgeapPm5x4eLPISkRJRkJSR4ZUXowFl8gpwX6ylW3j5E3T/A FNdRM9pK4wbm8KXm7p0Ya0lMFI+vHJnZtrm1mEnGx+7KJYmMG0ojNbWofsldWmOJP5jU 91/HarbQREkFD3ePslEkDOKMfVlpp7Yv/Buaxy03PQvi93Scmz7pMPpCJTLuR4dK1yCS aPCA== X-Gm-Message-State: AFqh2krLZmMZLxDJgaHq6iRX3Z3pIIZ/8XJ8PLhaNkGsUYnhaZQOY7u3 AOKkTBDhCiXdnDvzwlsUCwh+LTY= X-Google-Smtp-Source: AMrXdXvPDC2WKfBiLM6HUbbUbv2YDnJ3aSNzXOS91uUtYO9tQ60VpIw0Ekhh3Gp1BjJB5Yut76MwTVc= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90a:9d82:b0:228:d2c5:5b35 with SMTP id k2-20020a17090a9d8200b00228d2c55b35mr572306pjp.98.1673483575307; Wed, 11 Jan 2023 16:32:55 -0800 (PST) Date: Wed, 11 Jan 2023 16:32:27 -0800 In-Reply-To: <20230112003230.3779451-1-sdf@google.com> Mime-Version: 1.0 References: <20230112003230.3779451-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230112003230.3779451-15-sdf@google.com> From: Stanislav Fomichev To: bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EG6BDDALXCDN2JLPBP7UJBLUERCTLZ67 X-Message-ID-Hash: EG6BDDALXCDN2JLPBP7UJBLUERCTLZ67 X-MailFrom: 3N1W_YwMKCQQwhjksskpi.gsq1ht-lmrxw1ht-tvsnigx.rix@flex--sdf.bounces.google.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: 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, sdf@google.com, haoluo@google.com, jolsa@kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , David Ahern , Jakub Kicinski , 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] [PATCH bpf-next v7 14/17] xsk: Add cb area to struct xdp_buff_xsk List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Toke H=C3=B8iland-J=C3=B8rgensen Add an area after the xdp_buff in struct xdp_buff_xsk that drivers can use to stash extra information to use in metadata kfuncs. The maximum size of 24 bytes means the full xdp_buff_xsk structure will take up exactly two cache lines (with the cb field spanning both). Also add a macro drivers can use to check their own wrapping structs against the available size. Cc: John Fastabend Cc: David Ahern Cc: Martin KaFai Lau Cc: Jakub Kicinski Cc: Willem de Bruijn Cc: Jesper Dangaard Brouer Cc: Anatoly Burakov Cc: Alexander Lobakin Cc: Magnus Karlsson Cc: Maryam Tahhan Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Suggested-by: Jakub Kicinski Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Stanislav Fomichev --- include/net/xsk_buff_pool.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h index f787c3f524b0..3e952e569418 100644 --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -19,8 +19,11 @@ struct xdp_sock; struct device; struct page; =20 +#define XSK_PRIV_MAX 24 + struct xdp_buff_xsk { struct xdp_buff xdp; + u8 cb[XSK_PRIV_MAX]; dma_addr_t dma; dma_addr_t frame_dma; struct xsk_buff_pool *pool; @@ -28,6 +31,8 @@ struct xdp_buff_xsk { struct list_head free_list_node; }; =20 +#define XSK_CHECK_PRIV_TYPE(t) BUILD_BUG_ON(sizeof(t) > offsetofend(struct= xdp_buff_xsk, cb)) + struct xsk_dma_map { dma_addr_t *dma_pages; struct device *dev; --=20 2.39.0.314.g84b9a713c41-goog