Commit 414adede authored by Ilan Peer's avatar Ilan Peer Committed by Johannes Berg
Browse files
parent 38b3998d
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
@@ -692,6 +692,60 @@ 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_int_mlo_scan_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;
	u32 action;
	int ret;

	if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif))
		return -EINVAL;

	if (kstrtou32(buf, 0, &action))
		return -EINVAL;

	mutex_lock(&mvm->mutex);

	if (!action) {
		ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false);
	} else if (action == 1) {
		struct ieee80211_channel *channels[IEEE80211_MLD_MAX_NUM_LINKS];
		unsigned long usable_links = ieee80211_vif_usable_links(vif);
		size_t n_channels = 0;
		u8 link_id;

		rcu_read_lock();

		for_each_set_bit(link_id, &usable_links,
				 IEEE80211_MLD_MAX_NUM_LINKS) {
			struct ieee80211_bss_conf *link_conf =
				rcu_dereference(vif->link_conf[link_id]);

			if (WARN_ON_ONCE(!link_conf))
				continue;

			channels[n_channels++] = link_conf->chanreq.oper.chan;
		}

		rcu_read_unlock();

		if (n_channels)
			ret = iwl_mvm_int_mlo_scan_start(mvm, vif, channels,
							 n_channels);
		else
			ret = -EINVAL;
	} else {
		ret = -EINVAL;
	}

	mutex_unlock(&mvm->mutex);

	return ret ?: count;
}

#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) \
@@ -711,6 +765,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_WRITE_FILE_OPS(int_mlo_scan, 32);

void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -738,6 +793,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(int_mlo_scan, mvmvif->dbgfs_dir, 0200);

	if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
	    mvmvif == mvm->bf_allowed_vif)