Message ID | 20240221161732.3026127-1-leitao@debian.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1141104dyc; Wed, 21 Feb 2024 08:18:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWeIjrejWGzM5BhTnY9ln2wuPMPF/59k4pemXOUDXM1HUjRAplbVJASK/l6v3ND4ev14IiY3iuvMGo1n/RS/Tv/jlzwOQ== X-Google-Smtp-Source: AGHT+IH6GVXsAf8aAFtr2IMVU41ikAFaGCJoFqrea+ctIVHF4BT3JSmRxHCh21swiXb5hTd85vgA X-Received: by 2002:ac8:5f53:0:b0:42d:c88d:ed4b with SMTP id y19-20020ac85f53000000b0042dc88ded4bmr22451439qta.34.1708532311018; Wed, 21 Feb 2024 08:18:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708532310; cv=pass; d=google.com; s=arc-20160816; b=xdp1DBiU1/5b4PCVWBLfCpQeHACg8uuLHBt8CfxFmaWiNg/QdQ07+pmsWLnqyPxtHB zt9mktYhbKl+eygv3RsXvV6/cXDfZDXHva3flIpIQqz+cV5RVoOoVrnxlWiKK2AfRVSH dwCAiANvIdY+Hg37o0zOXvC09emL5p2UGZACDD6vL0GoKPcp431xHtKW1Ov29CKXVFaK P1kVrZfqWr3NQk3IbGHm4ICA1Ult5ZuMcuiOCa9eHqMwrlHr2HDzlRIv7NEQQouQN/NE uBgcaAyu2QBti/ZD41W/SaYrt2c8ys6fhet6NWCVKF1zGve8wHgyk7SvbsUVjWSk7ILq Ybxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=9Sihn+OQP2RXoSGGMUwVUZ2ON16ouXq3GovfkSaPw3Y=; fh=YyWKJDdtCsrBSrgr0KyiDca9+xZ8SyELMfEBoXSPrVg=; b=Z17gORXQh5onfy7fz2oFg6gRS5VvyaSJe6wMa1t0BQ55Qc0SaJ1uiOeFHapNwZo7D7 qhYcjW6/ZvqB84M+gcCUprwmClPTRA1MP5JPkp7rZZ4RMmzj2WM95iJcdUX7KYgeE4Xa RXYWtB8FLuY5Rjzc3IRTU61Wgh1pvBmSFmijj8y8JmcgnLvP0Pblkud5Xbok1YCcxPNb kbdkfsHrrFYqXk36x+ApF7PGTafm8QCM5B7YkKqHj+9XijKy+YeHh71lpXQbN2SbWVAx A8yjDWyGS5MJz0igA0z3yF1FfzS0yrwu9aHosblDYc4dQJ+QdpXq9cUZdmHWywjN4X3O CcoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c20-20020ac87d94000000b0042e12acefdesi7464347qtd.757.2024.02.21.08.18.30 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 08:18:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75089-ouuuleilei=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C8B561C245A7 for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 16:18:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 504E781AAE; Wed, 21 Feb 2024 16:18:10 +0000 (UTC) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 2235D446D9; Wed, 21 Feb 2024 16:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708532288; cv=none; b=UZuFggm8Nhatr06MlmOyVu4lfkRjXSnNt2t1G9xmrhyr7dB1vHHxVfetVv1kM71T6nxa6rKYsEPpBSrqrfVwUHeTwmvLg1+C7jOVHRY3mSdNWkqYluVK3xRQrZqLttENhpvRfPIFK+mhFgzWDLTHNgNwJIX0pVf/qUHryqX/qKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708532288; c=relaxed/simple; bh=/kpFXS2EwZl6WC5jy5PmXQiF+/eQUFkgRYhkxKfh0kE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=k/kC6FL56p3PLsKZXbg+sfADq0awWBbcw1pCY1ng4rfnqy4aPYmvHGLNBt3p6IETgNAiYNZKWwMxujmVBHbMttleWbUkNxsh1V/V4y7DyxZDpIDBe5STV5IXVuBiKCOg5wcPrVUVgrovw/M2I9FcVdq+xiidv7g+krRVDHvm4Kg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d21cdbc85bso10916511fa.2; Wed, 21 Feb 2024 08:18:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708532285; x=1709137085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9Sihn+OQP2RXoSGGMUwVUZ2ON16ouXq3GovfkSaPw3Y=; b=WsxQmUFHcBzBi+Iz9i+0KUWpWu6LEsOFcazJUHVooXa9oywIZ/5mC3vznvngobOGgn 2+e357V1BD6WNPmJmWVlPE/MmR+/MNNOtfUNeXXfs9sdEhQ9u3GnVrusqY/i4i7VM/lS OoJVfBesLNs2bzsTEBFfDD25951HyuSXKT4/4uKRz/ovwSI9PLA3Fs5/XFkKeUQpCJbE RVFEPAL8QUDRw6KxNO0HFG63NSihVslUMKWqiyd4trG+7haTuFwKdDwxZmiylweYqphC vm/SnLr8Yqm9TxK8YB3oblynaO+EuNfTnZBs5RllWrU2nqcOKtjgsISdWwe7ilR/PmP0 Fnng== X-Forwarded-Encrypted: i=1; AJvYcCVIjMKFDMBwiOBjENwVu9tAypW2sLnhFPzCGwUekTu8iMynViDn7d3ibFqC4SVBGejKttRKNVAYzLiB19aMBNMdELU6a4voXx6MzFqp X-Gm-Message-State: AOJu0YzX7yw2Q4QyeudY56vOdcQhK8BT/azlKvU67B7GV8yUw+DA4K60 OHMYC+twHXs+pL4vHPoxS/uEju7rj9PYuY7ampYW83bfvtrDQ9clsuLjsbHErQ0= X-Received: by 2002:a2e:9201:0:b0:2d2:37ff:f54a with SMTP id k1-20020a2e9201000000b002d237fff54amr6803294ljg.41.1708532284991; Wed, 21 Feb 2024 08:18:04 -0800 (PST) Received: from localhost (fwdproxy-lla-004.fbsv.net. [2a03:2880:30ff:4::face:b00c]) by smtp.gmail.com with ESMTPSA id u6-20020aa7d546000000b0056503299e26sm557848edr.88.2024.02.21.08.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 08:18:04 -0800 (PST) From: Breno Leitao <leitao@debian.org> To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, David Ahern <dsahern@kernel.org> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: [PATCH net-next] ipv6/sit: Do not allocate stats in the driver Date: Wed, 21 Feb 2024 08:17:32 -0800 Message-Id: <20240221161732.3026127-1-leitao@debian.org> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791525976059194716 X-GMAIL-MSGID: 1791525976059194716 |
Series |
[net-next] ipv6/sit: Do not allocate stats in the driver
|
|
Commit Message
Breno Leitao
Feb. 21, 2024, 4:17 p.m. UTC
With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and
convert veth & vrf"), stats allocation could be done on net core
instead of this driver.
With this new approach, the driver doesn't have to bother with error
handling (allocation failure checking, making sure free happens in the
right spot, etc). This is core responsibility now.
Remove the allocation in the ipv6/sit driver and leverage the network
core allocation.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/sit.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
Comments
On Wed, Feb 21, 2024 at 08:17:32AM -0800, Breno Leitao wrote: > With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and > convert veth & vrf"), stats allocation could be done on net core > instead of this driver. > > With this new approach, the driver doesn't have to bother with error > handling (allocation failure checking, making sure free happens in the > right spot, etc). This is core responsibility now. > > Remove the allocation in the ipv6/sit driver and leverage the network > core allocation. > > Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Simon Horman <horms@kernel.org>
On 2/21/24 9:17 AM, Breno Leitao wrote: > With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and > convert veth & vrf"), stats allocation could be done on net core > instead of this driver. > > With this new approach, the driver doesn't have to bother with error > handling (allocation failure checking, making sure free happens in the > right spot, etc). This is core responsibility now. > > Remove the allocation in the ipv6/sit driver and leverage the network > core allocation. > > Signed-off-by: Breno Leitao <leitao@debian.org> > --- > net/ipv6/sit.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > Reviewed-by: David Ahern <dsahern@kernel.org>
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Wed, 21 Feb 2024 08:17:32 -0800 you wrote: > With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and > convert veth & vrf"), stats allocation could be done on net core > instead of this driver. > > With this new approach, the driver doesn't have to bother with error > handling (allocation failure checking, making sure free happens in the > right spot, etc). This is core responsibility now. > > [...] Here is the summary with links: - [net-next] ipv6/sit: Do not allocate stats in the driver https://git.kernel.org/netdev/net-next/c/3e7a0dccf070 You are awesome, thank you!
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index ed3a44aa1e9d..5ad01480854d 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1408,7 +1408,6 @@ static void ipip6_dev_free(struct net_device *dev) struct ip_tunnel *tunnel = netdev_priv(dev); dst_cache_destroy(&tunnel->dst_cache); - free_percpu(dev->tstats); } #define SIT_FEATURES (NETIF_F_SG | \ @@ -1437,6 +1436,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) dev->features |= NETIF_F_LLTX; dev->features |= SIT_FEATURES; dev->hw_features |= SIT_FEATURES; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; + } static int ipip6_tunnel_init(struct net_device *dev) @@ -1449,16 +1450,11 @@ static int ipip6_tunnel_init(struct net_device *dev) strcpy(tunnel->parms.name, dev->name); ipip6_tunnel_bind_dev(dev); - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) - return -ENOMEM; err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL); - if (err) { - free_percpu(dev->tstats); - dev->tstats = NULL; + if (err) return err; - } + netdev_hold(dev, &tunnel->dev_tracker, GFP_KERNEL); netdev_lockdep_set_classes(dev); return 0;