drivers/net/wireless/ath/ath11k/debugfs_sta.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/debugfs_sta.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath11k/debugfs_sta.c
Extension
.c
Size
31909 bytes
Lines
1031
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations fops_tx_stats = {
	.read = ath11k_dbg_sta_dump_tx_stats,
	.open = simple_open,
	.owner = THIS_MODULE,
	.llseek = default_llseek,
};

#ifdef CONFIG_ATH11K_CFR
static ssize_t ath11k_dbg_sta_write_cfr_capture(struct file *file,
						const char __user *user_buf,
						size_t count, loff_t *ppos)
{
	struct ieee80211_sta *sta = file->private_data;
	struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
	struct ath11k *ar = arsta->arvif->ar;
	struct ath11k_cfr *cfr = &ar->cfr;
	struct wmi_peer_cfr_capture_conf_arg arg;
	u32 cfr_capture_enable = 0, cfr_capture_bw  = 0;
	u32 cfr_capture_method = 0, cfr_capture_period = 0;
	char buf[64] = {};
	int ret;

	simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);

	guard(mutex)(&ar->conf_mutex);

	if (ar->state != ATH11K_STATE_ON)
		return -ENETDOWN;

	if (!ar->cfr_enabled)
		return -EINVAL;

	ret = sscanf(buf, "%u %u %u %u", &cfr_capture_enable, &cfr_capture_bw,
		     &cfr_capture_period, &cfr_capture_method);

	if (ret < 1 || (cfr_capture_enable && ret != 4))
		return -EINVAL;

	if (cfr_capture_enable == arsta->cfr_capture.cfr_enable &&
	    (cfr_capture_period &&
	     cfr_capture_period == arsta->cfr_capture.cfr_period) &&
	    cfr_capture_bw == arsta->cfr_capture.cfr_bw &&
	    cfr_capture_method == arsta->cfr_capture.cfr_method)
		return count;

	if (!cfr_capture_enable &&
	    cfr_capture_enable == arsta->cfr_capture.cfr_enable)
		return count;

	if (cfr_capture_enable > WMI_PEER_CFR_CAPTURE_ENABLE ||
	    cfr_capture_bw > WMI_PEER_CFR_CAPTURE_BW_80 ||
	    cfr_capture_method > ATH11K_CFR_CAPTURE_METHOD_NULL_FRAME_WITH_PHASE ||
	    cfr_capture_period > WMI_PEER_CFR_PERIODICITY_MAX)
		return -EINVAL;

	/* Target expects cfr period in multiple of 10 */
	if (cfr_capture_period % 10) {
		ath11k_err(ar->ab, "periodicity should be 10x\n");
		return -EINVAL;
	}

	if (ar->cfr.cfr_enabled_peer_cnt >= ATH11K_MAX_CFR_ENABLED_CLIENTS &&
	    !arsta->cfr_capture.cfr_enable) {
		ath11k_err(ar->ab, "CFR enable peer threshold reached %u\n",
			   ar->cfr.cfr_enabled_peer_cnt);
		return -EINVAL;
	}

	if (!cfr_capture_enable) {
		cfr_capture_bw = arsta->cfr_capture.cfr_bw;
		cfr_capture_period = arsta->cfr_capture.cfr_period;
		cfr_capture_method = arsta->cfr_capture.cfr_method;
	}

	arg.request = cfr_capture_enable;
	arg.periodicity = cfr_capture_period;
	arg.bw = cfr_capture_bw;
	arg.method = cfr_capture_method;

	ret = ath11k_wmi_peer_set_cfr_capture_conf(ar, arsta->arvif->vdev_id,
						   sta->addr, &arg);
	if (ret) {
		ath11k_warn(ar->ab,
			    "failed to send cfr capture info: vdev_id %u peer %pM: %d\n",
			    arsta->arvif->vdev_id, sta->addr, ret);
		return ret;
	}

	spin_lock_bh(&ar->cfr.lock);

Annotation

Implementation Notes