]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
Merge remote-tracking branch 'sound/for-next'
[karo-tx-linux.git] / drivers / net / wireless / intel / iwlwifi / mvm / debugfs.c
index 90500e2d107b60ada39c82adaacedc9a5051cb7e..c529e5355803f10a923b601f5dc46acbd62cfd66 100644 (file)
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -261,17 +262,18 @@ static ssize_t iwl_dbgfs_nic_temp_read(struct file *file,
 {
        struct iwl_mvm *mvm = file->private_data;
        char buf[16];
-       int pos, temp;
+       int pos, ret;
+       s32 temp;
 
        if (!mvm->ucode_loaded)
                return -EIO;
 
        mutex_lock(&mvm->mutex);
-       temp = iwl_mvm_get_temp(mvm);
+       ret = iwl_mvm_get_temp(mvm, &temp);
        mutex_unlock(&mvm->mutex);
 
-       if (temp < 0)
-               return temp;
+       if (ret)
+               return -EIO;
 
        pos = scnprintf(buf , sizeof(buf), "%d\n", temp);
 
@@ -942,6 +944,47 @@ iwl_dbgfs_scan_ant_rxchain_write(struct iwl_mvm *mvm, char *buf,
        return count;
 }
 
+static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm,
+                                              char *buf, size_t count,
+                                              loff_t *ppos)
+{
+       struct iwl_rss_config_cmd cmd = {
+               .flags = cpu_to_le32(IWL_RSS_ENABLE),
+               .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
+                            IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
+                            IWL_RSS_HASH_TYPE_IPV6_TCP |
+                            IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
+       };
+       int ret, i, num_repeats, nbytes = count / 2;
+
+       ret = hex2bin(cmd.indirection_table, buf, nbytes);
+       if (ret)
+               return ret;
+
+       /*
+        * The input is the redirection table, partial or full.
+        * Repeat the pattern if needed.
+        * For example, input of 01020F will be repeated 42 times,
+        * indirecting RSS hash results to queues 1, 2, 15 (skipping
+        * queues 3 - 14).
+        */
+       num_repeats = ARRAY_SIZE(cmd.indirection_table) / nbytes;
+       for (i = 1; i < num_repeats; i++)
+               memcpy(&cmd.indirection_table[i * nbytes],
+                      cmd.indirection_table, nbytes);
+       /* handle cut in the middle pattern for the last places */
+       memcpy(&cmd.indirection_table[i * nbytes], cmd.indirection_table,
+              ARRAY_SIZE(cmd.indirection_table) % nbytes);
+
+       memcpy(cmd.secret_key, mvm->secret_key, ARRAY_SIZE(cmd.secret_key));
+
+       mutex_lock(&mvm->mutex);
+       ret = iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
+       mutex_unlock(&mvm->mutex);
+
+       return ret ?: count;
+}
+
 static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
                                          char __user *user_buf,
                                          size_t count, loff_t *ppos)
@@ -983,7 +1026,7 @@ static ssize_t iwl_dbgfs_cont_recording_write(struct iwl_mvm *mvm,
            trans->cfg->device_family != IWL_DEVICE_FAMILY_8000)
                return -EOPNOTSUPP;
 
-       ret = kstrtouint(buf, 0, &rec_mode);
+       ret = kstrtoint(buf, 0, &rec_mode);
        if (ret)
                return ret;
 
@@ -1454,6 +1497,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(fw_dbg_conf, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_dbg_collect, 64);
 MVM_DEBUGFS_WRITE_FILE_OPS(cont_recording, 8);
+MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl, 16);
 
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256);
@@ -1498,11 +1542,15 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(cont_recording, mvm->debugfs_dir, S_IWUSR);
+       MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, S_IWUSR);
        if (!debugfs_create_bool("enable_scan_iteration_notif",
                                 S_IRUSR | S_IWUSR,
                                 mvm->debugfs_dir,
                                 &mvm->scan_iter_notif_enabled))
                goto err;
+       if (!debugfs_create_bool("drop_bcn_ap_mode", S_IRUSR | S_IWUSR,
+                                mvm->debugfs_dir, &mvm->drop_bcn_ap_mode))
+               goto err;
 
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
        if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) {