]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: mvm: update mpdu metadata API
authorSara Sharon <sara.sharon@intel.com>
Mon, 4 Apr 2016 16:28:45 +0000 (19:28 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 1 Jul 2016 15:09:40 +0000 (18:09 +0300)
rx_phy notification is no longer sent in devices with
multiple rx queues.
All the needed data is now set in the metadata - update
code accordingly to reflect all the features as in the
previous RX path.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

index 8193d36ae2dd7a68024bb66f83d19a6321d26403..2f024c737e4f000e5c72233c7ae1e1bd270e4873 100644 (file)
@@ -211,6 +211,7 @@ struct iwl_cmd_header_wide {
 #define FH_RSCSR_FRAME_SIZE_MSK                0x00003FFF      /* bits 0-13 */
 #define FH_RSCSR_FRAME_INVALID         0x55550000
 #define FH_RSCSR_FRAME_ALIGN           0x40
+#define FH_RSCSR_RPA_EN                        BIT(25)
 
 struct iwl_rx_packet {
        /*
@@ -220,7 +221,9 @@ struct iwl_rx_packet {
         * 31:    flag flush RB request
         * 30:    flag ignore TC (terminal counter) request
         * 29:    flag fast IRQ request
-        * 28-14: Reserved
+        * 28-26: Reserved
+        * 25:    Offload enabled
+        * 24-14: Reserved
         * 13-00: RX frame size
         */
        __le32 len_n_flags;
index bb8ff404e7b9b6087884622f8dd2123af78c9b8b..1994331593cfb89bd664d28868790641437e3ede 100644 (file)
@@ -336,6 +336,18 @@ enum iwl_rx_mpdu_reorder_data {
        IWL_RX_MPDU_REORDER_BA_OLD_SN           = 0x80000000,
 };
 
+enum iwl_rx_mpdu_phy_info {
+       IWL_RX_MPDU_PHY_AMPDU           = BIT(5),
+       IWL_RX_MPDU_PHY_AMPDU_TOGGLE    = BIT(6),
+       IWL_RX_MPDU_PHY_SHORT_PREAMBLE  = BIT(7),
+       IWL_RX_MPDU_PHY_TSF_OVERLOAD    = BIT(8),
+};
+
+enum iwl_rx_mpdu_mac_info {
+       IWL_RX_MPDU_PHY_MAC_INDEX_MASK          = 0x0f,
+       IWL_RX_MPDU_PHY_PHY_INDEX_MASK          = 0xf0,
+};
+
 struct iwl_rx_mpdu_desc {
        /* DW2 */
        __le16 mpdu_len;
@@ -343,9 +355,9 @@ struct iwl_rx_mpdu_desc {
        u8 mac_flags2;
        /* DW3 */
        u8 amsdu_info;
-       __le16 reserved_for_software;
+       __le16 phy_info;
        u8 mac_phy_idx;
-       /* DW4 */
+       /* DW4 - carries csum data only when rpa_en == 1 */
        __le16 raw_csum; /* alledgedly unreliable */
        __le16 l3l4_flags;
        /* DW5 */
@@ -354,17 +366,17 @@ struct iwl_rx_mpdu_desc {
        u8 sta_id_flags;
        /* DW6 */
        __le32 reorder_data;
-       /* DW7 */
+       /* DW7 - carries rss_hash only when rpa_en == 1 */
        __le32 rss_hash;
-       /* DW8 */
+       /* DW8 - carries filter_match only when rpa_en == 1 */
        __le32 filter_match;
        /* DW9 */
        __le32 rate_n_flags;
        /* DW10 */
-       u8 energy_a, energy_b, channel, reserved;
+       u8 energy_a, energy_b, channel, mac_context;
        /* DW11 */
        __le32 gp2_on_air_rise;
-       /* DW12 & DW13 */
+       /* DW12 & DW13 - carries TSF only TSF_OVERLOAD bit == 0 */
        __le64 tsf_on_air_rise;
 } __packed;
 
index dd0b8f8d3378b1cc4b39b579bcb56c79b6aae7db..65f9a4b4b3b81f86df3fbc2f25c3aacfe569c8c4 100644 (file)
@@ -731,6 +731,7 @@ struct iwl_mvm {
        struct iwl_sf_region sf_space;
 
        u32 ampdu_ref;
+       bool ampdu_toggle;
 
        struct iwl_notif_wait_data notif_wait;
 
index 67924fc38364d8867c0219968626a5ee9f2521a0..1f4fef4469d15a3487bc3b10737e5cb47c848168 100644 (file)
@@ -737,6 +737,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
        struct ieee80211_hdr *hdr = (void *)(pkt->data + sizeof(*desc));
        u32 len = le16_to_cpu(desc->mpdu_len);
        u32 rate_n_flags = le32_to_cpu(desc->rate_n_flags);
+       u16 phy_info = le16_to_cpu(desc->phy_info);
        struct ieee80211_sta *sta = NULL;
        struct sk_buff *skb;
        u8 crypt_len = 0;
@@ -767,16 +768,34 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
                             le16_to_cpu(desc->status));
                rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
        }
-
-       rx_status->mactime = le64_to_cpu(desc->tsf_on_air_rise);
+       /* set the preamble flag if appropriate */
+       if (phy_info & IWL_RX_MPDU_PHY_SHORT_PREAMBLE)
+               rx_status->flag |= RX_FLAG_SHORTPRE;
+
+       if (likely(!(phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD))) {
+               rx_status->mactime = le64_to_cpu(desc->tsf_on_air_rise);
+               /* TSF as indicated by the firmware is at INA time */
+               rx_status->flag |= RX_FLAG_MACTIME_PLCP_START;
+       }
        rx_status->device_timestamp = le32_to_cpu(desc->gp2_on_air_rise);
        rx_status->band = desc->channel > 14 ? NL80211_BAND_5GHZ :
                                               NL80211_BAND_2GHZ;
        rx_status->freq = ieee80211_channel_to_frequency(desc->channel,
                                                         rx_status->band);
        iwl_mvm_get_signal_strength(mvm, desc, rx_status);
-       /* TSF as indicated by the firmware is at INA time */
-       rx_status->flag |= RX_FLAG_MACTIME_PLCP_START;
+
+       /* update aggregation data for monitor sake on default queue */
+       if (!queue && (phy_info & IWL_RX_MPDU_PHY_AMPDU)) {
+               bool toggle_bit = phy_info & IWL_RX_MPDU_PHY_AMPDU_TOGGLE;
+
+               rx_status->flag |= RX_FLAG_AMPDU_DETAILS;
+               rx_status->ampdu_reference = mvm->ampdu_ref;
+               /* toggle is switched whenever new aggregation starts */
+               if (toggle_bit != mvm->ampdu_toggle) {
+                       mvm->ampdu_ref++;
+                       mvm->ampdu_toggle = toggle_bit;
+               }
+       }
 
        rcu_read_lock();
 
@@ -831,8 +850,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
                                iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL);
                }
 
-               /* TODO: multi queue TCM */
-
                if (ieee80211_is_data(hdr->frame_control))
                        iwl_mvm_rx_csum(sta, skb, desc);
 
@@ -857,14 +874,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
                        iwl_mvm_agg_rx_received(mvm, baid);
        }
 
-       /*
-        * TODO: PHY info.
-        * Verify we don't have the information in the MPDU descriptor and
-        * that it is not needed.
-        * Make sure for monitor mode that we are on default queue, update
-        * ampdu_ref and the rest of phy info then
-        */
-
        /* Set up the HT phy flags */
        switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) {
        case RATE_MCS_CHAN_WIDTH_20:
@@ -908,8 +917,18 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
                                                            rx_status->band);
        }
 
-       /* TODO: PHY info - update ampdu queue statistics (for debugfs) */
-       /* TODO: PHY info - gscan */
+       /* management stuff on default queue */
+       if (!queue) {
+               if (unlikely((ieee80211_is_beacon(hdr->frame_control) ||
+                             ieee80211_is_probe_resp(hdr->frame_control)) &&
+                            mvm->sched_scan_pass_all ==
+                            SCHED_SCAN_PASS_ALL_ENABLED))
+                       mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_FOUND;
+
+               if (unlikely(ieee80211_is_beacon(hdr->frame_control) ||
+                            ieee80211_is_probe_resp(hdr->frame_control)))
+                       rx_status->boottime_ns = ktime_get_boot_ns();
+       }
 
        iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb);
        if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc))