Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1621513rdh; Sat, 28 Oct 2023 00:07:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHK3vdtJ6MPUe4g1YaTuiZ8QgpcTjLqm1aLN7KTV14jqMnAdKdCjPOnJl9lo6EiwgdbVcjH X-Received: by 2002:a17:90a:1a:b0:280:1d7f:440f with SMTP id 26-20020a17090a001a00b002801d7f440fmr1842152pja.26.1698476858521; Sat, 28 Oct 2023 00:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698476858; cv=none; d=google.com; s=arc-20160816; b=Ujsv9DQBauCQ0OnmalJI9jPKkTSQX2V/0TE+G2uqTc77p8/bdvRs3vbL9oe0Sg1CWZ Ic+70/xHzp5uGT3VEWYEsjyczU0HrebMNCXCO6rogxjC8rLB4o5xz20U8g38IIfeC82W yk/VFGGbPacdVy1PxdCx/XPMRJcYylctd1baXPE62asjAVhykMjhcwBifZtD3QVIV7lU kTnbpKxvO681hphBtNpHrDrx6f8zyEXNWkq1kKo/A4Q0M+VpBchOP3lsp8NkHL/W1kRe wvs0DhLFPZMkWisUXTRbP0VZ9ZXEWE8H58QbnC0YcUSej58c7NUIHh8x8gmxh7FacafK ccwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9jZ6IeTzqgI7KPSimrweLY9VVvaA0yg3+mceyW4nrIA=; fh=q/m00ADzAlPVK410e4ZIbFV0kMfcSIK8AQXE2RAGN7c=; b=kQhWZYrDGAscOWwdyH8iey/BQQNXB/ZYlZZqCi6Sr67bZLicnzYYRqnZJk0Ag6p/QJ Ul3V/7DhkSAwVjpkmghZnRYoKbd6yGtg03WkgIERRTas7OudWY/T6JHpnnJCoaaCNSZb tD1hmyD5+axKOphLiqoPoKXJHw7fHZ/ie6vorU33p47ODjrN+WKJ+EQLCjmBi4UxWY4Y Tag1+YUTvk+q6JD/ucWHxxSdCEBmbItrjnBr8rsGdolseDPuCZTCc6KIeixbxfXk3dQ4 uDo6HGUyr2KrMdF+kaxAaLEl7P/6SQjQsM1o8Hl/mnLdVc3UKUJ6z2q6rzfipv9cZ3A+ YsUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b=DANICsOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id md16-20020a17090b23d000b00276b35bc424si2061792pjb.26.2023.10.28.00.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 00:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b=DANICsOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1609D80699F6; Sat, 28 Oct 2023 00:07:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjJ1HHJ (ORCPT + 99 others); Sat, 28 Oct 2023 03:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjJ1HHH (ORCPT ); Sat, 28 Oct 2023 03:07:07 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30B03CA; Sat, 28 Oct 2023 00:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=iogearbox.net; s=default2302; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=9jZ6IeTzqgI7KPSimrweLY9VVvaA0yg3+mceyW4nrIA=; b=DANICsOCgGLFEj0wCWjFrMwVPC A5sg8Wg4RC6lswHA3/IGYWB7zI1WOhb7pOQinUO694iLQDudsxbuqYhX80XSEXeUCHyVB6GD22rJS 03R4JRIW2YJYzpDfpUrPPq/gGw0Ev0hrjbnFJKdMptLmefTwg1VIroVy1GHZ9CKIICO9/9yDEAgVI huLWlB08TWWm4Dt7I9QHaSKHWHlGBagEXQyaoUzD36rYXYOFzBiXg/ylDHrlvaCOf3xaPFcNOzopQ ZwQVq06qnun9klrwFB8oT9gWhZF0xSbvD+3a/MVycKZfylQUslgCUbxN59to6BlY9qSePwmVFjte6 yaOr1PiA==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwdPB-0000Xk-Rh; Sat, 28 Oct 2023 09:06:45 +0200 Received: from [85.1.206.226] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qwdPB-000Qwf-0W; Sat, 28 Oct 2023 09:06:45 +0200 Subject: Re: [PATCH net] veth: Fix RX stats for bpf_redirect_peer() traffic To: Peilin Ye , "David S. Miller" , Eric Dumazet , Jakub Kicinski , 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 Cc: Peilin Ye , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Jiang Wang , Youlun Zhang References: <20231027184657.83978-1-yepeilin.cs@gmail.com> <20231027190254.GA88444@n191-129-154.byted.org> From: Daniel Borkmann Message-ID: <59be18ff-dabc-2a07-3d78-039461b0f3f7@iogearbox.net> Date: Sat, 28 Oct 2023 09:06:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20231027190254.GA88444@n191-129-154.byted.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.10/27074/Fri Oct 27 09:58:36 2023) X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 28 Oct 2023 00:07:12 -0700 (PDT) Hi Peilin, On 10/27/23 9:02 PM, Peilin Ye wrote: > On Fri, Oct 27, 2023 at 06:46:57PM +0000, Peilin Ye wrote: >> diff --git a/net/core/filter.c b/net/core/filter.c >> index 21d75108c2e9..7aca28b7d0fd 100644 >> --- a/net/core/filter.c >> +++ b/net/core/filter.c >> @@ -2492,6 +2492,7 @@ int skb_do_redirect(struct sk_buff *skb) >> net_eq(net, dev_net(dev)))) >> goto out_drop; >> skb->dev = dev; >> + dev_sw_netstats_rx_add(dev, skb->len); > > This assumes that all devices that support BPF_F_PEER (currently only > veth) use tstats (instead of lstats, or dstats) - is that okay? Dumb question, but why all this change and not simply just call ... dev_lstats_add(dev, skb->len) ... on the host dev ? > If not, should I add another NDO e.g. ->ndo_stats_rx_add()? Definitely no new stats ndo resp indirect call in fast path. Thanks, Daniel