mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
wifi: qtnfmac: Move stats allocation to core
With commit 34d21de99c
("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 qtnfmac driver to leverage the core allocation.
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240426093156.2002258-1-leitao@debian.org
This commit is contained in:
parent
cc1380dd18
commit
3d1a6e573b
1 changed files with 1 additions and 14 deletions
|
@ -196,22 +196,8 @@ static int qtnf_netdev_port_parent_id(struct net_device *ndev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qtnf_netdev_alloc_pcpu_stats(struct net_device *dev)
|
|
||||||
{
|
|
||||||
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
|
|
||||||
|
|
||||||
return dev->tstats ? 0 : -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void qtnf_netdev_free_pcpu_stats(struct net_device *dev)
|
|
||||||
{
|
|
||||||
free_percpu(dev->tstats);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Network device ops handlers */
|
/* Network device ops handlers */
|
||||||
const struct net_device_ops qtnf_netdev_ops = {
|
const struct net_device_ops qtnf_netdev_ops = {
|
||||||
.ndo_init = qtnf_netdev_alloc_pcpu_stats,
|
|
||||||
.ndo_uninit = qtnf_netdev_free_pcpu_stats,
|
|
||||||
.ndo_open = qtnf_netdev_open,
|
.ndo_open = qtnf_netdev_open,
|
||||||
.ndo_stop = qtnf_netdev_close,
|
.ndo_stop = qtnf_netdev_close,
|
||||||
.ndo_start_xmit = qtnf_netdev_hard_start_xmit,
|
.ndo_start_xmit = qtnf_netdev_hard_start_xmit,
|
||||||
|
@ -483,6 +469,7 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif,
|
||||||
dev->watchdog_timeo = QTNF_DEF_WDOG_TIMEOUT;
|
dev->watchdog_timeo = QTNF_DEF_WDOG_TIMEOUT;
|
||||||
dev->tx_queue_len = 100;
|
dev->tx_queue_len = 100;
|
||||||
dev->ethtool_ops = &qtnf_ethtool_ops;
|
dev->ethtool_ops = &qtnf_ethtool_ops;
|
||||||
|
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
|
||||||
|
|
||||||
if (qtnf_hwcap_is_set(&mac->bus->hw_info, QLINK_HW_CAPAB_HW_BRIDGE))
|
if (qtnf_hwcap_is_set(&mac->bus->hw_info, QLINK_HW_CAPAB_HW_BRIDGE))
|
||||||
dev->needed_tailroom = sizeof(struct qtnf_frame_meta_info);
|
dev->needed_tailroom = sizeof(struct qtnf_frame_meta_info);
|
||||||
|
|
Loading…
Add table
Reference in a new issue