aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.c
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2010-04-16 13:03:54 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-04-30 18:34:31 -0400
commit17f36fc6ef3d1ab15f9d2160a9daa107db0887ca (patch)
treed578f43affda2b1fd859256f7d24f9ba74aa55e2 /drivers/net/wireless/iwlwifi/iwl-3945.c
parentc2845d010b0e58a17cd2301e657b614962331550 (diff)
iwl3945: add ucode statistics
Add general, rx and tx uCode statistics to 3945. This will help in debugging Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index d10e59def53e..9dad8672d700 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -49,6 +49,7 @@
49#include "iwl-helpers.h" 49#include "iwl-helpers.h"
50#include "iwl-led.h" 50#include "iwl-led.h"
51#include "iwl-3945-led.h" 51#include "iwl-3945-led.h"
52#include "iwl-3945-debugfs.h"
52 53
53#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ 54#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
54 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 55 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \
@@ -292,7 +293,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
292 * iwl3945_rx_reply_tx - Handle Tx response 293 * iwl3945_rx_reply_tx - Handle Tx response
293 */ 294 */
294static void iwl3945_rx_reply_tx(struct iwl_priv *priv, 295static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
295 struct iwl_rx_mem_buffer *rxb) 296 struct iwl_rx_mem_buffer *rxb)
296{ 297{
297 struct iwl_rx_packet *pkt = rxb_addr(rxb); 298 struct iwl_rx_packet *pkt = rxb_addr(rxb);
298 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 299 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -350,18 +351,81 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
350 * RX handler implementations 351 * RX handler implementations
351 * 352 *
352 *****************************************************************************/ 353 *****************************************************************************/
354#ifdef CONFIG_IWLWIFI_DEBUG
355/*
356 * based on the assumption of all statistics counter are in DWORD
357 * FIXME: This function is for debugging, do not deal with
358 * the case of counters roll-over.
359 */
360static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
361 __le32 *stats)
362{
363 int i;
364 __le32 *prev_stats;
365 u32 *accum_stats;
366 u32 *delta, *max_delta;
367
368 prev_stats = (__le32 *)&priv->_3945.statistics;
369 accum_stats = (u32 *)&priv->_3945.accum_statistics;
370 delta = (u32 *)&priv->_3945.delta_statistics;
371 max_delta = (u32 *)&priv->_3945.max_delta;
372
373 for (i = sizeof(__le32); i < sizeof(struct iwl3945_notif_statistics);
374 i += sizeof(__le32), stats++, prev_stats++, delta++,
375 max_delta++, accum_stats++) {
376 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
377 *delta = (le32_to_cpu(*stats) -
378 le32_to_cpu(*prev_stats));
379 *accum_stats += *delta;
380 if (*delta > *max_delta)
381 *max_delta = *delta;
382 }
383 }
384
385 /* reset accumulative statistics for "no-counter" type statistics */
386 priv->_3945.accum_statistics.general.temperature =
387 priv->_3945.statistics.general.temperature;
388 priv->_3945.accum_statistics.general.ttl_timestamp =
389 priv->_3945.statistics.general.ttl_timestamp;
390}
391#endif
353 392
354void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 393void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
355 struct iwl_rx_mem_buffer *rxb) 394 struct iwl_rx_mem_buffer *rxb)
356{ 395{
357 struct iwl_rx_packet *pkt = rxb_addr(rxb); 396 struct iwl_rx_packet *pkt = rxb_addr(rxb);
397
358 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", 398 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
359 (int)sizeof(struct iwl3945_notif_statistics), 399 (int)sizeof(struct iwl3945_notif_statistics),
360 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); 400 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
401#ifdef CONFIG_IWLWIFI_DEBUG
402 iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw);
403#endif
361 404
362 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); 405 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics));
363} 406}
364 407
408void iwl3945_reply_statistics(struct iwl_priv *priv,
409 struct iwl_rx_mem_buffer *rxb)
410{
411 struct iwl_rx_packet *pkt = rxb_addr(rxb);
412 __le32 *flag = (__le32 *)&pkt->u.raw;
413
414 if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
415#ifdef CONFIG_IWLWIFI_DEBUG
416 memset(&priv->_3945.accum_statistics, 0,
417 sizeof(struct iwl3945_notif_statistics));
418 memset(&priv->_3945.delta_statistics, 0,
419 sizeof(struct iwl3945_notif_statistics));
420 memset(&priv->_3945.max_delta, 0,
421 sizeof(struct iwl3945_notif_statistics));
422#endif
423 IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
424 }
425 iwl3945_hw_rx_statistics(priv, rxb);
426}
427
428
365/****************************************************************************** 429/******************************************************************************
366 * 430 *
367 * Misc. internal state and helper functions 431 * Misc. internal state and helper functions
@@ -2735,6 +2799,12 @@ static struct iwl_lib_ops iwl3945_lib = {
2735 .isr = iwl_isr_legacy, 2799 .isr = iwl_isr_legacy,
2736 .config_ap = iwl3945_config_ap, 2800 .config_ap = iwl3945_config_ap,
2737 .add_bcast_station = iwl3945_add_bcast_station, 2801 .add_bcast_station = iwl3945_add_bcast_station,
2802
2803 .debugfs_ops = {
2804 .rx_stats_read = iwl3945_ucode_rx_stats_read,
2805 .tx_stats_read = iwl3945_ucode_tx_stats_read,
2806 .general_stats_read = iwl3945_ucode_general_stats_read,
2807 },
2738}; 2808};
2739 2809
2740static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2810static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {