* [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core
@ 2024-06-07 10:20 Breno Leitao
2024-06-07 10:20 ` [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64 Breno Leitao
2024-06-08 8:59 ` [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Simon Horman
0 siblings, 2 replies; 4+ messages in thread
From: Breno Leitao @ 2024-06-07 10:20 UTC (permalink / raw)
To: kvalo, linux-wireless, Johannes Berg, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: horms, sbhatta, open list:NETWORKING [GENERAL], open list
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.
Move mac80211 driver to leverage the core allocation.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/mac80211/iface.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index dc42902e2693..605305cb3ff2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1458,11 +1458,6 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
return res;
}
-static void ieee80211_if_free(struct net_device *dev)
-{
- free_percpu(dev->tstats);
-}
-
static void ieee80211_if_setup(struct net_device *dev)
{
ether_setup(dev);
@@ -1470,7 +1465,6 @@ static void ieee80211_if_setup(struct net_device *dev)
dev->priv_flags |= IFF_NO_QUEUE;
dev->netdev_ops = &ieee80211_dataif_ops;
dev->needs_free_netdev = true;
- dev->priv_destructor = ieee80211_if_free;
}
static void ieee80211_iface_process_skb(struct ieee80211_local *local,
@@ -2101,11 +2095,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
dev_net_set(ndev, wiphy_net(local->hw.wiphy));
- ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
- if (!ndev->tstats) {
- free_netdev(ndev);
- return -ENOMEM;
- }
+ ndev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
ndev->needed_headroom = local->tx_headroom +
4*6 /* four MAC addresses */
@@ -2118,7 +2108,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ret = dev_alloc_name(ndev, ndev->name);
if (ret < 0) {
- ieee80211_if_free(ndev);
free_netdev(ndev);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64
2024-06-07 10:20 [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Breno Leitao
@ 2024-06-07 10:20 ` Breno Leitao
2024-06-08 8:59 ` Simon Horman
2024-06-08 8:59 ` [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Simon Horman
1 sibling, 1 reply; 4+ messages in thread
From: Breno Leitao @ 2024-06-07 10:20 UTC (permalink / raw)
To: kvalo, linux-wireless, Johannes Berg, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: horms, sbhatta, open list:NETWORKING [GENERAL], open list
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.
In this driver specifically, .ndo_get_stats64 basically points to
dev_fetch_sw_netstats(). Now it will point to dev_get_tstats64(), which
calls netdev_stats_to_stats64() and dev_fetch_sw_netstats().
netdev_stats_to_stats64() seems irrelevant for this driver.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
net/mac80211/iface.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 605305cb3ff2..8f5d5f5deb4d 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -815,12 +815,6 @@ static void ieee80211_uninit(struct net_device *dev)
ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev));
}
-static void
-ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
-{
- dev_fetch_sw_netstats(stats, dev->tstats);
-}
-
static int ieee80211_netdev_setup_tc(struct net_device *dev,
enum tc_setup_type type, void *type_data)
{
@@ -837,7 +831,6 @@ static const struct net_device_ops ieee80211_dataif_ops = {
.ndo_start_xmit = ieee80211_subif_start_xmit,
.ndo_set_rx_mode = ieee80211_set_multicast_list,
.ndo_set_mac_address = ieee80211_change_mac,
- .ndo_get_stats64 = ieee80211_get_stats64,
.ndo_setup_tc = ieee80211_netdev_setup_tc,
};
@@ -877,7 +870,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
.ndo_set_rx_mode = ieee80211_set_multicast_list,
.ndo_set_mac_address = ieee80211_change_mac,
.ndo_select_queue = ieee80211_monitor_select_queue,
- .ndo_get_stats64 = ieee80211_get_stats64,
};
static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
@@ -945,7 +937,6 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
.ndo_start_xmit = ieee80211_subif_start_xmit_8023,
.ndo_set_rx_mode = ieee80211_set_multicast_list,
.ndo_set_mac_address = ieee80211_change_mac,
- .ndo_get_stats64 = ieee80211_get_stats64,
.ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
.ndo_setup_tc = ieee80211_netdev_setup_tc,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core
2024-06-07 10:20 [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Breno Leitao
2024-06-07 10:20 ` [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64 Breno Leitao
@ 2024-06-08 8:59 ` Simon Horman
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-06-08 8:59 UTC (permalink / raw)
To: Breno Leitao
Cc: kvalo, linux-wireless, Johannes Berg, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, sbhatta,
open list:NETWORKING [GENERAL], open list
On Fri, Jun 07, 2024 at 03:20:43AM -0700, 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.
>
> Move mac80211 driver to leverage the core allocation.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64
2024-06-07 10:20 ` [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64 Breno Leitao
@ 2024-06-08 8:59 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-06-08 8:59 UTC (permalink / raw)
To: Breno Leitao
Cc: kvalo, linux-wireless, Johannes Berg, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, sbhatta,
open list:NETWORKING [GENERAL], open list
On Fri, Jun 07, 2024 at 03:20:44AM -0700, 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.
>
> In this driver specifically, .ndo_get_stats64 basically points to
> dev_fetch_sw_netstats(). Now it will point to dev_get_tstats64(), which
> calls netdev_stats_to_stats64() and dev_fetch_sw_netstats().
> netdev_stats_to_stats64() seems irrelevant for this driver.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-08 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07 10:20 [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Breno Leitao
2024-06-07 10:20 ` [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64 Breno Leitao
2024-06-08 8:59 ` Simon Horman
2024-06-08 8:59 ` [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).