Skip to content

Commit

Permalink
[MAC80211]: use internal network device stats
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Oct 10, 2007
1 parent 2433879 commit 68aae11
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
26 changes: 4 additions & 22 deletions net/mac80211/ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 4 additions & 7 deletions net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) &&
Expand Down
8 changes: 4 additions & 4 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 68aae11

Please sign in to comment.