Commit 4cfa8e45 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

hostap: convert to internal net_device_stats

Use pre-existing net_device_stats in network_device struct.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44e9ad0b
...@@ -207,13 +207,11 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d ...@@ -207,13 +207,11 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
static void monitor_rx(struct net_device *dev, struct sk_buff *skb, static void monitor_rx(struct net_device *dev, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats) struct hostap_80211_rx_status *rx_stats)
{ {
struct net_device_stats *stats;
int len; int len;
len = prism2_rx_80211(dev, skb, rx_stats, PRISM2_RX_MONITOR); len = prism2_rx_80211(dev, skb, rx_stats, PRISM2_RX_MONITOR);
stats = hostap_get_stats(dev); dev->stats.rx_packets++;
stats->rx_packets++; dev->stats.rx_bytes += len;
stats->rx_bytes += len;
} }
...@@ -724,7 +722,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -724,7 +722,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
size_t hdrlen; size_t hdrlen;
u16 fc, type, stype, sc; u16 fc, type, stype, sc;
struct net_device *wds = NULL; struct net_device *wds = NULL;
struct net_device_stats *stats;
unsigned int frag; unsigned int frag;
u8 *payload; u8 *payload;
struct sk_buff *skb2 = NULL; struct sk_buff *skb2 = NULL;
...@@ -748,7 +745,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -748,7 +745,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
iface = netdev_priv(dev); iface = netdev_priv(dev);
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
stats = hostap_get_stats(dev);
if (skb->len < 10) if (skb->len < 10)
goto rx_dropped; goto rx_dropped;
...@@ -866,10 +862,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -866,10 +862,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
if (hostap_rx_frame_wds(local, hdr, fc, &wds)) if (hostap_rx_frame_wds(local, hdr, fc, &wds))
goto rx_dropped; goto rx_dropped;
if (wds) { if (wds)
skb->dev = dev = wds; skb->dev = dev = wds;
stats = hostap_get_stats(dev);
}
if (local->iw_mode == IW_MODE_MASTER && !wds && if (local->iw_mode == IW_MODE_MASTER && !wds &&
(fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
...@@ -878,7 +872,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -878,7 +872,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) { memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */ /* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = local->stadev; skb->dev = dev = local->stadev;
stats = hostap_get_stats(dev);
from_assoc_ap = 1; from_assoc_ap = 1;
} }
...@@ -1069,8 +1062,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -1069,8 +1062,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
skb_trim(skb, skb->len - ETH_ALEN); skb_trim(skb, skb->len - ETH_ALEN);
} }
stats->rx_packets++; dev->stats.rx_packets++;
stats->rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
if (local->iw_mode == IW_MODE_MASTER && !wds && if (local->iw_mode == IW_MODE_MASTER && !wds &&
local->ap->bridge_packets) { local->ap->bridge_packets) {
...@@ -1115,7 +1108,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -1115,7 +1108,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
rx_dropped: rx_dropped:
dev_kfree_skb(skb); dev_kfree_skb(skb);
stats->rx_dropped++; dev->stats.rx_dropped++;
goto rx_exit; goto rx_exit;
} }
......
...@@ -2262,7 +2262,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -2262,7 +2262,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
if (skb->len < 16) if (skb->len < 16)
goto drop; goto drop;
local->stats.rx_packets++; dev->stats.rx_packets++;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
......
...@@ -1682,7 +1682,7 @@ static int prism2_get_txfid_idx(local_info_t *local) ...@@ -1682,7 +1682,7 @@ static int prism2_get_txfid_idx(local_info_t *local)
PDEBUG(DEBUG_EXTRA2, "prism2_get_txfid_idx: no room in txfid buf: " PDEBUG(DEBUG_EXTRA2, "prism2_get_txfid_idx: no room in txfid buf: "
"packet dropped\n"); "packet dropped\n");
local->stats.tx_dropped++; local->dev->stats.tx_dropped++;
return -1; return -1;
} }
...@@ -1787,11 +1787,9 @@ static int prism2_transmit(struct net_device *dev, int idx) ...@@ -1787,11 +1787,9 @@ static int prism2_transmit(struct net_device *dev, int idx)
prism2_transmit_cb, (long) idx); prism2_transmit_cb, (long) idx);
if (res) { if (res) {
struct net_device_stats *stats;
printk(KERN_DEBUG "%s: prism2_transmit: CMDCODE_TRANSMIT " printk(KERN_DEBUG "%s: prism2_transmit: CMDCODE_TRANSMIT "
"failed (res=%d)\n", dev->name, res); "failed (res=%d)\n", dev->name, res);
stats = hostap_get_stats(dev); dev->stats.tx_dropped++;
stats->tx_dropped++;
netif_wake_queue(dev); netif_wake_queue(dev);
return -1; return -1;
} }
...@@ -1939,12 +1937,10 @@ static void prism2_rx(local_info_t *local) ...@@ -1939,12 +1937,10 @@ static void prism2_rx(local_info_t *local)
struct net_device *dev = local->dev; struct net_device *dev = local->dev;
int res, rx_pending = 0; int res, rx_pending = 0;
u16 len, hdr_len, rxfid, status, macport; u16 len, hdr_len, rxfid, status, macport;
struct net_device_stats *stats;
struct hfa384x_rx_frame rxdesc; struct hfa384x_rx_frame rxdesc;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
prism2_callback(local, PRISM2_CALLBACK_RX_START); prism2_callback(local, PRISM2_CALLBACK_RX_START);
stats = hostap_get_stats(dev);
rxfid = prism2_read_fid_reg(dev, HFA384X_RXFID_OFF); rxfid = prism2_read_fid_reg(dev, HFA384X_RXFID_OFF);
#ifndef final_version #ifndef final_version
...@@ -2031,7 +2027,7 @@ static void prism2_rx(local_info_t *local) ...@@ -2031,7 +2027,7 @@ static void prism2_rx(local_info_t *local)
return; return;
rx_dropped: rx_dropped:
stats->rx_dropped++; dev->stats.rx_dropped++;
if (skb) if (skb)
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto rx_exit; goto rx_exit;
...@@ -2335,7 +2331,7 @@ static void prism2_txexc(local_info_t *local) ...@@ -2335,7 +2331,7 @@ static void prism2_txexc(local_info_t *local)
struct hfa384x_tx_frame txdesc; struct hfa384x_tx_frame txdesc;
show_dump = local->frame_dump & PRISM2_DUMP_TXEXC_HDR; show_dump = local->frame_dump & PRISM2_DUMP_TXEXC_HDR;
local->stats.tx_errors++; dev->stats.tx_errors++;
res = hostap_tx_compl_read(local, 1, &txdesc, &payload); res = hostap_tx_compl_read(local, 1, &txdesc, &payload);
HFA384X_OUTW(HFA384X_EV_TXEXC, HFA384X_EVACK_OFF); HFA384X_OUTW(HFA384X_EV_TXEXC, HFA384X_EVACK_OFF);
......
...@@ -607,14 +607,6 @@ int hostap_80211_get_hdrlen(__le16 fc) ...@@ -607,14 +607,6 @@ int hostap_80211_get_hdrlen(__le16 fc)
} }
struct net_device_stats *hostap_get_stats(struct net_device *dev)
{
struct hostap_interface *iface;
iface = netdev_priv(dev);
return &iface->stats;
}
static int prism2_close(struct net_device *dev) static int prism2_close(struct net_device *dev)
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
...@@ -832,7 +824,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local, ...@@ -832,7 +824,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
ether_setup(dev); ether_setup(dev);
/* kernel callbacks */ /* kernel callbacks */
dev->get_stats = hostap_get_stats;
if (iface) { if (iface) {
/* Currently, we point to the proper spy_data only on /* Currently, we point to the proper spy_data only on
* the main_dev. This could be fixed. Jean II */ * the main_dev. This could be fixed. Jean II */
...@@ -1112,7 +1103,6 @@ EXPORT_SYMBOL(hostap_set_auth_algs); ...@@ -1112,7 +1103,6 @@ EXPORT_SYMBOL(hostap_set_auth_algs);
EXPORT_SYMBOL(hostap_dump_rx_header); EXPORT_SYMBOL(hostap_dump_rx_header);
EXPORT_SYMBOL(hostap_dump_tx_header); EXPORT_SYMBOL(hostap_dump_tx_header);
EXPORT_SYMBOL(hostap_80211_get_hdrlen); EXPORT_SYMBOL(hostap_80211_get_hdrlen);
EXPORT_SYMBOL(hostap_get_stats);
EXPORT_SYMBOL(hostap_setup_dev); EXPORT_SYMBOL(hostap_setup_dev);
EXPORT_SYMBOL(hostap_set_multicast_list_queue); EXPORT_SYMBOL(hostap_set_multicast_list_queue);
EXPORT_SYMBOL(hostap_set_hostapd); EXPORT_SYMBOL(hostap_set_hostapd);
......
...@@ -684,7 +684,6 @@ struct local_info { ...@@ -684,7 +684,6 @@ struct local_info {
u16 channel_mask; /* mask of allowed channels */ u16 channel_mask; /* mask of allowed channels */
u16 scan_channel_mask; /* mask of channels to be scanned */ u16 scan_channel_mask; /* mask of channels to be scanned */
struct comm_tallies_sums comm_tallies; struct comm_tallies_sums comm_tallies;
struct net_device_stats stats;
struct proc_dir_entry *proc; struct proc_dir_entry *proc;
int iw_mode; /* operating mode (IW_MODE_*) */ int iw_mode; /* operating mode (IW_MODE_*) */
int pseudo_adhoc; /* 0: IW_MODE_ADHOC is real 802.11 compliant IBSS int pseudo_adhoc; /* 0: IW_MODE_ADHOC is real 802.11 compliant IBSS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment