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>
This commit is contained in:
Tobias Klauser 2014-07-08 08:37:00 +02:00 committed by Greg Kroah-Hartman
parent cd687a4073
commit 9630f6b97a
4 changed files with 17 additions and 44 deletions

View File

@ -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 */
}

View File

@ -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,
@ -133,30 +132,6 @@ static int p80211knetdev_init(netdevice_t *netdev)
return 0;
}
/*----------------------------------------------------------------
* 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
*
@ -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,

View File

@ -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;

View File

@ -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++;
}
/*----------------------------------------------------------------