summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-07-08 08:37:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-09 11:59:51 -0700
commit9630f6b97a5918c7a14803954ae2ff5ff3f9fb3c (patch)
tree83f36275bf423ebd9f7e4e2747dbd6961087c5aa /drivers/staging
parentcd687a4073d58b5763ed085b942302714f0fa73d (diff)
staging: wlan-ng: Use net_device_stats from struct net_device
Instead of using an own copy of struct net_device_stats in struct wlandevice, use stats from struct net_device. Also remove the thus unnecessary .ndo_get_stats function, as it would now just return netdev->stats, which is the default in dev_get_stats(). Furthermore, convert prefix increment of stats counters to the more common postfix increment idiom. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/wlan-ng/hfa384x_usb.c18
-rw-r--r--drivers/staging/wlan-ng/p80211netdev.c40
-rw-r--r--drivers/staging/wlan-ng/p80211netdev.h1
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c2
4 files changed, 17 insertions, 44 deletions
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 07cee5637276..2f63e0c6d445 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3158,8 +3158,8 @@ static void hfa384x_usbin_callback(struct urb *urb)
/* Check for short packet */
if (urb->actual_length == 0) {
- ++(wlandev->linux_stats.rx_errors);
- ++(wlandev->linux_stats.rx_length_errors);
+ wlandev->netdev->stats.rx_errors++;
+ wlandev->netdev->stats.rx_length_errors++;
action = RESUBMIT;
}
break;
@@ -3169,7 +3169,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
wlandev->netdev->name);
if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags))
schedule_work(&hw->usb_work);
- ++(wlandev->linux_stats.rx_errors);
+ wlandev->netdev->stats.rx_errors++;
action = ABORT;
break;
@@ -3180,12 +3180,12 @@ static void hfa384x_usbin_callback(struct urb *urb)
!timer_pending(&hw->throttle)) {
mod_timer(&hw->throttle, jiffies + THROTTLE_JIFFIES);
}
- ++(wlandev->linux_stats.rx_errors);
+ wlandev->netdev->stats.rx_errors++;
action = ABORT;
break;
case -EOVERFLOW:
- ++(wlandev->linux_stats.rx_over_errors);
+ wlandev->netdev->stats.rx_over_errors++;
action = RESUBMIT;
break;
@@ -3204,7 +3204,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
default:
pr_debug("urb status=%d, transfer flags=0x%x\n",
urb->status, urb->transfer_flags);
- ++(wlandev->linux_stats.rx_errors);
+ wlandev->netdev->stats.rx_errors++;
action = RESUBMIT;
break;
}
@@ -3712,7 +3712,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
if (!test_and_set_bit
(WORK_TX_HALT, &hw->usb_flags))
schedule_work(&hw->usb_work);
- ++(wlandev->linux_stats.tx_errors);
+ wlandev->netdev->stats.tx_errors++;
break;
}
@@ -3728,7 +3728,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
mod_timer(&hw->throttle,
jiffies + THROTTLE_JIFFIES);
}
- ++(wlandev->linux_stats.tx_errors);
+ wlandev->netdev->stats.tx_errors++;
netif_stop_queue(wlandev->netdev);
break;
}
@@ -3741,7 +3741,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
default:
netdev_info(wlandev->netdev, "unknown urb->status=%d\n",
urb->status);
- ++(wlandev->linux_stats.tx_errors);
+ wlandev->netdev->stats.tx_errors++;
break;
} /* switch */
}
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 00b186c59725..29afa573cc99 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -92,7 +92,6 @@
/* netdevice method functions */
static int p80211knetdev_init(netdevice_t *netdev);
-static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev);
static int p80211knetdev_open(netdevice_t *netdev);
static int p80211knetdev_stop(netdevice_t *netdev);
static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
@@ -134,30 +133,6 @@ static int p80211knetdev_init(netdevice_t *netdev)
}
/*----------------------------------------------------------------
-* p80211knetdev_get_stats
-*
-* Statistics retrieval for linux netdevices. Here we're reporting
-* the Linux i/f level statistics. Hence, for the primary numbers,
-* we don't want to report the numbers from the MIB. Eventually,
-* it might be useful to collect some of the error counters though.
-*
-* Arguments:
-* netdev Linux netdevice
-*
-* Returns:
-* the address of the statistics structure
-----------------------------------------------------------------*/
-static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev)
-{
- wlandevice_t *wlandev = netdev->ml_priv;
-
- /* TODO: review the MIB stats for items that correspond to
- linux stats */
-
- return &(wlandev->linux_stats);
-}
-
-/*----------------------------------------------------------------
* p80211knetdev_open
*
* Linux netdevice open method. Following a successful call here,
@@ -273,8 +248,8 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
skb->dev->last_rx = jiffies;
- wlandev->linux_stats.rx_packets++;
- wlandev->linux_stats.rx_bytes += skb->len;
+ wlandev->netdev->stats.rx_packets++;
+ wlandev->netdev->stats.rx_bytes += skb->len;
netif_rx_ni(skb);
return 0;
}
@@ -310,8 +285,8 @@ static void p80211netdev_rx_bh(unsigned long arg)
skb->protocol = htons(ETH_P_80211_RAW);
dev->last_rx = jiffies;
- wlandev->linux_stats.rx_packets++;
- wlandev->linux_stats.rx_bytes += skb->len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += skb->len;
netif_rx_ni(skb);
continue;
} else {
@@ -386,7 +361,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
if (skb->protocol != ETH_P_80211_RAW) {
netif_start_queue(wlandev->netdev);
netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
- wlandev->linux_stats.tx_dropped++;
+ netdev->stats.tx_dropped++;
result = 0;
goto failed;
}
@@ -420,9 +395,9 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
netdev->trans_start = jiffies;
- wlandev->linux_stats.tx_packets++;
+ netdev->stats.tx_packets++;
/* count only the packet payload */
- wlandev->linux_stats.tx_bytes += skb->len;
+ netdev->stats.tx_bytes += skb->len;
txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep);
@@ -710,7 +685,6 @@ static const struct net_device_ops p80211_netdev_ops = {
.ndo_init = p80211knetdev_init,
.ndo_open = p80211knetdev_open,
.ndo_stop = p80211knetdev_stop,
- .ndo_get_stats = p80211knetdev_get_stats,
.ndo_start_xmit = p80211knetdev_hard_start_xmit,
.ndo_set_rx_mode = p80211knetdev_set_multicast_list,
.ndo_do_ioctl = p80211knetdev_do_ioctl,
diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h
index 2e0bd24f997c..69a4f59c8312 100644
--- a/drivers/staging/wlan-ng/p80211netdev.h
+++ b/drivers/staging/wlan-ng/p80211netdev.h
@@ -209,7 +209,6 @@ typedef struct wlandevice {
/* queue for indications waiting for cmd completion */
/* Linux netdevice and support */
netdevice_t *netdev; /* ptr to linux netdevice */
- struct net_device_stats linux_stats;
/* Rx bottom half */
struct tasklet_struct rx_bh;
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 209e4db6979a..799ce8aa70ef 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1848,7 +1848,7 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
{
pr_debug("Tx Complete, status=0x%04x\n", status);
/* update linux network stats */
- wlandev->linux_stats.tx_packets++;
+ wlandev->netdev->stats.tx_packets++;
}
/*----------------------------------------------------------------