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.129.124]) by mail.toke.dk (Postfix) with ESMTPS id 8BC719DD197 for ; Thu, 12 Jan 2023 23:30:03 +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=QE//1x2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673562602; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M8F9OX5swVhSRcHg5vV1QIAQDXBfRvHWPRcoZhArxmo=; b=QE//1x2FnTk+dtzd2ErM/IknTLgcoD+ZOdnZltzKbbm1QAeAPeMH8rDjYtyONA2o6+JF6m wBRTrrg6Q1edP5wruplcf7OzBOHM0JBHBYXg6NiLZEwZJaJUi/E01cLzEI485nGA+BwgyN PkMXfiaZN2FczWW7N7ChPOsG0rPnlqs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-367-mMFGIlCoMoaTN4aJuuBUJQ-1; Thu, 12 Jan 2023 17:30:00 -0500 X-MC-Unique: mMFGIlCoMoaTN4aJuuBUJQ-1 Received: by mail-ej1-f70.google.com with SMTP id oz11-20020a1709077d8b00b007c0dd8018b6so13685098ejc.17 for ; Thu, 12 Jan 2023 14:30:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=AmmMTMTkl1SpATAvKbKhhENq0+Dt4nDr+jehSO4eUlc=; b=k+hWWOZS+/1mfsPjzkZnjTRqc6G4Yr870c1x7K6cD/Ef5YVRsT+U8XzGLPCunSIghn lbDsnKOA2VetcZqE7F69s0ubAj8tF/CFV2mgO5IXS3H8MVPR2R2o1+iWi4gXdXGR79W6 zIs0CwSRkbtjhbkgH6oWezbw6hyDtjy+F5GiEVhRr8Bb6+bmSy/8i1Td5rVYI0Rzb8/U kC7tHRGAja5pHfpylTzuNVKjmuu2P7rR/MWlawQjjzYb0WJviSu3xagj/VGGo5f8qa3U deB6lmDApK2Xvw0hKH0pDSmloOl/8emvRpYjoh+gBiwK2EHLOY70kjApYbI0W7HAjm+X bF2Q== X-Gm-Message-State: AFqh2krIIqb1aBT6Awq9mpF2ABgaJARvX3NiN9oihuqz52DvfPWRNVHG RLG0+7MRpUqUqF/WNcVW8YGRuQi8/iSg368u36ltNzQvt8nRlEFJbW5ZsrSAoH7b0QOI1nOS55E cMWhOVM1FafS1ojxqQx8U X-Received: by 2002:a17:906:9f20:b0:84d:43a0:7090 with SMTP id fy32-20020a1709069f2000b0084d43a07090mr15422520ejc.77.1673562599722; Thu, 12 Jan 2023 14:29:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXsqPdHBhI5sdFZhQI7ZFU9LyJiPErvoKHj1tV1uSh9/yzeA+17qJ9uEVoWX2vLXSimcX2vkQQ== X-Received: by 2002:a17:906:9f20:b0:84d:43a0:7090 with SMTP id fy32-20020a1709069f2000b0084d43a07090mr15422479ejc.77.1673562599344; Thu, 12 Jan 2023 14:29:59 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id c10-20020a17090618aa00b0084d14646fd9sm7751190ejf.165.2023.01.12.14.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:29:58 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 45232900731; Thu, 12 Jan 2023 23:29:58 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stanislav Fomichev In-Reply-To: References: <20230112003230.3779451-1-sdf@google.com> <20230112003230.3779451-16-sdf@google.com> <87k01rfojm.fsf@toke.dk> <87h6wvfmfa.fsf@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 12 Jan 2023 23:29:58 +0100 Message-ID: <87edrzfkt5.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SG6NE2FOG5LI33DOJD4AMKVPNBKTTPE6 X-Message-ID-Hash: SG6NE2FOG5LI33DOJD4AMKVPNBKTTPE6 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: Tariq Toukan , 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 , Saeed Mahameed , 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 v7 15/17] net/mlx5e: Introduce 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: > On Thu, Jan 12, 2023 at 1:55 PM Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> >> Toke H=C3=B8iland-J=C3=B8rgensen writes: >> >> > Stanislav Fomichev writes: >> > >> >> On Thu, Jan 12, 2023 at 12:07 AM Tariq Toukan wrote: >> >>> >> >>> >> >>> >> >>> On 12/01/2023 2:32, Stanislav Fomichev wrote: >> >>> > From: Toke H=C3=B8iland-J=C3=B8rgensen >> >>> > >> >>> > Preparation for implementing HW metadata kfuncs. No functional cha= nge. >> >>> > >> >>> > Cc: Tariq Toukan >> >>> > Cc: Saeed Mahameed >> >>> > 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: Toke H=C3=B8iland-J=C3=B8rgensen >> >>> > Signed-off-by: Stanislav Fomichev >> >>> > --- >> >>> > drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + >> >>> > .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +- >> >>> > .../net/ethernet/mellanox/mlx5/core/en/xdp.h | 6 +- >> >>> > .../ethernet/mellanox/mlx5/core/en/xsk/rx.c | 25 ++++---- >> >>> > .../net/ethernet/mellanox/mlx5/core/en_rx.c | 58 +++++++++----= ------ >> >>> > 5 files changed, 50 insertions(+), 43 deletions(-) >> >>> > >> >>> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/driver= s/net/ethernet/mellanox/mlx5/core/en.h >> >>> > index 2d77fb8a8a01..af663978d1b4 100644 >> >>> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h >> >>> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h >> >>> > @@ -469,6 +469,7 @@ struct mlx5e_txqsq { >> >>> > union mlx5e_alloc_unit { >> >>> > struct page *page; >> >>> > struct xdp_buff *xsk; >> >>> > + struct mlx5e_xdp_buff *mxbuf; >> >>> >> >>> In XSK files below you mix usage of both alloc_units[page_idx].mxbuf= and >> >>> alloc_units[page_idx].xsk, while both fields share the memory of a u= nion. >> >>> >> >>> As struct mlx5e_xdp_buff wraps struct xdp_buff, I think that you jus= t >> >>> need to change the existing xsk field type from struct xdp_buff *xsk >> >>> into struct mlx5e_xdp_buff *xsk and align the usage. >> >> >> >> Hmmm, good point. I'm actually not sure how it works currently. >> >> mlx5e_alloc_unit.mxbuf doesn't seem to be initialized anywhere? Toke, >> >> am I missing something? >> > >> > It's initialised piecemeal in different places; but yeah, we're mixing >> > things a bit... >> > >> >> I'm thinking about something like this: > > Seems more invasive? I don't care much tbf, but what's wrong with > keeping 'xdp_buff xsk' member and use it consistently? Yeah, it's more invasive, but it's also more consistent with the non-xsk path where every usage of struct xdp_buff is replaced with the wrapping struct? Both will work, I suppose (in fact I think the resulting code will be more or less identical), so it's more a matter of which one is easier to read and where we put the type-safety-breaking casts. I can live with either one (just note you'll have to move the 'mxbuf->rq' initialisation next to the one for mxbuf->cqe for yours, but that's probably fine too). Let's see which way Tariq prefers... -Toke