aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-05-05 16:14:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-05 16:14:16 -0400
commit83163244f845c296a118ce85c653872dbff6abfe (patch)
treece2eac695a1c198f23d537e20ed86c16ece21f7e /drivers/net/wireless/iwlwifi/iwl-3945.c
parent0a12761bcd5646691c5d16dd93df84d1b8849285 (diff)
parentadfba3c7c026a6a5560d2a43fefc9b198cb74462 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: drivers/net/wireless/libertas_tf/cmd.c drivers/net/wireless/libertas_tf/main.c
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 59af2594c9c5..17197a78d894 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -50,6 +50,7 @@
50#include "iwl-helpers.h" 50#include "iwl-helpers.h"
51#include "iwl-led.h" 51#include "iwl-led.h"
52#include "iwl-3945-led.h" 52#include "iwl-3945-led.h"
53#include "iwl-3945-debugfs.h"
53 54
54#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ 55#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
55 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 56 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \
@@ -293,7 +294,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
293 * iwl3945_rx_reply_tx - Handle Tx response 294 * iwl3945_rx_reply_tx - Handle Tx response
294 */ 295 */
295static void iwl3945_rx_reply_tx(struct iwl_priv *priv, 296static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
296 struct iwl_rx_mem_buffer *rxb) 297 struct iwl_rx_mem_buffer *rxb)
297{ 298{
298 struct iwl_rx_packet *pkt = rxb_addr(rxb); 299 struct iwl_rx_packet *pkt = rxb_addr(rxb);
299 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 300 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -351,18 +352,81 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
351 * RX handler implementations 352 * RX handler implementations
352 * 353 *
353 *****************************************************************************/ 354 *****************************************************************************/
355#ifdef CONFIG_IWLWIFI_DEBUG
356/*
357 * based on the assumption of all statistics counter are in DWORD
358 * FIXME: This function is for debugging, do not deal with
359 * the case of counters roll-over.
360 */
361static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
362 __le32 *stats)
363{
364 int i;
365 __le32 *prev_stats;
366 u32 *accum_stats;
367 u32 *delta, *max_delta;
368
369 prev_stats = (__le32 *)&priv->_3945.statistics;
370 accum_stats = (u32 *)&priv->_3945.accum_statistics;
371 delta = (u32 *)&priv->_3945.delta_statistics;
372 max_delta = (u32 *)&priv->_3945.max_delta;
373
374 for (i = sizeof(__le32); i < sizeof(struct iwl3945_notif_statistics);
375 i += sizeof(__le32), stats++, prev_stats++, delta++,
376 max_delta++, accum_stats++) {
377 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
378 *delta = (le32_to_cpu(*stats) -
379 le32_to_cpu(*prev_stats));
380 *accum_stats += *delta;
381 if (*delta > *max_delta)
382 *max_delta = *delta;
383 }
384 }
385
386 /* reset accumulative statistics for "no-counter" type statistics */
387 priv->_3945.accum_statistics.general.temperature =
388 priv->_3945.statistics.general.temperature;
389 priv->_3945.accum_statistics.general.ttl_timestamp =
390 priv->_3945.statistics.general.ttl_timestamp;
391}
392#endif
354 393
355void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 394void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
356 struct iwl_rx_mem_buffer *rxb) 395 struct iwl_rx_mem_buffer *rxb)
357{ 396{
358 struct iwl_rx_packet *pkt = rxb_addr(rxb); 397 struct iwl_rx_packet *pkt = rxb_addr(rxb);
398
359 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", 399 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
360 (int)sizeof(struct iwl3945_notif_statistics), 400 (int)sizeof(struct iwl3945_notif_statistics),
361 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); 401 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
402#ifdef CONFIG_IWLWIFI_DEBUG
403 iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw);
404#endif
362 405
363 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); 406 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics));
364} 407}
365 408
409void iwl3945_reply_statistics(struct iwl_priv *priv,
410 struct iwl_rx_mem_buffer *rxb)
411{
412 struct iwl_rx_packet *pkt = rxb_addr(rxb);
413 __le32 *flag = (__le32 *)&pkt->u.raw;
414
415 if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
416#ifdef CONFIG_IWLWIFI_DEBUG
417 memset(&priv->_3945.accum_statistics, 0,
418 sizeof(struct iwl3945_notif_statistics));
419 memset(&priv->_3945.delta_statistics, 0,
420 sizeof(struct iwl3945_notif_statistics));
421 memset(&priv->_3945.max_delta, 0,
422 sizeof(struct iwl3945_notif_statistics));
423#endif
424 IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
425 }
426 iwl3945_hw_rx_statistics(priv, rxb);
427}
428
429
366/****************************************************************************** 430/******************************************************************************
367 * 431 *
368 * Misc. internal state and helper functions 432 * Misc. internal state and helper functions
@@ -2736,6 +2800,12 @@ static struct iwl_lib_ops iwl3945_lib = {
2736 .isr = iwl_isr_legacy, 2800 .isr = iwl_isr_legacy,
2737 .config_ap = iwl3945_config_ap, 2801 .config_ap = iwl3945_config_ap,
2738 .add_bcast_station = iwl3945_add_bcast_station, 2802 .add_bcast_station = iwl3945_add_bcast_station,
2803
2804 .debugfs_ops = {
2805 .rx_stats_read = iwl3945_ucode_rx_stats_read,
2806 .tx_stats_read = iwl3945_ucode_tx_stats_read,
2807 .general_stats_read = iwl3945_ucode_general_stats_read,
2808 },
2739}; 2809};
2740 2810
2741static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2811static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {