aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c225
1 files changed, 180 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
index 5e5c5122fb15..f052c6d09b37 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
@@ -31,21 +31,24 @@
31static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) 31static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
32{ 32{
33 int p = 0; 33 int p = 0;
34 u32 flag;
34 35
35 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", 36 if (priv->cfg->bt_statistics)
36 le32_to_cpu(priv->_agn.statistics.flag)); 37 flag = le32_to_cpu(priv->_agn.statistics_bt.flag);
37 if (le32_to_cpu(priv->_agn.statistics.flag) & 38 else
38 UCODE_STATISTICS_CLEAR_MSK) 39 flag = le32_to_cpu(priv->_agn.statistics.flag);
40
41 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
42 if (flag & UCODE_STATISTICS_CLEAR_MSK)
39 p += scnprintf(buf + p, bufsz - p, 43 p += scnprintf(buf + p, bufsz - p,
40 "\tStatistics have been cleared\n"); 44 "\tStatistics have been cleared\n");
41 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", 45 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
42 (le32_to_cpu(priv->_agn.statistics.flag) & 46 (flag & UCODE_STATISTICS_FREQUENCY_MSK)
43 UCODE_STATISTICS_FREQUENCY_MSK) 47 ? "2.4 GHz" : "5.2 GHz");
44 ? "2.4 GHz" : "5.2 GHz");
45 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", 48 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
46 (le32_to_cpu(priv->_agn.statistics.flag) & 49 (flag & UCODE_STATISTICS_NARROW_BAND_MSK)
47 UCODE_STATISTICS_NARROW_BAND_MSK) 50 ? "enabled" : "disabled");
48 ? "enabled" : "disabled"); 51
49 return p; 52 return p;
50} 53}
51 54
@@ -79,22 +82,43 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
79 * the last statistics notification from uCode 82 * the last statistics notification from uCode
80 * might not reflect the current uCode activity 83 * might not reflect the current uCode activity
81 */ 84 */
82 ofdm = &priv->_agn.statistics.rx.ofdm; 85 if (priv->cfg->bt_statistics) {
83 cck = &priv->_agn.statistics.rx.cck; 86 ofdm = &priv->_agn.statistics_bt.rx.ofdm;
84 general = &priv->_agn.statistics.rx.general; 87 cck = &priv->_agn.statistics_bt.rx.cck;
85 ht = &priv->_agn.statistics.rx.ofdm_ht; 88 general = &priv->_agn.statistics_bt.rx.general.common;
86 accum_ofdm = &priv->_agn.accum_statistics.rx.ofdm; 89 ht = &priv->_agn.statistics_bt.rx.ofdm_ht;
87 accum_cck = &priv->_agn.accum_statistics.rx.cck; 90 accum_ofdm = &priv->_agn.accum_statistics_bt.rx.ofdm;
88 accum_general = &priv->_agn.accum_statistics.rx.general; 91 accum_cck = &priv->_agn.accum_statistics_bt.rx.cck;
89 accum_ht = &priv->_agn.accum_statistics.rx.ofdm_ht; 92 accum_general =
90 delta_ofdm = &priv->_agn.delta_statistics.rx.ofdm; 93 &priv->_agn.accum_statistics_bt.rx.general.common;
91 delta_cck = &priv->_agn.delta_statistics.rx.cck; 94 accum_ht = &priv->_agn.accum_statistics_bt.rx.ofdm_ht;
92 delta_general = &priv->_agn.delta_statistics.rx.general; 95 delta_ofdm = &priv->_agn.delta_statistics_bt.rx.ofdm;
93 delta_ht = &priv->_agn.delta_statistics.rx.ofdm_ht; 96 delta_cck = &priv->_agn.delta_statistics_bt.rx.cck;
94 max_ofdm = &priv->_agn.max_delta.rx.ofdm; 97 delta_general =
95 max_cck = &priv->_agn.max_delta.rx.cck; 98 &priv->_agn.delta_statistics_bt.rx.general.common;
96 max_general = &priv->_agn.max_delta.rx.general; 99 delta_ht = &priv->_agn.delta_statistics_bt.rx.ofdm_ht;
97 max_ht = &priv->_agn.max_delta.rx.ofdm_ht; 100 max_ofdm = &priv->_agn.max_delta_bt.rx.ofdm;
101 max_cck = &priv->_agn.max_delta_bt.rx.cck;
102 max_general = &priv->_agn.max_delta_bt.rx.general.common;
103 max_ht = &priv->_agn.max_delta_bt.rx.ofdm_ht;
104 } else {
105 ofdm = &priv->_agn.statistics.rx.ofdm;
106 cck = &priv->_agn.statistics.rx.cck;
107 general = &priv->_agn.statistics.rx.general;
108 ht = &priv->_agn.statistics.rx.ofdm_ht;
109 accum_ofdm = &priv->_agn.accum_statistics.rx.ofdm;
110 accum_cck = &priv->_agn.accum_statistics.rx.cck;
111 accum_general = &priv->_agn.accum_statistics.rx.general;
112 accum_ht = &priv->_agn.accum_statistics.rx.ofdm_ht;
113 delta_ofdm = &priv->_agn.delta_statistics.rx.ofdm;
114 delta_cck = &priv->_agn.delta_statistics.rx.cck;
115 delta_general = &priv->_agn.delta_statistics.rx.general;
116 delta_ht = &priv->_agn.delta_statistics.rx.ofdm_ht;
117 max_ofdm = &priv->_agn.max_delta.rx.ofdm;
118 max_cck = &priv->_agn.max_delta.rx.cck;
119 max_general = &priv->_agn.max_delta.rx.general;
120 max_ht = &priv->_agn.max_delta.rx.ofdm_ht;
121 }
98 122
99 pos += iwl_statistics_flag(priv, buf, bufsz); 123 pos += iwl_statistics_flag(priv, buf, bufsz);
100 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 124 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
@@ -560,10 +584,18 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file,
560 * the last statistics notification from uCode 584 * the last statistics notification from uCode
561 * might not reflect the current uCode activity 585 * might not reflect the current uCode activity
562 */ 586 */
563 tx = &priv->_agn.statistics.tx; 587 if (priv->cfg->bt_statistics) {
564 accum_tx = &priv->_agn.accum_statistics.tx; 588 tx = &priv->_agn.statistics_bt.tx;
565 delta_tx = &priv->_agn.delta_statistics.tx; 589 accum_tx = &priv->_agn.accum_statistics_bt.tx;
566 max_tx = &priv->_agn.max_delta.tx; 590 delta_tx = &priv->_agn.delta_statistics_bt.tx;
591 max_tx = &priv->_agn.max_delta_bt.tx;
592 } else {
593 tx = &priv->_agn.statistics.tx;
594 accum_tx = &priv->_agn.accum_statistics.tx;
595 delta_tx = &priv->_agn.delta_statistics.tx;
596 max_tx = &priv->_agn.max_delta.tx;
597 }
598
567 pos += iwl_statistics_flag(priv, buf, bufsz); 599 pos += iwl_statistics_flag(priv, buf, bufsz);
568 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 600 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
569 "acumulative delta max\n", 601 "acumulative delta max\n",
@@ -759,8 +791,8 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
759 char *buf; 791 char *buf;
760 int bufsz = sizeof(struct statistics_general) * 10 + 300; 792 int bufsz = sizeof(struct statistics_general) * 10 + 300;
761 ssize_t ret; 793 ssize_t ret;
762 struct statistics_general *general, *accum_general; 794 struct statistics_general_common *general, *accum_general;
763 struct statistics_general *delta_general, *max_general; 795 struct statistics_general_common *delta_general, *max_general;
764 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; 796 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
765 struct statistics_div *div, *accum_div, *delta_div, *max_div; 797 struct statistics_div *div, *accum_div, *delta_div, *max_div;
766 798
@@ -777,18 +809,34 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
777 * the last statistics notification from uCode 809 * the last statistics notification from uCode
778 * might not reflect the current uCode activity 810 * might not reflect the current uCode activity
779 */ 811 */
780 general = &priv->_agn.statistics.general; 812 if (priv->cfg->bt_statistics) {
781 dbg = &priv->_agn.statistics.general.dbg; 813 general = &priv->_agn.statistics_bt.general.common;
782 div = &priv->_agn.statistics.general.div; 814 dbg = &priv->_agn.statistics_bt.general.common.dbg;
783 accum_general = &priv->_agn.accum_statistics.general; 815 div = &priv->_agn.statistics_bt.general.common.div;
784 delta_general = &priv->_agn.delta_statistics.general; 816 accum_general = &priv->_agn.accum_statistics_bt.general.common;
785 max_general = &priv->_agn.max_delta.general; 817 accum_dbg = &priv->_agn.accum_statistics_bt.general.common.dbg;
786 accum_dbg = &priv->_agn.accum_statistics.general.dbg; 818 accum_div = &priv->_agn.accum_statistics_bt.general.common.div;
787 delta_dbg = &priv->_agn.delta_statistics.general.dbg; 819 delta_general = &priv->_agn.delta_statistics_bt.general.common;
788 max_dbg = &priv->_agn.max_delta.general.dbg; 820 max_general = &priv->_agn.max_delta_bt.general.common;
789 accum_div = &priv->_agn.accum_statistics.general.div; 821 delta_dbg = &priv->_agn.delta_statistics_bt.general.common.dbg;
790 delta_div = &priv->_agn.delta_statistics.general.div; 822 max_dbg = &priv->_agn.max_delta_bt.general.common.dbg;
791 max_div = &priv->_agn.max_delta.general.div; 823 delta_div = &priv->_agn.delta_statistics_bt.general.common.div;
824 max_div = &priv->_agn.max_delta_bt.general.common.div;
825 } else {
826 general = &priv->_agn.statistics.general.common;
827 dbg = &priv->_agn.statistics.general.common.dbg;
828 div = &priv->_agn.statistics.general.common.div;
829 accum_general = &priv->_agn.accum_statistics.general.common;
830 accum_dbg = &priv->_agn.accum_statistics.general.common.dbg;
831 accum_div = &priv->_agn.accum_statistics.general.common.div;
832 delta_general = &priv->_agn.delta_statistics.general.common;
833 max_general = &priv->_agn.max_delta.general.common;
834 delta_dbg = &priv->_agn.delta_statistics.general.common.dbg;
835 max_dbg = &priv->_agn.max_delta.general.common.dbg;
836 delta_div = &priv->_agn.delta_statistics.general.common.div;
837 max_div = &priv->_agn.max_delta.general.common.div;
838 }
839
792 pos += iwl_statistics_flag(priv, buf, bufsz); 840 pos += iwl_statistics_flag(priv, buf, bufsz);
793 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" 841 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
794 "acumulative delta max\n", 842 "acumulative delta max\n",
@@ -876,3 +924,90 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
876 kfree(buf); 924 kfree(buf);
877 return ret; 925 return ret;
878} 926}
927
928ssize_t iwl_ucode_bt_stats_read(struct file *file,
929 char __user *user_buf,
930 size_t count, loff_t *ppos)
931{
932 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
933 int pos = 0;
934 char *buf;
935 int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200;
936 ssize_t ret;
937 struct statistics_bt_activity *bt, *accum_bt;
938
939 if (!iwl_is_alive(priv))
940 return -EAGAIN;
941
942 /* make request to uCode to retrieve statistics information */
943 mutex_lock(&priv->mutex);
944 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
945 mutex_unlock(&priv->mutex);
946
947 if (ret) {
948 IWL_ERR(priv,
949 "Error sending statistics request: %zd\n", ret);
950 return -EAGAIN;
951 }
952 buf = kzalloc(bufsz, GFP_KERNEL);
953 if (!buf) {
954 IWL_ERR(priv, "Can not allocate Buffer\n");
955 return -ENOMEM;
956 }
957
958 /*
959 * the statistic information display here is based on
960 * the last statistics notification from uCode
961 * might not reflect the current uCode activity
962 */
963 bt = &priv->_agn.statistics_bt.general.activity;
964 accum_bt = &priv->_agn.accum_statistics_bt.general.activity;
965
966 pos += iwl_statistics_flag(priv, buf, bufsz);
967 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n");
968 pos += scnprintf(buf + pos, bufsz - pos,
969 "\t\t\tcurrent\t\t\taccumulative\n");
970 pos += scnprintf(buf + pos, bufsz - pos,
971 "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
972 le32_to_cpu(bt->hi_priority_tx_req_cnt),
973 accum_bt->hi_priority_tx_req_cnt);
974 pos += scnprintf(buf + pos, bufsz - pos,
975 "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
976 le32_to_cpu(bt->hi_priority_tx_denied_cnt),
977 accum_bt->hi_priority_tx_denied_cnt);
978 pos += scnprintf(buf + pos, bufsz - pos,
979 "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
980 le32_to_cpu(bt->lo_priority_tx_req_cnt),
981 accum_bt->lo_priority_tx_req_cnt);
982 pos += scnprintf(buf + pos, bufsz - pos,
983 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
984 le32_to_cpu(bt->lo_priority_tx_denied_cnt),
985 accum_bt->lo_priority_tx_denied_cnt);
986 pos += scnprintf(buf + pos, bufsz - pos,
987 "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
988 le32_to_cpu(bt->hi_priority_rx_req_cnt),
989 accum_bt->hi_priority_rx_req_cnt);
990 pos += scnprintf(buf + pos, bufsz - pos,
991 "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
992 le32_to_cpu(bt->hi_priority_rx_denied_cnt),
993 accum_bt->hi_priority_rx_denied_cnt);
994 pos += scnprintf(buf + pos, bufsz - pos,
995 "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
996 le32_to_cpu(bt->lo_priority_rx_req_cnt),
997 accum_bt->lo_priority_rx_req_cnt);
998 pos += scnprintf(buf + pos, bufsz - pos,
999 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1000 le32_to_cpu(bt->lo_priority_rx_denied_cnt),
1001 accum_bt->lo_priority_rx_denied_cnt);
1002
1003 pos += scnprintf(buf + pos, bufsz - pos,
1004 "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
1005 le32_to_cpu(priv->_agn.statistics_bt.rx.
1006 general.num_bt_kills),
1007 priv->_agn.accum_statistics_bt.rx.
1008 general.num_bt_kills);
1009
1010 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1011 kfree(buf);
1012 return ret;
1013}