Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3587611pxp; Tue, 8 Mar 2022 18:10:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJz16F1iHQgKpcmmIZ/a/GB0P2T2OWgYdmK7zNyU1z9CLUUBmZxOE/s6mXphtf18JF9qeZpd X-Received: by 2002:a17:90a:f8c:b0:1bc:cf23:2319 with SMTP id 12-20020a17090a0f8c00b001bccf232319mr8028882pjz.67.1646791824749; Tue, 08 Mar 2022 18:10:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646791824; cv=none; d=google.com; s=arc-20160816; b=StdCyo51WmMr6Vo3OyrqLIwHRdUhzTZgaqunwUCagm/Yv1iEwC2kYIn5c3FOxBbeKz BAF1sxf2Mt5gs28vY8HCV2uiE2W0REKcJUf133FpBZxmF1R3++UjqkjBecGcr/Iu1fLJ IbpR/OHp98C4nJ1+2bXFTpQSt7FTADTI6WalgHMqxFFt8JBN4QlbTNBJqFujSi0OjTDS 8ImOrl148G4injIY3kX/LkUjMhb1e2mR086ZZk1RHtYxbUZbKoi6VBvN4YZZD+is6LAB HuwycN+WXTpnzvGM3vQPI6UM12Hoeo3ex4N7YbQWuX8KArFenL5dXasPd5KmlVsRugGs PT6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=eendtF7O1jT4ZpjoFlzKIyJ4YNYGYwK/GXLvyJ/A4B0=; b=BYyDumiNUNXXYX7SZcbsu7lKPW94NOSAHGr+8fqYUNGYyV+bbSzzsysmG+2bwcBrEd NUs6TC7ggG0Hy7Fliq+GyRYAAgMkMwJmirdJeIB2V0SX3obZHZOOZnpyDLJdgb4Z6NIp iAFAkn3E/qOXjQW8u2h5G2CpmFg5689pjU3dzEZlVvPm+spkMad4ErP3Xez9y7dD8wk3 N+3nkR3D1llfzJYfPLRYkwL/ePtoExlsmJbsUFgtI7ktqLVJaDsM1Yf13utK4ggst7Xk jwUCBllszke3PertvPqPbmXRbZmcea8aZCNWJ917FVO3y8bnV+03olqhT4Is0TG/ETv4 7D2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rWZalxpb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r64-20020a632b43000000b003807c3416c2si519673pgr.489.2022.03.08.18.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 18:10:24 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rWZalxpb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A257E269A5E; Tue, 8 Mar 2022 16:40:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbiCHXT7 (ORCPT + 99 others); Tue, 8 Mar 2022 18:19:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiCHXT4 (ORCPT ); Tue, 8 Mar 2022 18:19:56 -0500 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33A49D4C6 for ; Tue, 8 Mar 2022 15:18:50 -0800 (PST) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-2dc585dbb02so4445787b3.13 for ; Tue, 08 Mar 2022 15:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eendtF7O1jT4ZpjoFlzKIyJ4YNYGYwK/GXLvyJ/A4B0=; b=rWZalxpbNZkyKJTe0k9BvpqyDA6xyuUWEczrB/MzwuKjD1dqeAAJkFpYG7Rd9qHBVI 9egVQB3Iqk6Yv8xdg7MOdOWlKJf8Bl///qOS2RrGkcf7tuQqO7GKtNtRpFai3hWY6CIj PdsqqLhM+fW9R/dQKoJLgJmXGkkJ6vdgjFgwjIVieW3QjrE0/bx8WpSD1cI9vPSNATBc eTaJ+V/aflZrW3st1K5SLYbO8UU5nTaSksOPkX+FZE/jl1cK6PSF2tDtkwdxvvuaFSsf KcE5YGkbsORk7mrWPkeM/Q63MD6UHFU/ztOn42tOJhBr/m/VyQfnHJfzyJXX29ubQMRk 7BNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eendtF7O1jT4ZpjoFlzKIyJ4YNYGYwK/GXLvyJ/A4B0=; b=jxBOMQxZwOq3KW7eQowYTDTQQYNnsfNGM3IXvBK0jhefRiVg3cOnhbodISXdA7PkbC +Q1fL4WoOq9jxNLlo+TH2H9wyfZ+2BT+z/mVhhEAwz36tZLkv5cAK+5gFxXFnK8yzjtQ qmk3ndp8h1iEgIRGGXgm1AWLiB6A0RfqCz321WXbYV+XtsPMH9/H2F20bmYoyhD6//q2 j13dpZGwMWw1rT7UHpE46Lfn0NFrFMSR+dW/cMRcZj6YXzk4KWRdel/wd25e0YmXYAU7 lCbv7tcbwU2s+5zAbc5vMor+Ugju/XPtl5rH1Jaai1BKfa+C2HBhDpcSPNeWXaGsV+jM lnzg== X-Gm-Message-State: AOAM531M49/kI5rnw/crOtVqPYIfFfCg9mjzIUFk6b4QLQk044LkRPvU s3c9UHPY9WTNoobR4KDWAUAk58ASsrrBjYN4TQjgUg== X-Received: by 2002:a81:1043:0:b0:2dc:289f:9533 with SMTP id 64-20020a811043000000b002dc289f9533mr14625066ywq.467.1646781516920; Tue, 08 Mar 2022 15:18:36 -0800 (PST) MIME-Version: 1.0 References: <20220308212531.752215-1-jeffreyjilinux@gmail.com> In-Reply-To: From: Eric Dumazet Date: Tue, 8 Mar 2022 15:18:25 -0800 Message-ID: Subject: Re: [PATCH v3 net-next] net-core: add rx_otherhost_dropped counter To: David Ahern Cc: Jeffrey Ji , "David S . Miller" , Brian Vazquez , Jakub Kicinski , Hideaki YOSHIFUJI , Antoine Tenart , Sebastian Andrzej Siewior , Alexander Lobakin , Kumar Kartikeya Dwivedi , Arnd Bergmann , netdev , LKML , jeffreyji Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 On Tue, Mar 8, 2022 at 2:51 PM David Ahern wrote: > > On 3/8/22 2:25 PM, Jeffrey Ji wrote: > > diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c > > index 95f7bb052784..8b87ea99904b 100644 > > --- a/net/ipv4/ip_input.c > > +++ b/net/ipv4/ip_input.c > > @@ -451,6 +451,7 @@ static struct sk_buff *ip_rcv_core(struct sk_buff *skb, struct net *net) > > * that it receives, do not try to analyse it. > > */ > > if (skb->pkt_type == PACKET_OTHERHOST) { > > + atomic_long_inc(&skb->dev->rx_otherhost_dropped); > > drop_reason = SKB_DROP_REASON_OTHERHOST; > > goto drop; > > } > > diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c > > index 5b5ea35635f9..5624c937f87f 100644 > > --- a/net/ipv6/ip6_input.c > > +++ b/net/ipv6/ip6_input.c > > @@ -150,6 +150,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev, > > struct inet6_dev *idev; > > > > if (skb->pkt_type == PACKET_OTHERHOST) { > > + atomic_long_inc(&skb->dev->rx_otherhost_dropped); > > kfree_skb(skb); > > return NULL; > > } > > that's an expensive packet counter for a common path (e.g., hosting > environments). This was the reason for the initial patch, using SNMP stat, being per cpu. Adding per-device per-cpu data for this counter will increase cost of netdevice dismantle phase, and increase time for ndo_get_stats64(), especially on hosts with 256 or 512 cpus.