Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp482939rdb; Tue, 31 Oct 2023 12:54:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMHHR17qTfRI/CV0PSokh6FIhgO91CD0T73/Bx3ExnvcVo498/e63ebZf+AICz5EZvxxom X-Received: by 2002:a17:902:d413:b0:1cc:32ae:4afd with SMTP id b19-20020a170902d41300b001cc32ae4afdmr7008348ple.46.1698782054194; Tue, 31 Oct 2023 12:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698782054; cv=none; d=google.com; s=arc-20160816; b=Lx2ot8laPdKzCsIp/b8/BAgSC9ZXrIsMfepCZjrYFIVv9DomE0p9tXsJW21S3WecQx Vp5AnMJ7wE2E0kf/VP2bde4XVrv7wxAUAowM3PxLQbh560EADkf5TtCgqUzFr/9LMFbQ 9ifobEOoVeB4eKNCnE+iaXxYsm2ayG04GIuzits8iMRrUHoftk1sqHGB3UuRi9dK5lkO KnSG3V+oWi+TKk6V1gZzwhdWHQ5Ue1NbnjGxov+7L3yhD949CsIyvVQJpihmnB6LBbaN njEV/V1DPMsUvoXkrtIZZAofYqv/bG2usSFlw9uwnWLqv3cppKozITYytz7ECx2/RqBV sdBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=eP5kGVHDuMjNjKGdd5clRDwSrTjdi5bBsrmXpFCB5ZM=; fh=C0VBaWk5U+6gzZ780pAhso5Bq2Dh4vEqCAZc5pzRuCQ=; b=Ta0hAR76BY37xkb50UAxzz0BNTt3IqkdOGdiLH6+iX57j0qcUNNl0y0V82dnFMVijT ONi4fEbGS2iNpcKWvc0k03V03SkZLNjIP5cZzjrQ0wHbt6AmHeStYGABIcXfh8oNiI9k M5GbqAeUW3FtscM2od230LQOpsacieXRy4RTEno2dYXvcltbXzO6s+v0IxfFnVLbRwTk 9SwPyASgrHj4WQ1zGxO5jjM5ArM2zaj9vrVvkpPJ9EFMUjY+FcCCwtixp8VHCDGfvE4f ZNvEQs/nCVA9laBcEJXyHy8/WNTT6h8q4TdZ/1UqTwXZxqVdrvurSj37N+TofWx9e0jN YBfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QwvqM/vx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c10-20020a170903234a00b001cc56120079si1474654plh.84.2023.10.31.12.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 12:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QwvqM/vx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 32FFB80292A7; Tue, 31 Oct 2023 12:54:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231392AbjJaTyC (ORCPT + 99 others); Tue, 31 Oct 2023 15:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbjJaTx6 (ORCPT ); Tue, 31 Oct 2023 15:53:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B41FCDA for ; Tue, 31 Oct 2023 12:53:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF144C433C7; Tue, 31 Oct 2023 19:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698782029; bh=2oK9cLvx1sCDZNWlQ8YmD9XkYwVk52IAfb2GSyqsfFc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QwvqM/vxLUku3QjCdu5Eg5XrdhSYkBdWRjg6HQB1qwynnRUbLEWDc32mkIePftzyi lFVKmTxwmx5EyhzaY4tGlPHsV3Ge48WSUYThxF/cNjNz7cwLdnFn8UrqVq+o2rcV9b Ffeuq9d+6GOK7QS2GLyLIjtcGkc6H/Ljro0eQ5MQeKVwtpCnOCLqjaedYXcZ1yiL1q erE2ddwGXYHUaOmMfkC6wPqyPzNz8yasVZebpG67Rz5avikUKUAPeYJCGXo3N2By7k E3TOpljh28b3s/Y9344i7pf0JWj8kX5I7fmbVzAo3QKIN1ND1HEy3VtVKhu3ZhgqMc pGcw9rVhTxRiw== Date: Tue, 31 Oct 2023 12:53:48 -0700 From: Jakub Kicinski To: Daniel Borkmann Cc: Peilin Ye , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Jesper Dangaard Brouer , Peilin Ye , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Jiang Wang , Youlun Zhang Subject: Re: [PATCH net] veth: Fix RX stats for bpf_redirect_peer() traffic Message-ID: <20231031125348.70fc975e@kernel.org> In-Reply-To: <94c88020-5282-c82b-8f88-a2d012444699@iogearbox.net> References: <20231027184657.83978-1-yepeilin.cs@gmail.com> <20231027190254.GA88444@n191-129-154.byted.org> <59be18ff-dabc-2a07-3d78-039461b0f3f7@iogearbox.net> <20231028231135.GA2236124@n191-129-154.byted.org> <94c88020-5282-c82b-8f88-a2d012444699@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 31 Oct 2023 12:54:10 -0700 (PDT) On Mon, 30 Oct 2023 15:19:26 +0100 Daniel Borkmann wrote: > > Since I didn't want to update host-veth's TX counters. If we > > bpf_redirect_peer()ed a packet from NIC TC ingress to Pod-veth TC ingress, > > I think it means we've bypassed host-veth TX? > > Yes. So the idea is to transition to tstats replace the location where > we used to bump lstats with tstat's tx counter, and only the peer redirect > would bump the rx counter.. then upon stats traversal we fold the latter into > the rx stats which was populated by the opposite's tx counters. Makes sense. > > OT: does cadvisor run inside the Pod to collect the device stats? Just > curious how it gathers them. Somewhat related - where does netkit count stats? > >> Definitely no new stats ndo resp indirect call in fast path. > > > > Yeah, I think I'll put a comment saying that all devices that support > > BPF_F_PEER must use tstats (or must use lstats), then. > > sgtm. Is comment good enough? Can we try to do something more robust? Move the allocation of stats into the core at registration based on some u8 assigned in the driver? (I haven't looked at the code TBH)