iwlwifi: setup correctly L1 L0S pi link values
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl4965-base.c
index db4f606bad500f8253c349bfdd6f1374544dc0bd..ee9fe56552cbff82c1ab78d03ee9c84a056439d8 100644 (file)
@@ -1606,17 +1606,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
 static void iwl4965_txstatus_to_ieee(struct iwl_priv *priv,
                                     struct iwl_tx_info *tx_sta)
 {
-
-       tx_sta->status.ack_signal = 0;
-       tx_sta->status.excessive_retries = 0;
-
-       if (in_interrupt())
-               ieee80211_tx_status_irqsafe(priv->hw,
-                                           tx_sta->skb[0], &(tx_sta->status));
-       else
-               ieee80211_tx_status(priv->hw,
-                                   tx_sta->skb[0], &(tx_sta->status));
-
+       ieee80211_tx_status_irqsafe(priv->hw, tx_sta->skb[0]);
        tx_sta->skb[0] = NULL;
 }
 
@@ -1710,7 +1700,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
 {
        u16 status;
        struct agg_tx_status *frame_status = &tx_resp->status;
-       struct ieee80211_tx_status *tx_status = NULL;
+       struct ieee80211_tx_info *info = NULL;
        struct ieee80211_hdr *hdr = NULL;
        int i, sh;
        int txq_id, idx;
@@ -1736,14 +1726,14 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
                                   agg->frame_count, agg->start_idx, idx);
 
-               tx_status = &(priv->txq[txq_id].txb[idx].status);
-               tx_status->retry_count = tx_resp->failure_frame;
-               tx_status->control.flags &= ~IEEE80211_TXCTL_AMPDU;
-               tx_status->flags = iwl4965_is_tx_success(status)?
-                       IEEE80211_TX_STATUS_ACK : 0;
+               info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
+               info->status.retry_count = tx_resp->failure_frame;
+               info->flags &= ~IEEE80211_TX_CTL_AMPDU;
+               info->flags |= iwl4965_is_tx_success(status)?
+                       IEEE80211_TX_STAT_ACK : 0;
                iwl4965_hwrate_to_tx_control(priv,
                                             le32_to_cpu(tx_resp->rate_n_flags),
-                                            &tx_status->control);
+                                            info);
                /* FIXME: code repetition end */
 
                IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
@@ -1830,7 +1820,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
        struct iwl_tx_queue *txq = &priv->txq[txq_id];
-       struct ieee80211_tx_status *tx_status;
+       struct ieee80211_tx_info *info;
        struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
        u32  status = le32_to_cpu(tx_resp->status);
 #ifdef CONFIG_IWL4965_HT
@@ -1848,6 +1838,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                return;
        }
 
+       info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
+       memset(&info->status, 0, sizeof(info->status));
+
 #ifdef CONFIG_IWL4965_HT
        hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index);
        fc = le16_to_cpu(hdr->frame_control);
@@ -1902,13 +1895,12 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                }
        } else {
 #endif /* CONFIG_IWL4965_HT */
-       tx_status = &(txq->txb[txq->q.read_ptr].status);
 
-       tx_status->retry_count = tx_resp->failure_frame;
-       tx_status->flags =
-           iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0;
+       info->status.retry_count = tx_resp->failure_frame;
+       info->flags |=
+           iwl4965_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
        iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
-                                    &tx_status->control);
+                                    info);
 
        IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x "
                     "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status),
@@ -1935,11 +1927,11 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 }
 
 
-static void iwl4965_rx_reply_alive(struct iwl_priv *priv,
-                                  struct iwl_rx_mem_buffer *rxb)
+static void iwl_rx_reply_alive(struct iwl_priv *priv,
+                               struct iwl_rx_mem_buffer *rxb)
 {
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-       struct iwl4965_alive_resp *palive;
+       struct iwl_alive_resp *palive;
        struct delayed_work *pwork;
 
        palive = &pkt->u.alive_frame;
@@ -1953,12 +1945,12 @@ static void iwl4965_rx_reply_alive(struct iwl_priv *priv,
                IWL_DEBUG_INFO("Initialization Alive received.\n");
                memcpy(&priv->card_alive_init,
                       &pkt->u.alive_frame,
-                      sizeof(struct iwl4965_init_alive_resp));
+                      sizeof(struct iwl_init_alive_resp));
                pwork = &priv->init_alive_start;
        } else {
                IWL_DEBUG_INFO("Runtime Alive received.\n");
                memcpy(&priv->card_alive, &pkt->u.alive_frame,
-                      sizeof(struct iwl4965_alive_resp));
+                      sizeof(struct iwl_alive_resp));
                pwork = &priv->alive_start;
        }
 
@@ -2053,7 +2045,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work)
        struct sk_buff *beacon;
 
        /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
-       beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL);
+       beacon = ieee80211_beacon_get(priv->hw, priv->vif);
 
        if (!beacon) {
                IWL_ERROR("update beacon failed\n");
@@ -2287,7 +2279,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
  */
 static void iwl4965_setup_rx_handlers(struct iwl_priv *priv)
 {
-       priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive;
+       priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive;
        priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta;
        priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error;
        priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa;
@@ -2621,76 +2613,6 @@ static inline void iwl4965_disable_interrupts(struct iwl_priv *priv)
        IWL_DEBUG_ISR("Disabled interrupts\n");
 }
 
-static const char *desc_lookup(int i)
-{
-       switch (i) {
-       case 1:
-               return "FAIL";
-       case 2:
-               return "BAD_PARAM";
-       case 3:
-               return "BAD_CHECKSUM";
-       case 4:
-               return "NMI_INTERRUPT";
-       case 5:
-               return "SYSASSERT";
-       case 6:
-               return "FATAL_ERROR";
-       }
-
-       return "UNKNOWN";
-}
-
-#define ERROR_START_OFFSET  (1 * sizeof(u32))
-#define ERROR_ELEM_SIZE     (7 * sizeof(u32))
-
-static void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
-{
-       u32 data2, line;
-       u32 desc, time, count, base, data1;
-       u32 blink1, blink2, ilink1, ilink2;
-       int rc;
-
-       base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
-
-       if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
-               return;
-       }
-
-       rc = iwl_grab_nic_access(priv);
-       if (rc) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
-               return;
-       }
-
-       count = iwl_read_targ_mem(priv, base);
-
-       if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
-               IWL_ERROR("Start IWL Error Log Dump:\n");
-               IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count);
-       }
-
-       desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32));
-       blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32));
-       blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32));
-       ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32));
-       ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32));
-       data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32));
-       data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32));
-       line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
-       time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
-
-       IWL_ERROR("Desc               Time       "
-                 "data1      data2      line\n");
-       IWL_ERROR("%-13s (#%d) %010u 0x%08X 0x%08X %u\n",
-                 desc_lookup(desc), desc, time, data1, data2, line);
-       IWL_ERROR("blink1  blink2  ilink1  ilink2\n");
-       IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
-                 ilink1, ilink2);
-
-       iwl_release_nic_access(priv);
-}
 
 /**
  * iwl4965_irq_handle_error - called for HW or SW error interrupt from card
@@ -2705,7 +2627,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        if (priv->debug_level & IWL_DL_FW_ERRORS) {
-               iwl4965_dump_nic_error_log(priv);
+               iwl_dump_nic_error_log(priv);
                iwl_dump_nic_event_log(priv);
                iwl4965_print_rx_config_cmd(priv);
        }
@@ -3322,11 +3244,11 @@ static int iwl4965_read_ucode(struct iwl_priv *priv)
 }
 
 /**
- * iwl4965_alive_start - called after REPLY_ALIVE notification received
+ * iwl_alive_start - called after REPLY_ALIVE notification received
  *                   from protocol/runtime uCode (initialization uCode's
- *                   Alive gets handled by iwl4965_init_alive_start()).
+ *                   Alive gets handled by iwl_init_alive_start()).
  */
-static void iwl4965_alive_start(struct iwl_priv *priv)
+static void iwl_alive_start(struct iwl_priv *priv)
 {
        int ret = 0;
 
@@ -3350,7 +3272,6 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
        }
 
        iwlcore_clear_stations_table(priv);
-
        ret = priv->cfg->ops->lib->alive_notify(priv);
        if (ret) {
                IWL_WARNING("Could not complete ALIVE transition [ntf]: %d\n",
@@ -3388,12 +3309,12 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
        /* Configure Bluetooth device coexistence support */
        iwl4965_send_bt_config(priv);
 
+       iwl_reset_run_time_calib(priv);
+
        /* Configure the adapter for unassociated operation */
        iwl4965_commit_rxon(priv);
 
        /* At this point, the NIC is initialized and operational */
-       priv->notif_missed_beacons = 0;
-
        iwl4965_rf_kill_ct_config(priv);
 
        iwl_leds_register(priv);
@@ -3419,12 +3340,9 @@ static void __iwl4965_down(struct iwl_priv *priv)
 {
        unsigned long flags;
        int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
-       struct ieee80211_conf *conf = NULL;
 
        IWL_DEBUG_INFO(DRV_NAME " is going down\n");
 
-       conf = ieee80211_get_hw_conf(priv->hw);
-
        if (!exit_pending)
                set_bit(STATUS_EXIT_PENDING, &priv->status);
 
@@ -3505,7 +3423,7 @@ static void __iwl4965_down(struct iwl_priv *priv)
        priv->cfg->ops->lib->free_shared_mem(priv);
 
  exit:
-       memset(&priv->card_alive, 0, sizeof(struct iwl4965_alive_resp));
+       memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));
 
        if (priv->ibss_beacon)
                dev_kfree_skb(priv->ibss_beacon);
@@ -3637,7 +3555,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
  *
  *****************************************************************************/
 
-static void iwl4965_bg_init_alive_start(struct work_struct *data)
+static void iwl_bg_init_alive_start(struct work_struct *data)
 {
        struct iwl_priv *priv =
            container_of(data, struct iwl_priv, init_alive_start.work);
@@ -3650,7 +3568,7 @@ static void iwl4965_bg_init_alive_start(struct work_struct *data)
        mutex_unlock(&priv->mutex);
 }
 
-static void iwl4965_bg_alive_start(struct work_struct *data)
+static void iwl_bg_alive_start(struct work_struct *data)
 {
        struct iwl_priv *priv =
            container_of(data, struct iwl_priv, alive_start.work);
@@ -3659,7 +3577,7 @@ static void iwl4965_bg_alive_start(struct work_struct *data)
                return;
 
        mutex_lock(&priv->mutex);
-       iwl4965_alive_start(priv);
+       iwl_alive_start(priv);
        mutex_unlock(&priv->mutex);
 }
 
@@ -4268,8 +4186,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
        IWL_DEBUG_MAC80211("leave\n");
 }
 
-static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
-                     struct ieee80211_tx_control *ctl)
+static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
        struct iwl_priv *priv = hw->priv;
 
@@ -4281,9 +4198,9 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
        }
 
        IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
-                    ctl->tx_rate->bitrate);
+                    ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
-       if (iwl_tx_skb(priv, skb, ctl))
+       if (iwl_tx_skb(priv, skb))
                dev_kfree_skb_any(skb);
 
        IWL_DEBUG_MAC80211("leave\n");
@@ -5065,8 +4982,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
        IWL_DEBUG_MAC80211("leave\n");
 }
 
-static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
-                                struct ieee80211_tx_control *control)
+static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
        struct iwl_priv *priv = hw->priv;
        unsigned long flags;
@@ -5159,7 +5075,7 @@ static ssize_t show_version(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
        struct iwl_priv *priv = d->driver_data;
-       struct iwl4965_alive_resp *palive = &priv->card_alive;
+       struct iwl_alive_resp *palive = &priv->card_alive;
 
        if (palive->is_valid)
                return sprintf(buf, "fw version: 0x%01X.0x%01X.0x%01X.0x%01X\n"
@@ -5529,20 +5445,6 @@ static ssize_t show_status(struct device *d,
 
 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
-static ssize_t dump_error_log(struct device *d,
-                             struct device_attribute *attr,
-                             const char *buf, size_t count)
-{
-       char *p = (char *)buf;
-
-       if (p[0] == '1')
-               iwl4965_dump_nic_error_log((struct iwl_priv *)d->driver_data);
-
-       return strnlen(buf, count);
-}
-
-static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log);
-
 /*****************************************************************************
  *
  * driver setup and teardown
@@ -5565,8 +5467,8 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv)
        INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update);
        INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor);
        INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate);
-       INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start);
-       INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start);
+       INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start);
+       INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start);
        INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check);
 
        iwl4965_hw_setup_deferred_work(priv);
@@ -5588,7 +5490,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
 
 static struct attribute *iwl4965_sysfs_entries[] = {
        &dev_attr_channels.attr,
-       &dev_attr_dump_errors.attr,
        &dev_attr_flags.attr,
        &dev_attr_filter_flags.attr,
 #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
This page took 0.038579 seconds and 5 git commands to generate.