mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
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:
parent
cd687a4073
commit
9630f6b97a
4 changed files with 17 additions and 44 deletions
|
@ -3158,8 +3158,8 @@ static void hfa384x_usbin_callback(struct urb *urb)
|
||||||
|
|
||||||
/* Check for short packet */
|
/* Check for short packet */
|
||||||
if (urb->actual_length == 0) {
|
if (urb->actual_length == 0) {
|
||||||
++(wlandev->linux_stats.rx_errors);
|
wlandev->netdev->stats.rx_errors++;
|
||||||
++(wlandev->linux_stats.rx_length_errors);
|
wlandev->netdev->stats.rx_length_errors++;
|
||||||
action = RESUBMIT;
|
action = RESUBMIT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3169,7 +3169,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
|
||||||
wlandev->netdev->name);
|
wlandev->netdev->name);
|
||||||
if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags))
|
if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags))
|
||||||
schedule_work(&hw->usb_work);
|
schedule_work(&hw->usb_work);
|
||||||
++(wlandev->linux_stats.rx_errors);
|
wlandev->netdev->stats.rx_errors++;
|
||||||
action = ABORT;
|
action = ABORT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3180,12 +3180,12 @@ static void hfa384x_usbin_callback(struct urb *urb)
|
||||||
!timer_pending(&hw->throttle)) {
|
!timer_pending(&hw->throttle)) {
|
||||||
mod_timer(&hw->throttle, jiffies + THROTTLE_JIFFIES);
|
mod_timer(&hw->throttle, jiffies + THROTTLE_JIFFIES);
|
||||||
}
|
}
|
||||||
++(wlandev->linux_stats.rx_errors);
|
wlandev->netdev->stats.rx_errors++;
|
||||||
action = ABORT;
|
action = ABORT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -EOVERFLOW:
|
case -EOVERFLOW:
|
||||||
++(wlandev->linux_stats.rx_over_errors);
|
wlandev->netdev->stats.rx_over_errors++;
|
||||||
action = RESUBMIT;
|
action = RESUBMIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3204,7 +3204,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
|
||||||
default:
|
default:
|
||||||
pr_debug("urb status=%d, transfer flags=0x%x\n",
|
pr_debug("urb status=%d, transfer flags=0x%x\n",
|
||||||
urb->status, urb->transfer_flags);
|
urb->status, urb->transfer_flags);
|
||||||
++(wlandev->linux_stats.rx_errors);
|
wlandev->netdev->stats.rx_errors++;
|
||||||
action = RESUBMIT;
|
action = RESUBMIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3712,7 +3712,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
|
||||||
if (!test_and_set_bit
|
if (!test_and_set_bit
|
||||||
(WORK_TX_HALT, &hw->usb_flags))
|
(WORK_TX_HALT, &hw->usb_flags))
|
||||||
schedule_work(&hw->usb_work);
|
schedule_work(&hw->usb_work);
|
||||||
++(wlandev->linux_stats.tx_errors);
|
wlandev->netdev->stats.tx_errors++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3728,7 +3728,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
|
||||||
mod_timer(&hw->throttle,
|
mod_timer(&hw->throttle,
|
||||||
jiffies + THROTTLE_JIFFIES);
|
jiffies + THROTTLE_JIFFIES);
|
||||||
}
|
}
|
||||||
++(wlandev->linux_stats.tx_errors);
|
wlandev->netdev->stats.tx_errors++;
|
||||||
netif_stop_queue(wlandev->netdev);
|
netif_stop_queue(wlandev->netdev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3741,7 +3741,7 @@ static void hfa384x_usbout_callback(struct urb *urb)
|
||||||
default:
|
default:
|
||||||
netdev_info(wlandev->netdev, "unknown urb->status=%d\n",
|
netdev_info(wlandev->netdev, "unknown urb->status=%d\n",
|
||||||
urb->status);
|
urb->status);
|
||||||
++(wlandev->linux_stats.tx_errors);
|
wlandev->netdev->stats.tx_errors++;
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@
|
||||||
|
|
||||||
/* netdevice method functions */
|
/* netdevice method functions */
|
||||||
static int p80211knetdev_init(netdevice_t *netdev);
|
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_open(netdevice_t *netdev);
|
||||||
static int p80211knetdev_stop(netdevice_t *netdev);
|
static int p80211knetdev_stop(netdevice_t *netdev);
|
||||||
static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
|
static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
|
||||||
|
@ -133,30 +132,6 @@ static int p80211knetdev_init(netdevice_t *netdev)
|
||||||
return 0;
|
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
|
* 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) {
|
if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
|
||||||
skb->dev->last_rx = jiffies;
|
skb->dev->last_rx = jiffies;
|
||||||
wlandev->linux_stats.rx_packets++;
|
wlandev->netdev->stats.rx_packets++;
|
||||||
wlandev->linux_stats.rx_bytes += skb->len;
|
wlandev->netdev->stats.rx_bytes += skb->len;
|
||||||
netif_rx_ni(skb);
|
netif_rx_ni(skb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -310,8 +285,8 @@ static void p80211netdev_rx_bh(unsigned long arg)
|
||||||
skb->protocol = htons(ETH_P_80211_RAW);
|
skb->protocol = htons(ETH_P_80211_RAW);
|
||||||
dev->last_rx = jiffies;
|
dev->last_rx = jiffies;
|
||||||
|
|
||||||
wlandev->linux_stats.rx_packets++;
|
dev->stats.rx_packets++;
|
||||||
wlandev->linux_stats.rx_bytes += skb->len;
|
dev->stats.rx_bytes += skb->len;
|
||||||
netif_rx_ni(skb);
|
netif_rx_ni(skb);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -386,7 +361,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
|
||||||
if (skb->protocol != ETH_P_80211_RAW) {
|
if (skb->protocol != ETH_P_80211_RAW) {
|
||||||
netif_start_queue(wlandev->netdev);
|
netif_start_queue(wlandev->netdev);
|
||||||
netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
|
netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
|
||||||
wlandev->linux_stats.tx_dropped++;
|
netdev->stats.tx_dropped++;
|
||||||
result = 0;
|
result = 0;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
@ -420,9 +395,9 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
|
||||||
|
|
||||||
netdev->trans_start = jiffies;
|
netdev->trans_start = jiffies;
|
||||||
|
|
||||||
wlandev->linux_stats.tx_packets++;
|
netdev->stats.tx_packets++;
|
||||||
/* count only the packet payload */
|
/* 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);
|
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_init = p80211knetdev_init,
|
||||||
.ndo_open = p80211knetdev_open,
|
.ndo_open = p80211knetdev_open,
|
||||||
.ndo_stop = p80211knetdev_stop,
|
.ndo_stop = p80211knetdev_stop,
|
||||||
.ndo_get_stats = p80211knetdev_get_stats,
|
|
||||||
.ndo_start_xmit = p80211knetdev_hard_start_xmit,
|
.ndo_start_xmit = p80211knetdev_hard_start_xmit,
|
||||||
.ndo_set_rx_mode = p80211knetdev_set_multicast_list,
|
.ndo_set_rx_mode = p80211knetdev_set_multicast_list,
|
||||||
.ndo_do_ioctl = p80211knetdev_do_ioctl,
|
.ndo_do_ioctl = p80211knetdev_do_ioctl,
|
||||||
|
|
|
@ -209,7 +209,6 @@ typedef struct wlandevice {
|
||||||
/* queue for indications waiting for cmd completion */
|
/* queue for indications waiting for cmd completion */
|
||||||
/* Linux netdevice and support */
|
/* Linux netdevice and support */
|
||||||
netdevice_t *netdev; /* ptr to linux netdevice */
|
netdevice_t *netdev; /* ptr to linux netdevice */
|
||||||
struct net_device_stats linux_stats;
|
|
||||||
|
|
||||||
/* Rx bottom half */
|
/* Rx bottom half */
|
||||||
struct tasklet_struct rx_bh;
|
struct tasklet_struct rx_bh;
|
||||||
|
|
|
@ -1848,7 +1848,7 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
|
||||||
{
|
{
|
||||||
pr_debug("Tx Complete, status=0x%04x\n", status);
|
pr_debug("Tx Complete, status=0x%04x\n", status);
|
||||||
/* update linux network stats */
|
/* update linux network stats */
|
||||||
wlandev->linux_stats.tx_packets++;
|
wlandev->netdev->stats.tx_packets++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------
|
/*----------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue