Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp390757lqb; Tue, 4 Jun 2024 14:49:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPhQJ7oSBJoU+HBAyIrBy6ux90swlzkzDS64PQrSJGTsi0VKuKw4brKvHVXvGlAhoN+VS4cfco4UKl+xdzOfmqQIu4PAFVLWBKMEbjEA== X-Google-Smtp-Source: AGHT+IEGbxOFDJS7rZpEa5Ow6OWsYnRJlcdbRfCk6n66uKRk9/BEekBhttgdIhMQ65SoY+G8ow48 X-Received: by 2002:a17:907:38c:b0:a68:a800:5f7e with SMTP id a640c23a62f3a-a699faa9160mr47454166b.10.1717537740314; Tue, 04 Jun 2024 14:49:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717537740; cv=pass; d=google.com; s=arc-20160816; b=Pxx/eCAjmry7DWQpNycwqrz9/W+hdQaZzPluOeFIWLj8fhJ2JmPDAMFpYcbIZjcvtN p2ZZB6VldnWs85nrffL/2bOTM/BjtxhYHehOj6d32lNyxhmzkBICDdaWObFrwCCVyml7 WFn8tz+oOxL/A1h1uJ8jUfDOoaNGvrH9i14llz0JDUMnGy+Nadse22SX8XVySh9T1awB 8PrJKhfshwpa7c4thSsLgkZ1XO2YslExSgG35TIYZnmffXW9mP8tA0XMVOIdzgbhxyfO w51JTH84+fs9zwEld95oeMZ2LAEdvBv90AnYm9q7Vb/5i/XkEVqOv8fzklSfU4HmvP/x dyWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GJDm6iwovalgWz0sxMpvGD5PNxGmSKas+lavj2Qq0ow=; fh=x+3yq1v7u/+8GWd5nLMJzajoIvSy2vWh29u4yrmNDjs=; b=jQ3kDcWxEyvdOU4eE4yLVFiCZy+6QyiXhETRTf2h28pQ8rdr4Sq8tMe1YHG/mKQr+s SVpw5EtJQ7IXIidbLRUZ9qoSXw/tatn97qh3/tg6thbyc5ATeo8TXAmnnxgOPRLmj3nb R8JqGfcXokz0YvYiFNJ9snQxbmKLTi+svI8zxXmzSH61mnNmgb5/vMgXRKken+yVg6fF ewyKoiKPT6VlLsp2eznQvVmRuL65xVcdq3WnAWbGI2tANhB4P2eIyInYYFTxbx5Zx/B9 yEv8Vu0D9MLlFcmoKlrTAuLhLRji9AM8fTuQkAlsqp7rcJY9SXGxwZWnSO/fo9sR6Eo9 kZLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google09082023 header.b=ECNOhF4D; arc=pass (i=1 spf=pass spfdomain=cloudflare.com dkim=pass dkdomain=cloudflare.com dmarc=pass fromdomain=cloudflare.com); spf=pass (google.com: domain of linux-kernel+bounces-201423-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68c9fa1b7csi352277866b.884.2024.06.04.14.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201423-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google09082023 header.b=ECNOhF4D; arc=pass (i=1 spf=pass spfdomain=cloudflare.com dkim=pass dkdomain=cloudflare.com dmarc=pass fromdomain=cloudflare.com); spf=pass (google.com: domain of linux-kernel+bounces-201423-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201423-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0DF6E1F210D3 for ; Tue, 4 Jun 2024 21:49:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 616A714D28F; Tue, 4 Jun 2024 21:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="ECNOhF4D" Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EF5814E2D4 for ; Tue, 4 Jun 2024 21:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717537674; cv=none; b=NEge3AfD4jsopjojTdFiOe2J3VpTxQ7mdUSfMX5McZZ/EAPLKy26HnJjoiIvne5UEBMTLL8w1Zt245QizU4hQ0dyRjcjSEEDtLuNmE7sColgFLTqicF2hXXm9HlBR7Dnp/CyKvi2KtCX/+MCIAgmE3InW6c9GpYxYLoA464naEQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717537674; c=relaxed/simple; bh=kSyvuVmoawm0A1229Z9cjCnSswrtkKHtT2WgaP8HoEM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kY+LI3meqXtcFY6wUH2cENZJS53ua0wypOMKQAntycwa6uepCGSP8rdE6aXDjtkpUctATRYg4JGT2HeDf4771U98w3aCJEiMXvTUWsIz1fhhwU1sVKyIJG5I96FqJvDVHyf5JSUD1Mw3XxEfnplOLU9uIl26djCaWP7G6wIuPXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com; spf=pass smtp.mailfrom=cloudflare.com; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b=ECNOhF4D; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloudflare.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-44025bb945dso5448041cf.0 for ; Tue, 04 Jun 2024 14:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1717537672; x=1718142472; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GJDm6iwovalgWz0sxMpvGD5PNxGmSKas+lavj2Qq0ow=; b=ECNOhF4DhW2ck/MgMn1GFml8XgX8b+BjYujnwEMYcKdHODY0s8cx8aSIJ1Y1K1B+wc fWxZD4GHXFcZSBH5YsyaeEbm0AmPHfFrU4LrrDgr72TrjMXcDE9YiwuNGGtXWNkDRJwg zqYbNQ6YRjdRUGYDewv2hfnYC25Id6c+SOJ1rB/aoHgUEFWOR5NMMmf6ZTeLR49z9ZjX u2IZQ3sFjhQItraejhwuuBdRMiRqnRuKg3A3P24uM9Xv21/2LWZWwiMFVFOm0QKa4Wr0 cErmXR1vL/CG0CVG5oKDxRd7y2++TrFJHbgfIPoqgEa83AeIezy9cLfX6nUlgMPDjG0o vLcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717537672; x=1718142472; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GJDm6iwovalgWz0sxMpvGD5PNxGmSKas+lavj2Qq0ow=; b=J/EyE50HOZyQ2hZq/oL9Ngze0ovRS6PKZXqMk78htj8kkx/iNFoUvRt6Zy2DyKYXTg wEoVDeavPqhQ0Sf9so52byDeSMOVYxevvgY/Ghs3SHQSzzbQhHR3gK4i3abOCQ9LSrfa D3WC8DBxP9ctPKozTPrF8rJGQO7mSt9lnuPLRT4cI3ptvef4DT5kFfXNaAcm0ExhvpMO GsOYqyiTai7398j5bknspx7R5+ePL8pUpFF5K5whcGLhI7Znea9DAHz6Jkv5kw3nL5X7 VNgf45sty9TqeODzyy2BKsasonPe77cDdWlAv65byXeLpNykTEcltk8A47oxWuhnCTU1 zolA== X-Forwarded-Encrypted: i=1; AJvYcCUba+BdgcB0NGFP30MaOtugXBBU2wSOaeUHq9qMyIg6Nnxb4XAs1bm8xyYYLvx/+wxohPp+BtEIgAsg4Ee8ixz74DD1be/3gyMIotcJ X-Gm-Message-State: AOJu0YzVSdM/sPOr3vU7mECZsqLnoSgVqnt2Jdi8OaIPOaD6XOX9It9W 6zH6v9UppgGWRhXcorrQpA4vOb6NL9OORlH9HXe0uwsJAIFcm6rV66iSTZdK4Vc= X-Received: by 2002:ac8:5dd2:0:b0:43d:f989:edbc with SMTP id d75a77b69052e-4402b670b7emr5780621cf.52.1717537672021; Tue, 04 Jun 2024 14:47:52 -0700 (PDT) Received: from debian.debian ([2a09:bac5:7a49:f9b::18e:1c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4402627e268sm6946441cf.61.2024.06.04.14.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:47:51 -0700 (PDT) Date: Tue, 4 Jun 2024 14:47:48 -0700 From: Yan Zhai To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , David Ahern , Abhishek Chauhan , Mina Almasry , Florian Westphal , Alexander Lobakin , David Howells , Jiri Pirko , Daniel Borkmann , Sebastian Andrzej Siewior , Lorenzo Bianconi , Pavel Begunkov , linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Jesper Dangaard Brouer , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Neil Horman , linux-trace-kernel@vger.kernel.org, Dan Carpenter Subject: [RFC v3 net-next 4/7] net: raw: use sk_skb_reason_drop to free rx packets Message-ID: <854cb997b5407fbc4d23014d895f7cef5df724a1.1717529533.git.yan@cloudflare.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/raw.c | 4 ++-- net/ipv6/raw.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1a0953650356..474dfd263c8b 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -301,7 +301,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) ipv4_pktinfo_prepare(sk, skb, true); if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) { - kfree_skb_reason(skb, reason); + sk_skb_reason_drop(sk, skb, reason); return NET_RX_DROP; } @@ -312,7 +312,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) { if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) { atomic_inc(&sk->sk_drops); - kfree_skb_reason(skb, SKB_DROP_REASON_XFRM_POLICY); + sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_XFRM_POLICY); return NET_RX_DROP; } nf_reset_ct(skb); diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index f838366e8256..608fa9d05b55 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -362,14 +362,14 @@ static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb) if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) && skb_checksum_complete(skb)) { atomic_inc(&sk->sk_drops); - kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM); + sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_SKB_CSUM); return NET_RX_DROP; } /* Charge it to the socket. */ skb_dst_drop(skb); if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) { - kfree_skb_reason(skb, reason); + sk_skb_reason_drop(sk, skb, reason); return NET_RX_DROP; } @@ -390,7 +390,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { atomic_inc(&sk->sk_drops); - kfree_skb_reason(skb, SKB_DROP_REASON_XFRM_POLICY); + sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_XFRM_POLICY); return NET_RX_DROP; } nf_reset_ct(skb); @@ -415,7 +415,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) if (inet_test_bit(HDRINCL, sk)) { if (skb_checksum_complete(skb)) { atomic_inc(&sk->sk_drops); - kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM); + sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_SKB_CSUM); return NET_RX_DROP; } } -- 2.30.2