From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by mail.toke.dk (Postfix) with ESMTPS id D70709D92D4 for ; Wed, 4 Jan 2023 23:00:15 +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=UgN+5U7A Received: by mail-pf1-x449.google.com with SMTP id n22-20020a62e516000000b005817b3a197aso9946081pff.14 for ; Wed, 04 Jan 2023 14:00:15 -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=UgN+5U7AwdFy3wokiMPqJj/3rNQgM6rvQldU9Tt3xkUhVJtG9QQSI/KXwWNUZQhsUh p2ReVJKVGsvUbq9CY076DBiojhMMBzlGzc/dKnpStfAKWsZpDUZq6IvevSxzjjKpflq3 qptZ+jCRCpZQUtYPiWSiLrwSLksWamrIIuQv4x0XN3nD5AqR1B/w1JieR023nUH/EsvG Y19AJkmB0bGeJiOqrVceZvUwMx/MP89Np1kCP2+rIK82be9+FGW3+1qXBBJ7wv+bv6xf EodrnF5G0ybZAyYmtS/ueMSCVd9NWThnMpDiA7UBYekYT3LK6vY0JiXmLmkjbJmjn+p/ oP7A== 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=FBi0tnocCNSJ2iOIWVLA2FCwsbv4/5iGX2xy56lsgXaF000+9HmCSOgGP5Bf5057Ua DelR70/27C5ocp/Sj+y6wJBkXnjoNJeupn4lxv1I43jmfqx8mY+8v6LodozZrZ02GYfP de4Zf90xNPjLjoWQ0x2MxJLF4QWjjMLnGO5XoI8W+/KWV5m0qHr/wN1m0JnwHcvOo4h3 E0UwVGklQA2vDRuSDNGBV7p6CswpdlMgTRawbm7Wg0XAQ/Egu+7ZXelJ1RKO9hNqSBNZ rJNBDu1AS2VZvW+Zq1Hg2TEu5gLYkNJTEN2/WCXiR5wW+NpMAO5RsHmVYWQjo/U1tpPp up+w== X-Gm-Message-State: AFqh2ko16f9TiXacPDn2/QTcieQbarb+nIQOHUeUasHhO4dWOn3yK0H6 0Qik+FtQMask/nEmdVPqNS4g38c= X-Google-Smtp-Source: AMrXdXsNC3IVgkpL/uKDWGz/ihEARird1EJTq8ulZNnDQhJD9yhVjeTzP3t4jP0aU+IWL/EwWYE+MQs= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:902:d585:b0:189:af2b:ebb1 with SMTP id k5-20020a170902d58500b00189af2bebb1mr2847509plh.35.1672869614304; Wed, 04 Jan 2023 14:00:14 -0800 (PST) Date: Wed, 4 Jan 2023 13:59:46 -0800 In-Reply-To: <20230104215949.529093-1-sdf@google.com> Mime-Version: 1.0 References: <20230104215949.529093-1-sdf@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230104215949.529093-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: 4KQS6UCJOUYTGF5LCF4CDOYGKGMT4234 X-Message-ID-Hash: 4KQS6UCJOUYTGF5LCF4CDOYGKGMT4234 X-MailFrom: 37va1YwMKCdcL689HH9E7.5HFQ6I-ABGMLQ6I-IKHC75M.G7M@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 v6 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