mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
ie: Fix VHT Capabilities to Data Rate conversion
Code that walked the VHT TX/RX MCS maps seemed to assume that bit_field operated on bits that start at '1'. But this utility actually operates on bits that start at '0'. I.e. the least significant bit is at position 0. While we're at it, rename the mcs variable into bitoffset to make it clearer how the maps are being iterated over. Supported MCS is actually the value found in the map.
This commit is contained in:
parent
5120f46199
commit
e265f95f45
15
src/ie.c
15
src/ie.c
@ -1941,6 +1941,7 @@ static int ie_parse_vht_capability(struct ie_tlv_iter *vht_iter,
|
|||||||
uint64_t *data_rate)
|
uint64_t *data_rate)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
|
int bitoffset;
|
||||||
int mcs;
|
int mcs;
|
||||||
unsigned int nss;
|
unsigned int nss;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
@ -1995,11 +1996,11 @@ static int ie_parse_vht_capability(struct ie_tlv_iter *vht_iter,
|
|||||||
tx_mcs_map[1] = *data++;
|
tx_mcs_map[1] = *data++;
|
||||||
|
|
||||||
/* NSS->MCS map values are grouped in 2-bit values */
|
/* NSS->MCS map values are grouped in 2-bit values */
|
||||||
for (mcs = 15; mcs >= 0; mcs -= 2) {
|
for (bitoffset = 14; bitoffset >= 0; bitoffset -= 2) {
|
||||||
uint8_t rx_val = bit_field(rx_mcs_map[mcs / 8],
|
uint8_t rx_val = bit_field(rx_mcs_map[bitoffset / 8],
|
||||||
mcs % 8, 2);
|
bitoffset % 8, 2);
|
||||||
uint8_t tx_val = bit_field(tx_mcs_map[mcs / 8],
|
uint8_t tx_val = bit_field(tx_mcs_map[bitoffset / 8],
|
||||||
mcs % 8, 2);
|
bitoffset % 8, 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 0 indicates support for MCS 0-7
|
* 0 indicates support for MCS 0-7
|
||||||
@ -2010,12 +2011,12 @@ static int ie_parse_vht_capability(struct ie_tlv_iter *vht_iter,
|
|||||||
*/
|
*/
|
||||||
if (!max_rx_mcs && rx_val < 3) {
|
if (!max_rx_mcs && rx_val < 3) {
|
||||||
max_rx_mcs = 7 + rx_val;
|
max_rx_mcs = 7 + rx_val;
|
||||||
rx_nss = (mcs / 2) + 1;
|
rx_nss = (bitoffset / 2) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!max_tx_mcs && tx_val < 3) {
|
if (!max_tx_mcs && tx_val < 3) {
|
||||||
max_tx_mcs = 7 + tx_val;
|
max_tx_mcs = 7 + tx_val;
|
||||||
tx_nss = (mcs / 2) + 1;
|
tx_nss = (bitoffset / 2) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_rx_mcs && max_tx_mcs)
|
if (max_rx_mcs && max_tx_mcs)
|
||||||
|
Loading…
Reference in New Issue
Block a user