Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b8b6e6e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: add max_mcs attribute"

parents 958e1dcc 553a362b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -806,6 +806,7 @@ int wil_priv_init(struct wil6210_priv *wil)

	wil->amsdu_en = 1;
	wil->fw_state = WIL_FW_STATE_DOWN;
	wil->max_mcs = 0;

	return 0;

+41 −0
Original line number Diff line number Diff line
@@ -435,6 +435,46 @@ int wil_snr_thresh_set(struct wil6210_priv *wil, const char *buf)
	return 0;
}

static ssize_t max_mcs_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	struct wil6210_priv *wil = dev_get_drvdata(dev);
	ssize_t len;

	len = scnprintf(buf, PAGE_SIZE, "%d\n", wil->max_mcs);

	return len;
}

static ssize_t max_mcs_store(struct device *dev,
			     struct device_attribute *attr, const char *buf,
			     size_t count)
{
	struct wil6210_priv *wil = dev_get_drvdata(dev);
	u8 max_mcs;

	if (kstrtou8(buf, 0, &max_mcs))
		return -EINVAL;

	if (test_bit(wil_status_fwready, wil->status)) {
		wil_err(wil, "Cannot set MAX MCS while interface is up\n");
		return -EIO;
	}

	if (max_mcs > WIL_MCS_MAX) {
		wil_err(wil, "Ignore invalid MCS %d\n", max_mcs);
		return -EINVAL;
	}

	wil_info(wil, "Sysfs: set max MCS to %d\n", max_mcs);

	wil->max_mcs = max_mcs;

	return count;
}

static DEVICE_ATTR_RW(max_mcs);

static ssize_t
snr_thresh_store(struct device *dev,
		 struct device_attribute *attr,
@@ -465,6 +505,7 @@ static struct attribute *wil6210_sysfs_entries[] = {
	&dev_attr_snr_thresh.attr,
	&dev_attr_vr_profile.attr,
	&dev_attr_fst_config.attr,
	&dev_attr_max_mcs.attr,
	NULL
};

+5 −0
Original line number Diff line number Diff line
@@ -1142,6 +1142,11 @@ struct wil6210_priv {

	u32 tx_reserved_entries; /* Used only in Talyn code-path */
	s32 cqm_rssi_thold;

	/* For now, this applies to VR mode only. Can be extended
	 * in the future to apply also to other modes.
	 */
	u8 max_mcs;
};

#define wil_to_wiphy(i) (i->wiphy)
+3 −1
Original line number Diff line number Diff line
@@ -4362,7 +4362,9 @@ int wmi_set_vr_profile(struct wil6210_priv *wil, u8 profile)
	};

	cmd.profile = profile;
	wil_info(wil, "sending set vr config command, profile=%d\n", profile);
	cmd.max_mcs = wil->max_mcs;
	wil_info(wil, "sending set vr config command, profile=%d, max_mcs=%d\n",
		 profile, wil->max_mcs);
	rc = wmi_call(wil, WMI_SET_VR_PROFILE_CMDID, vif->mid, &cmd,
		      sizeof(cmd), WMI_SET_VR_PROFILE_EVENTID,
		      &reply, sizeof(reply), WIL_WMI_CALL_GENERAL_TO_MS);
+3 −1
Original line number Diff line number Diff line
@@ -4280,7 +4280,9 @@ enum wmi_vr_profile {
struct wmi_set_vr_profile_cmd {
	/* enum wmi_vr_profile */
	u8 profile;
	u8 reserved[3];
	/* Set to 0 to use FW default */
	u8 max_mcs;
	u8 reserved[2];
} __packed;

/* WMI_SET_VR_PROFILE_EVENTID */