[PATCH] ieee80211: Provide generic get_stats implementation
bcm43xx and ipw2100 currently duplicate the same simplistic get_stats handler. Additionally, zd1211rw requires the same handler to fix a bug where all stats are reported as 0. This patch adds a generic implementation to the ieee80211 layer, which drivers are free to override. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
b1382edef9
commit
718cc4ca2b
|
@ -4013,11 +4013,6 @@ static int bcm43xx_ieee80211_hard_start_xmit(struct ieee80211_txb *txb,
|
|||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
static struct net_device_stats * bcm43xx_net_get_stats(struct net_device *net_dev)
|
||||
{
|
||||
return &(bcm43xx_priv(net_dev)->ieee->stats);
|
||||
}
|
||||
|
||||
static void bcm43xx_net_tx_timeout(struct net_device *net_dev)
|
||||
{
|
||||
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
|
||||
|
@ -4131,7 +4126,6 @@ static int __devinit bcm43xx_init_one(struct pci_dev *pdev,
|
|||
|
||||
net_dev->open = bcm43xx_net_open;
|
||||
net_dev->stop = bcm43xx_net_stop;
|
||||
net_dev->get_stats = bcm43xx_net_get_stats;
|
||||
net_dev->tx_timeout = bcm43xx_net_tx_timeout;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
net_dev->poll_controller = bcm43xx_net_poll_controller;
|
||||
|
|
|
@ -5827,19 +5827,6 @@ static void ipw2100_tx_timeout(struct net_device *dev)
|
|||
schedule_reset(priv);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: reimplement it so that it reads statistics
|
||||
* from the adapter using ordinal tables
|
||||
* instead of/in addition to collecting them
|
||||
* in the driver
|
||||
*/
|
||||
static struct net_device_stats *ipw2100_stats(struct net_device *dev)
|
||||
{
|
||||
struct ipw2100_priv *priv = ieee80211_priv(dev);
|
||||
|
||||
return &priv->ieee->stats;
|
||||
}
|
||||
|
||||
static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value)
|
||||
{
|
||||
/* This is called when wpa_supplicant loads and closes the driver
|
||||
|
@ -6022,7 +6009,6 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
|
|||
dev->open = ipw2100_open;
|
||||
dev->stop = ipw2100_close;
|
||||
dev->init = ipw2100_net_init;
|
||||
dev->get_stats = ipw2100_stats;
|
||||
dev->ethtool_ops = &ipw2100_ethtool_ops;
|
||||
dev->tx_timeout = ipw2100_tx_timeout;
|
||||
dev->wireless_handlers = &ipw2100_wx_handler_def;
|
||||
|
|
|
@ -123,6 +123,13 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *ieee80211_generic_get_stats(
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct ieee80211_device *ieee = netdev_priv(dev);
|
||||
return &ieee->stats;
|
||||
}
|
||||
|
||||
struct net_device *alloc_ieee80211(int sizeof_priv)
|
||||
{
|
||||
struct ieee80211_device *ieee;
|
||||
|
@ -140,6 +147,10 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
|
|||
dev->hard_start_xmit = ieee80211_xmit;
|
||||
dev->change_mtu = ieee80211_change_mtu;
|
||||
|
||||
/* Drivers are free to override this if the generic implementation
|
||||
* does not meet their needs. */
|
||||
dev->get_stats = ieee80211_generic_get_stats;
|
||||
|
||||
ieee->dev = dev;
|
||||
|
||||
err = ieee80211_networks_allocate(ieee);
|
||||
|
|
Loading…
Reference in New Issue