aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-rx.c
diff options
context:
space:
mode:
authorHalperin, Daniel C <daniel.c.halperin@intel.com>2008-12-05 10:58:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-12 13:48:20 -0500
commit00e540b3768c96a5e2a9d5d39524fef98b2cd981 (patch)
tree73de7a7ad96fe0755c3c1327d741178ae45faeb3 /drivers/net/wireless/iwlwifi/iwl-rx.c
parent447107fb32d75425c95a33f58e6b4b760b470092 (diff)
iwlwifi: implement iwl_debug_report_frame for iwlagn
The old version of this code was copied from 3945 and never updated. This patch cleans up structs that do not apply and accounts for other changes from 3945->iwlagn (e.g., PHY info can come in a separate cmd response from the ucode.) Signed-off-by: Daniel Halperin <daniel.c.halperin@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/wireless/iwlwifi/iwl-rx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c85
1 files changed, 31 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8d2b73e194d..6dd16c7b5d9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -622,20 +622,24 @@ static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
622 return sig_qual; 622 return sig_qual;
623} 623}
624 624
625#ifdef CONFIG_IWLWIFI_DEBUG 625/* Calc max signal level (dBm) among 3 possible receivers */
626static inline int iwl_calc_rssi(struct iwl_priv *priv,
627 struct iwl_rx_phy_res *rx_resp)
628{
629 return priv->cfg->ops->utils->calc_rssi(priv, rx_resp);
630}
626 631
632#ifdef CONFIG_IWLWIFI_DEBUG
627/** 633/**
628 * iwl_dbg_report_frame - dump frame to syslog during debug sessions 634 * iwl_dbg_report_frame - dump frame to syslog during debug sessions
629 * 635 *
630 * You may hack this function to show different aspects of received frames, 636 * You may hack this function to show different aspects of received frames,
631 * including selective frame dumps. 637 * including selective frame dumps.
632 * group100 parameter selects whether to show 1 out of 100 good frames. 638 * group100 parameter selects whether to show 1 out of 100 good data frames.
633 * 639 * All beacon and probe response frames are printed.
634 * TODO: This was originally written for 3945, need to audit for
635 * proper operation with 4965.
636 */ 640 */
637static void iwl_dbg_report_frame(struct iwl_priv *priv, 641static void iwl_dbg_report_frame(struct iwl_priv *priv,
638 struct iwl_rx_packet *pkt, 642 struct iwl_rx_phy_res *phy_res, u16 length,
639 struct ieee80211_hdr *header, int group100) 643 struct ieee80211_hdr *header, int group100)
640{ 644{
641 u32 to_us; 645 u32 to_us;
@@ -647,20 +651,9 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
647 u16 seq_ctl; 651 u16 seq_ctl;
648 u16 channel; 652 u16 channel;
649 u16 phy_flags; 653 u16 phy_flags;
650 int rate_sym; 654 u32 rate_n_flags;
651 u16 length;
652 u16 status;
653 u16 bcn_tmr;
654 u32 tsf_low; 655 u32 tsf_low;
655 u64 tsf; 656 int rssi;
656 u8 rssi;
657 u8 agc;
658 u16 sig_avg;
659 u16 noise_diff;
660 struct iwl4965_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
661 struct iwl4965_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
662 struct iwl4965_rx_frame_end *rx_end = IWL_RX_END(pkt);
663 u8 *data = IWL_RX_DATA(pkt);
664 657
665 if (likely(!(priv->debug_level & IWL_DL_RX))) 658 if (likely(!(priv->debug_level & IWL_DL_RX)))
666 return; 659 return;
@@ -670,22 +663,13 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
670 seq_ctl = le16_to_cpu(header->seq_ctrl); 663 seq_ctl = le16_to_cpu(header->seq_ctrl);
671 664
672 /* metadata */ 665 /* metadata */
673 channel = le16_to_cpu(rx_hdr->channel); 666 channel = le16_to_cpu(phy_res->channel);
674 phy_flags = le16_to_cpu(rx_hdr->phy_flags); 667 phy_flags = le16_to_cpu(phy_res->phy_flags);
675 rate_sym = rx_hdr->rate; 668 rate_n_flags = le32_to_cpu(phy_res->rate_n_flags);
676 length = le16_to_cpu(rx_hdr->len);
677
678 /* end-of-frame status and timestamp */
679 status = le32_to_cpu(rx_end->status);
680 bcn_tmr = le32_to_cpu(rx_end->beacon_timestamp);
681 tsf_low = le64_to_cpu(rx_end->timestamp) & 0x0ffffffff;
682 tsf = le64_to_cpu(rx_end->timestamp);
683 669
684 /* signal statistics */ 670 /* signal statistics */
685 rssi = rx_stats->rssi; 671 rssi = iwl_calc_rssi(priv, phy_res);
686 agc = rx_stats->agc; 672 tsf_low = le64_to_cpu(phy_res->timestamp) & 0x0ffffffff;
687 sig_avg = le16_to_cpu(rx_stats->sig_avg);
688 noise_diff = le16_to_cpu(rx_stats->noise_diff);
689 673
690 to_us = !compare_ether_addr(header->addr1, priv->mac_addr); 674 to_us = !compare_ether_addr(header->addr1, priv->mac_addr);
691 675
@@ -739,11 +723,13 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
739 else 723 else
740 title = "Frame"; 724 title = "Frame";
741 725
742 rate_idx = iwl_hwrate_to_plcp_idx(rate_sym); 726 rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags);
743 if (unlikely(rate_idx == -1)) 727 if (unlikely((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT))) {
744 bitrate = 0; 728 bitrate = 0;
745 else 729 WARN_ON_ONCE(1);
730 } else {
746 bitrate = iwl_rates[rate_idx].ieee / 2; 731 bitrate = iwl_rates[rate_idx].ieee / 2;
732 }
747 733
748 /* print frame summary. 734 /* print frame summary.
749 * MAC addresses show just the last byte (for brevity), 735 * MAC addresses show just the last byte (for brevity),
@@ -755,23 +741,22 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
755 length, rssi, channel, bitrate); 741 length, rssi, channel, bitrate);
756 else { 742 else {
757 /* src/dst addresses assume managed mode */ 743 /* src/dst addresses assume managed mode */
758 IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " 744 IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, src=0x%02x, "
759 "src=0x%02x, rssi=%u, tim=%lu usec, " 745 "len=%u, rssi=%d, tim=%lu usec, "
760 "phy=0x%02x, chnl=%d\n", 746 "phy=0x%02x, chnl=%d\n",
761 title, le16_to_cpu(fc), header->addr1[5], 747 title, le16_to_cpu(fc), header->addr1[5],
762 header->addr3[5], rssi, 748 header->addr3[5], length, rssi,
763 tsf_low - priv->scan_start_tsf, 749 tsf_low - priv->scan_start_tsf,
764 phy_flags, channel); 750 phy_flags, channel);
765 } 751 }
766 } 752 }
767 if (print_dump) 753 if (print_dump)
768 iwl_print_hex_dump(priv, IWL_DL_RX, data, length); 754 iwl_print_hex_dump(priv, IWL_DL_RX, header, length);
769} 755}
770#else 756#else
771static inline void iwl_dbg_report_frame(struct iwl_priv *priv, 757static void iwl_dbg_report_frame(struct iwl_priv *priv,
772 struct iwl_rx_packet *pkt, 758 struct iwl_rx_phy_res *phy_res, u16 length,
773 struct ieee80211_hdr *header, 759 struct ieee80211_hdr *header, int group100)
774 int group100)
775{ 760{
776} 761}
777#endif 762#endif
@@ -966,14 +951,6 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
966 rxb->skb = NULL; 951 rxb->skb = NULL;
967} 952}
968 953
969/* Calc max signal level (dBm) among 3 possible receivers */
970static inline int iwl_calc_rssi(struct iwl_priv *priv,
971 struct iwl_rx_phy_res *rx_resp)
972{
973 return priv->cfg->ops->utils->calc_rssi(priv, rx_resp);
974}
975
976
977/* This is necessary only for a number of statistics, see the caller. */ 954/* This is necessary only for a number of statistics, see the caller. */
978static int iwl_is_network_packet(struct iwl_priv *priv, 955static int iwl_is_network_packet(struct iwl_priv *priv,
979 struct ieee80211_hdr *header) 956 struct ieee80211_hdr *header)
@@ -1096,8 +1073,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1096 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 1073 priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
1097 1074
1098 /* Set "1" to report good data frames in groups of 100 */ 1075 /* Set "1" to report good data frames in groups of 100 */
1099 /* FIXME: need to optimize the call: */ 1076 if (unlikely(priv->debug_level & IWL_DL_RX))
1100 iwl_dbg_report_frame(priv, pkt, header, 1); 1077 iwl_dbg_report_frame(priv, rx_start, len, header, 1);
1101 1078
1102 IWL_DEBUG_STATS_LIMIT("Rssi %d, noise %d, qual %d, TSF %llu\n", 1079 IWL_DEBUG_STATS_LIMIT("Rssi %d, noise %d, qual %d, TSF %llu\n",
1103 rx_status.signal, rx_status.noise, rx_status.signal, 1080 rx_status.signal, rx_status.noise, rx_status.signal,