From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by mail.toke.dk (Postfix) with ESMTPS id C79459CB637 for ; Tue, 6 Dec 2022 03:46:11 +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=gEkfVyQr Received: by mail-pf1-x44a.google.com with SMTP id 67-20020a621946000000b00575f8210320so12183964pfz.10 for ; Mon, 05 Dec 2022 18:46: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=UZy6zkebzShtYgGpy5Q+YTSoYFTyeOrDSEuSxWCy75g=; b=gEkfVyQr2QEqHozM41NVEezWgDGZdZIBfvzgPcTfCPyceYMSkeXlrqRMw7zaQqL8MO hR4VBqJDzmJNJTWNgC4OYelhGM/7M08tKcdVxcsDaVNCfRuwn84eeRgZ5N9h7bUppixg u/wKNuKOdbQDs3QTNCcFvnVaZbdpoWt+rf6lu9cdhL5R45pNci/OjGriKv/hm0T3aQLz qrOU2ySKoSm0qcVAt2zhN5qnNQgRXsMgmqmwZ9HCid1BEk1J9PLO7OLO+WBg9VP84mOJ Q7/raNxMa+xuCB+3Em+2NMc10SDyX5PatQ1+Vjbt6yZ91S8Wzb0mItKwIE/JomAJyMl5 /N6Q== 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=UZy6zkebzShtYgGpy5Q+YTSoYFTyeOrDSEuSxWCy75g=; b=M3HtsJLNE5Xr7tJ0h0Yf2iC/QOfz51N/xmG5pnIsXAF9XW7p4YwsijYiyEt3mOWwOE wAM2HD+OXl3VEt7uldk7+1m1/rxSnCc11lpp/P+mTBMvdrqk6dRrToQ1R5jnJvuAFevT ww6SY9BmOXRUmAPNXIjuY4RunTR9qrJpo3vRmvQDz6ED5lU+48KB6DkNC+1qlZVrPC3F Ri/fsNxAWC9gPwNKkl2zg1+UQgDWw/msROM1sbMJCuS14KufUvSguaATBb5Rup0OZAHn 9Ie4lIAJUVZVmoy5VPToAJOgAdM1JpwXHfydE0N5z59OizFw9F7LlV2bTFJr7yKBy29Y yuRg== X-Gm-Message-State: ANoB5plfwor3dnQGzEpc/Ms3r7CgmVCEBEV742vP22F1dBCRJ9OaEvfN 5ujlKzYjq3QYrT9YdriFTgsVxP4= X-Google-Smtp-Source: AA0mqf4UnF9Fm2sPRgnEv5gKJQEmAPOG7F3MItD2A0LrJSE/fNUiN5si6iC2lnB4PRUxcUoxSy2nLOo= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a05:6a00:22ca:b0:56e:64c8:f222 with SMTP id f10-20020a056a0022ca00b0056e64c8f222mr89232750pfj.71.1670294771338; Mon, 05 Dec 2022 18:46:11 -0800 (PST) Date: Mon, 5 Dec 2022 18:45:51 -0800 In-Reply-To: <20221206024554.3826186-1-sdf@google.com> Mime-Version: 1.0 References: <20221206024554.3826186-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221206024554.3826186-10-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: 4EBW3KCGH2M4CLFZPUNQ7J4Z5WK65GAB X-Message-ID-Hash: 4EBW3KCGH2M4CLFZPUNQ7J4Z5WK65GAB X-MailFrom: 386yOYwMKCaocNPQYYQVO.MYWhNZ-RSXdchNZ-ZbYTOMd.XOd@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 09/12] 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.rc0.267.gcb52ba06e7-goog