From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by mail.toke.dk (Postfix) with ESMTPS id 307279C5262 for ; Wed, 23 Nov 2022 19:26:53 +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=BqQX3hXI Received: by mail-ot1-x32c.google.com with SMTP id l42-20020a9d1b2d000000b0066c6366fbc3so11743008otl.3 for ; Wed, 23 Nov 2022 10:26:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KxZjY6uw2Em3G53xRNjX7Yz5BdGbdDp2xXgPi2K5u5I=; b=BqQX3hXI6U7DtzeBOpFFIfBSHY9lS4Uqg4Xunm/HpEJV9/wnSAXNp2p+K7cD6e2wkC 1i3emLFOQY+6sLFLSrR6hHW/iru3zOE3HGi64ZW6VLFsT5MvajRUn79Vo7ova6r/MVZ+ If0iGz3+Cif+Od3X8j1lJ4C15eDJmogdYOJxzQ9wi6ctrmkkicgyIR9WX25v6+Buo/TB KsdV18Yq8pfuSMi9/aavmdk4ft50bX79z/vlpHovzcgjvk+hXwxq2AmDerQw+nuOGEZ3 R+uN25QTGBNS2Nsaq7y9KB+A1sPXDhCraPImpUwIcpfT2e40dHlyHi/5soRS6NgrIbpb fE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KxZjY6uw2Em3G53xRNjX7Yz5BdGbdDp2xXgPi2K5u5I=; b=KvghhMKBsN4O1jrqo/2VtnCXxOB6m8B/9KgpGVWDeUSozgrj8plywbXXgHVRPrdACR IRd3MfgwKHA07gOsJjU81yzYDZ5eqBal/dVI0zAW4WhkVlX3liZOAIxSZHnANsgRUfjr PahUK/mhBi/lyFS29G9btZIkAV9Nof7HdchKwx78kxbn+uoGKjG8P8SadAugbT6v2T3g 25Mffr2KF+bJH/7RgXfnJ6BmQnaH9a1wX086KQhBdDaK73oWmDMx7aJS+cZ0ssZOJ1Xi 7SKtFNBieBKe5Q0AoPI1dskPWjLs5OqrtNvEax34cPvBv6VB7avx8o696LFWMngMvLYT xO4Q== X-Gm-Message-State: ANoB5pmca014a/KcBylq1eXyNv7lwcljIZaxXgq0jviO6db7OJvvADMk mAjy7MO6VkT9/3m4doc4Jch9eL8IckXMsJgqeiq4Vw== X-Google-Smtp-Source: AA0mqf4t1u7CbP4t6YEydv4SOZrmpX7bzb9Yb0ZC52xR1t9Zl1+EAmsnKImYBxyr5Gu1bqCLRd5rg6uuBsyvFA0OFvU= X-Received: by 2002:a05:6830:18d3:b0:66c:dd29:813d with SMTP id v19-20020a05683018d300b0066cdd29813dmr6427677ote.312.1669228011980; Wed, 23 Nov 2022 10:26:51 -0800 (PST) MIME-Version: 1.0 References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-7-sdf@google.com> <874jupviyc.fsf@toke.dk> In-Reply-To: <874jupviyc.fsf@toke.dk> From: Stanislav Fomichev Date: Wed, 23 Nov 2022 10:26:41 -0800 Message-ID: To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4BVNC7M7ZIEDRECKKBSVGTPMRWVNAVWN X-Message-ID-Hash: 4BVNC7M7ZIEDRECKKBSVGTPMRWVNAVWN X-MailFrom: sdf@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: bpf@vger.kernel.org, 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, haoluo@google.com, jolsa@kernel.org, Tariq Toukan , 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] Re: [PATCH bpf-next v2 6/8] mlx4: Introduce mlx4_xdp_buff wrapper for xdp_buff List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Nov 23, 2022 at 6:33 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Stanislav Fomichev writes: > > > No functional changes. Boilerplate to allow stuffing more data after xd= p_buff. > > > > Cc: Tariq Toukan > > 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 > > Signed-off-by: Stanislav Fomichev > > --- > > drivers/net/ethernet/mellanox/mlx4/en_rx.c | 26 +++++++++++++--------- > > 1 file changed, 15 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/e= thernet/mellanox/mlx4/en_rx.c > > index 8f762fc170b3..467356633172 100644 > > --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c > > +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c > > @@ -661,17 +661,21 @@ static int check_csum(struct mlx4_cqe *cqe, struc= t sk_buff *skb, void *va, > > #define MLX4_CQE_STATUS_IP_ANY (MLX4_CQE_STATUS_IPV4) > > #endif > > > > +struct mlx4_xdp_buff { > > + struct xdp_buff xdp; > > +}; > > This embedding trick works for drivers that put xdp_buff on the stack, > but mlx5 supports XSK zerocopy, which uses the xsk_buff_pool for > allocating them. This makes it a bit awkward to do the same thing there; > and since it's probably going to be fairly common to do something like > this, how about we just add a 'void *drv_priv' pointer to struct > xdp_buff that the drivers can use? The xdp_buff already takes up a full > cache line anyway, so any data stuffed after it will spill over to a new > one; so I don't think there's much difference performance-wise. I guess the alternative is to extend xsk_buff_pool with some new argument for xdp_buff tailroom? (so it can kmalloc(sizeof(xdp_buff) + xdp_buff_tailroom)) But it seems messy because there is no way of knowing what the target device's tailroom is, so it has to be a user setting :-/ I've started with a priv pointer in xdp_buff initially, it seems fine to go back. I'll probably convert veth/mlx4 to the same mode as well to avoid having different approaches in different places.. > I'll send my patch to add support to mlx5 (using the drv_priv pointer > approach) separately. Saw them, thanks! Will include them in v3+.