diff mbox series

[02/15] wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time

Message ID 20230612184434.4ab332037a25.I57c33574a61edd68bd0ec1aa7009f31111fd7efe@changeid (mailing list archive)
State Accepted
Delegated to: Miri Korenblit
Headers show
Series wifi: iwlwifi: updates intended for v6.5 2023-06-12 | expand

Commit Message

Greenman, Gregory June 12, 2023, 3:51 p.m. UTC
From: Avraham Stern <avraham.stern@intel.com>

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>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++
 3 files changed, 44 insertions(+)

Comments

Johannes Berg June 14, 2023, 10:03 a.m. UTC | #1
On Mon, 2023-06-12 at 18:51 +0300, gregory.greenman@intel.com wrote:
> From: Avraham Stern <avraham.stern@intel.com>
> 
> 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>
> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
> ---
>  .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++
>  drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++
>  .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++
>  3 files changed, 44 insertions(+)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> index 3613b1fdc5d9..762bce70e262 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> @@ -679,6 +679,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);

This is a strange debugfs file, it only takes effect the next time
iwl_mvm_rs_fw_rate_init() is called, which can be kind of random? Seems
like it should force a reinit?

johannes
Greenman, Gregory June 14, 2023, 3:13 p.m. UTC | #2
On Wed, 2023-06-14 at 12:03 +0200, Johannes Berg wrote:
> On Mon, 2023-06-12 at 18:51 +0300, gregory.greenman@intel.com wrote:
> > From: Avraham Stern <avraham.stern@intel.com>
> > 
> > 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>
> > Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
> > ---
> >  .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++
> >  drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++
> >  .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++
> >  3 files changed, 44 insertions(+)
> > 
> > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > index 3613b1fdc5d9..762bce70e262 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > @@ -679,6 +679,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);
> 
> This is a strange debugfs file, it only takes effect the next time
> iwl_mvm_rs_fw_rate_init() is called, which can be kind of random? Seems
> like it should force a reinit?
> 
> johannes

You're right. We need to add some fixes to this commit.
Let's drop it meanwhile, I'll send a new version later.
I've verified that there're no any conflicts without this patch.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index 3613b1fdc5d9..762bce70e262 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -679,6 +679,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);
+}
+
 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
 	_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -698,6 +734,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);
 
 
 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
@@ -733,6 +770,7 @@  void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, 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);
 
 	if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
 	    mvmvif == mvm->bf_allowed_vif)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 90cb8eeec47c..afcc55231bbc 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -358,6 +358,7 @@  struct iwl_mvm_vif_link_info {
  * @csa_failed: CSA failed to schedule time event, report an error later
  * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel
  * @features: hw features active for this vif
+ * @max_tx_op: max TXOP in usecs for all ACs, zero for no limit.
  */
 struct iwl_mvm_vif {
 	struct iwl_mvm *mvm;
@@ -443,6 +444,8 @@  struct iwl_mvm_vif {
 		struct ieee80211_key_conf __rcu *keys[2];
 	} bcn_prot;
 
+	u16 max_tx_op;
+
 	struct iwl_mvm_vif_link_info deflink;
 	struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS];
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index e77b6157f759..992642edfcbe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -588,6 +588,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;
 
@@ -616,6 +617,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,
 					WIDE_ID(DATA_PATH_GROUP,
 						TLC_MNG_CONFIG_CMD),