diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-03-12 19:58:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-25 16:41:47 -0400 |
commit | 19758bef09abe9d2a14575ffb6f686947e97fcb1 (patch) | |
tree | e4975d3e59996b06e964b17af9be4fe692c5628a /drivers/net | |
parent | c79dd5b5bc5a65822cdc9d571032c469ad7577d5 (diff) |
iwlwifi: Add TX/RX statistcs to driver
This patch supports collecting of TX and RX statistics in the driver.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 10 |
3 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 7b0ad728f927..b2ea4d4f3f31 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -3337,6 +3337,14 @@ static void iwl4965_add_radiotap(struct iwl_priv *priv, | |||
3337 | stats->flag |= RX_FLAG_RADIOTAP; | 3337 | stats->flag |= RX_FLAG_RADIOTAP; |
3338 | } | 3338 | } |
3339 | 3339 | ||
3340 | static void iwl_update_rx_stats(struct iwl_priv *priv, u16 fc, u16 len) | ||
3341 | { | ||
3342 | /* 0 - mgmt, 1 - cnt, 2 - data */ | ||
3343 | int idx = (fc & IEEE80211_FCTL_FTYPE) >> 2; | ||
3344 | priv->rx_stats[idx].cnt++; | ||
3345 | priv->rx_stats[idx].bytes += len; | ||
3346 | } | ||
3347 | |||
3340 | static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, | 3348 | static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, |
3341 | int include_phy, | 3349 | int include_phy, |
3342 | struct iwl4965_rx_mem_buffer *rxb, | 3350 | struct iwl4965_rx_mem_buffer *rxb, |
@@ -3406,6 +3414,7 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, | |||
3406 | if (priv->add_radiotap) | 3414 | if (priv->add_radiotap) |
3407 | iwl4965_add_radiotap(priv, rxb->skb, rx_start, stats, ampdu_status); | 3415 | iwl4965_add_radiotap(priv, rxb->skb, rx_start, stats, ampdu_status); |
3408 | 3416 | ||
3417 | iwl_update_rx_stats(priv, le16_to_cpu(hdr->frame_control), len); | ||
3409 | ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); | 3418 | ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); |
3410 | priv->alloc_rxb_skb--; | 3419 | priv->alloc_rxb_skb--; |
3411 | rxb->skb = NULL; | 3420 | rxb->skb = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 60353b2645d4..aded6010ce20 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -1107,6 +1107,12 @@ struct iwl_priv { | |||
1107 | int last_rx_rssi; /* From Rx packet statisitics */ | 1107 | int last_rx_rssi; /* From Rx packet statisitics */ |
1108 | int last_rx_noise; /* From beacon statistics */ | 1108 | int last_rx_noise; /* From beacon statistics */ |
1109 | 1109 | ||
1110 | /* counts mgmt, ctl, and data packets */ | ||
1111 | struct traffic_stats { | ||
1112 | u32 cnt; | ||
1113 | u64 bytes; | ||
1114 | } tx_stats[3], rx_stats[3]; | ||
1115 | |||
1110 | struct iwl4965_power_mgr power_data; | 1116 | struct iwl4965_power_mgr power_data; |
1111 | 1117 | ||
1112 | struct iwl4965_notif_statistics statistics; | 1118 | struct iwl4965_notif_statistics statistics; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 4e899ce81b32..4f6ed6942065 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -2529,7 +2529,13 @@ static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv, | |||
2529 | cmd->cmd.tx.tx_flags = tx_flags; | 2529 | cmd->cmd.tx.tx_flags = tx_flags; |
2530 | cmd->cmd.tx.next_frame_len = 0; | 2530 | cmd->cmd.tx.next_frame_len = 0; |
2531 | } | 2531 | } |
2532 | 2532 | static void iwl_update_tx_stats(struct iwl_priv *priv, u16 fc, u16 len) | |
2533 | { | ||
2534 | /* 0 - mgmt, 1 - cnt, 2 - data */ | ||
2535 | int idx = (fc & IEEE80211_FCTL_FTYPE) >> 2; | ||
2536 | priv->tx_stats[idx].cnt++; | ||
2537 | priv->tx_stats[idx].bytes += len; | ||
2538 | } | ||
2533 | /** | 2539 | /** |
2534 | * iwl4965_get_sta_id - Find station's index within station table | 2540 | * iwl4965_get_sta_id - Find station's index within station table |
2535 | * | 2541 | * |
@@ -2776,6 +2782,8 @@ static int iwl4965_tx_skb(struct iwl_priv *priv, | |||
2776 | /* set is_hcca to 0; it probably will never be implemented */ | 2782 | /* set is_hcca to 0; it probably will never be implemented */ |
2777 | iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); | 2783 | iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); |
2778 | 2784 | ||
2785 | iwl_update_tx_stats(priv, fc, len); | ||
2786 | |||
2779 | scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + | 2787 | scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + |
2780 | offsetof(struct iwl4965_tx_cmd, scratch); | 2788 | offsetof(struct iwl4965_tx_cmd, scratch); |
2781 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); | 2789 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); |