Skip to content

Commit 7696c07

Browse files
gomordjmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: add EHT RU allocation to radiotap
FW new API added the info missing for update RU allocation, so use the new API to update radiotap information. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230305124407.b16acaa4bad1.I53afa03058dbd2cd8afbaf5e82596c8ed501a476@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 558f874 commit 7696c07

File tree

2 files changed

+95
-10
lines changed
  • drivers/net/wireless/intel/iwlwifi

2 files changed

+95
-10
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/rx.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ enum iwl_rx_phy_eht_data2 {
414414
/* OFDM_RX_VECTOR_COMMON_RU_ALLOC_0_OUT */
415415
IWL_RX_PHY_DATA2_EHT_MU_EXT_RU_ALLOC_A1 = 0x000001ff,
416416
IWL_RX_PHY_DATA2_EHT_MU_EXT_RU_ALLOC_A2 = 0x0003fe00,
417-
IWL_RX_PHY_DATA2_EHT_MU_EXT_RU_ALLOC_A3 = 0x01fc0000,
417+
IWL_RX_PHY_DATA2_EHT_MU_EXT_RU_ALLOC_B1 = 0x07fc0000,
418418

419419
/* info type: EHT-TB-EXT */
420420
IWL_RX_PHY_DATA2_EHT_TB_EXT_TRIG_SIGA1 = 0xffffffff,
@@ -424,19 +424,18 @@ enum iwl_rx_phy_eht_data2 {
424424
enum iwl_rx_phy_eht_data3 {
425425
/* info type: EHT-MU-EXT */
426426
/* OFDM_RX_VECTOR_COMMON_RU_ALLOC_1_OUT */
427-
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_B1 = 0x000001ff,
428-
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_B2 = 0x0003fe00,
429-
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_B3 = 0x01fc0000,
427+
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_B2 = 0x000001ff,
428+
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_C1 = 0x0003fe00,
429+
IWL_RX_PHY_DATA3_EHT_MU_EXT_RU_ALLOC_C2 = 0x07fc0000,
430430
};
431431

432432
/* goes into Metadata DW 4 */
433433
enum iwl_rx_phy_eht_data4 {
434434
/* info type: EHT-MU-EXT */
435435
/* OFDM_RX_VECTOR_COMMON_RU_ALLOC_2_OUT */
436-
IWL_RX_PHY_DATA4_EHT_MU_EXT_RU_ALLOC_C1 = 0x000001ff,
437-
IWL_RX_PHY_DATA4_EHT_MU_EXT_RU_ALLOC_C2 = 0x0003fe00,
438-
IWL_RX_PHY_DATA4_EHT_MU_EXT_RU_ALLOC_C3 = 0x01fc0000,
439-
IWL_RX_PHY_DATA4_EHT_MU_EXT_SIGB_MCS = 0x18000000,
436+
IWL_RX_PHY_DATA4_EHT_MU_EXT_RU_ALLOC_D1 = 0x000001ff,
437+
IWL_RX_PHY_DATA4_EHT_MU_EXT_RU_ALLOC_D2 = 0x0003fe00,
438+
IWL_RX_PHY_DATA4_EHT_MU_EXT_SIGB_MCS = 0x000c0000,
440439
};
441440

442441
/* goes into Metadata DW 16 */

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,17 +1468,54 @@ static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
14681468
(_usig)->value |= LE32_DEC_ENC(in_value, dec_bits, _enc_bits); \
14691469
} while (0)
14701470

1471+
#define __IWL_MVM_ENC_EHT_RU(rt_data, rt_ru, fw_data, fw_ru) \
1472+
eht->data[(rt_data)] |= \
1473+
(cpu_to_le32 \
1474+
(IEEE80211_RADIOTAP_EHT_DATA ## rt_data ## _RU_ALLOC_CC_ ## rt_ru ## _KNOWN) | \
1475+
LE32_DEC_ENC(data ## fw_data, \
1476+
IWL_RX_PHY_DATA ## fw_data ## _EHT_MU_EXT_RU_ALLOC_ ## fw_ru, \
1477+
IEEE80211_RADIOTAP_EHT_DATA ## rt_data ## _RU_ALLOC_CC_ ## rt_ru))
1478+
1479+
#define _IWL_MVM_ENC_EHT_RU(rt_data, rt_ru, fw_data, fw_ru) \
1480+
__IWL_MVM_ENC_EHT_RU(rt_data, rt_ru, fw_data, fw_ru)
1481+
1482+
#define IEEE80211_RADIOTAP_RU_DATA_1_1_1 1
1483+
#define IEEE80211_RADIOTAP_RU_DATA_2_1_1 2
1484+
#define IEEE80211_RADIOTAP_RU_DATA_1_1_2 2
1485+
#define IEEE80211_RADIOTAP_RU_DATA_2_1_2 2
1486+
#define IEEE80211_RADIOTAP_RU_DATA_1_2_1 3
1487+
#define IEEE80211_RADIOTAP_RU_DATA_2_2_1 3
1488+
#define IEEE80211_RADIOTAP_RU_DATA_1_2_2 3
1489+
#define IEEE80211_RADIOTAP_RU_DATA_2_2_2 4
1490+
1491+
#define IWL_RX_RU_DATA_A1 2
1492+
#define IWL_RX_RU_DATA_A2 2
1493+
#define IWL_RX_RU_DATA_B1 2
1494+
#define IWL_RX_RU_DATA_B2 3
1495+
#define IWL_RX_RU_DATA_C1 3
1496+
#define IWL_RX_RU_DATA_C2 3
1497+
#define IWL_RX_RU_DATA_D1 4
1498+
#define IWL_RX_RU_DATA_D2 4
1499+
1500+
#define IWL_MVM_ENC_EHT_RU(rt_ru, fw_ru) \
1501+
_IWL_MVM_ENC_EHT_RU(IEEE80211_RADIOTAP_RU_DATA_ ## rt_ru, \
1502+
rt_ru, \
1503+
IWL_RX_RU_DATA_ ## fw_ru, \
1504+
fw_ru)
1505+
14711506
static void iwl_mvm_decode_eht_ext_mu(struct iwl_mvm *mvm,
14721507
struct iwl_mvm_rx_phy_data *phy_data,
14731508
struct ieee80211_rx_status *rx_status,
14741509
struct ieee80211_radiotap_eht *eht,
14751510
struct ieee80211_radiotap_eht_usig *usig)
14761511
{
1477-
__le32 data1 = phy_data->d1;
1478-
14791512
if (phy_data->with_data) {
1513+
__le32 data1 = phy_data->d1;
1514+
__le32 data2 = phy_data->d2;
1515+
__le32 data3 = phy_data->d3;
14801516
__le32 data4 = phy_data->eht_d4;
14811517
__le32 data5 = phy_data->d5;
1518+
u32 phy_bw = phy_data->rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK;
14821519

14831520
IWL_MVM_ENC_USIG_VALUE_MASK(usig, data5,
14841521
IWL_RX_PHY_DATA5_EHT_TYPE_AND_COMP,
@@ -1493,6 +1530,55 @@ static void iwl_mvm_decode_eht_ext_mu(struct iwl_mvm *mvm,
14931530
(usig, data1, IWL_RX_PHY_DATA1_EHT_MU_NUM_SIG_SYM_USIGA2,
14941531
IEEE80211_RADIOTAP_EHT_USIG2_MU_B11_B15_EHT_SIG_SYMBOLS);
14951532

1533+
eht->user_info[0] |=
1534+
cpu_to_le32(IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID_KNOWN) |
1535+
LE32_DEC_ENC(data5, IWL_RX_PHY_DATA5_EHT_MU_STA_ID_USR,
1536+
IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID);
1537+
1538+
eht->known |= cpu_to_le32(IEEE80211_RADIOTAP_EHT_KNOWN_NR_NON_OFDMA_USERS_M);
1539+
eht->data[7] |= LE32_DEC_ENC
1540+
(data5, IWL_RX_PHY_DATA5_EHT_MU_NUM_USR_NON_OFDMA,
1541+
IEEE80211_RADIOTAP_EHT_DATA7_NUM_OF_NON_OFDMA_USERS);
1542+
1543+
/*
1544+
* Hardware labels the content channels/RU allocation values
1545+
* as follows:
1546+
* Content Channel 1 Content Channel 2
1547+
* 20 MHz: A1
1548+
* 40 MHz: A1 B1
1549+
* 80 MHz: A1 C1 B1 D1
1550+
* 160 MHz: A1 C1 A2 C2 B1 D1 B2 D2
1551+
* 320 MHz: A1 C1 A2 C2 A3 C3 A4 C4 B1 D1 B2 D2 B3 D3 B4 D4
1552+
*
1553+
* However firmware can only give us A1-D2, so the higher
1554+
* frequencies are missing.
1555+
*/
1556+
1557+
switch (phy_bw) {
1558+
case RATE_MCS_CHAN_WIDTH_320:
1559+
/* additional values are missing in RX metadata */
1560+
case RATE_MCS_CHAN_WIDTH_160:
1561+
/* content channel 1 */
1562+
IWL_MVM_ENC_EHT_RU(1_2_1, A2);
1563+
IWL_MVM_ENC_EHT_RU(1_2_2, C2);
1564+
/* content channel 2 */
1565+
IWL_MVM_ENC_EHT_RU(2_2_1, B2);
1566+
IWL_MVM_ENC_EHT_RU(2_2_2, D2);
1567+
fallthrough;
1568+
case RATE_MCS_CHAN_WIDTH_80:
1569+
/* content channel 1 */
1570+
IWL_MVM_ENC_EHT_RU(1_1_2, C1);
1571+
/* content channel 2 */
1572+
IWL_MVM_ENC_EHT_RU(2_1_2, D1);
1573+
fallthrough;
1574+
case RATE_MCS_CHAN_WIDTH_40:
1575+
/* content channel 2 */
1576+
IWL_MVM_ENC_EHT_RU(2_1_1, B1);
1577+
fallthrough;
1578+
case RATE_MCS_CHAN_WIDTH_20:
1579+
IWL_MVM_ENC_EHT_RU(1_1_1, A1);
1580+
break;
1581+
}
14961582
} else {
14971583
__le32 usig_a1 = phy_data->rx_vec[0];
14981584
__le32 usig_a2 = phy_data->rx_vec[1];

0 commit comments

Comments
 (0)