wifi: iwlwifi: clean up band in RX metadata
authorJohannes Berg <johannes.berg@intel.com>
Thu, 24 Apr 2025 12:38:25 +0000 (15:38 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 25 Apr 2025 09:26:33 +0000 (11:26 +0200)
Use u8_get_bits() instead of open-coding, and adjust the
name as well. Also don't use enum nl80211_band for the
variable holding an entirely different type.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250424153620.c41058510800.Ic3f16ce2f0c991fde2cfe7bcd58ee3b875575fce@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
drivers/net/wireless/intel/iwlwifi/mld/rx.c
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

index 691c879cb90dc20acf44a5a510ea721122175330..42ddd03c1c653728f7c40482c649e7f95e4ddf5b 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017 Intel Deutschland GmbH
  */
@@ -193,10 +193,11 @@ enum iwl_rx_mpdu_amsdu_info {
        IWL_RX_MPDU_AMSDU_LAST_SUBFRAME         = 0x80,
 };
 
-#define RX_MPDU_BAND_POS 6
-#define RX_MPDU_BAND_MASK 0xC0
-#define BAND_IN_RX_STATUS(_val) \
-       (((_val) & RX_MPDU_BAND_MASK) >> RX_MPDU_BAND_POS)
+enum iwl_rx_mpdu_mac_phy_band {
+       IWL_RX_MPDU_MAC_PHY_BAND_MAC_MASK       = 0x0f,
+       IWL_RX_MPDU_MAC_PHY_BAND_PHY_MASK       = 0x30,
+       IWL_RX_MPDU_MAC_PHY_BAND_BAND_MASK      = 0xc0,
+};
 
 enum iwl_rx_l3_proto_values {
        IWL_RX_L3_TYPE_NONE,
@@ -668,9 +669,10 @@ struct iwl_rx_mpdu_desc {
         */
        __le16 phy_info;
        /**
-        * @mac_phy_idx: MAC/PHY index
+        * @mac_phy_band: MAC ID, PHY ID, band;
+        *      see &enum iwl_rx_mpdu_mac_phy_band
         */
-       u8 mac_phy_idx;
+       u8 mac_phy_band;
        /* DW4 */
        union {
                struct {
index c4f189bcece2136e31337cfdab5692f4700ae236..c04097b1c825a1eefdbd3913b7d93e2e6353fb3b 100644 (file)
@@ -1739,9 +1739,9 @@ iwl_mld_fill_rx_status_band_freq(struct iwl_mld_rx_phy_data *phy_data,
                                 struct iwl_rx_mpdu_desc *mpdu_desc,
                                 struct ieee80211_rx_status *rx_status)
 {
-       enum nl80211_band band;
+       u8 band = u8_get_bits(mpdu_desc->mac_phy_band,
+                             IWL_RX_MPDU_MAC_PHY_BAND_BAND_MASK);
 
-       band = BAND_IN_RX_STATUS(mpdu_desc->mac_phy_idx);
        rx_status->band = iwl_mld_phy_band_to_nl80211(band);
        rx_status->freq = ieee80211_channel_to_frequency(phy_data->channel,
                                                         rx_status->band);
index 14ea89f931bbf365d95e0fe22ff0d8a0726c66df..358643ae0e4207376af27ce1f4a08c21f6c255da 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017 Intel Deutschland GmbH
  */
@@ -2157,7 +2157,8 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
        }
 
        if (iwl_mvm_is_band_in_rx_supported(mvm)) {
-               u8 band = BAND_IN_RX_STATUS(desc->mac_phy_idx);
+               u8 band = u8_get_bits(desc->mac_phy_band,
+                                     IWL_RX_MPDU_MAC_PHY_BAND_BAND_MASK);
 
                rx_status->band = iwl_mvm_nl80211_band_from_phy(band);
        } else {