* [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator
@ 2024-04-04 12:52 Breno Leitao
2024-04-04 12:52 ` [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64 Breno Leitao
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Breno Leitao @ 2024-04-04 12:52 UTC (permalink / raw)
To: kuba, davem, pabeni, edumazet, Steffen Klassert, Herbert Xu,
David Ahern
Cc: linux-kernel, netdev
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 in 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 ip6_vti and leverage the network
core allocation instead.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/ip6_vti.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7f4f976aa24a..71c749bb4b3e 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -174,11 +174,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t)
}
}
-static void vti6_dev_free(struct net_device *dev)
-{
- free_percpu(dev->tstats);
-}
-
static int vti6_tnl_create2(struct net_device *dev)
{
struct ip6_tnl *t = netdev_priv(dev);
@@ -907,9 +902,8 @@ static void vti6_dev_setup(struct net_device *dev)
{
dev->netdev_ops = &vti6_netdev_ops;
dev->header_ops = &ip_tunnel_header_ops;
- dev->needs_free_netdev = true;
- dev->priv_destructor = vti6_dev_free;
+ dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
dev->type = ARPHRD_TUNNEL6;
dev->min_mtu = IPV4_MIN_MTU;
dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr);
@@ -931,9 +925,6 @@ static inline int vti6_dev_init_gen(struct net_device *dev)
t->dev = dev;
t->net = dev_net(dev);
- dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
- if (!dev->tstats)
- return -ENOMEM;
netdev_hold(dev, &t->dev_tracker, GFP_KERNEL);
netdev_lockdep_set_classes(dev);
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64
2024-04-04 12:52 [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator Breno Leitao
@ 2024-04-04 12:52 ` Breno Leitao
2024-04-04 18:09 ` David Ahern
2024-04-04 18:08 ` [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator David Ahern
2024-04-08 10:00 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Breno Leitao @ 2024-04-04 12:52 UTC (permalink / raw)
To: kuba, davem, pabeni, edumazet, Steffen Klassert, Herbert Xu,
David Ahern
Cc: linux-kernel, netdev
Commit 3e2f544dd8a33 ("net: get stats64 if device if driver is
configured") moved the callback to dev_get_tstats64() to net core, so,
unless the driver is doing some custom stats collection, it does not
need to set .ndo_get_stats64.
Since this driver is now relying in NETDEV_PCPU_STAT_TSTATS, then, it
doesn't need to set the dev_get_tstats64() generic .ndo_get_stats64
function pointer.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/ipv6/ip6_vti.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 71c749bb4b3e..4d68a0777b0c 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -887,7 +887,6 @@ static const struct net_device_ops vti6_netdev_ops = {
.ndo_uninit = vti6_dev_uninit,
.ndo_start_xmit = vti6_tnl_xmit,
.ndo_siocdevprivate = vti6_siocdevprivate,
- .ndo_get_stats64 = dev_get_tstats64,
.ndo_get_iflink = ip6_tnl_get_iflink,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator
2024-04-04 12:52 [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator Breno Leitao
2024-04-04 12:52 ` [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64 Breno Leitao
@ 2024-04-04 18:08 ` David Ahern
2024-04-08 10:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2024-04-04 18:08 UTC (permalink / raw)
To: Breno Leitao, kuba, davem, pabeni, edumazet, Steffen Klassert,
Herbert Xu
Cc: linux-kernel, netdev
On 4/4/24 6:52 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 in 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 ip6_vti and leverage the network
> core allocation instead.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> net/ipv6/ip6_vti.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64
2024-04-04 12:52 ` [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64 Breno Leitao
@ 2024-04-04 18:09 ` David Ahern
0 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2024-04-04 18:09 UTC (permalink / raw)
To: Breno Leitao, kuba, davem, pabeni, edumazet, Steffen Klassert,
Herbert Xu
Cc: linux-kernel, netdev
On 4/4/24 6:52 AM, Breno Leitao wrote:
> Commit 3e2f544dd8a33 ("net: get stats64 if device if driver is
> configured") moved the callback to dev_get_tstats64() to net core, so,
> unless the driver is doing some custom stats collection, it does not
> need to set .ndo_get_stats64.
>
> Since this driver is now relying in NETDEV_PCPU_STAT_TSTATS, then, it
> doesn't need to set the dev_get_tstats64() generic .ndo_get_stats64
> function pointer.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> net/ipv6/ip6_vti.c | 1 -
> 1 file changed, 1 deletion(-)
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator
2024-04-04 12:52 [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator Breno Leitao
2024-04-04 12:52 ` [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64 Breno Leitao
2024-04-04 18:08 ` [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator David Ahern
@ 2024-04-08 10:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-08 10:00 UTC (permalink / raw)
To: Breno Leitao
Cc: kuba, davem, pabeni, edumazet, steffen.klassert, herbert, dsahern,
linux-kernel, netdev
Hello:
This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 4 Apr 2024 05:52:51 -0700 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 in 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,1/2] ip6_vti: Do not use custom stat allocator
https://git.kernel.org/netdev/net-next/c/a9b2d55a8f1e
- [net-next,2/2] ip6_vti: Remove generic .ndo_get_stats64
https://git.kernel.org/netdev/net-next/c/b2c919c108ab
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-08 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 12:52 [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator Breno Leitao
2024-04-04 12:52 ` [PATCH net-next 2/2] ip6_vti: Remove generic .ndo_get_stats64 Breno Leitao
2024-04-04 18:09 ` David Ahern
2024-04-04 18:08 ` [PATCH net-next 1/2] ip6_vti: Do not use custom stat allocator David Ahern
2024-04-08 10:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox