qcacld-3.0: Don't use hdd_assemble_rate_code API to set 11be rate

hdd_assemble_rate_code uses WMI_ASSEMBLE_RATECODE_V1 to configure rate
to Fw. But this macro is not as per expectation by FW.

To address this, Don't use hdd_assemble_rate_code API and read the rate
code from user as per FW expectation and configure it to the FW.

To set 11be rate, write 2 bytes value to the sysfs entry as below.
In this byte-1 should be 11be preamble id i.e. 5, in byte-2 MSB 3-bits
represents NSS and LSB 5-bits represents MCS. For e.g. the below
command will configure the 11be rate to MCS 7 and NSS 2.

echo 0x0547 > /sys/class/net/wlan1/11be_rate

Change-Id: I9c8ecc840b14fbd954f0df1f8ec841daf5435fab
CRs-Fixed: 3004042
This commit is contained in:
Bapiraju Alla
2021-07-30 12:57:18 +05:30
committed by Madan Koyyalamudi
parent b72e11a8da
commit 608145a17f
2 changed files with 12 additions and 9 deletions

View File

@@ -97,7 +97,7 @@ void wlan_hdd_get_mlo_link_id(struct hdd_beacon_data *beacon,
*
* Return: 0 on success, negative errno on failure
*/
int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint8_t rate_code);
int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code);
/**
* hdd_sysfs_11be_rate_create() - Create sysfs entry to configure 11be rate
@@ -132,7 +132,7 @@ void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx)
}
static inline int
hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint8_t rate_code)
hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code)
{
return 0;
}

View File

@@ -199,7 +199,7 @@ void hdd_update_wiphy_eht_cap(struct hdd_context *hdd_ctx)
hdd_exit();
}
int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint8_t rate_code)
int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint16_t rate_code)
{
uint8_t preamble = 0, nss = 0, rix = 0;
int ret;
@@ -220,11 +220,14 @@ int hdd_set_11be_rate_code(struct hdd_adapter *adapter, uint8_t rate_code)
return -EIO;
}
rix = RC_2_RATE_IDX_11BE(rate_code);
preamble = WMI_RATE_PREAMBLE_EHT;
nss = HT_RC_2_STREAMS_11BE(rate_code);
if ((rate_code >> 8) != WMI_RATE_PREAMBLE_EHT) {
hdd_err_rl("Invalid input: %x", rate_code);
return -EIO;
}
rate_code = hdd_assemble_rate_code(preamble, nss, rix);
rix = RC_2_RATE_IDX_11BE(rate_code);
preamble = rate_code >> 8;
nss = HT_RC_2_STREAMS_11BE(rate_code) + 1;
hdd_debug("SET_11BE_RATE rate_code %d rix %d preamble %x nss %d",
rate_code, rix, preamble, nss);
@@ -244,7 +247,7 @@ __hdd_sysfs_set_11be_fixed_rate(struct net_device *net_dev, char const *buf,
struct hdd_context *hdd_ctx;
char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
int ret;
uint8_t rate_code;
uint16_t rate_code;
char *sptr, *token;
if (hdd_validate_adapter(adapter)) {
@@ -273,7 +276,7 @@ __hdd_sysfs_set_11be_fixed_rate(struct net_device *net_dev, char const *buf,
sptr = buf_local;
token = strsep(&sptr, " ");
if (!token || kstrtou8(token, 0, &rate_code)) {
if (!token || kstrtou16(token, 0, &rate_code)) {
hdd_err_rl("invalid input");
return -EINVAL;
}