iwlwifi: mvm: add debugfs hook to send ECHO_CMD to the firmware
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 17 Aug 2015 07:45:50 +0000 (10:45 +0300)
committerLuciano Coelho <luciano.coelho@intel.com>
Fri, 28 Aug 2015 10:26:32 +0000 (13:26 +0300)
ECHO_CMD is a simple command that can be sent to the
firmware just to check that it is alive.
This command is useful for debug purpose, provide a debugfs
hook to send it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/fw-api.h
drivers/net/wireless/iwlwifi/mvm/ops.c

index 08d2ae355700010cc093d56aa5358147ce179a97..3b8481f34a18e99d04a4276d717c3bfe1aa660f4 100644 (file)
@@ -1361,11 +1361,25 @@ out:
        return count;
 }
 
+static ssize_t
+iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
+                             size_t count, loff_t *ppos)
+{
+       int ret;
+
+       mutex_lock(&mvm->mutex);
+       ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL);
+       mutex_unlock(&mvm->mutex);
+
+       return ret ?: count;
+}
+
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
 
 /* Device wide debugfs entries */
 MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16);
 MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8);
+MVM_DEBUGFS_WRITE_FILE_OPS(send_echo_cmd, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
 MVM_DEBUGFS_READ_FILE_OPS(nic_temp);
@@ -1425,6 +1439,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(d0i3_refs, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_conf, mvm->debugfs_dir, S_IRUSR | S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, S_IWUSR);
+       MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, S_IWUSR);
        if (!debugfs_create_bool("enable_scan_iteration_notif",
                                 S_IRUSR | S_IWUSR,
                                 mvm->debugfs_dir,
index 4af7513adda22e3a08a59361313659ba0ff8d450..cd293d27677e6ae57601c5bd58c5d151ae16c5ef 100644 (file)
@@ -100,6 +100,7 @@ enum iwl_mvm_tx_fifo {
 enum {
        MVM_ALIVE = 0x1,
        REPLY_ERROR = 0x2,
+       ECHO_CMD = 0x3,
 
        INIT_COMPLETE_NOTIF = 0x4,
 
index a37de3f410a01e0b594f41d43bfda4360273e324..009228615d26c1c7d9fc6ce18c6ed2fc148d74b1 100644 (file)
@@ -271,6 +271,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
 static const char *const iwl_mvm_cmd_strings[REPLY_MAX + 1] = {
        CMD(MVM_ALIVE),
        CMD(REPLY_ERROR),
+       CMD(ECHO_CMD),
        CMD(INIT_COMPLETE_NOTIF),
        CMD(PHY_CONTEXT_CMD),
        CMD(MGMT_MCAST_KEY),