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 566AE9CD3FB for ; Fri, 9 Dec 2022 01:02:49 +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=SQRQA40D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670544168; 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=eDjpZTzpQHuFcOQSGAT2WzTURtYSuufNt2pnLYu1YmI=; b=SQRQA40DGTjmXjpUshj0QYBVOT6qzenJufmk2VJvqFIXwLNK4n3/mXRU7grXu24CpSG+w1 P5gzg2o5x/MbuacvpuxBl7GmI5gXoZt11bExyoU0+tBqw7zRlGGfsecSdQlMQk/Ad60UDp PB1fnYFFrbbDdcl/+jNSRcnXkXBxEyo= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-9-KCR9lr68MGmSUGflHHCRjw-1; Thu, 08 Dec 2022 19:02:46 -0500 X-MC-Unique: KCR9lr68MGmSUGflHHCRjw-1 Received: by mail-ej1-f71.google.com with SMTP id js17-20020a17090797d100b007c0dd8018b6so2006147ejc.17 for ; Thu, 08 Dec 2022 16:02:46 -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=eDjpZTzpQHuFcOQSGAT2WzTURtYSuufNt2pnLYu1YmI=; b=Vt2edJ1RqoKx9d5OlpU6+dxxnqxpgcAna5Teymt+d5ln6WZMIRaEnBzL2nw4gI7i6i gMeKTcFVpH6xWSVKViuYfYr/xLCiFIhM7Su3np9ZQ1kuUSa0Eq4OqMsfU/L5uzUeSHwR j1bfUSiMsJeAGlCGqwvH41+jKA8wKtxYhxWe0WvqwUdWpP13PkO304Or0ltQsecTONTI woS+ogNsq+TIgge7L8QsBNLhrV7mNX0mtVWBFeR7YkEfvaMt1gW3tAlu/VFFJWZQENzg cj1v/N0KHHIcU22wdF5otJvR0HnYcTf/7vtroYl+DyrnpGPG0YL/1Mzd9iryD3N7TTRR 5/6A== X-Gm-Message-State: ANoB5pkjkxkehXbKnkSnprGu8+m6nh0T3d4Cxv4CpkInxCnizVxDJuSu ca8Du/sHPInymuce5vrlwL54wDMJE6PXWKbghqal8rPnHoR+sAqNjZO27wk/AvVzZyDwF+0tctD +4gn4zklD2N9pLDl499Hi X-Received: by 2002:a17:906:2a44:b0:78d:f457:1052 with SMTP id k4-20020a1709062a4400b0078df4571052mr3230365eje.15.1670544165615; Thu, 08 Dec 2022 16:02:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf76wB+k5ajX4E3y8sgqWTu39b5SiGHxM11076HvMfkR+2aSdEsML81MxIdPiWvaJ0xdpilLsw== X-Received: by 2002:a17:906:2a44:b0:78d:f457:1052 with SMTP id k4-20020a1709062a4400b0078df4571052mr3230329eje.15.1670544165123; Thu, 08 Dec 2022 16:02:45 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id u1-20020a1709061da100b007ae1e528390sm10136701ejh.163.2022.12.08.16.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 16:02:42 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id E751A82E9C2; Fri, 9 Dec 2022 01:02:41 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Stanislav Fomichev In-Reply-To: References: <20221206024554.3826186-1-sdf@google.com> <20221206024554.3826186-12-sdf@google.com> <875yellcx6.fsf@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 09 Dec 2022 01:02:41 +0100 Message-ID: <87359pl9zy.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: KNIFJC44DWYDGWUOTQ6Z6AGCM35HGK2J X-Message-ID-Hash: KNIFJC44DWYDGWUOTQ6Z6AGCM35HGK2J 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: 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, 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 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: Stanislav Fomichev writes: > On Thu, Dec 8, 2022 at 2:59 PM Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> >> Stanislav Fomichev writes: >> >> > From: Toke H=C3=B8iland-J=C3=B8rgensen >> > >> > Support RX hash and timestamp metadata kfuncs. We need to pass in the = cqe >> > pointer to the mlx5e_skb_from* functions so it can be retrieved from t= he >> > XDP ctx to do this. >> >> So I finally managed to get enough ducks in row to actually benchmark >> this. With the caveat that I suddenly can't get the timestamp support to >> work (it was working in an earlier version, but now >> timestamp_supported() just returns false). I'm not sure if this is an >> issue with the enablement patch, or if I just haven't gotten the >> hardware configured properly. I'll investigate some more, but figured >> I'd post these results now: >> >> Baseline XDP_DROP: 25,678,262 pps / 38.94 ns/pkt >> XDP_DROP + read metadata: 23,924,109 pps / 41.80 ns/pkt >> Overhead: 1,754,153 pps / 2.86 ns/pkt >> >> As per the above, this is with calling three kfuncs/pkt >> (metadata_supported(), rx_hash_supported() and rx_hash()). So that's >> ~0.95 ns per function call, which is a bit less, but not far off from >> the ~1.2 ns that I'm used to. The tests where I accidentally called the >> default kfuncs cut off ~1.3 ns for one less kfunc call, so it's >> definitely in that ballpark. >> >> I'm not doing anything with the data, just reading it into an on-stack >> buffer, so this is the smallest possible delta from just getting the >> data out of the driver. I did confirm that the call instructions are >> still in the BPF program bytecode when it's dumped back out from the >> kernel. >> >> -Toke >> > > Oh, that's great, thanks for running the numbers! Will definitely > reference them in v4! > Presumably, we should be able to at least unroll most of the > _supported callbacks if we want, they should be relatively easy; but > the numbers look fine as is? Well, this is for one (and a half) piece of metadata. If we extrapolate it adds up quickly. Say we add csum and vlan tags, say, and maybe another callback to get the type of hash (l3/l4). Those would probably be relevant for most packets in a fairly common setup. Extrapolating from the ~1 ns/call figure, that's 8 ns/pkt, which is 20% of the baseline of 39 ns. So in that sense I still think unrolling makes sense. At least for the _supported() calls, as eating a whole function call just for that is probably a bit much (which I think was also Jakub's point in a sibling thread somewhere). -Toke