iwlwifi: mvm: BT Coex - add debugfs hook to set BT Tx priority
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 16 Mar 2014 19:55:43 +0000 (21:55 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Mar 2014 19:15:37 +0000 (21:15 +0200)
In order to debug the firmware, we need to be able to set
the BT priority of WiFi packets. This priority is set based
on the type of the packet (control frames, EAPOL etc...).
For debugging purposes, allow to override this priority by
a debugfs controlled value.
Enable this feature that needs this priority to be able to
test it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/coex.c
drivers/net/wireless/iwlwifi/mvm/constants.h
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h
drivers/net/wireless/iwlwifi/mvm/mvm.h

index 018d75c805addd9c48021bebbbe22f6701c01fd4..c9b320a0607000c03c34d9934d743c3f633601f2 100644 (file)
@@ -616,6 +616,11 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
                bt_cmd->flags |= cpu_to_le32(BT_COEX_CORUNNING);
        }
 
+       if (IWL_MVM_BT_COEX_MPLUT) {
+               bt_cmd->flags |= cpu_to_le32(BT_COEX_MPLUT);
+               bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_MULTI_PRIO_LUT);
+       }
+
        if (mvm->cfg->bt_shared_single_ant)
                memcpy(&bt_cmd->decision_lut, iwl_single_shared_ant,
                       sizeof(iwl_single_shared_ant));
@@ -1215,6 +1220,9 @@ u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
        if (info->band != IEEE80211_BAND_2GHZ)
                return 0;
 
+       if (unlikely(mvm->bt_tx_prio))
+               return mvm->bt_tx_prio - 1;
+
        /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */
        if (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO ||
             is_multicast_ether_addr(hdr->addr1) ||
index 37d5f3594c4fd39bfa7801d8b80856ac3179624c..921b177a92b8910b159afd3b9f5502658e109541 100644 (file)
@@ -83,5 +83,6 @@
 #define IWL_MVM_LOWLAT_DUAL_BINDING_MAXDUR     24 /* TU */
 #define IWL_MVM_BT_COEX_SYNC2SCO               1
 #define IWL_MVM_BT_COEX_CORUNNING              1
+#define IWL_MVM_BT_COEX_MPLUT                  1
 
 #endif /* __MVM_CONSTANTS_H */
index cf1fa498e53e7077cf817d8e33a2f4a037495698..2566fa9913ef9b773eeb5b62def3b7ce1555480e 100644 (file)
@@ -441,6 +441,22 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
        return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
+static ssize_t
+iwl_dbgfs_bt_tx_prio_write(struct iwl_mvm *mvm, char *buf,
+                          size_t count, loff_t *ppos)
+{
+       u32 bt_tx_prio;
+
+       if (sscanf(buf, "%u", &bt_tx_prio) != 1)
+               return -EINVAL;
+       if (bt_tx_prio > 4)
+               return -EINVAL;
+
+       mvm->bt_tx_prio = bt_tx_prio;
+
+       return count;
+}
+
 #define PRINT_STATS_LE32(_str, _val)                                   \
                         pos += scnprintf(buf + pos, bufsz - pos,       \
                                          fmt_table, _str,              \
@@ -1085,6 +1101,7 @@ MVM_DEBUGFS_READ_FILE_OPS(fw_rx_stats);
 MVM_DEBUGFS_READ_FILE_OPS(drv_rx_stats);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart, 10);
 MVM_DEBUGFS_WRITE_FILE_OPS(fw_nmi, 10);
+MVM_DEBUGFS_WRITE_FILE_OPS(bt_tx_prio, 10);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8);
 
@@ -1126,6 +1143,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(drv_rx_stats, mvm->debugfs_dir, S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR);
+       MVM_DEBUGFS_ADD_FILE(bt_tx_prio, mvm->debugfs_dir, S_IWUSR);
        MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir,
                             S_IWUSR | S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(prph_reg, mvm->debugfs_dir, S_IWUSR | S_IRUSR);
index 32156d7e2d07227b19d0eb001e3b25d42eb6fad5..21877e5966a8093d6780d3297944c1a214dc55e3 100644 (file)
@@ -78,6 +78,7 @@
  * @BT_COEX_NW:
  * @BT_COEX_SYNC2SCO:
  * @BT_COEX_CORUNNING:
+ * @BT_COEX_MPLUT:
  *
  * The COEX_MODE must be set for each command. Even if it is not changed.
  */
@@ -90,6 +91,7 @@ enum iwl_bt_coex_flags {
        BT_COEX_NW                      = 0x3 << BT_COEX_MODE_POS,
        BT_COEX_SYNC2SCO                = BIT(7),
        BT_COEX_CORUNNING               = BIT(8),
+       BT_COEX_MPLUT                   = BIT(9),
 };
 
 /*
index cb6dbb1408208a1aefdbd8f7bbb68172f74db458..d58118241d6118ad1002dc06b3518ad3f9a7a101 100644 (file)
@@ -611,6 +611,7 @@ struct iwl_mvm {
        struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
        u32 last_ant_isol;
        u8 last_corun_lut;
+       u8 bt_tx_prio;
 
        /* Thermal Throttling and CTkill */
        struct iwl_mvm_tt_mgmt thermal_throttle;