Commit 68aae116 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[MAC80211]: use internal network device stats

Stats are now available for device usage inside network_device
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24338793
...@@ -47,13 +47,6 @@ struct ieee80211_tx_status_rtap_hdr { ...@@ -47,13 +47,6 @@ struct ieee80211_tx_status_rtap_hdr {
/* common interface routines */ /* common interface routines */
static struct net_device_stats *ieee80211_get_stats(struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return &(sdata->stats);
}
static int header_parse_80211(struct sk_buff *skb, unsigned char *haddr) static int header_parse_80211(struct sk_buff *skb, unsigned char *haddr)
{ {
memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
...@@ -168,11 +161,9 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, ...@@ -168,11 +161,9 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
{ {
struct ieee80211_frame_info *fi; struct ieee80211_frame_info *fi;
const size_t hlen = sizeof(struct ieee80211_frame_info); const size_t hlen = sizeof(struct ieee80211_frame_info);
struct ieee80211_sub_if_data *sdata; struct net_device *dev = local->apdev;
skb->dev = local->apdev; skb->dev = dev;
sdata = IEEE80211_DEV_TO_SUB_IF(local->apdev);
if (skb_headroom(skb) < hlen) { if (skb_headroom(skb) < hlen) {
I802_DEBUG_INC(local->rx_expand_skb_head); I802_DEBUG_INC(local->rx_expand_skb_head);
...@@ -187,8 +178,8 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, ...@@ -187,8 +178,8 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
ieee80211_fill_frame_info(local, fi, status); ieee80211_fill_frame_info(local, fi, status);
fi->msg_type = htonl(msg_type); fi->msg_type = htonl(msg_type);
sdata->stats.rx_packets++; dev->stats.rx_packets++;
sdata->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
skb_set_mac_header(skb, 0); skb_set_mac_header(skb, 0);
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
...@@ -269,7 +260,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev) ...@@ -269,7 +260,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev)
ether_setup(dev); ether_setup(dev);
dev->hard_start_xmit = ieee80211_mgmt_start_xmit; dev->hard_start_xmit = ieee80211_mgmt_start_xmit;
dev->change_mtu = ieee80211_change_mtu_apdev; dev->change_mtu = ieee80211_change_mtu_apdev;
dev->get_stats = ieee80211_get_stats;
dev->open = ieee80211_mgmt_open; dev->open = ieee80211_mgmt_open;
dev->stop = ieee80211_mgmt_stop; dev->stop = ieee80211_mgmt_stop;
dev->type = ARPHRD_IEEE80211_PRISM; dev->type = ARPHRD_IEEE80211_PRISM;
...@@ -599,7 +589,6 @@ void ieee80211_if_setup(struct net_device *dev) ...@@ -599,7 +589,6 @@ void ieee80211_if_setup(struct net_device *dev)
dev->wireless_handlers = &ieee80211_iw_handler_def; dev->wireless_handlers = &ieee80211_iw_handler_def;
dev->set_multicast_list = ieee80211_set_multicast_list; dev->set_multicast_list = ieee80211_set_multicast_list;
dev->change_mtu = ieee80211_change_mtu; dev->change_mtu = ieee80211_change_mtu;
dev->get_stats = ieee80211_get_stats;
dev->open = ieee80211_open; dev->open = ieee80211_open;
dev->stop = ieee80211_stop; dev->stop = ieee80211_stop;
dev->uninit = ieee80211_if_reinit; dev->uninit = ieee80211_if_reinit;
...@@ -1461,13 +1450,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw) ...@@ -1461,13 +1450,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
} }
EXPORT_SYMBOL(ieee80211_free_hw); EXPORT_SYMBOL(ieee80211_free_hw);
struct net_device_stats *ieee80211_dev_stats(struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return &sdata->stats;
}
static int __init ieee80211_init(void) static int __init ieee80211_init(void)
{ {
struct sk_buff *skb; struct sk_buff *skb;
......
...@@ -301,7 +301,6 @@ struct ieee80211_sub_if_data { ...@@ -301,7 +301,6 @@ struct ieee80211_sub_if_data {
unsigned int flags; unsigned int flags;
struct net_device_stats stats;
int drop_unencrypted; int drop_unencrypted;
int eapol; /* 0 = process EAPOL frames as normal data frames, int eapol; /* 0 = process EAPOL frames as normal data frames,
* 1 = send EAPOL frames through wlan#ap to hostapd * 1 = send EAPOL frames through wlan#ap to hostapd
...@@ -723,7 +722,6 @@ void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); ...@@ -723,7 +722,6 @@ void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
void ieee80211_if_setup(struct net_device *dev); void ieee80211_if_setup(struct net_device *dev);
void ieee80211_if_mgmt_setup(struct net_device *dev); void ieee80211_if_mgmt_setup(struct net_device *dev);
struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
int phymode, int hwrate); int phymode, int hwrate);
void ieee80211_key_threshold_notify(struct net_device *dev, void ieee80211_key_threshold_notify(struct net_device *dev,
......
...@@ -137,7 +137,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, ...@@ -137,7 +137,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_rx_status *status) struct ieee80211_rx_status *status)
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_sub_if_data *sdata;
struct ieee80211_rate *rate; struct ieee80211_rate *rate;
struct ieee80211_rtap_hdr { struct ieee80211_rtap_hdr {
struct ieee80211_radiotap_header hdr; struct ieee80211_radiotap_header hdr;
...@@ -150,8 +149,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, ...@@ -150,8 +149,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb,
skb->dev = dev; skb->dev = dev;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (status->flag & RX_FLAG_RADIOTAP) if (status->flag & RX_FLAG_RADIOTAP)
goto out; goto out;
...@@ -184,8 +181,8 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, ...@@ -184,8 +181,8 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb,
rthdr->antsignal = status->ssi; rthdr->antsignal = status->ssi;
out: out:
sdata->stats.rx_packets++; dev->stats.rx_packets++;
sdata->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
skb_set_mac_header(skb, 0); skb_set_mac_header(skb, 0);
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
...@@ -1053,8 +1050,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx) ...@@ -1053,8 +1050,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
skb2 = NULL; skb2 = NULL;
sdata->stats.rx_packets++; dev->stats.rx_packets++;
sdata->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP
|| sdata->type == IEEE80211_IF_TYPE_VLAN) && || sdata->type == IEEE80211_IF_TYPE_VLAN) &&
......
...@@ -1528,8 +1528,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, ...@@ -1528,8 +1528,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE; pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
skb->dev = local->mdev; skb->dev = local->mdev;
sdata->stats.tx_packets++; dev->stats.tx_packets++;
sdata->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
/* Update skb pointers to various headers since this modified frame /* Update skb pointers to various headers since this modified frame
* is going to go through Linux networking code that may potentially * is going to go through Linux networking code that may potentially
...@@ -1602,8 +1602,8 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1602,8 +1602,8 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (!(fc & IEEE80211_FCTL_PROTECTED)) if (!(fc & IEEE80211_FCTL_PROTECTED))
pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
sdata->stats.tx_packets++; dev->stats.tx_packets++;
sdata->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
dev_queue_xmit(skb); dev_queue_xmit(skb);
......
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