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 0EE549D29E5 for ; Tue, 20 Dec 2022 23:21:12 +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=QU5rXZY5 Received: by mail-pg1-x549.google.com with SMTP id a33-20020a630b61000000b00429d91cc649so7763859pgl.8 for ; Tue, 20 Dec 2022 14:21:11 -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=QU5rXZY51IYDtIPXczKfRymujAQRVfDedJDPJkcGvEijVm6FuEUYqMxlAuZ12pL6CW 77vlD+T9su0alS4MyN1dVME5HLHAKa5YJOd/pYprasBYX6DHO+Ypo/gncdzjdgPsRSS2 BsQl81SFjSFHy+dLj/WYPCgJSpgU3nBddGV2TBVw2/QCgq15ogVrhqoRDmbNjsM2X/kN x1p2gCGxhUxkXBVsXtld3REegAQGAskmKEnMCkD7MDxKGZHb2e8CZAYowodzh02P4+Uj SW/dYye/TcT4ZZkLRN+7oNXeX8wyes3GukvtcSyD70D34+Tttsvs2gkOCK1+Vbo9r01s 4SnA== 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=OtoMH2Mb1U7T7I/2YQVbsYHLfyZRBY3GTDFaIGb640wZbvw2OnF8OKFy4NKM6uWBiA FbbhMb3AhgteJ7u7NQ3zY7D6ebb9+48/fmEHGVhtdAW0TDnPjbu+UEL4ZLwxEJuJ6En7 h7HLqUvHEvJb6Gy1G810zLYqqQjHIvOh6UntET3+6FXUCkRcFRkVf327UmT//+WNnqKy i3NSQy+IkbTW43Fm8xQfW0+stH9e64Lac8WspbiAFTwTrj5LOJCngyDpK86TGgAMV3pH MDOMXvnt86GpSjGILXAA210sjFCxU4bzux3y0VhriSSMKLea6RT0ljzjQZLag1rBGYFr iD1w== X-Gm-Message-State: ANoB5pnZXICdDPQDIxVIbJEK3Q/wclIqsBEDU7KfhPCpNDX84Ewb23RX whqsgAIVCsSoa/F+ty7A+7wizQ0= X-Google-Smtp-Source: AA0mqf71FV3cUaHj89bBiQjY0b5r796mRu/GfHEUXAkRixdUA4v/absSYPLS6h9WtMd/hBG2Kwqiuzk= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a63:4420:0:b0:479:3eee:a727 with SMTP id r32-20020a634420000000b004793eeea727mr1699661pga.56.1671574870508; Tue, 20 Dec 2022 14:21:10 -0800 (PST) Date: Tue, 20 Dec 2022 14:20:40 -0800 In-Reply-To: <20221220222043.3348718-1-sdf@google.com> Mime-Version: 1.0 References: <20221220222043.3348718-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221220222043.3348718-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: Q7HTPOCSFGHXKUNZZUKERXOQIZYCYLCY X-Message-ID-Hash: Q7HTPOCSFGHXKUNZZUKERXOQIZYCYLCY X-MailFrom: 3VjWiYwMKCW0dOQRZZRWP.NZXiOa-STYediOa-acZUPNe.YPe@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 v5 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