iwlwifi: align RX status flags with firmware
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Sep 2020 16:19:49 +0000 (19:19 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 1 Oct 2020 19:02:21 +0000 (22:02 +0300)
There are some bits declared here that simply don't exist
in the firmware, and some are missing (e.g. the key) from
what the firmware has. Align this and move all the fields
into a single one for this status word, which makes this a
bit easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930191738.0ba403d72e7c.I5fa3aa0538f3fbf8c3885b27a1204b5b0464c20a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

index 05923e39b60070dec1f1b8acc4eb07c08e197ec2..8a8a204bfe26ac10b4db1b48148f2f30c9ccaf34 100644 (file)
@@ -308,17 +308,11 @@ enum iwl_rx_mpdu_status {
        IWL_RX_MPDU_STATUS_EXT_IV_MATCH         = BIT(13),
        IWL_RX_MPDU_STATUS_KEY_ID_MATCH         = BIT(14),
        IWL_RX_MPDU_STATUS_ROBUST_MNG_FRAME     = BIT(15),
-};
 
-enum iwl_rx_mpdu_hash_filter {
-       IWL_RX_MPDU_HF_A1_HASH_MASK             = 0x3f,
-       IWL_RX_MPDU_HF_FILTER_STATUS_MASK       = 0xc0,
-};
+       IWL_RX_MPDU_STATUS_KEY                  = 0x3f0000,
+       IWL_RX_MPDU_STATUS_DUPLICATE            = BIT(22),
 
-enum iwl_rx_mpdu_sta_id_flags {
-       IWL_RX_MPDU_SIF_STA_ID_MASK             = 0x1f,
-       IWL_RX_MPDU_SIF_RRF_ABORT               = 0x20,
-       IWL_RX_MPDU_SIF_FILTER_STATUS_MASK      = 0xc0,
+       IWL_RX_MPDU_STATUS_STA_ID               = 0x1f000000,
 };
 
 #define IWL_RX_REORDER_DATA_INVALID_BAID 0x7f
@@ -672,15 +666,8 @@ struct iwl_rx_mpdu_desc {
        /**
         * @status: &enum iwl_rx_mpdu_status
         */
-       __le16 status;
-       /**
-        * @hash_filter: hash filter value
-        */
-       u8 hash_filter;
-       /**
-        * @sta_id_flags: &enum iwl_rx_mpdu_sta_id_flags
-        */
-       u8 sta_id_flags;
+       __le32 status;
+
        /* DW6 */
        /**
         * @reorder_data: &enum iwl_rx_mpdu_reorder_data
index 5cade5946cc496a4403a9c31bb3b8cf1b423a1ed..ea29aeb86eef1b9498c0e5077f1b4dc638a12d71 100644 (file)
@@ -333,7 +333,7 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
                             struct iwl_rx_mpdu_desc *desc,
                             u32 pkt_flags, int queue, u8 *crypt_len)
 {
-       u16 status = le16_to_cpu(desc->status);
+       u32 status = le32_to_cpu(desc->status);
 
        /*
         * Drop UNKNOWN frames in aggregation, unless in monitor mode
@@ -1707,10 +1707,10 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
         * Keep packets with CRC errors (and with overrun) for monitor mode
         * (otherwise the firmware discards them) but mark them as bad.
         */
-       if (!(desc->status & cpu_to_le16(IWL_RX_MPDU_STATUS_CRC_OK)) ||
-           !(desc->status & cpu_to_le16(IWL_RX_MPDU_STATUS_OVERRUN_OK))) {
+       if (!(desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_CRC_OK)) ||
+           !(desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_OVERRUN_OK))) {
                IWL_DEBUG_RX(mvm, "Bad CRC or FIFO: 0x%08X.\n",
-                            le16_to_cpu(desc->status));
+                            le32_to_cpu(desc->status));
                rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
        }
        /* set the preamble flag if appropriate */
@@ -1770,8 +1770,8 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 
        rcu_read_lock();
 
-       if (desc->status & cpu_to_le16(IWL_RX_MPDU_STATUS_SRC_STA_FOUND)) {
-               u8 id = desc->sta_id_flags & IWL_RX_MPDU_SIF_STA_ID_MASK;
+       if (desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_SRC_STA_FOUND)) {
+               u8 id = le32_get_bits(desc->status, IWL_RX_MPDU_STATUS_STA_ID);
 
                if (!WARN_ON_ONCE(id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))) {
                        sta = rcu_dereference(mvm->fw_id_to_mac_id[id]);