From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mail.toke.dk (Postfix) with ESMTPS id 3D24A9C511D for ; Wed, 23 Nov 2022 15:33:53 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I+Yejqnw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669214032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VEC/ljsECl0xwOwNuuFj4J2VWL3DFQIVZWJ6dvR2khs=; b=I+YejqnwNHO7xBlt/tdaJ7fCz2mx8IOTVOM83br1NOdkAQlMvqlzqqvXkw2GzllpSNbnA9 KX8DU5x1mPOV2Iq99TKqnJQ9BfjCN+hkMSJLbXsMCr82PTaeAHDUU56AeZbZa6UfVcx7/D VV27OzemNq0awNbyTTqBeXxk7iM1+gM= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-570-w-xyMm8iNsWF5KxihZeIzw-1; Wed, 23 Nov 2022 09:33:50 -0500 X-MC-Unique: w-xyMm8iNsWF5KxihZeIzw-1 Received: by mail-ed1-f72.google.com with SMTP id dz9-20020a0564021d4900b0045d9a3aded4so10765556edb.22 for ; Wed, 23 Nov 2022 06:33:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VEC/ljsECl0xwOwNuuFj4J2VWL3DFQIVZWJ6dvR2khs=; b=WSyOVCV94Hpu5QJo5oNpWcV1OXfjVZk1iZNRA4pcMBIojzEs53mN9Ddn365EYR0tV2 1aZBqxxBYfbKWJVMSma4dpfyJyRR8CVcEAvtrjyJbBwWvI38rhB+OTKvxv4qz6OWtbAE XtTIOE+DROtKzvQBnTJc9za8JMlblWzEGg9N5lyyziVV7NitPCLXeQ8XA+qi4NPus9J9 c6kqHpZ0upwN07wd/xD9GrUZz9S2WqpfSkHHoVWqBahR/S0Nj9B6ZSF5J6s8nMvy3/TE KTEPtPpMmvwI20yOVGJ0Hk7j6ZBHrhJkgp/Ed2tN7JBkOMBPVze7whHxwkigE5lesGcm 5rDw== X-Gm-Message-State: ANoB5pkD1Jle/zzstuEWbwrDJol1/XSyyaA/4034N2/qvFqmcWU9b2KC mKdtTd98UmxPHmP1Vlq/XtSBI7K8UrwFEoPyB1V6x16f5vF5jDHMJctSoQI3vgaoAVbYJqevk96 +jeXF2/nLYOlSiI00QKtm X-Received: by 2002:a17:906:ce35:b0:7ae:215:2dd5 with SMTP id sd21-20020a170906ce3500b007ae02152dd5mr8205300ejb.208.1669214029127; Wed, 23 Nov 2022 06:33:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Br7EfMXN8zzJJucIbAC1NA/3UEE3+EzuxBZef9EsnddC7aq3JapzaQq+3gcmcLf6jmsIGvw== X-Received: by 2002:a17:906:ce35:b0:7ae:215:2dd5 with SMTP id sd21-20020a170906ce3500b007ae02152dd5mr8205265ejb.208.1669214028772; Wed, 23 Nov 2022 06:33:48 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id es8-20020a056402380800b00459148fbb3csm7642794edb.86.2022.11.23.06.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 06:33:48 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 63FC87D511B; Wed, 23 Nov 2022 15:33:47 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stanislav Fomichev , bpf@vger.kernel.org In-Reply-To: <20221121182552.2152891-7-sdf@google.com> References: <20221121182552.2152891-1-sdf@google.com> <20221121182552.2152891-7-sdf@google.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 23 Nov 2022 15:33:47 +0100 Message-ID: <874jupviyc.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Message-ID-Hash: HLRPL7F2LXBSDUJ5SQ7ZZR6DHCOL3KAE X-Message-ID-Hash: HLRPL7F2LXBSDUJ5SQ7ZZR6DHCOL3KAE X-MailFrom: toke@redhat.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, 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: Stanislav Fomichev writes: > No functional changes. Boilerplate to allow stuffing more data after xdp_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/ethernet/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, struct 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'll send my patch to add support to mlx5 (using the drv_priv pointer approach) separately. -Toke