From patchwork Sat Feb 26 04:18:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12761188 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0984C433EF for ; Sat, 26 Feb 2022 04:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbiBZEUQ (ORCPT ); Fri, 25 Feb 2022 23:20:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiBZEUJ (ORCPT ); Fri, 25 Feb 2022 23:20:09 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4078621F9F5; Fri, 25 Feb 2022 20:19:36 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id e6so5003322pgn.2; Fri, 25 Feb 2022 20:19:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tkgz19jZXWoKaZZFHf0Mr4htYcNeEwU33DzQTnxSRwY=; b=jq2MudbZGpMn2sWFfzQOA0olYtl3yWKXMjHMJPg3jYhkRD9y9+Jyt+CP6VH84xbI2G qhrDq2FiGQC67XGtlenU1z/eoCcHxMIWqiymxppAvzJ4SOUf9lPRWHF50UhTlhLdgbkl Ey3umOeWWhaoQdCsAzaSesfxp4JgJluSaThqi6TNVGZbWKxBID3OLzIx3sW/ki7OtmPY husUYJDAhUrNkQLou2bao75+KzNw8Wi2rpH8EHKNaq8BAgSqBqVn+2uAT28VYpT00Pvk O4SufctTRarpVf9yEKZyprPn9paT52xZru941Y1ai48qu3+ukSit/O3N8UkO5K0zh097 IExw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tkgz19jZXWoKaZZFHf0Mr4htYcNeEwU33DzQTnxSRwY=; b=arAAgBADskZRhN9jwZaGdrwARNUYpVvOOersTQVxQMGYywQI+g7luByvGvyfbVFdFQ 3k+3hOL9KekBdjwA05RX2LPW3n4VUVeNBs80SUcXggVIUOVA8k0Jb0jspwZYx6vujUfL c5pGtPoy4jBZ7MkuvWu/JVHYBcxC3PvQ19iHQ82ySCtEHHF8IjqvKrLP0S8A7qObUIbh yQjcp6OGEQzJgDwUa3OzkXPNoMtGFxEzTLe7eXuHwVPXE3heC7Bl3JtJ6p7ZiX/QWuAP VM+RRXq3VMcO7EruKm+MOfrm0vz9YFn25m8I4y131OQKravNYX3Id7zkCLDGcc9jPN7c tCag== X-Gm-Message-State: AOAM5312JeoDnRPlBLN52m3ld1ug73XYWY8Lz2u/XtlJ1rV/3l5SMVEi JPLObxX689fubez/1X1RADk= X-Google-Smtp-Source: ABdhPJzdhni2kJLhCFDyjScud98tKYjLk+2wpFCOStKS+NRINkJg5NqwgTj5bpJXd0OFT7rfDRslOA== X-Received: by 2002:a65:6751:0:b0:363:43a5:c7e3 with SMTP id c17-20020a656751000000b0036343a5c7e3mr8662675pgu.46.1645849175745; Fri, 25 Feb 2022 20:19:35 -0800 (PST) Received: from localhost.localdomain ([203.205.141.112]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004f1335c8889sm4896193pff.7.2022.02.25.20.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 20:19:35 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: dsahern@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org, imagedong@tencent.com, edumazet@google.com, alobakin@pm.me, cong.wang@bytedance.com, paulb@nvidia.com, talalahmad@google.com, keescook@chromium.org, ilias.apalodimas@linaro.org, memxor@gmail.com, flyingpeng@tencent.com, mengensun@tencent.com, daniel@iogearbox.net, yajun.deng@linux.dev, roopa@nvidia.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v3 1/3] net: ip: add skb drop reasons for ip egress path Date: Sat, 26 Feb 2022 12:18:29 +0800 Message-Id: <20220226041831.2058437-2-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220226041831.2058437-1-imagedong@tencent.com> References: <20220226041831.2058437-1-imagedong@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Menglong Dong Replace kfree_skb() which is used in the packet egress path of IP layer with kfree_skb_reason(). Functions that are involved include: __ip_queue_xmit() ip_finish_output() ip_mc_finish_output() ip6_output() ip6_finish_output() ip6_finish_output2() Following new drop reasons are introduced: SKB_DROP_REASON_IP_OUTNOROUTES SKB_DROP_REASON_BPF_CGROUP_EGRESS SKB_DROP_REASON_IPV6DISABLED SKB_DROP_REASON_NEIGH_CREATEFAIL Reviewed-by: Mengen Sun Reviewed-by: Hao Peng Signed-off-by: Menglong Dong Reviewed-by: David Ahern --- v3: - fix typo in 'SKB_DROP_REASON_IPV6DSIABLED' noticed by Roman v2: - introduce SKB_DROP_REASON_NEIGH_CREATEFAIL for neigh entry create failure - replace SKB_DROP_REASON_IP_OUTNOROUTES with SKB_DROP_REASON_NEIGH_CREATEFAIL in ip6_finish_output2(), as I think it's more suitable --- include/linux/skbuff.h | 9 +++++++++ include/trace/events/skb.h | 5 +++++ net/ipv4/ip_output.c | 8 ++++---- net/ipv6/ip6_output.c | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a3e90efe6586..bd6ed54f2460 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -380,6 +380,15 @@ enum skb_drop_reason { * the ofo queue, corresponding to * LINUX_MIB_TCPOFOMERGE */ + SKB_DROP_REASON_IP_OUTNOROUTES, /* route lookup failed */ + SKB_DROP_REASON_BPF_CGROUP_EGRESS, /* dropped by + * BPF_PROG_TYPE_CGROUP_SKB + * eBPF program + */ + SKB_DROP_REASON_IPV6DISABLED, /* IPv6 is disabled on the device */ + SKB_DROP_REASON_NEIGH_CREATEFAIL, /* failed to create neigh + * entry + */ SKB_DROP_REASON_MAX, }; diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 2ab7193313aa..97f8097651da 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -37,6 +37,11 @@ EM(SKB_DROP_REASON_TCP_OLD_DATA, TCP_OLD_DATA) \ EM(SKB_DROP_REASON_TCP_OVERWINDOW, TCP_OVERWINDOW) \ EM(SKB_DROP_REASON_TCP_OFOMERGE, TCP_OFOMERGE) \ + EM(SKB_DROP_REASON_IP_OUTNOROUTES, IP_OUTNOROUTES) \ + EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS, \ + BPF_CGROUP_EGRESS) \ + EM(SKB_DROP_REASON_IPV6DISABLED, IPV6DISABLED) \ + EM(SKB_DROP_REASON_NEIGH_CREATEFAIL, NEIGH_CREATEFAIL) \ EMe(SKB_DROP_REASON_MAX, MAX) #undef EM diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 0c0574eb5f5b..7f618f72fb42 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -233,7 +233,7 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s net_dbg_ratelimited("%s: No header cache and no neighbour!\n", __func__); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_CREATEFAIL); return -EINVAL; } @@ -317,7 +317,7 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk case NET_XMIT_CN: return __ip_finish_output(net, sk, skb) ? : ret; default: - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_BPF_CGROUP_EGRESS); return ret; } } @@ -337,7 +337,7 @@ static int ip_mc_finish_output(struct net *net, struct sock *sk, case NET_XMIT_SUCCESS: break; default: - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_BPF_CGROUP_EGRESS); return ret; } @@ -536,7 +536,7 @@ int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, no_route: rcu_read_unlock(); IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_IP_OUTNOROUTES); return -EHOSTUNREACH; } EXPORT_SYMBOL(__ip_queue_xmit); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 3286b64ec03d..15244fa6649d 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -130,7 +130,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * rcu_read_unlock_bh(); IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTNOROUTES); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_CREATEFAIL); return -EINVAL; } @@ -202,7 +202,7 @@ static int ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff *s case NET_XMIT_CN: return __ip6_finish_output(net, sk, skb) ? : ret; default: - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_BPF_CGROUP_EGRESS); return ret; } } @@ -217,7 +217,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) if (unlikely(idev->cnf.disable_ipv6)) { IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_IPV6DISABLED); return 0; } From patchwork Sat Feb 26 04:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12761189 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 114E7C433EF for ; Sat, 26 Feb 2022 04:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbiBZEUR (ORCPT ); Fri, 25 Feb 2022 23:20:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbiBZEUP (ORCPT ); Fri, 25 Feb 2022 23:20:15 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD2421F9FC; Fri, 25 Feb 2022 20:19:41 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id c1so6382806pgk.11; Fri, 25 Feb 2022 20:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HRHNQDNF5OpWMtsci03yux/pgrST514TVdTkLdLRMoQ=; b=IdJvqiYFQvHbZg6AFtKmWqdo3u/57hrG/PQXtNhUXnWufUk840BoaISCqpRtaOjiue dPvqOvgfNyhDeAfblgQZB5NoHz3klBzLIx+lU9mVV7FxApx6cn3a1tDcDwxVuYKEu3u4 liCk5oW+DCGsdO1gFBfRTO7ANQFdMzrRWKs3l+qD6RC8jLA//lI0XlmbTCIF1OdRHYu0 wcjHFyRRSkhAAxptH9DKIqgxBtYrHbGEaZNVCv81nvDXrhrNitizlDvNmkYflqoAllR9 D5xqx1O1wLK7NHECKYFeHBNS8eCLwgJkhEnukmAyYsORDdPy8du3CfSThTrz+8Mxg6jz AuBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HRHNQDNF5OpWMtsci03yux/pgrST514TVdTkLdLRMoQ=; b=VoZ2s2146KRe/+LyCY236P0PPykesD8hARaxYlZ6DvXBJcjI743ft9a0zqfwFya5ge vZNvner7Yc7G0LclDqwBjopnSmy1ZNKjVfpKq4APcsF9Hogrk2LR48zIJIIcx5buqLxC IW5wMV4D6MGACZJlSzLnNNVF2how9zsmHDu3dyMwwRNBJjH4gHJkPBsih7PKD6YQT6RF qiC4mGmC32w55xhv2FYLbzIBgZxowSVT825zVLybyj38cm+DaITa+s9Rye3m2tSL5++h wOfFLLSGkmemaCn98rDNHs2TtC36Als/qAEGKqByQfFRnnd5jIzFek5xg3aYs0nR5ilY yESg== X-Gm-Message-State: AOAM531THdxHhq8PPp3G9Y3kc9Hrah3Hezt3B+SMLnNknOsjKn6qLPUf GCZHj8jwyBQ33cTeC83l9o4= X-Google-Smtp-Source: ABdhPJx1+DDr7dos9lCkZeSKsCfgObqLdHUTo6gpbntNEjZ9wM/klId+MY5eNmExEJA/5yU/iFLyRA== X-Received: by 2002:a05:6a00:ac1:b0:4f1:29e4:b3a1 with SMTP id c1-20020a056a000ac100b004f129e4b3a1mr11081837pfl.63.1645849180922; Fri, 25 Feb 2022 20:19:40 -0800 (PST) Received: from localhost.localdomain ([203.205.141.112]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004f1335c8889sm4896193pff.7.2022.02.25.20.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 20:19:40 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: dsahern@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org, imagedong@tencent.com, edumazet@google.com, alobakin@pm.me, cong.wang@bytedance.com, paulb@nvidia.com, talalahmad@google.com, keescook@chromium.org, ilias.apalodimas@linaro.org, memxor@gmail.com, flyingpeng@tencent.com, mengensun@tencent.com, daniel@iogearbox.net, yajun.deng@linux.dev, roopa@nvidia.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v3 2/3] net: neigh: use kfree_skb_reason() for __neigh_event_send() Date: Sat, 26 Feb 2022 12:18:30 +0800 Message-Id: <20220226041831.2058437-3-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220226041831.2058437-1-imagedong@tencent.com> References: <20220226041831.2058437-1-imagedong@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Menglong Dong Replace kfree_skb() used in __neigh_event_send() with kfree_skb_reason(). Following drop reasons are added: SKB_DROP_REASON_NEIGH_FAILED SKB_DROP_REASON_NEIGH_QUEUEFULL SKB_DROP_REASON_NEIGH_DEAD The first two reasons above should be the hot path that skb drops in neighbour subsystem. Reviewed-by: Mengen Sun Reviewed-by: Hao Peng Signed-off-by: Menglong Dong Reviewed-by: David Ahern --- v2: - introduce the new drop reason 'SKB_DROP_REASON_NEIGH_DEAD' - simplify the document for the new drop reasons --- include/linux/skbuff.h | 5 +++++ include/trace/events/skb.h | 3 +++ net/core/neighbour.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bd6ed54f2460..9c4f6fc4e118 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -389,6 +389,11 @@ enum skb_drop_reason { SKB_DROP_REASON_NEIGH_CREATEFAIL, /* failed to create neigh * entry */ + SKB_DROP_REASON_NEIGH_FAILED, /* neigh entry in failed state */ + SKB_DROP_REASON_NEIGH_QUEUEFULL, /* arp_queue for neigh + * entry is full + */ + SKB_DROP_REASON_NEIGH_DEAD, /* neigh entry is dead */ SKB_DROP_REASON_MAX, }; diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 97f8097651da..1977f301260d 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -42,6 +42,9 @@ BPF_CGROUP_EGRESS) \ EM(SKB_DROP_REASON_IPV6DISABLED, IPV6DISABLED) \ EM(SKB_DROP_REASON_NEIGH_CREATEFAIL, NEIGH_CREATEFAIL) \ + EM(SKB_DROP_REASON_NEIGH_FAILED, NEIGH_FAILED) \ + EM(SKB_DROP_REASON_NEIGH_QUEUEFULL, NEIGH_QUEUEFULL) \ + EM(SKB_DROP_REASON_NEIGH_DEAD, NEIGH_DEAD) \ EMe(SKB_DROP_REASON_MAX, MAX) #undef EM diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ec0bf737b076..f64ebd050f6c 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1171,7 +1171,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb, neigh->updated = jiffies; write_unlock_bh(&neigh->lock); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_FAILED); return 1; } } else if (neigh->nud_state & NUD_STALE) { @@ -1193,7 +1193,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb, if (!buff) break; neigh->arp_queue_len_bytes -= buff->truesize; - kfree_skb(buff); + kfree_skb_reason(buff, SKB_DROP_REASON_NEIGH_QUEUEFULL); NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards); } skb_dst_force(skb); @@ -1215,7 +1215,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb, if (neigh->nud_state & NUD_STALE) goto out_unlock_bh; write_unlock_bh(&neigh->lock); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_DEAD); trace_neigh_event_send_dead(neigh, 1); return 1; } From patchwork Sat Feb 26 04:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12761190 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C185C433EF for ; Sat, 26 Feb 2022 04:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbiBZEUa (ORCPT ); Fri, 25 Feb 2022 23:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiBZEUU (ORCPT ); Fri, 25 Feb 2022 23:20:20 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 940E222011A; Fri, 25 Feb 2022 20:19:46 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id u16so6389049pfg.12; Fri, 25 Feb 2022 20:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E0+eJj0NPmwxnSMx1LXVXrNLUrIv19z+ZDO3nRYWhjc=; b=oI1ZrcyJTTa6Nsp+GTnXBkoaItgt5KmP8JGfnhwj1ltlFXvp+0b+ADel2Sz5KmTRpO 6D8+HH7LlBoivftVgjHlA+7cyUE866z/MiQ0lF3NpbslKh0olBH54i0ZNaJBxCdQcCGm jHjrLn5vrrUyBsg6nMBQnq+q7y84nyCq/daaTKXkqRO8mNxuEeGF83MXPtnWveWM1+E6 62R6cr3hJ5VMX2tiN27mw7nUbhVQkPdFeQIOvtozo1KdRfMbucLrjcfTfqozV1o+R4WI 04tOAr0I/3q125ARozgG01uRLZES7u/0+ViwWhV6GWiLPrqkjbX+yfQz1dWJeBhd+mrl ibKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E0+eJj0NPmwxnSMx1LXVXrNLUrIv19z+ZDO3nRYWhjc=; b=HdWV9i9y8uGEqrFgiIG4qbAPlMIezYpKCO9gJSNI4DbuLHftC3Xp/nkgkaC7EEjeNl sYbDtvAQ+Dn1BRDNpj4XaWVA3Kon8eVmb04cGs/n+0dLKxnGrzad2bP7gMgdC1dp+mqL Y072aXLGpRzHCED6EmhMph5+02OSqhPHzHgz6f31UzWySULnWZtbf3MHvHF/369myUyu uHaFmtVMVWAuHeD00KaddN2XjF1fNBmQeN4wG6J+xv0uuqAiPbgEiiyiePkV0/ld3ElM kKy4eJ99N3MGMOntYxPmDRdgwk3cSW7jM4coCONiZc27kDddY9yRVRFj/1liDw1ueIin Cigg== X-Gm-Message-State: AOAM5336GS6oMaR+qMi8uUWqDNaOSt4n/wh9yOthJgUBuJTZmmA1c7yV N68N7pIqlKsisI1HgD3Rp8s= X-Google-Smtp-Source: ABdhPJwuBBwQtLfdsMQxH7b6WoLbDmCiZjOVW9m3/Tik/YGwbxhMycXlzRIpTusE4+vqx0W+vGdWnQ== X-Received: by 2002:a63:e01:0:b0:374:2525:7690 with SMTP id d1-20020a630e01000000b0037425257690mr8838609pgl.37.1645849186064; Fri, 25 Feb 2022 20:19:46 -0800 (PST) Received: from localhost.localdomain ([203.205.141.112]) by smtp.gmail.com with ESMTPSA id k22-20020aa788d6000000b004f1335c8889sm4896193pff.7.2022.02.25.20.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 20:19:45 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: dsahern@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org, imagedong@tencent.com, edumazet@google.com, alobakin@pm.me, cong.wang@bytedance.com, paulb@nvidia.com, talalahmad@google.com, keescook@chromium.org, ilias.apalodimas@linaro.org, memxor@gmail.com, flyingpeng@tencent.com, mengensun@tencent.com, daniel@iogearbox.net, yajun.deng@linux.dev, roopa@nvidia.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v3 3/3] net: neigh: add skb drop reasons to arp_error_report() Date: Sat, 26 Feb 2022 12:18:31 +0800 Message-Id: <20220226041831.2058437-4-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220226041831.2058437-1-imagedong@tencent.com> References: <20220226041831.2058437-1-imagedong@tencent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Menglong Dong When neighbour become invalid or destroyed, neigh_invalidate() will be called. neigh->ops->error_report() will be called if the neighbour's state is NUD_FAILED, and seems here is the only use of error_report(). So we can tell that the reason of skb drops in arp_error_report() is SKB_DROP_REASON_NEIGH_FAILED. Replace kfree_skb() used in arp_error_report() with kfree_skb_reason(). Reviewed-by: Mengen Sun Reviewed-by: Hao Peng Signed-off-by: Menglong Dong Reviewed-by: David Ahern --- net/ipv4/arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 4db0325f6e1a..8e4ca4738c43 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -293,7 +293,7 @@ static int arp_constructor(struct neighbour *neigh) static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb) { dst_link_failure(skb); - kfree_skb(skb); + kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_FAILED); } /* Create and send an arp packet. */