iwlwifi: mvm: Add beacon notification handler
authorIlan Peer <ilan.peer@intel.com>
Tue, 5 Mar 2013 13:26:03 +0000 (15:26 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 20 Mar 2013 11:02:27 +0000 (12:02 +0100)
Mostly for debugging purposes

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h
drivers/net/wireless/iwlwifi/mvm/fw-api.h
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/ops.c

index 6d53850..007a93b 100644 (file)
@@ -537,6 +537,12 @@ struct iwl_mac_beacon_cmd {
        struct ieee80211_hdr frame[0];
 } __packed;
 
+struct iwl_beacon_notif {
+       struct iwl_mvm_tx_resp beacon_notify_hdr;
+       __le64 tsf;
+       __le32 ibss_mgr_status;
+} __packed;
+
 /**
  * enum iwl_dump_control - dump (flush) control flags
  * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty
index 0e94d8b..1073f26 100644 (file)
@@ -151,6 +151,7 @@ enum {
 
        SET_CALIB_DEFAULT_CMD = 0x8e,
 
+       BEACON_NOTIFICATION = 0x90,
        BEACON_TEMPLATE_CMD = 0x91,
        TX_ANT_CONFIGURATION_CMD = 0x98,
        BT_CONFIG = 0x9b,
index 2779235..a00fb73 100644 (file)
@@ -1013,3 +1013,22 @@ int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        mvmvif->uploaded = false;
        return 0;
 }
+
+int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
+                           struct iwl_rx_cmd_buffer *rxb,
+                           struct iwl_device_cmd *cmd)
+{
+       struct iwl_rx_packet *pkt = rxb_addr(rxb);
+       struct iwl_beacon_notif *beacon = (void *)pkt->data;
+       u16 status __maybe_unused =
+               le16_to_cpu(beacon->beacon_notify_hdr.status.status);
+       u32 rate __maybe_unused =
+               le32_to_cpu(beacon->beacon_notify_hdr.initial_rate);
+
+       IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n",
+                    status & TX_STATUS_MSK,
+                    beacon->beacon_notify_hdr.failure_frame,
+                    le64_to_cpu(beacon->tsf),
+                    rate);
+       return 0;
+}
index d022e44..ea1fafd 100644 (file)
@@ -448,6 +448,9 @@ u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
                                struct ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
                                    struct ieee80211_vif *vif);
+int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
+                           struct iwl_rx_cmd_buffer *rxb,
+                           struct iwl_device_cmd *cmd);
 
 /* Bindings */
 int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
index b490426..81ff283 100644 (file)
@@ -231,6 +231,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
        RX_HANDLER(SCAN_COMPLETE_NOTIFICATION, iwl_mvm_rx_scan_complete, false),
 
        RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true),
+       RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false),
 
        RX_HANDLER(RADIO_VERSION_NOTIFICATION, iwl_mvm_rx_radio_ver, false),
        RX_HANDLER(CARD_STATE_NOTIFICATION, iwl_mvm_rx_card_state_notif, false),
@@ -276,6 +277,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
        CMD(WEP_KEY),
        CMD(REPLY_RX_PHY_CMD),
        CMD(REPLY_RX_MPDU_CMD),
+       CMD(BEACON_NOTIFICATION),
        CMD(BEACON_TEMPLATE_CMD),
        CMD(STATISTICS_NOTIFICATION),
        CMD(TX_ANT_CONFIGURATION_CMD),