aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-08-07 18:41:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:47 -0400
commit141b03e07a54af68fc099459bf780a182b240b45 (patch)
tree61be04439861690152b97cca6b354885b67e4089 /drivers/net/wireless/iwlwifi/iwl-debugfs.c
parent22fdf3c9e19dce6d66bcfdbed547a5aa52b89933 (diff)
iwlwifi: tx/rx queue pointer information
Adding debugfs function to show current TxFifo/RxFifo read/write pointer, plus the current tx queue status (wake/stop) for both real and virtual queue. This is part of debug feature set to help debugging driver/uCode. use tx_queue and rx_queue in /sys/kernel/debug/ieee80211/phy0/iwlagn/debug directory to show the current read/write pointer for both TxFifo and RxFifo queue Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> 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-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index a0e5063cd8c9..d4109cbb4f31 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -887,9 +887,74 @@ static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
887 return count; 887 return count;
888} 888}
889 889
890static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
891 char __user *user_buf,
892 size_t count, loff_t *ppos) {
893
894 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
895 struct iwl_tx_queue *txq;
896 struct iwl_queue *q;
897 char *buf;
898 int pos = 0;
899 int cnt;
900 int ret;
901 const size_t bufsz = sizeof(char) * 60 * IWL_MAX_NUM_QUEUES;
902
903 buf = kzalloc(bufsz, GFP_KERNEL);
904 if (!buf)
905 return -ENOMEM;
906
907 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
908 txq = &priv->txq[cnt];
909 q = &txq->q;
910 pos += scnprintf(buf + pos, bufsz - pos,
911 "hwq %.2d: read=%u write=%u stop=%d"
912 " swq_id=%#.2x (ac %d/hwq %d)\n",
913 cnt, q->read_ptr, q->write_ptr,
914 !!test_bit(cnt, priv->queue_stopped),
915 txq->swq_id,
916 txq->swq_id & 0x80 ? txq->swq_id & 3 :
917 txq->swq_id,
918 txq->swq_id & 0x80 ? (txq->swq_id >> 2) &
919 0x1f : txq->swq_id);
920 if (cnt >= 4)
921 continue;
922 /* for the ACs, display the stop count too */
923 pos += scnprintf(buf + pos, bufsz - pos,
924 " stop-count: %d\n",
925 atomic_read(&priv->queue_stop_count[cnt]));
926 }
927 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
928 kfree(buf);
929 return ret;
930}
931
932static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
933 char __user *user_buf,
934 size_t count, loff_t *ppos) {
935
936 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
937 struct iwl_rx_queue *rxq = &priv->rxq;
938 char buf[256];
939 int pos = 0;
940 const size_t bufsz = sizeof(buf);
941
942 pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n",
943 rxq->read);
944 pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n",
945 rxq->write);
946 pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n",
947 rxq->free_count);
948 pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
949 le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF);
950 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
951}
952
890DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); 953DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics);
891DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); 954DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics);
892DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 955DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
956DEBUGFS_READ_FILE_OPS(rx_queue);
957DEBUGFS_READ_FILE_OPS(tx_queue);
893 958
894/* 959/*
895 * Create the debugfs files and directories 960 * Create the debugfs files and directories
@@ -934,6 +999,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
934 DEBUGFS_ADD_FILE(rx_statistics, debug); 999 DEBUGFS_ADD_FILE(rx_statistics, debug);
935 DEBUGFS_ADD_FILE(tx_statistics, debug); 1000 DEBUGFS_ADD_FILE(tx_statistics, debug);
936 DEBUGFS_ADD_FILE(traffic_log, debug); 1001 DEBUGFS_ADD_FILE(traffic_log, debug);
1002 DEBUGFS_ADD_FILE(rx_queue, debug);
1003 DEBUGFS_ADD_FILE(tx_queue, debug);
937 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); 1004 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
938 DEBUGFS_ADD_BOOL(disable_chain_noise, rf, 1005 DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
939 &priv->disable_chain_noise_cal); 1006 &priv->disable_chain_noise_cal);
@@ -976,6 +1043,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
976 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_statistics); 1043 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_statistics);
977 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_statistics); 1044 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_statistics);
978 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); 1045 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log);
1046 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue);
1047 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue);
979 DEBUGFS_REMOVE(priv->dbgfs->dir_debug); 1048 DEBUGFS_REMOVE(priv->dbgfs->dir_debug);
980 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); 1049 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
981 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); 1050 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);