Merge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-rx.c
index 45230c6..5cd7560 100644 (file)
@@ -28,6 +28,7 @@
  *****************************************************************************/
 
 #include <linux/etherdevice.h>
+#include <linux/slab.h>
 #include <net/mac80211.h>
 #include <asm/unaligned.h>
 #include "iwl-eeprom.h"
@@ -250,7 +251,7 @@ EXPORT_SYMBOL(iwl_rx_spectrum_measure_notif);
 static void iwl_rx_calc_noise(struct iwl_priv *priv)
 {
        struct statistics_rx_non_phy *rx_info
-                               = &(priv->statistics.rx.general);
+                               = &(priv->_agn.statistics.rx.general);
        int num_active_rx = 0;
        int total_silence = 0;
        int bcn_silence_a =
@@ -259,6 +260,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
                le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
        int bcn_silence_c =
                le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
+       int last_rx_noise;
 
        if (bcn_silence_a) {
                total_silence += bcn_silence_a;
@@ -275,16 +277,16 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
 
        /* Average among active antennas */
        if (num_active_rx)
-               priv->last_rx_noise = (total_silence / num_active_rx) - 107;
+               last_rx_noise = (total_silence / num_active_rx) - 107;
        else
-               priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
+               last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
 
        IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
                        bcn_silence_a, bcn_silence_b, bcn_silence_c,
-                       priv->last_rx_noise);
+                       last_rx_noise);
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUGFS
 /*
  *  based on the assumption of all statistics counter are in DWORD
  *  FIXME: This function is for debugging, do not deal with
@@ -298,10 +300,10 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
        u32 *accum_stats;
        u32 *delta, *max_delta;
 
-       prev_stats = (__le32 *)&priv->statistics;
-       accum_stats = (u32 *)&priv->accum_statistics;
-       delta = (u32 *)&priv->delta_statistics;
-       max_delta = (u32 *)&priv->max_delta;
+       prev_stats = (__le32 *)&priv->_agn.statistics;
+       accum_stats = (u32 *)&priv->_agn.accum_statistics;
+       delta = (u32 *)&priv->_agn.delta_statistics;
+       max_delta = (u32 *)&priv->_agn.max_delta;
 
        for (i = sizeof(__le32); i < sizeof(struct iwl_notif_statistics);
             i += sizeof(__le32), stats++, prev_stats++, delta++,
@@ -316,18 +318,18 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
        }
 
        /* reset accumulative statistics for "no-counter" type statistics */
-       priv->accum_statistics.general.temperature =
-               priv->statistics.general.temperature;
-       priv->accum_statistics.general.temperature_m =
-               priv->statistics.general.temperature_m;
-       priv->accum_statistics.general.ttl_timestamp =
-               priv->statistics.general.ttl_timestamp;
-       priv->accum_statistics.tx.tx_power.ant_a =
-               priv->statistics.tx.tx_power.ant_a;
-       priv->accum_statistics.tx.tx_power.ant_b =
-               priv->statistics.tx.tx_power.ant_b;
-       priv->accum_statistics.tx.tx_power.ant_c =
-               priv->statistics.tx.tx_power.ant_c;
+       priv->_agn.accum_statistics.general.temperature =
+               priv->_agn.statistics.general.temperature;
+       priv->_agn.accum_statistics.general.temperature_m =
+               priv->_agn.statistics.general.temperature_m;
+       priv->_agn.accum_statistics.general.ttl_timestamp =
+               priv->_agn.statistics.general.ttl_timestamp;
+       priv->_agn.accum_statistics.tx.tx_power.ant_a =
+               priv->_agn.statistics.tx.tx_power.ant_a;
+       priv->_agn.accum_statistics.tx.tx_power.ant_b =
+               priv->_agn.statistics.tx.tx_power.ant_b;
+       priv->_agn.accum_statistics.tx.tx_power.ant_c =
+               priv->_agn.statistics.tx.tx_power.ant_c;
 }
 #endif
 
@@ -362,9 +364,9 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
        if (plcp_msec) {
                combined_plcp_delta =
                        (le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err) -
-                       le32_to_cpu(priv->statistics.rx.ofdm.plcp_err)) +
+                       le32_to_cpu(priv->_agn.statistics.rx.ofdm.plcp_err)) +
                        (le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err) -
-                       le32_to_cpu(priv->statistics.rx.ofdm_ht.plcp_err));
+                       le32_to_cpu(priv->_agn.statistics.rx.ofdm_ht.plcp_err));
 
                if ((combined_plcp_delta > 0) &&
                    ((combined_plcp_delta * 100) / plcp_msec) >
@@ -384,10 +386,10 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
                                "%u, %u, %u, %u, %d, %u mSecs\n",
                                priv->cfg->plcp_delta_threshold,
                                le32_to_cpu(pkt->u.stats.rx.ofdm.plcp_err),
-                               le32_to_cpu(priv->statistics.rx.ofdm.plcp_err),
+                               le32_to_cpu(priv->_agn.statistics.rx.ofdm.plcp_err),
                                le32_to_cpu(pkt->u.stats.rx.ofdm_ht.plcp_err),
                                le32_to_cpu(
-                                 priv->statistics.rx.ofdm_ht.plcp_err),
+                                 priv->_agn.statistics.rx.ofdm_ht.plcp_err),
                                combined_plcp_delta, plcp_msec);
                        rc = false;
                }
@@ -396,7 +398,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
 }
 EXPORT_SYMBOL(iwl_good_plcp_health);
 
-static void iwl_recover_from_statistics(struct iwl_priv *priv,
+void iwl_recover_from_statistics(struct iwl_priv *priv,
                                struct iwl_rx_packet *pkt)
 {
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -411,9 +413,11 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv,
                                 */
                                IWL_ERR(priv, "low ack count detected, "
                                        "restart firmware\n");
-                               iwl_force_reset(priv, IWL_FW_RESET);
+                               if (!iwl_force_reset(priv, IWL_FW_RESET))
+                                       return;
                        }
-               } else if (priv->cfg->ops->lib->check_plcp_health) {
+               }
+               if (priv->cfg->ops->lib->check_plcp_health) {
                        if (!priv->cfg->ops->lib->check_plcp_health(
                            priv, pkt)) {
                                /*
@@ -425,6 +429,7 @@ static void iwl_recover_from_statistics(struct iwl_priv *priv,
                }
        }
 }
+EXPORT_SYMBOL(iwl_recover_from_statistics);
 
 void iwl_rx_statistics(struct iwl_priv *priv,
                              struct iwl_rx_mem_buffer *rxb)
@@ -434,21 +439,22 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 
 
        IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
-                    (int)sizeof(priv->statistics),
+                    (int)sizeof(priv->_agn.statistics),
                     le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
 
-       change = ((priv->statistics.general.temperature !=
+       change = ((priv->_agn.statistics.general.temperature !=
                   pkt->u.stats.general.temperature) ||
-                 ((priv->statistics.flag &
+                 ((priv->_agn.statistics.flag &
                    STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
                   (pkt->u.stats.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
 
-#ifdef CONFIG_IWLWIFI_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUGFS
        iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
 #endif
        iwl_recover_from_statistics(priv, pkt);
 
-       memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics));
+       memcpy(&priv->_agn.statistics, &pkt->u.stats,
+               sizeof(priv->_agn.statistics));
 
        set_bit(STATUS_STATISTICS, &priv->status);
 
@@ -475,12 +481,12 @@ void iwl_reply_statistics(struct iwl_priv *priv,
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
 
        if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
-#ifdef CONFIG_IWLWIFI_DEBUG
-               memset(&priv->accum_statistics, 0,
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+               memset(&priv->_agn.accum_statistics, 0,
                        sizeof(struct iwl_notif_statistics));
-               memset(&priv->delta_statistics, 0,
+               memset(&priv->_agn.delta_statistics, 0,
                        sizeof(struct iwl_notif_statistics));
-               memset(&priv->max_delta, 0,
+               memset(&priv->_agn.max_delta, 0,
                        sizeof(struct iwl_notif_statistics));
 #endif
                IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
@@ -489,139 +495,6 @@ void iwl_reply_statistics(struct iwl_priv *priv,
 }
 EXPORT_SYMBOL(iwl_reply_statistics);
 
-/* Calc max signal level (dBm) among 3 possible receivers */
-static inline int iwl_calc_rssi(struct iwl_priv *priv,
-                               struct iwl_rx_phy_res *rx_resp)
-{
-       return priv->cfg->ops->utils->calc_rssi(priv, rx_resp);
-}
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-/**
- * iwl_dbg_report_frame - dump frame to syslog during debug sessions
- *
- * You may hack this function to show different aspects of received frames,
- * including selective frame dumps.
- * group100 parameter selects whether to show 1 out of 100 good data frames.
- *    All beacon and probe response frames are printed.
- */
-static void iwl_dbg_report_frame(struct iwl_priv *priv,
-                     struct iwl_rx_phy_res *phy_res, u16 length,
-                     struct ieee80211_hdr *header, int group100)
-{
-       u32 to_us;
-       u32 print_summary = 0;
-       u32 print_dump = 0;     /* set to 1 to dump all frames' contents */
-       u32 hundred = 0;
-       u32 dataframe = 0;
-       __le16 fc;
-       u16 seq_ctl;
-       u16 channel;
-       u16 phy_flags;
-       u32 rate_n_flags;
-       u32 tsf_low;
-       int rssi;
-
-       if (likely(!(iwl_get_debug_level(priv) & IWL_DL_RX)))
-               return;
-
-       /* MAC header */
-       fc = header->frame_control;
-       seq_ctl = le16_to_cpu(header->seq_ctrl);
-
-       /* metadata */
-       channel = le16_to_cpu(phy_res->channel);
-       phy_flags = le16_to_cpu(phy_res->phy_flags);
-       rate_n_flags = le32_to_cpu(phy_res->rate_n_flags);
-
-       /* signal statistics */
-       rssi = iwl_calc_rssi(priv, phy_res);
-       tsf_low = le64_to_cpu(phy_res->timestamp) & 0x0ffffffff;
-
-       to_us = !compare_ether_addr(header->addr1, priv->mac_addr);
-
-       /* if data frame is to us and all is good,
-        *   (optionally) print summary for only 1 out of every 100 */
-       if (to_us && (fc & ~cpu_to_le16(IEEE80211_FCTL_PROTECTED)) ==
-           cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) {
-               dataframe = 1;
-               if (!group100)
-                       print_summary = 1;      /* print each frame */
-               else if (priv->framecnt_to_us < 100) {
-                       priv->framecnt_to_us++;
-                       print_summary = 0;
-               } else {
-                       priv->framecnt_to_us = 0;
-                       print_summary = 1;
-                       hundred = 1;
-               }
-       } else {
-               /* print summary for all other frames */
-               print_summary = 1;
-       }
-
-       if (print_summary) {
-               char *title;
-               int rate_idx;
-               u32 bitrate;
-
-               if (hundred)
-                       title = "100Frames";
-               else if (ieee80211_has_retry(fc))
-                       title = "Retry";
-               else if (ieee80211_is_assoc_resp(fc))
-                       title = "AscRsp";
-               else if (ieee80211_is_reassoc_resp(fc))
-                       title = "RasRsp";
-               else if (ieee80211_is_probe_resp(fc)) {
-                       title = "PrbRsp";
-                       print_dump = 1; /* dump frame contents */
-               } else if (ieee80211_is_beacon(fc)) {
-                       title = "Beacon";
-                       print_dump = 1; /* dump frame contents */
-               } else if (ieee80211_is_atim(fc))
-                       title = "ATIM";
-               else if (ieee80211_is_auth(fc))
-                       title = "Auth";
-               else if (ieee80211_is_deauth(fc))
-                       title = "DeAuth";
-               else if (ieee80211_is_disassoc(fc))
-                       title = "DisAssoc";
-               else
-                       title = "Frame";
-
-               rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags);
-               if (unlikely((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT))) {
-                       bitrate = 0;
-                       WARN_ON_ONCE(1);
-               } else {
-                       bitrate = iwl_rates[rate_idx].ieee / 2;
-               }
-
-               /* print frame summary.
-                * MAC addresses show just the last byte (for brevity),
-                *    but you can hack it to show more, if you'd like to. */
-               if (dataframe)
-                       IWL_DEBUG_RX(priv, "%s: mhd=0x%04x, dst=0x%02x, "
-                                    "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
-                                    title, le16_to_cpu(fc), header->addr1[5],
-                                    length, rssi, channel, bitrate);
-               else {
-                       /* src/dst addresses assume managed mode */
-                       IWL_DEBUG_RX(priv, "%s: 0x%04x, dst=0x%02x, src=0x%02x, "
-                                    "len=%u, rssi=%d, tim=%lu usec, "
-                                    "phy=0x%02x, chnl=%d\n",
-                                    title, le16_to_cpu(fc), header->addr1[5],
-                                    header->addr3[5], length, rssi,
-                                    tsf_low - priv->scan_start_tsf,
-                                    phy_flags, channel);
-               }
-       }
-       if (print_dump)
-               iwl_print_hex_dump(priv, IWL_DL_RX, header, length);
-}
-#endif
-
 /*
  * returns non-zero if packet should be dropped
  */
@@ -669,281 +542,3 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv,
        return 0;
 }
 EXPORT_SYMBOL(iwl_set_decrypted_flag);
-
-static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
-{
-       u32 decrypt_out = 0;
-
-       if ((decrypt_in & RX_RES_STATUS_STATION_FOUND) ==
-                                       RX_RES_STATUS_STATION_FOUND)
-               decrypt_out |= (RX_RES_STATUS_STATION_FOUND |
-                               RX_RES_STATUS_NO_STATION_INFO_MISMATCH);
-
-       decrypt_out |= (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK);
-
-       /* packet was not encrypted */
-       if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) ==
-                                       RX_RES_STATUS_SEC_TYPE_NONE)
-               return decrypt_out;
-
-       /* packet was encrypted with unknown alg */
-       if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) ==
-                                       RX_RES_STATUS_SEC_TYPE_ERR)
-               return decrypt_out;
-
-       /* decryption was not done in HW */
-       if ((decrypt_in & RX_MPDU_RES_STATUS_DEC_DONE_MSK) !=
-                                       RX_MPDU_RES_STATUS_DEC_DONE_MSK)
-               return decrypt_out;
-
-       switch (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) {
-
-       case RX_RES_STATUS_SEC_TYPE_CCMP:
-               /* alg is CCM: check MIC only */
-               if (!(decrypt_in & RX_MPDU_RES_STATUS_MIC_OK))
-                       /* Bad MIC */
-                       decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC;
-               else
-                       decrypt_out |= RX_RES_STATUS_DECRYPT_OK;
-
-               break;
-
-       case RX_RES_STATUS_SEC_TYPE_TKIP:
-               if (!(decrypt_in & RX_MPDU_RES_STATUS_TTAK_OK)) {
-                       /* Bad TTAK */
-                       decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK;
-                       break;
-               }
-               /* fall through if TTAK OK */
-       default:
-               if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK))
-                       decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC;
-               else
-                       decrypt_out |= RX_RES_STATUS_DECRYPT_OK;
-               break;
-       };
-
-       IWL_DEBUG_RX(priv, "decrypt_in:0x%x  decrypt_out = 0x%x\n",
-                                       decrypt_in, decrypt_out);
-
-       return decrypt_out;
-}
-
-static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
-                                       struct ieee80211_hdr *hdr,
-                                       u16 len,
-                                       u32 ampdu_status,
-                                       struct iwl_rx_mem_buffer *rxb,
-                                       struct ieee80211_rx_status *stats)
-{
-       struct sk_buff *skb;
-       int ret = 0;
-       __le16 fc = hdr->frame_control;
-
-       /* We only process data packets if the interface is open */
-       if (unlikely(!priv->is_open)) {
-               IWL_DEBUG_DROP_LIMIT(priv,
-                   "Dropping packet while interface is not open.\n");
-               return;
-       }
-
-       /* In case of HW accelerated crypto and bad decryption, drop */
-       if (!priv->cfg->mod_params->sw_crypto &&
-           iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats))
-               return;
-
-       skb = alloc_skb(IWL_LINK_HDR_MAX * 2, GFP_ATOMIC);
-       if (!skb) {
-               IWL_ERR(priv, "alloc_skb failed\n");
-               return;
-       }
-
-       skb_reserve(skb, IWL_LINK_HDR_MAX);
-       skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len);
-
-       /* mac80211 currently doesn't support paged SKB. Convert it to
-        * linear SKB for management frame and data frame requires
-        * software decryption or software defragementation. */
-       if (ieee80211_is_mgmt(fc) ||
-           ieee80211_has_protected(fc) ||
-           ieee80211_has_morefrags(fc) ||
-           le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG ||
-           (ieee80211_is_data_qos(fc) &&
-            *ieee80211_get_qos_ctl(hdr) &
-            IEEE80211_QOS_CONTROL_A_MSDU_PRESENT))
-               ret = skb_linearize(skb);
-       else
-               ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ?
-                        0 : -ENOMEM;
-
-       if (ret) {
-               kfree_skb(skb);
-               goto out;
-       }
-
-       /*
-        * XXX: We cannot touch the page and its virtual memory (hdr) after
-        * here. It might have already been freed by the above skb change.
-        */
-
-       iwl_update_stats(priv, false, fc, len);
-       memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
-
-       ieee80211_rx(priv->hw, skb);
- out:
-       priv->alloc_rxb_page--;
-       rxb->page = NULL;
-}
-
-/* Called for REPLY_RX (legacy ABG frames), or
- * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
-void iwl_rx_reply_rx(struct iwl_priv *priv,
-                               struct iwl_rx_mem_buffer *rxb)
-{
-       struct ieee80211_hdr *header;
-       struct ieee80211_rx_status rx_status;
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       struct iwl_rx_phy_res *phy_res;
-       __le32 rx_pkt_status;
-       struct iwl4965_rx_mpdu_res_start *amsdu;
-       u32 len;
-       u32 ampdu_status;
-       u32 rate_n_flags;
-
-       /**
-        * REPLY_RX and REPLY_RX_MPDU_CMD are handled differently.
-        *      REPLY_RX: physical layer info is in this buffer
-        *      REPLY_RX_MPDU_CMD: physical layer info was sent in separate
-        *              command and cached in priv->last_phy_res
-        *
-        * Here we set up local variables depending on which command is
-        * received.
-        */
-       if (pkt->hdr.cmd == REPLY_RX) {
-               phy_res = (struct iwl_rx_phy_res *)pkt->u.raw;
-               header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res)
-                               + phy_res->cfg_phy_cnt);
-
-               len = le16_to_cpu(phy_res->byte_count);
-               rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*phy_res) +
-                               phy_res->cfg_phy_cnt + len);
-               ampdu_status = le32_to_cpu(rx_pkt_status);
-       } else {
-               if (!priv->last_phy_res[0]) {
-                       IWL_ERR(priv, "MPDU frame without cached PHY data\n");
-                       return;
-               }
-               phy_res = (struct iwl_rx_phy_res *)&priv->last_phy_res[1];
-               amsdu = (struct iwl4965_rx_mpdu_res_start *)pkt->u.raw;
-               header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu));
-               len = le16_to_cpu(amsdu->byte_count);
-               rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len);
-               ampdu_status = iwl_translate_rx_status(priv,
-                               le32_to_cpu(rx_pkt_status));
-       }
-
-       if ((unlikely(phy_res->cfg_phy_cnt > 20))) {
-               IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
-                               phy_res->cfg_phy_cnt);
-               return;
-       }
-
-       if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) ||
-           !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
-               IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n",
-                               le32_to_cpu(rx_pkt_status));
-               return;
-       }
-
-       /* This will be used in several places later */
-       rate_n_flags = le32_to_cpu(phy_res->rate_n_flags);
-
-       /* rx_status carries information about the packet to mac80211 */
-       rx_status.mactime = le64_to_cpu(phy_res->timestamp);
-       rx_status.freq =
-               ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel));
-       rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
-                               IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
-       rx_status.rate_idx =
-               iwl_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band);
-       rx_status.flag = 0;
-
-       /* TSF isn't reliable. In order to allow smooth user experience,
-        * this W/A doesn't propagate it to the mac80211 */
-       /*rx_status.flag |= RX_FLAG_TSFT;*/
-
-       priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
-
-       /* Find max signal strength (dBm) among 3 antenna/receiver chains */
-       rx_status.signal = iwl_calc_rssi(priv, phy_res);
-
-       /* Meaningful noise values are available only from beacon statistics,
-        *   which are gathered only when associated, and indicate noise
-        *   only for the associated network channel ...
-        * Ignore these noise values while scanning (other channels) */
-       if (iwl_is_associated(priv) &&
-           !test_bit(STATUS_SCANNING, &priv->status)) {
-               rx_status.noise = priv->last_rx_noise;
-       } else {
-               rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
-       }
-
-       /* Reset beacon noise level if not associated. */
-       if (!iwl_is_associated(priv))
-               priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-       /* Set "1" to report good data frames in groups of 100 */
-       if (unlikely(iwl_get_debug_level(priv) & IWL_DL_RX))
-               iwl_dbg_report_frame(priv, phy_res, len, header, 1);
-#endif
-       iwl_dbg_log_rx_data_frame(priv, len, header);
-       IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n",
-               rx_status.signal, rx_status.noise,
-               (unsigned long long)rx_status.mactime);
-
-       /*
-        * "antenna number"
-        *
-        * It seems that the antenna field in the phy flags value
-        * is actually a bit field. This is undefined by radiotap,
-        * it wants an actual antenna number but I always get "7"
-        * for most legacy frames I receive indicating that the
-        * same frame was received on all three RX chains.
-        *
-        * I think this field should be removed in favor of a
-        * new 802.11n radiotap field "RX chains" that is defined
-        * as a bitmask.
-        */
-       rx_status.antenna =
-               (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK)
-               >> RX_RES_PHY_FLAGS_ANTENNA_POS;
-
-       /* set the preamble flag if appropriate */
-       if (phy_res->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
-               rx_status.flag |= RX_FLAG_SHORTPRE;
-
-       /* Set up the HT phy flags */
-       if (rate_n_flags & RATE_MCS_HT_MSK)
-               rx_status.flag |= RX_FLAG_HT;
-       if (rate_n_flags & RATE_MCS_HT40_MSK)
-               rx_status.flag |= RX_FLAG_40MHZ;
-       if (rate_n_flags & RATE_MCS_SGI_MSK)
-               rx_status.flag |= RX_FLAG_SHORT_GI;
-
-       iwl_pass_packet_to_mac80211(priv, header, len, ampdu_status,
-                                   rxb, &rx_status);
-}
-EXPORT_SYMBOL(iwl_rx_reply_rx);
-
-/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
- * This will be used later in iwl_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
-void iwl_rx_reply_rx_phy(struct iwl_priv *priv,
-                                   struct iwl_rx_mem_buffer *rxb)
-{
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       priv->last_phy_res[0] = 1;
-       memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]),
-              sizeof(struct iwl_rx_phy_res));
-}
-EXPORT_SYMBOL(iwl_rx_reply_rx_phy);