From patchwork Sun Feb 20 15:57:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12752751 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 35979C433F5 for ; Sun, 20 Feb 2022 15:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244269AbiBTP7T (ORCPT ); Sun, 20 Feb 2022 10:59:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243520AbiBTP7S (ORCPT ); Sun, 20 Feb 2022 10:59:18 -0500 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 146FC43AFE; Sun, 20 Feb 2022 07:58:57 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id ev16-20020a17090aead000b001bc3835fea8so603154pjb.0; Sun, 20 Feb 2022 07:58:57 -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=n6gvWaFKwJ4c00qvrbIyVU2QHYUO7UdYkobNiYVL6FU=; b=Wd+miKXq1iMzYA2L5WBFCJ9m3Z1paX2px5Te9c3iCwlYXcKiK2eGa6eRNkYpQI5oiP IKQkpxLbxzJglW5/6JJPcXsGA3MPRN2+HtJdZTF/7KtV44KXgpOCw+VvuMXn/q/xPLSc MRy3aVpFXTVQ0c9dPg/jxt8BiXZ0v/4gb13GGFB4rifD95U7LbNP6fQTp0VaHXqAqJhQ Za1JOGYS0IaF4NBeYqRr1hQImfnsvgdCTfDAesrADVHgVOWPxyjLB3sQVzcpHCL+PwhX nyJuWh7YtywpLVKVWU1Lek0Bss2hwTYn6Z3GRMEl/YeyVi6GemgKRd6gSo5XgtiorTw/ 7LEQ== 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=n6gvWaFKwJ4c00qvrbIyVU2QHYUO7UdYkobNiYVL6FU=; b=m94Hlpc6uF/SC49bcH8fRoCFW7XJbOou8bOiT4YgER8700WooY2zugG/9ZcfdfzhQb NJT/6eCp4wpaurflMkcE3EW2E0xp9necKzb0mSvFMk3CvSbPJDFfZQp8yOoqJTx+hU0f TzZPG6cUPJjVXxsf8MrEtuqb5v6Qd6x1ds2NMFxCoKxa8Vo61bwjrCLXDCUeDeufcUCM X0hRY2mJcdBFTKAyuoct2iYqoYWPXypY0FI9V4rOVekgxucSeNj/f2jrAh38B2wf8Dcb msnOmhwm+fX3pwUWyirSVZ0XLQNJHOX1MTndysvy80tEGE7IVzv/rJhjf31N//l8Khiw FBwg== X-Gm-Message-State: AOAM5322SVqr+PKzQ2HqmpJglwol7laCLOFb9Uu/UMmj32hLcCzDP6Uz F6IOgO/vFH7TSYKWvnxHWrc= X-Google-Smtp-Source: ABdhPJyX7EBuEdIMsMoR+wifYixriLOjrTR4BxgU3fYxTBgCSiGDP0jQKGdTRaZ4BqPX27uDw2lIMQ== X-Received: by 2002:a17:90a:d243:b0:1b9:cbac:a775 with SMTP id o3-20020a17090ad24300b001b9cbaca775mr17638579pjw.196.1645372736596; Sun, 20 Feb 2022 07:58:56 -0800 (PST) Received: from localhost.localdomain ([203.205.141.114]) by smtp.gmail.com with ESMTPSA id o14sm5001927pfw.121.2022.02.20.07.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:58:56 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: kuba@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.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 1/3] net: ip: add skb drop reasons for ip egress path Date: Sun, 20 Feb 2022 23:57:03 +0800 Message-Id: <20220220155705.194266-2-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220155705.194266-1-imagedong@tencent.com> References: <20220220155705.194266-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() with kfree_skb_reason() in the packet egress path of IP layer (both IPv4 and IPv6 are considered). Following functions are involved: __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_IPV6DSIABLED Reviewed-by: Mengen Sun Reviewed-by: Hao Peng Signed-off-by: Menglong Dong --- include/linux/skbuff.h | 13 +++++++++++++ include/trace/events/skb.h | 4 ++++ net/ipv4/ip_output.c | 6 +++--- net/ipv6/ip6_output.c | 6 +++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a3e90efe6586..c310a4a8fc86 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -380,6 +380,19 @@ enum skb_drop_reason { * the ofo queue, corresponding to * LINUX_MIB_TCPOFOMERGE */ + SKB_DROP_REASON_IP_OUTNOROUTES, /* route lookup failed during + * packet outputting + */ + SKB_DROP_REASON_BPF_CGROUP_EGRESS, /* dropped by eBPF program + * with type of BPF_PROG_TYPE_CGROUP_SKB + * and attach type of + * BPF_CGROUP_INET_EGRESS + * during packet sending + */ + SKB_DROP_REASON_IPV6DSIABLED, /* IPv6 is disabled on the device, + * see the doc for disable_ipv6 + * in ip-sysctl.rst for detail + */ SKB_DROP_REASON_MAX, }; diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 2ab7193313aa..47dedef7b6b8 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -37,6 +37,10 @@ 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_IPV6DSIABLED, IPV6DSIABLED) \ EMe(SKB_DROP_REASON_MAX, MAX) #undef EM diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 0c0574eb5f5b..df549b7415fb 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -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 0c6c971ce0a5..4cd9e5fd25e4 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_IP_OUTNOROUTES); 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_IPV6DSIABLED); return 0; } From patchwork Sun Feb 20 15:57:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12752752 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 1A6EFC433F5 for ; Sun, 20 Feb 2022 15:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244275AbiBTP71 (ORCPT ); Sun, 20 Feb 2022 10:59:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243520AbiBTP7X (ORCPT ); Sun, 20 Feb 2022 10:59:23 -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 41C2E4476D; Sun, 20 Feb 2022 07:59:02 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id 12so8631261pgd.0; Sun, 20 Feb 2022 07:59:02 -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=44LYBQpyrjIKyg3Y9on2cX6HSqaMbgnWx5oGl5OsXPY=; b=XEODjzbh6LmU2vDPqqhz1yXoiLwka8QJblDkRG0ZXapsTjpPNgUu3/PDQMaPfAAsly SYusaQSBQDjpLemEbYwG//xfO2DCi+osj64jheB/NC7JeFh3kn3ObUr1mJuJ7Hl4q9/P MoNQ4BlKTI1VRBuyhgFdb0uawAwiH06xiv0aA00q/tic0hSuiUltEkxxQiUbSZWeBCVq Zsm9C9QdgYZHiX7P6+TctVvwBf9hvpqDbAjZb8wI3NTQBjEL7aKPyK0sKCTOWPK4FVn7 aLxv7kgfi3wYMOKj2k7lDF587ELxh1iTobvErixEqhvu8DgjJovpv7SQ9rkvf2/ljY6S uYpQ== 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=44LYBQpyrjIKyg3Y9on2cX6HSqaMbgnWx5oGl5OsXPY=; b=RE9pD3nqOebqktNUagepsZMFMU2YWdNAN8Z9Jz5dYeuvzwygiYPsElw3fHjYKFVtMg H0NTyp8VUSO+64qkrhRkIW19QO05RJI7UhoNu+42w41OgWpxeZ9Wh2kc15AaLvi0Y3pY Zy9QHngXKSpA+zVlJMWntf/COHnh/+8BvimOaDhVrK0HOxFrUT5DGY8Yr+TaO3bMyXsS nJz163Ef57kMulSltPBnGu4iXG0pPxmNY3hXsDuqosq7+Tpmp2mrwVrIgTiUGbXmMk6h F5LOFMH0N7OJdyeEbm9UbrNQMXYEcBtnpmdMZhwfjGaETXD3ZWzwSp1gYhH4/sRt70FH GLBQ== X-Gm-Message-State: AOAM531FixWKpDolWYHziWGyeWPZaVwv1dTgW4B8Zn77S8C3XnsJ0GiS 6YnbTgRbqq1MwQvR6nN99tfyAUynzE4= X-Google-Smtp-Source: ABdhPJzn9S0cEXinVzxQHrgEyWcCZaNhLMOJNxIeZgoh99J3QV3vnukOy/kS4zl8voBMFhggoqRhlQ== X-Received: by 2002:a05:6a00:1995:b0:4e1:a7dd:96d6 with SMTP id d21-20020a056a00199500b004e1a7dd96d6mr16218258pfl.16.1645372741775; Sun, 20 Feb 2022 07:59:01 -0800 (PST) Received: from localhost.localdomain ([203.205.141.114]) by smtp.gmail.com with ESMTPSA id o14sm5001927pfw.121.2022.02.20.07.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:59:01 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: kuba@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.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 2/3] net: neigh: use kfree_skb_reason() for __neigh_event_send() Date: Sun, 20 Feb 2022 23:57:04 +0800 Message-Id: <20220220155705.194266-3-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220155705.194266-1-imagedong@tencent.com> References: <20220220155705.194266-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 The 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 --- include/linux/skbuff.h | 9 +++++++++ include/trace/events/skb.h | 2 ++ net/core/neighbour.c | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c310a4a8fc86..206b66f5ce6b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -393,6 +393,15 @@ enum skb_drop_reason { * see the doc for disable_ipv6 * in ip-sysctl.rst for detail */ + SKB_DROP_REASON_NEIGH_FAILED, /* dropped as the state of + * neighbour is NUD_FAILED + */ + SKB_DROP_REASON_NEIGH_QUEUEFULL, /* the skbs that waiting + * for sending on the queue + * of neigh->arp_queue is + * full, and the skbs on the + * tail will be dropped + */ SKB_DROP_REASON_MAX, }; diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 47dedef7b6b8..dd06366ded4a 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -41,6 +41,8 @@ EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS, \ BPF_CGROUP_EGRESS) \ EM(SKB_DROP_REASON_IPV6DSIABLED, IPV6DSIABLED) \ + EM(SKB_DROP_REASON_NEIGH_FAILED, NEIGH_FAILED) \ + EM(SKB_DROP_REASON_NEIGH_QUEUEFULL, NEIGH_QUEUEFULL) \ EMe(SKB_DROP_REASON_MAX, MAX) #undef EM diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ec0bf737b076..c353834e8fa9 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); From patchwork Sun Feb 20 15:57:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Menglong Dong X-Patchwork-Id: 12752753 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 5491DC433F5 for ; Sun, 20 Feb 2022 15:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244290AbiBTP7a (ORCPT ); Sun, 20 Feb 2022 10:59:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:32834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244286AbiBTP72 (ORCPT ); Sun, 20 Feb 2022 10:59:28 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 612F1443D3; Sun, 20 Feb 2022 07:59:07 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id l17so1329234plg.0; Sun, 20 Feb 2022 07:59:07 -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=pyq6u+oy+fqZeW/hecUnoAg2DOu5MbfwxNlJm6r1Xhc=; b=nhNXKjiu6EaOKVNgwNWDgMQAPqgMwsRFUEymL567UuWUK/arrTFPbe44ACR42cYIBL bsN0eLNtzre4HgEeRuF8ScM8yxmTEfo2b/QbVuK9VD5j6gDvzMA0qfrn5zGdCT7n5fBR myLeaYTe2aqFcjbJEqxFrWBr+5poGn3GlFM9xQ8vAYNWQJ01KmsBNXZOGnXeyjWB2lBr L8OPTmlMzBsDz3M87LeFQtVljORl+JOQ0YQsELxbxgMckEycSdeX1WBRCvkcf9RHzpmx /zpv3O2GTASPwelzwWD7l7Je6mHKpMpYv0WRF/8ZHcjhVSk8SqfFwHQVpIbku+sqcuKD 7CsQ== 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=pyq6u+oy+fqZeW/hecUnoAg2DOu5MbfwxNlJm6r1Xhc=; b=T+S/0YM2LumXjw04abeU/w8S2IwXO6C41bA3eEjhIP6JA9ED6OZ0ZXmGnRWXO1WYeT Ub0iBSHI8JhnTz6nucjuo8T1c64w9IQm0JJ4W/6ucHcT3kNcKBr4MR4dmxZVDUO0savY HWS6ssozW5N7JjWlEMVtIw4HPIahXPp4y9QJZYJ4jwMMEg0JWoOELYyHQQe0zS2ApCA+ 6rwyiY192R+OFN2iTBWwgJd3ieHO7QeYKelrBGo0Z/VtZCuPGuev1u/v6/zGOLqrWmAT D59ZWZ8TCj7yYPzcztMNbGG8u9h+5CeTbume4aDxwK7AiKXxOzjn67YmgtuEtg7vLDOv 2I+g== X-Gm-Message-State: AOAM533mB7nho57eX2d1lUOWhn2mzQFdq0tQ5l8JrlaKWzgJmXnUpWXD fjBuKdDxrnxkkczHR2CCeq4= X-Google-Smtp-Source: ABdhPJyDvTw5u1Ag3PqOeCX1fHbyL3QF88xpCu/Gh3BQO2dQKLD7HyGzmy1YoZhB7ui8yKZigMidAQ== X-Received: by 2002:a17:903:192:b0:14d:8b5a:5446 with SMTP id z18-20020a170903019200b0014d8b5a5446mr15649776plg.46.1645372746931; Sun, 20 Feb 2022 07:59:06 -0800 (PST) Received: from localhost.localdomain ([203.205.141.114]) by smtp.gmail.com with ESMTPSA id o14sm5001927pfw.121.2022.02.20.07.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:59:06 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: kuba@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.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 3/3] net: neigh: add skb drop reasons to arp_error_report() Date: Sun, 20 Feb 2022 23:57:05 +0800 Message-Id: <20220220155705.194266-4-imagedong@tencent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220155705.194266-1-imagedong@tencent.com> References: <20220220155705.194266-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. */