aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-09-06 12:31:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-14 13:56:38 -0400
commit41f5e0475c7c04b17b207736146187636b04eb4c (patch)
treeeb96fcf451be1362e60b9fb784f6ca67cc062abc /drivers/net/wireless
parent522376d206da66cecc90929134ad70c0446e874b (diff)
iwlagn: move traffic_log back to upper layer
The traffic log debugfs handlers were mistakenly moved to the transport layer because they print the pointers of the Tx / Rx queues. The pointers of the queues can be fetched by another debugfs handler. So bring the traffic log back to the upper layer and remove the part that reads the Tx / Rx queues' pointers. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c85
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c107
2 files changed, 85 insertions, 107 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index e320cc10167e..d0c63cfee15c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -804,6 +804,89 @@ DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
804DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); 804DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
805DEBUGFS_READ_FILE_OPS(current_sleep_command); 805DEBUGFS_READ_FILE_OPS(current_sleep_command);
806 806
807static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
808 char __user *user_buf,
809 size_t count, loff_t *ppos)
810{
811 struct iwl_priv *priv = file->private_data;
812 int pos = 0, ofs = 0;
813 int cnt = 0, entry;
814
815 char *buf;
816 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
817 (hw_params(priv).max_txq_num * 32 * 8) + 400;
818 const u8 *ptr;
819 ssize_t ret;
820
821 buf = kzalloc(bufsz, GFP_KERNEL);
822 if (!buf) {
823 IWL_ERR(priv, "Can not allocate buffer\n");
824 return -ENOMEM;
825 }
826 if (priv->tx_traffic &&
827 (iwl_get_debug_level(priv->shrd) & IWL_DL_TX)) {
828 ptr = priv->tx_traffic;
829 pos += scnprintf(buf + pos, bufsz - pos,
830 "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
831 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
832 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
833 entry++, ofs += 16) {
834 pos += scnprintf(buf + pos, bufsz - pos,
835 "0x%.4x ", ofs);
836 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
837 buf + pos, bufsz - pos, 0);
838 pos += strlen(buf + pos);
839 if (bufsz - pos > 0)
840 buf[pos++] = '\n';
841 }
842 }
843 }
844
845 if (priv->rx_traffic &&
846 (iwl_get_debug_level(priv->shrd) & IWL_DL_RX)) {
847 ptr = priv->rx_traffic;
848 pos += scnprintf(buf + pos, bufsz - pos,
849 "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
850 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
851 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
852 entry++, ofs += 16) {
853 pos += scnprintf(buf + pos, bufsz - pos,
854 "0x%.4x ", ofs);
855 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
856 buf + pos, bufsz - pos, 0);
857 pos += strlen(buf + pos);
858 if (bufsz - pos > 0)
859 buf[pos++] = '\n';
860 }
861 }
862 }
863
864 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
865 kfree(buf);
866 return ret;
867}
868
869static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
870 const char __user *user_buf,
871 size_t count, loff_t *ppos)
872{
873 struct iwl_priv *priv = file->private_data;
874 char buf[8];
875 int buf_size;
876 int traffic_log;
877
878 memset(buf, 0, sizeof(buf));
879 buf_size = min(count, sizeof(buf) - 1);
880 if (copy_from_user(buf, user_buf, buf_size))
881 return -EFAULT;
882 if (sscanf(buf, "%d", &traffic_log) != 1)
883 return -EFAULT;
884 if (traffic_log == 0)
885 iwl_reset_traffic_log(priv);
886
887 return count;
888}
889
807static const char *fmt_value = " %-30s %10u\n"; 890static const char *fmt_value = " %-30s %10u\n";
808static const char *fmt_hex = " %-30s 0x%02X\n"; 891static const char *fmt_hex = " %-30s 0x%02X\n";
809static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; 892static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
@@ -2340,6 +2423,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
2340 2423
2341DEBUGFS_READ_FILE_OPS(rx_statistics); 2424DEBUGFS_READ_FILE_OPS(rx_statistics);
2342DEBUGFS_READ_FILE_OPS(tx_statistics); 2425DEBUGFS_READ_FILE_OPS(tx_statistics);
2426DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
2343DEBUGFS_READ_FILE_OPS(ucode_rx_stats); 2427DEBUGFS_READ_FILE_OPS(ucode_rx_stats);
2344DEBUGFS_READ_FILE_OPS(ucode_tx_stats); 2428DEBUGFS_READ_FILE_OPS(ucode_tx_stats);
2345DEBUGFS_READ_FILE_OPS(ucode_general_stats); 2429DEBUGFS_READ_FILE_OPS(ucode_general_stats);
@@ -2400,6 +2484,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2400 DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); 2484 DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR);
2401 DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); 2485 DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR);
2402 DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); 2486 DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR);
2487 DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR);
2403 DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); 2488 DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR);
2404 DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); 2489 DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR);
2405 DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); 2490 DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 3948d317bc19..28fbaa2517a0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -1561,111 +1561,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1561 .llseek = generic_file_llseek, \ 1561 .llseek = generic_file_llseek, \
1562}; 1562};
1563 1563
1564static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
1565 char __user *user_buf,
1566 size_t count, loff_t *ppos)
1567{
1568 struct iwl_trans *trans = file->private_data;
1569 struct iwl_priv *priv = priv(trans);
1570 int pos = 0, ofs = 0;
1571 int cnt = 0, entry;
1572 struct iwl_trans_pcie *trans_pcie =
1573 IWL_TRANS_GET_PCIE_TRANS(trans);
1574 struct iwl_tx_queue *txq;
1575 struct iwl_queue *q;
1576 struct iwl_rx_queue *rxq = &trans_pcie->rxq;
1577 char *buf;
1578 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
1579 (hw_params(trans).max_txq_num * 32 * 8) + 400;
1580 const u8 *ptr;
1581 ssize_t ret;
1582
1583 if (!trans_pcie->txq) {
1584 IWL_ERR(trans, "txq not ready\n");
1585 return -EAGAIN;
1586 }
1587 buf = kzalloc(bufsz, GFP_KERNEL);
1588 if (!buf) {
1589 IWL_ERR(trans, "Can not allocate buffer\n");
1590 return -ENOMEM;
1591 }
1592 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
1593 for (cnt = 0; cnt < hw_params(trans).max_txq_num; cnt++) {
1594 txq = &trans_pcie->txq[cnt];
1595 q = &txq->q;
1596 pos += scnprintf(buf + pos, bufsz - pos,
1597 "q[%d]: read_ptr: %u, write_ptr: %u\n",
1598 cnt, q->read_ptr, q->write_ptr);
1599 }
1600 if (priv->tx_traffic &&
1601 (iwl_get_debug_level(trans->shrd) & IWL_DL_TX)) {
1602 ptr = priv->tx_traffic;
1603 pos += scnprintf(buf + pos, bufsz - pos,
1604 "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
1605 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
1606 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
1607 entry++, ofs += 16) {
1608 pos += scnprintf(buf + pos, bufsz - pos,
1609 "0x%.4x ", ofs);
1610 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
1611 buf + pos, bufsz - pos, 0);
1612 pos += strlen(buf + pos);
1613 if (bufsz - pos > 0)
1614 buf[pos++] = '\n';
1615 }
1616 }
1617 }
1618
1619 pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n");
1620 pos += scnprintf(buf + pos, bufsz - pos,
1621 "read: %u, write: %u\n",
1622 rxq->read, rxq->write);
1623
1624 if (priv->rx_traffic &&
1625 (iwl_get_debug_level(trans->shrd) & IWL_DL_RX)) {
1626 ptr = priv->rx_traffic;
1627 pos += scnprintf(buf + pos, bufsz - pos,
1628 "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
1629 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
1630 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
1631 entry++, ofs += 16) {
1632 pos += scnprintf(buf + pos, bufsz - pos,
1633 "0x%.4x ", ofs);
1634 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
1635 buf + pos, bufsz - pos, 0);
1636 pos += strlen(buf + pos);
1637 if (bufsz - pos > 0)
1638 buf[pos++] = '\n';
1639 }
1640 }
1641 }
1642
1643 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1644 kfree(buf);
1645 return ret;
1646}
1647
1648static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
1649 const char __user *user_buf,
1650 size_t count, loff_t *ppos)
1651{
1652 struct iwl_trans *trans = file->private_data;
1653 char buf[8];
1654 int buf_size;
1655 int traffic_log;
1656
1657 memset(buf, 0, sizeof(buf));
1658 buf_size = min(count, sizeof(buf) - 1);
1659 if (copy_from_user(buf, user_buf, buf_size))
1660 return -EFAULT;
1661 if (sscanf(buf, "%d", &traffic_log) != 1)
1662 return -EFAULT;
1663 if (traffic_log == 0)
1664 iwl_reset_traffic_log(priv(trans));
1665
1666 return count;
1667}
1668
1669static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, 1564static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1670 char __user *user_buf, 1565 char __user *user_buf,
1671 size_t count, loff_t *ppos) 1566 size_t count, loff_t *ppos)
@@ -2031,7 +1926,6 @@ static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
2031 return ret; 1926 return ret;
2032} 1927}
2033 1928
2034DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
2035DEBUGFS_READ_WRITE_FILE_OPS(log_event); 1929DEBUGFS_READ_WRITE_FILE_OPS(log_event);
2036DEBUGFS_READ_WRITE_FILE_OPS(interrupt); 1930DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
2037DEBUGFS_READ_FILE_OPS(fh_reg); 1931DEBUGFS_READ_FILE_OPS(fh_reg);
@@ -2046,7 +1940,6 @@ DEBUGFS_WRITE_FILE_OPS(csr);
2046static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, 1940static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
2047 struct dentry *dir) 1941 struct dentry *dir)
2048{ 1942{
2049 DEBUGFS_ADD_FILE(traffic_log, dir, S_IWUSR | S_IRUSR);
2050 DEBUGFS_ADD_FILE(rx_queue, dir, S_IRUSR); 1943 DEBUGFS_ADD_FILE(rx_queue, dir, S_IRUSR);
2051 DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR); 1944 DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR);
2052 DEBUGFS_ADD_FILE(log_event, dir, S_IWUSR | S_IRUSR); 1945 DEBUGFS_ADD_FILE(log_event, dir, S_IWUSR | S_IRUSR);