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 30EF79C80A4 for ; Tue, 29 Nov 2022 20:35:09 +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=mwzFMQHX Received: by mail-pl1-x649.google.com with SMTP id h16-20020a170902f55000b001871b770a83so14375657plf.9 for ; Tue, 29 Nov 2022 11:35:09 -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=LWDX6e0cj1Yq+chnlf+AJrNTZ0k1bmxGFANkxMRBzk8=; b=mwzFMQHXcovMhDNjapMZrvpGoUMIZ4+kq6mJGv0IWid5yeUAAvLE3+JoeOuWj2Onw4 waaywLZoFbAj7HcTA+DuY/qPgWH/6VUHIrm5B3hibvKFeXZ1mfclW3axlOfHZgjOZoGC OINq0yCAZJFVTYf1Vx2eo5CmE7gtkpfRD0iPWU5DeTos3Sb4HrKFi8WJwP+EW4+cFMBz twhXpEb9jT0U+ZfuX75T6AerjhkECb2KQCqdkDQHrpgbpaqRldJ1jVgb07QKY8XMSMPg mnjdF7eD23/lnVfQTEQ+DW/7ZByil4IDp4pkiEwwsfKoBo1HGdC7KQmgXg/LrDCMMedL iTRQ== 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=LWDX6e0cj1Yq+chnlf+AJrNTZ0k1bmxGFANkxMRBzk8=; b=HPpy8vqm+OR2qLoG4e5IIW8c62D2tI47HwPx7+BX2JWHOWbN13H4KCIyLZUCLNqlcO H4/TapY7fPlCHufHXtHYkSh9nEO4sWwg1j8F3qUj3hVcAO4/RrbgW+Bc7ZAMy8rlovcv wRZ10J2JRWMHwVP4ZFvVHceebOBCla4lPxDXCPYGXFi0F1O27Bs1tojjGBsDVuLet/5f I+Aq12pH4b3q04v4yGSTlfg8t0BAvglkIil0MW2+rbgBq8L6se/H9YgF8ApTMOfXUYP4 K4C6I7I/JUlmGOhhLp0o+Hpl9FrmcZ/17cZ+zyUDv/CmkD5mhBqW55LiIp96fw2b+CWs Rmow== X-Gm-Message-State: ANoB5pk+KUyzyKVAyE95NnlYcMxJaTIKRl9Q4/2DxZMJNwYOWooEluSc 6MPKwy5GlryjbOqjQ/xH8xs2EC8= X-Google-Smtp-Source: AA0mqf6AVwgAGav6M+opXS21wbL57Jq4TD/QP4soKIby0MQez1x5WQlLFQwvuHxAVY/ksjaj6TSBkCc= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a63:1659:0:b0:46e:f23a:e9aa with SMTP id 25-20020a631659000000b0046ef23ae9aamr35336799pgw.428.1669750507608; Tue, 29 Nov 2022 11:35:07 -0800 (PST) Date: Tue, 29 Nov 2022 11:34:49 -0800 In-Reply-To: <20221129193452.3448944-1-sdf@google.com> Mime-Version: 1.0 References: <20221129193452.3448944-1-sdf@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221129193452.3448944-9-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: R665OFHJTMOFFITJSI3DLQOP7W2UGBRX X-Message-ID-Hash: R665OFHJTMOFFITJSI3DLQOP7W2UGBRX X-MailFrom: 3616GYwMKCeQYJLMUUMRK.IUSdJV-NOTZYdJV-VXUPKIZ.TKZ@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 v3 08/11] 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 --- 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.38.1.584.g0f3c55d4c2-goog