From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by mail.toke.dk (Postfix) with ESMTPS id 8C2939CDB57 for ; Fri, 9 Dec 2022 17:45:29 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=fyE/CIxD Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 479F1622B1; Fri, 9 Dec 2022 16:45:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BE0FC433D2; Fri, 9 Dec 2022 16:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670604326; bh=y9ju5uWeIvPH5xCPeQBcrFadw2lTaWjzkAGNG7iNTAQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fyE/CIxDGjWaUL0DLNshTMZ1OLUruLbVpHvrC61X21127DREq2ElfVR/r9oxf2evI VE+faV6CiOQrmW+Q5IDLeEttgAIy3f9iLs0Bk8hB8uhjEK0/wSQjCYPLFdRA/wo+X9 jNx19EbIQj3FSi/15GyHrmQkaIyTJWXBQXAZld0+8NZPAQlGR9+AuzZL//huJJ/RuT Bh4ek2x38/DIFZRNfDekKCyHTB1eWRG6e6tpIZUnyKppl5ORiKnkeAuLGydtR4MuTT XNv/HG/4jv1y8EFUVbfSSgLIWdLaGV4k/valaLbAuyaBcL48VWWxbNwKpx/aAR9JEt 2QMlH8EDn1o1A== Date: Fri, 9 Dec 2022 08:45:24 -0800 From: Jakub Kicinski To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Message-ID: <20221209084524.01c09d9c@kernel.org> In-Reply-To: <87cz8sk59e.fsf@toke.dk> References: <20221206024554.3826186-1-sdf@google.com> <20221206024554.3826186-12-sdf@google.com> <875yellcx6.fsf@toke.dk> <87359pl9zy.fsf@toke.dk> <87tu25ju77.fsf@toke.dk> <87o7sdjt20.fsf@toke.dk> <87cz8sk59e.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FJ3MAKS7DI6FMTHEBIROR3C22HPMMVJM X-Message-ID-Hash: FJ3MAKS7DI6FMTHEBIROR3C22HPMMVJM X-MailFrom: kuba@kernel.org 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: Stanislav Fomichev , Alexei Starovoitov , bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Saeed Mahameed , David Ahern , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, Network Development X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v3 11/12] mlx5: Support RX XDP metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 09 Dec 2022 15:42:37 +0100 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > If we expect the program to do out of band probing, we could just get > rid of the _supported() functions entirely? >=20 > I mean, to me, the whole point of having the separate _supported() > function for each item was to have a lower-overhead way of checking if > the metadata item was supported. But if the overhead is not actually > lower (because both incur a function call), why have them at all? Then > we could just change the implementation from this: >=20 > bool mlx5e_xdp_rx_hash_supported(const struct xdp_md *ctx) > { > const struct mlx5_xdp_buff *_ctx =3D (void *)ctx; >=20 > return _ctx->xdp.rxq->dev->features & NETIF_F_RXHASH; > } >=20 > u32 mlx5e_xdp_rx_hash(const struct xdp_md *ctx) > { > const struct mlx5_xdp_buff *_ctx =3D (void *)ctx; >=20 > return be32_to_cpu(_ctx->cqe->rss_hash_result); > } >=20 > to this: >=20 > u32 mlx5e_xdp_rx_hash(const struct xdp_md *ctx) > { > const struct mlx5_xdp_buff *_ctx =3D (void *)ctx; >=20 > if (!(_ctx->xdp.rxq->dev->features & NETIF_F_RXHASH)) > return 0; >=20 > return be32_to_cpu(_ctx->cqe->rss_hash_result); > } Are there no corner cases? E.g. in case of an L2 frame you'd then expect a hash of 0? Rather than no hash?=20 If I understand we went for the _supported() thing to make inlining=20 the check easier than inlining the actual read of the field. But we're told inlining is a bit of a wait.. so isn't the motivation for the _supported() pretty much gone? And we should we go back to returning an error from the actual read? Is partial inlining hard? (inline just the check and generate a full call for the read, ending up with the same code as with _supported())