From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by mail.toke.dk (Postfix) with ESMTPS id E5B259CF2BB for ; Tue, 13 Dec 2022 03:36:28 +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=Hjf6Mn54 Received: by mail-pl1-x649.google.com with SMTP id u10-20020a17090341ca00b001897a151311so11811989ple.8 for ; Mon, 12 Dec 2022 18:36:28 -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=EOrvK1gw9vfZIaV6escFweupEfR/SySrD3QD5/GqZUQ=; b=Hjf6Mn54lrEHFalZ3MDUKajTGcbTWEGqXALxq9bDY7Gk6dNlUM5uQOS8qPVZ6M632t Vz/mm9XBf1PYnBL9Omy7BnGiTrY9vhEt7wcMEqs3UQ8M/BWrjYMtMpc01WG55TO7TAUX qSkPhYqWK/Gq4xY/S4JOrrlAZA4rpl3gxDQasKBc2HVc2jXH2gFV2AMIHb28en5KtRfh PYTXf4HA7+xg9H0NU7bPGlfxS3nH9nxSIWDJAxpOzxepGt5N93GNvuUGnYBCreqiTAeg zzrcegDY83gyx/EYtTosPB5+lmPFNVX9wiAYDtjZyFaUU0XY9D1z0VUpp9qLoV6oCOIy 3tQg== 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=EOrvK1gw9vfZIaV6escFweupEfR/SySrD3QD5/GqZUQ=; b=IAt4QRXZwrNXVJUD5euNvWJ5yFlazZigRv+PqGDST4gr4ZYK/up29Ntc7D+slPrFFW scgmquVL+Z/w2UY2QUgvVrfWM6Rmb5sq7botYZHFCGK85Z5BNCf3efC0HlcTj3Arxt9m SmArqhsUKYQtbPC3zNsJzDSGOkUtTRbF3tMCVt5HOj07WK8wFyJGZDqa+l5E9FcEtsyt +a7d5S1bFBL55kSTSZS/KRgFhianeniHfddPkKfOll9iHn3CiuohvcIcLx0YWMIZFaPK tTNj4SkJ2MzvFWCuxwWQlgYWsMR7LxeGCiCSv/raHzCh75ZVdqYDI6JhHBBfTeq+DaQq Srsw== X-Gm-Message-State: ANoB5pnghtObFHlNKPseX+zeriOWzagJChmLXF05DrDcEM+YLal4ZTJN q8reqX+767U+2lHOcAKX7pXHHnA= X-Google-Smtp-Source: AA0mqf5Yezl460xdj2mhHHtqGgfZz/ZzIk5c7VQN31jyGdgaoqi+dk4UuU0g3JO+ktli9sB56GKm2Eo= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90b:1010:b0:219:1d0a:34a6 with SMTP id gm16-20020a17090b101000b002191d0a34a6mr11500pjb.1.1670898987095; Mon, 12 Dec 2022 18:36:27 -0800 (PST) Date: Mon, 12 Dec 2022 18:36:02 -0800 In-Reply-To: <20221213023605.737383-1-sdf@google.com> Mime-Version: 1.0 References: <20221213023605.737383-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog Message-ID: <20221213023605.737383-13-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: OVXNQRJ77KMRQOWQEEQBIVQ2ZTVEX45K X-Message-ID-Hash: OVXNQRJ77KMRQOWQEEQBIVQ2ZTVEX45K X-MailFrom: 3K-WXYwMKCXgoZbckkcha.YkitZl-dejpotZl-lnkfaYp.jap@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 v4 12/15] 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.rc1.256.g54fd8350bd-goog