iwlwifi: mvm: support new format for the beacon notification
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 26 Nov 2018 11:24:55 +0000 (13:24 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 4 Feb 2019 10:27:19 +0000 (12:27 +0200)
The firmware is changing the format of the beacon
notification to remove the dependency on the Tx response
format.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/tx.h
drivers/net/wireless/intel/iwlwifi/fw/file.h
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 358bdf0..8511e73 100644 (file)
@@ -847,13 +847,13 @@ struct iwl_beacon_notif {
 } __packed;
 
 /**
- * struct iwl_extended_beacon_notif - notifies about beacon transmission
+ * struct iwl_extended_beacon_notif_v5 - notifies about beacon transmission
  * @beacon_notify_hdr: tx response command associated with the beacon
  * @tsf: last beacon tsf
  * @ibss_mgr_status: whether IBSS is manager
  * @gp2: last beacon time in gp2
  */
-struct iwl_extended_beacon_notif {
+struct iwl_extended_beacon_notif_v5 {
        struct iwl_mvm_tx_resp beacon_notify_hdr;
        __le64 tsf;
        __le32 ibss_mgr_status;
@@ -861,6 +861,20 @@ struct iwl_extended_beacon_notif {
 } __packed; /* BEACON_NTFY_API_S_VER_5 */
 
 /**
+ * struct iwl_extended_beacon_notif - notifies about beacon transmission
+ * @status: the status of the Tx response of the beacon
+ * @tsf: last beacon tsf
+ * @ibss_mgr_status: whether IBSS is manager
+ * @gp2: last beacon time in gp2
+ */
+struct iwl_extended_beacon_notif {
+       __le32 status;
+       __le64 tsf;
+       __le32 ibss_mgr_status;
+       __le32 gp2;
+} __packed; /* BEACON_NTFY_API_S_VER_6_ */
+
+/**
  * enum iwl_dump_control - dump (flush) control flags
  * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty
  *     and the TFD queues are empty.
index db392cf..a6dd27f 100644 (file)
@@ -263,6 +263,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_api_t;
  * @IWL_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS
  * @IWL_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of
  *     the REDUCE_TX_POWER_CMD.
+ * @IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short
+ *     version of the beacon notification.
  *
  * @NUM_IWL_UCODE_TLV_API: number of bits used
  */
@@ -287,6 +289,7 @@ enum iwl_ucode_tlv_api {
        IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2     = (__force iwl_ucode_tlv_api_t)42,
        IWL_UCODE_TLV_API_FRAG_EBS              = (__force iwl_ucode_tlv_api_t)44,
        IWL_UCODE_TLV_API_REDUCE_TX_POWER       = (__force iwl_ucode_tlv_api_t)45,
+       IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF    = (__force iwl_ucode_tlv_api_t)46,
 
        NUM_IWL_UCODE_TLV_API
 #ifdef __CHECKER__
index 768a87e..c1eb07c 100644 (file)
@@ -1330,7 +1330,7 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
        struct iwl_extended_beacon_notif *beacon = (void *)pkt->data;
-       struct iwl_mvm_tx_resp *beacon_notify_hdr;
+       struct iwl_extended_beacon_notif_v5 *beacon_v5 = (void *)pkt->data;
        struct ieee80211_vif *csa_vif;
        struct ieee80211_vif *tx_blocked_vif;
        struct agg_tx_status *agg_status;
@@ -1338,18 +1338,29 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
 
        lockdep_assert_held(&mvm->mutex);
 
-       beacon_notify_hdr = &beacon->beacon_notify_hdr;
        mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2);
-       mvm->ibss_manager = beacon->ibss_mgr_status != 0;
-
-       agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
-       status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK;
-       IWL_DEBUG_RX(mvm,
-                    "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n",
-                    status, beacon_notify_hdr->failure_frame,
-                    le64_to_cpu(beacon->tsf),
-                    mvm->ap_last_beacon_gp2,
-                    le32_to_cpu(beacon_notify_hdr->initial_rate));
+
+       if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) {
+               struct iwl_mvm_tx_resp *beacon_notify_hdr =
+                       &beacon_v5->beacon_notify_hdr;
+
+               mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0;
+               agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
+               status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK;
+               IWL_DEBUG_RX(mvm,
+                            "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n",
+                            status, beacon_notify_hdr->failure_frame,
+                            le64_to_cpu(beacon->tsf),
+                            mvm->ap_last_beacon_gp2,
+                            le32_to_cpu(beacon_notify_hdr->initial_rate));
+       } else {
+               mvm->ibss_manager = beacon->ibss_mgr_status != 0;
+               status = le32_to_cpu(beacon->status) & TX_STATUS_MSK;
+               IWL_DEBUG_RX(mvm,
+                            "beacon status %#x tsf:0x%016llX gp2:0x%X\n",
+                            status, le64_to_cpu(beacon->tsf),
+                            mvm->ap_last_beacon_gp2);
+       }
 
        csa_vif = rcu_dereference_protected(mvm->csa_vif,
                                            lockdep_is_held(&mvm->mutex));
index 12e9ecc..f717602 100644 (file)
@@ -1311,6 +1311,12 @@ static inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm)
        return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS);
 }
 
+static inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm)
+{
+       return fw_has_api(&mvm->fw->ucode_capa,
+                         IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF);
+}
+
 static inline bool iwl_mvm_enter_d0i3_on_suspend(struct iwl_mvm *mvm)
 {
        /* For now we only use this mode to differentiate between