From 68aae11674b9d6598b660d1148ffba9eef3f895f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 24 Aug 2007 11:29:34 -0700 Subject: [PATCH] [MAC80211]: use internal network device stats Stats are now available for device usage inside network_device Signed-off-by: Stephen Hemminger Acked-by: Johannes Berg Signed-off-by: John W. Linville Signed-off-by: David S. Miller --- net/mac80211/ieee80211.c | 26 ++++---------------------- net/mac80211/ieee80211_i.h | 2 -- net/mac80211/rx.c | 11 ++++------- net/mac80211/tx.c | 8 ++++---- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 0e8a70f408e2..0c1f7b2e157c 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -47,13 +47,6 @@ struct ieee80211_tx_status_rtap_hdr { /* 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) { 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, { struct ieee80211_frame_info *fi; 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; - - sdata = IEEE80211_DEV_TO_SUB_IF(local->apdev); + skb->dev = dev; if (skb_headroom(skb) < hlen) { I802_DEBUG_INC(local->rx_expand_skb_head); @@ -187,8 +178,8 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, ieee80211_fill_frame_info(local, fi, status); fi->msg_type = htonl(msg_type); - sdata->stats.rx_packets++; - sdata->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; skb_set_mac_header(skb, 0); skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -269,7 +260,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev) ether_setup(dev); dev->hard_start_xmit = ieee80211_mgmt_start_xmit; dev->change_mtu = ieee80211_change_mtu_apdev; - dev->get_stats = ieee80211_get_stats; dev->open = ieee80211_mgmt_open; dev->stop = ieee80211_mgmt_stop; dev->type = ARPHRD_IEEE80211_PRISM; @@ -599,7 +589,6 @@ void ieee80211_if_setup(struct net_device *dev) dev->wireless_handlers = &ieee80211_iw_handler_def; dev->set_multicast_list = ieee80211_set_multicast_list; dev->change_mtu = ieee80211_change_mtu; - dev->get_stats = ieee80211_get_stats; dev->open = ieee80211_open; dev->stop = ieee80211_stop; dev->uninit = ieee80211_if_reinit; @@ -1461,13 +1450,6 @@ void ieee80211_free_hw(struct ieee80211_hw *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) { struct sk_buff *skb; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 0149f9055918..14e8c366af3d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -301,7 +301,6 @@ struct ieee80211_sub_if_data { unsigned int flags; - struct net_device_stats stats; int drop_unencrypted; int eapol; /* 0 = process EAPOL frames as normal data frames, * 1 = send EAPOL frames through wlan#ap to hostapd @@ -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); void ieee80211_if_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, int phymode, int hwrate); void ieee80211_key_threshold_notify(struct net_device *dev, diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 28b8b6af4c42..a5619d1f9a3b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -137,7 +137,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, struct ieee80211_rx_status *status) { struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct ieee80211_sub_if_data *sdata; struct ieee80211_rate *rate; struct ieee80211_rtap_hdr { struct ieee80211_radiotap_header hdr; @@ -150,8 +149,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, skb->dev = dev; - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - if (status->flag & RX_FLAG_RADIOTAP) goto out; @@ -184,8 +181,8 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, rthdr->antsignal = status->ssi; out: - sdata->stats.rx_packets++; - sdata->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; skb_set_mac_header(skb, 0); skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1053,8 +1050,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx) skb2 = NULL; - sdata->stats.rx_packets++; - sdata->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP || sdata->type == IEEE80211_IF_TYPE_VLAN) && diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1780c24f7957..acfc3054d467 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1528,8 +1528,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE; skb->dev = local->mdev; - sdata->stats.tx_packets++; - sdata->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; /* Update skb pointers to various headers since this modified frame * 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) if (!(fc & IEEE80211_FCTL_PROTECTED)) pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; - sdata->stats.tx_packets++; - sdata->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; dev_queue_xmit(skb); -- 2.20.1