diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-08-24 14:29:34 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:31 -0400 |
commit | 68aae11674b9d6598b660d1148ffba9eef3f895f (patch) | |
tree | d5213c5b624e9908b948f2642b7e15721021b4ee /net | |
parent | 24338793eea9dcc0865826e1115af86a19af8d18 (diff) |
[MAC80211]: use internal network device stats
Stats are now available for device usage inside network_device
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ieee80211.c | 26 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/rx.c | 11 | ||||
-rw-r--r-- | 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 { | |||
47 | 47 | ||
48 | /* common interface routines */ | 48 | /* common interface routines */ |
49 | 49 | ||
50 | static struct net_device_stats *ieee80211_get_stats(struct net_device *dev) | ||
51 | { | ||
52 | struct ieee80211_sub_if_data *sdata; | ||
53 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
54 | return &(sdata->stats); | ||
55 | } | ||
56 | |||
57 | static int header_parse_80211(struct sk_buff *skb, unsigned char *haddr) | 50 | static int header_parse_80211(struct sk_buff *skb, unsigned char *haddr) |
58 | { | 51 | { |
59 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ | 52 | 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 | { | 161 | { |
169 | struct ieee80211_frame_info *fi; | 162 | struct ieee80211_frame_info *fi; |
170 | const size_t hlen = sizeof(struct ieee80211_frame_info); | 163 | const size_t hlen = sizeof(struct ieee80211_frame_info); |
171 | struct ieee80211_sub_if_data *sdata; | 164 | struct net_device *dev = local->apdev; |
172 | 165 | ||
173 | skb->dev = local->apdev; | 166 | skb->dev = dev; |
174 | |||
175 | sdata = IEEE80211_DEV_TO_SUB_IF(local->apdev); | ||
176 | 167 | ||
177 | if (skb_headroom(skb) < hlen) { | 168 | if (skb_headroom(skb) < hlen) { |
178 | I802_DEBUG_INC(local->rx_expand_skb_head); | 169 | I802_DEBUG_INC(local->rx_expand_skb_head); |
@@ -187,8 +178,8 @@ ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, | |||
187 | ieee80211_fill_frame_info(local, fi, status); | 178 | ieee80211_fill_frame_info(local, fi, status); |
188 | fi->msg_type = htonl(msg_type); | 179 | fi->msg_type = htonl(msg_type); |
189 | 180 | ||
190 | sdata->stats.rx_packets++; | 181 | dev->stats.rx_packets++; |
191 | sdata->stats.rx_bytes += skb->len; | 182 | dev->stats.rx_bytes += skb->len; |
192 | 183 | ||
193 | skb_set_mac_header(skb, 0); | 184 | skb_set_mac_header(skb, 0); |
194 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 185 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -269,7 +260,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev) | |||
269 | ether_setup(dev); | 260 | ether_setup(dev); |
270 | dev->hard_start_xmit = ieee80211_mgmt_start_xmit; | 261 | dev->hard_start_xmit = ieee80211_mgmt_start_xmit; |
271 | dev->change_mtu = ieee80211_change_mtu_apdev; | 262 | dev->change_mtu = ieee80211_change_mtu_apdev; |
272 | dev->get_stats = ieee80211_get_stats; | ||
273 | dev->open = ieee80211_mgmt_open; | 263 | dev->open = ieee80211_mgmt_open; |
274 | dev->stop = ieee80211_mgmt_stop; | 264 | dev->stop = ieee80211_mgmt_stop; |
275 | dev->type = ARPHRD_IEEE80211_PRISM; | 265 | dev->type = ARPHRD_IEEE80211_PRISM; |
@@ -599,7 +589,6 @@ void ieee80211_if_setup(struct net_device *dev) | |||
599 | dev->wireless_handlers = &ieee80211_iw_handler_def; | 589 | dev->wireless_handlers = &ieee80211_iw_handler_def; |
600 | dev->set_multicast_list = ieee80211_set_multicast_list; | 590 | dev->set_multicast_list = ieee80211_set_multicast_list; |
601 | dev->change_mtu = ieee80211_change_mtu; | 591 | dev->change_mtu = ieee80211_change_mtu; |
602 | dev->get_stats = ieee80211_get_stats; | ||
603 | dev->open = ieee80211_open; | 592 | dev->open = ieee80211_open; |
604 | dev->stop = ieee80211_stop; | 593 | dev->stop = ieee80211_stop; |
605 | dev->uninit = ieee80211_if_reinit; | 594 | dev->uninit = ieee80211_if_reinit; |
@@ -1461,13 +1450,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw) | |||
1461 | } | 1450 | } |
1462 | EXPORT_SYMBOL(ieee80211_free_hw); | 1451 | EXPORT_SYMBOL(ieee80211_free_hw); |
1463 | 1452 | ||
1464 | struct net_device_stats *ieee80211_dev_stats(struct net_device *dev) | ||
1465 | { | ||
1466 | struct ieee80211_sub_if_data *sdata; | ||
1467 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1468 | return &sdata->stats; | ||
1469 | } | ||
1470 | |||
1471 | static int __init ieee80211_init(void) | 1453 | static int __init ieee80211_init(void) |
1472 | { | 1454 | { |
1473 | struct sk_buff *skb; | 1455 | 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 { | |||
301 | 301 | ||
302 | unsigned int flags; | 302 | unsigned int flags; |
303 | 303 | ||
304 | struct net_device_stats stats; | ||
305 | int drop_unencrypted; | 304 | int drop_unencrypted; |
306 | int eapol; /* 0 = process EAPOL frames as normal data frames, | 305 | int eapol; /* 0 = process EAPOL frames as normal data frames, |
307 | * 1 = send EAPOL frames through wlan#ap to hostapd | 306 | * 1 = send EAPOL frames through wlan#ap to hostapd |
@@ -723,7 +722,6 @@ void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); | |||
723 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); | 722 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); |
724 | void ieee80211_if_setup(struct net_device *dev); | 723 | void ieee80211_if_setup(struct net_device *dev); |
725 | void ieee80211_if_mgmt_setup(struct net_device *dev); | 724 | void ieee80211_if_mgmt_setup(struct net_device *dev); |
726 | struct net_device_stats *ieee80211_dev_stats(struct net_device *dev); | ||
727 | struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, | 725 | struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, |
728 | int phymode, int hwrate); | 726 | int phymode, int hwrate); |
729 | void ieee80211_key_threshold_notify(struct net_device *dev, | 727 | 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, | |||
137 | struct ieee80211_rx_status *status) | 137 | struct ieee80211_rx_status *status) |
138 | { | 138 | { |
139 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 139 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
140 | struct ieee80211_sub_if_data *sdata; | ||
141 | struct ieee80211_rate *rate; | 140 | struct ieee80211_rate *rate; |
142 | struct ieee80211_rtap_hdr { | 141 | struct ieee80211_rtap_hdr { |
143 | struct ieee80211_radiotap_header hdr; | 142 | struct ieee80211_radiotap_header hdr; |
@@ -150,8 +149,6 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, | |||
150 | 149 | ||
151 | skb->dev = dev; | 150 | skb->dev = dev; |
152 | 151 | ||
153 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
154 | |||
155 | if (status->flag & RX_FLAG_RADIOTAP) | 152 | if (status->flag & RX_FLAG_RADIOTAP) |
156 | goto out; | 153 | goto out; |
157 | 154 | ||
@@ -184,8 +181,8 @@ ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, | |||
184 | rthdr->antsignal = status->ssi; | 181 | rthdr->antsignal = status->ssi; |
185 | 182 | ||
186 | out: | 183 | out: |
187 | sdata->stats.rx_packets++; | 184 | dev->stats.rx_packets++; |
188 | sdata->stats.rx_bytes += skb->len; | 185 | dev->stats.rx_bytes += skb->len; |
189 | 186 | ||
190 | skb_set_mac_header(skb, 0); | 187 | skb_set_mac_header(skb, 0); |
191 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 188 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1053,8 +1050,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx) | |||
1053 | 1050 | ||
1054 | skb2 = NULL; | 1051 | skb2 = NULL; |
1055 | 1052 | ||
1056 | sdata->stats.rx_packets++; | 1053 | dev->stats.rx_packets++; |
1057 | sdata->stats.rx_bytes += skb->len; | 1054 | dev->stats.rx_bytes += skb->len; |
1058 | 1055 | ||
1059 | if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP | 1056 | if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP |
1060 | || sdata->type == IEEE80211_IF_TYPE_VLAN) && | 1057 | || 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, | |||
1528 | pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE; | 1528 | pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE; |
1529 | 1529 | ||
1530 | skb->dev = local->mdev; | 1530 | skb->dev = local->mdev; |
1531 | sdata->stats.tx_packets++; | 1531 | dev->stats.tx_packets++; |
1532 | sdata->stats.tx_bytes += skb->len; | 1532 | dev->stats.tx_bytes += skb->len; |
1533 | 1533 | ||
1534 | /* Update skb pointers to various headers since this modified frame | 1534 | /* Update skb pointers to various headers since this modified frame |
1535 | * is going to go through Linux networking code that may potentially | 1535 | * 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 | if (!(fc & IEEE80211_FCTL_PROTECTED)) | 1602 | if (!(fc & IEEE80211_FCTL_PROTECTED)) |
1603 | pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; | 1603 | pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; |
1604 | 1604 | ||
1605 | sdata->stats.tx_packets++; | 1605 | dev->stats.tx_packets++; |
1606 | sdata->stats.tx_bytes += skb->len; | 1606 | dev->stats.tx_bytes += skb->len; |
1607 | 1607 | ||
1608 | dev_queue_xmit(skb); | 1608 | dev_queue_xmit(skb); |
1609 | 1609 | ||