wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time
authorAvraham Stern <avraham.stern@intel.com>
Fri, 10 May 2024 14:06:32 +0000 (17:06 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 08:50:09 +0000 (10:50 +0200)
Add an entry for setting the maximum TXOP time in microseconds.
The configured value can be read from the same entry.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240510170500.b8d17a9c1731.I57c33574a61edd68bd0ec1aa7009f31111fd7efe@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c

index 17c97dfbc62aa25ad91d040aaef8d3bcb05e9e4e..25f07e00db42973a309f149be94a65407300d8cc 100644 (file)
@@ -692,6 +692,42 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file,
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
+static ssize_t iwl_dbgfs_max_tx_op_write(struct ieee80211_vif *vif, char *buf,
+                                        size_t count, loff_t *ppos)
+{
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+       struct iwl_mvm *mvm = mvmvif->mvm;
+       u16 value;
+       int ret;
+
+       ret = kstrtou16(buf, 0, &value);
+       if (ret)
+               return ret;
+
+       mutex_lock(&mvm->mutex);
+       mvmvif->max_tx_op = value;
+       mutex_unlock(&mvm->mutex);
+
+       return count;
+}
+
+static ssize_t iwl_dbgfs_max_tx_op_read(struct file *file,
+                                       char __user *user_buf,
+                                       size_t count, loff_t *ppos)
+{
+       struct ieee80211_vif *vif = file->private_data;
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+       struct iwl_mvm *mvm = mvmvif->mvm;
+       char buf[10];
+       int len;
+
+       mutex_lock(&mvm->mutex);
+       len = scnprintf(buf, sizeof(buf), "%hu\n", mvmvif->max_tx_op);
+       mutex_unlock(&mvm->mutex);
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
 static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif,
                                            char *buf, size_t count,
                                            loff_t *ppos)
@@ -801,6 +837,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(uapsd_misbehaving, 20);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
 MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
+MVM_DEBUGFS_READ_WRITE_FILE_OPS(max_tx_op, 10);
 MVM_DEBUGFS_WRITE_FILE_OPS(int_mlo_scan, 32);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(esr_disable_reason, 32);
 
@@ -830,6 +867,7 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
        MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, 0600);
        MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir, 0600);
        MVM_DEBUGFS_ADD_FILE_VIF(os_device_timediff, mvmvif->dbgfs_dir, 0400);
+       MVM_DEBUGFS_ADD_FILE_VIF(max_tx_op, mvmvif->dbgfs_dir, 0600);
        debugfs_create_bool("ftm_unprotected", 0200, mvmvif->dbgfs_dir,
                            &mvmvif->ftm_unprotected);
        MVM_DEBUGFS_ADD_FILE_VIF(int_mlo_scan, mvmvif->dbgfs_dir, 0200);
index 1f58c727fa632df016241ed1a64ba5731d0b1d79..ca1c5944da670329db04b5b52fe763a15b89bbb3 100644 (file)
@@ -426,6 +426,7 @@ struct iwl_mvm_esr_exit {
  * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel
  * @csa_blocks_tx: CSA is blocking TX
  * @features: hw features active for this vif
+ * @max_tx_op: max TXOP in usecs for all ACs, zero for no limit.
  * @ap_beacon_time: AP beacon time for synchronisation (on older FW)
  * @bf_enabled: indicates if beacon filtering is enabled
  * @ba_enabled: indicated if beacon abort is enabled
@@ -538,6 +539,8 @@ struct iwl_mvm_vif {
                struct ieee80211_key_conf __rcu *keys[2];
        } bcn_prot;
 
+       u16 max_tx_op;
+
        u16 link_selection_res;
        u8 link_selection_primary;
        u8 primary_link;
index 3ba62fb2c85e2a23b3f501d4d1ac7a131a4d493e..884fd56e74263dd4b0a5b4c591585e0505472578 100644 (file)
@@ -609,6 +609,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
                                cpu_to_le16(max_amsdu_len) : 0,
        };
        unsigned int link_id = link_conf->link_id;
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
        int cmd_ver;
        int ret;
 
@@ -654,6 +655,8 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
         */
        sta->deflink.agg.max_amsdu_len = max_amsdu_len;
 
+       cfg_cmd.max_tx_op = cpu_to_le16(mvmvif->max_tx_op);
+
        cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 0);
        IWL_DEBUG_RATE(mvm, "TLC CONFIG CMD, sta_id=%d, max_ch_width=%d, mode=%d\n",
                       cfg_cmd.sta_id, cfg_cmd.max_ch_width, cfg_cmd.mode);