@@ -622,24 +622,20 @@ static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
622
622
return sig_qual ;
623
623
}
624
624
625
- /* Calc max signal level (dBm) among 3 possible receivers */
626
- static 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
- }
631
-
632
625
#ifdef CONFIG_IWLWIFI_DEBUG
626
+
633
627
/**
634
628
* iwl_dbg_report_frame - dump frame to syslog during debug sessions
635
629
*
636
630
* You may hack this function to show different aspects of received frames,
637
631
* including selective frame dumps.
638
- * group100 parameter selects whether to show 1 out of 100 good data frames.
639
- * All beacon and probe response frames are printed.
632
+ * group100 parameter selects whether to show 1 out of 100 good frames.
633
+ *
634
+ * TODO: This was originally written for 3945, need to audit for
635
+ * proper operation with 4965.
640
636
*/
641
637
static void iwl_dbg_report_frame (struct iwl_priv * priv ,
642
- struct iwl_rx_phy_res * phy_res , u16 length ,
638
+ struct iwl_rx_packet * pkt ,
643
639
struct ieee80211_hdr * header , int group100 )
644
640
{
645
641
u32 to_us ;
@@ -651,9 +647,20 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
651
647
u16 seq_ctl ;
652
648
u16 channel ;
653
649
u16 phy_flags ;
654
- u32 rate_n_flags ;
650
+ int rate_sym ;
651
+ u16 length ;
652
+ u16 status ;
653
+ u16 bcn_tmr ;
655
654
u32 tsf_low ;
656
- int rssi ;
655
+ u64 tsf ;
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 );
657
664
658
665
if (likely (!(priv -> debug_level & IWL_DL_RX )))
659
666
return ;
@@ -663,13 +670,22 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
663
670
seq_ctl = le16_to_cpu (header -> seq_ctrl );
664
671
665
672
/* metadata */
666
- channel = le16_to_cpu (phy_res -> channel );
667
- phy_flags = le16_to_cpu (phy_res -> phy_flags );
668
- rate_n_flags = le32_to_cpu (phy_res -> rate_n_flags );
673
+ channel = le16_to_cpu (rx_hdr -> channel );
674
+ phy_flags = le16_to_cpu (rx_hdr -> phy_flags );
675
+ rate_sym = rx_hdr -> rate ;
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 );
669
683
670
684
/* signal statistics */
671
- rssi = iwl_calc_rssi (priv , phy_res );
672
- tsf_low = le64_to_cpu (phy_res -> timestamp ) & 0x0ffffffff ;
685
+ rssi = rx_stats -> rssi ;
686
+ agc = rx_stats -> agc ;
687
+ sig_avg = le16_to_cpu (rx_stats -> sig_avg );
688
+ noise_diff = le16_to_cpu (rx_stats -> noise_diff );
673
689
674
690
to_us = !compare_ether_addr (header -> addr1 , priv -> mac_addr );
675
691
@@ -723,13 +739,11 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
723
739
else
724
740
title = "Frame" ;
725
741
726
- rate_idx = iwl_hwrate_to_plcp_idx (rate_n_flags );
727
- if (unlikely (( rate_idx < 0 ) || ( rate_idx >= IWL_RATE_COUNT ))) {
742
+ rate_idx = iwl_hwrate_to_plcp_idx (rate_sym );
743
+ if (unlikely (rate_idx == -1 ))
728
744
bitrate = 0 ;
729
- WARN_ON_ONCE (1 );
730
- } else {
745
+ else
731
746
bitrate = iwl_rates [rate_idx ].ieee / 2 ;
732
- }
733
747
734
748
/* print frame summary.
735
749
* MAC addresses show just the last byte (for brevity),
@@ -741,22 +755,23 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
741
755
length , rssi , channel , bitrate );
742
756
else {
743
757
/* src/dst addresses assume managed mode */
744
- IWL_DEBUG_RX ("%s: 0x%04x, dst=0x%02x, src=0x%02x, "
745
- "len=%u , rssi=%d , tim=%lu usec, "
758
+ IWL_DEBUG_RX ("%s: 0x%04x, dst=0x%02x, "
759
+ "src=0x%02x , rssi=%u , tim=%lu usec, "
746
760
"phy=0x%02x, chnl=%d\n" ,
747
761
title , le16_to_cpu (fc ), header -> addr1 [5 ],
748
- header -> addr3 [5 ], length , rssi ,
762
+ header -> addr3 [5 ], rssi ,
749
763
tsf_low - priv -> scan_start_tsf ,
750
764
phy_flags , channel );
751
765
}
752
766
}
753
767
if (print_dump )
754
- iwl_print_hex_dump (priv , IWL_DL_RX , header , length );
768
+ iwl_print_hex_dump (priv , IWL_DL_RX , data , length );
755
769
}
756
770
#else
757
- static void iwl_dbg_report_frame (struct iwl_priv * priv ,
758
- struct iwl_rx_phy_res * phy_res , u16 length ,
759
- struct ieee80211_hdr * header , int group100 )
771
+ static inline void iwl_dbg_report_frame (struct iwl_priv * priv ,
772
+ struct iwl_rx_packet * pkt ,
773
+ struct ieee80211_hdr * header ,
774
+ int group100 )
760
775
{
761
776
}
762
777
#endif
@@ -951,6 +966,14 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
951
966
rxb -> skb = NULL ;
952
967
}
953
968
969
+ /* Calc max signal level (dBm) among 3 possible receivers */
970
+ static 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
+
954
977
/* This is necessary only for a number of statistics, see the caller. */
955
978
static int iwl_is_network_packet (struct iwl_priv * priv ,
956
979
struct ieee80211_hdr * header )
@@ -1073,8 +1096,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1073
1096
priv -> last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE ;
1074
1097
1075
1098
/* Set "1" to report good data frames in groups of 100 */
1076
- if ( unlikely ( priv -> debug_level & IWL_DL_RX ))
1077
- iwl_dbg_report_frame (priv , rx_start , len , header , 1 );
1099
+ /* FIXME: need to optimize the call: */
1100
+ iwl_dbg_report_frame (priv , pkt , header , 1 );
1078
1101
1079
1102
IWL_DEBUG_STATS_LIMIT ("Rssi %d, noise %d, qual %d, TSF %llu\n" ,
1080
1103
rx_status .signal , rx_status .noise , rx_status .signal ,
0 commit comments