iwlwifi: changing irrelevant comment
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl4965-base.c
index 2e976c3881e652cdbb2b65a8eed4fe77dbf245fc..d0f948d2cfab2be71c66372654701b3f6a18ef7d 100644 (file)
@@ -54,7 +54,7 @@
 #include "iwl-calib.h"
 
 static int iwl4965_tx_queue_update_write_ptr(struct iwl_priv *priv,
-                                 struct iwl4965_tx_queue *txq);
+                                 struct iwl_tx_queue *txq);
 
 /******************************************************************************
  *
@@ -347,7 +347,7 @@ u8 iwl4965_add_station_flags(struct iwl_priv *priv, const u8 *addr,
  */
 int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
-       struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
+       struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
        struct iwl4965_queue *q = &txq->q;
        struct iwl_tfd_frame *tfd;
        u32 *control_flags;
@@ -1767,7 +1767,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
        struct iwl_tfd_frame *tfd;
        u32 *control_flags;
        int txq_id = ctl->queue;
-       struct iwl4965_tx_queue *txq = NULL;
+       struct iwl_tx_queue *txq = NULL;
        struct iwl4965_queue *q = NULL;
        dma_addr_t phys_addr;
        dma_addr_t txcmd_phys;
@@ -2331,7 +2331,7 @@ static void iwl4965_txstatus_to_ieee(struct iwl_priv *priv,
  */
 int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
 {
-       struct iwl4965_tx_queue *txq = &priv->txq[txq_id];
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct iwl4965_queue *q = &txq->q;
        int nfreed = 0;
 
@@ -2531,7 +2531,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
-       struct iwl4965_tx_queue *txq = &priv->txq[txq_id];
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct ieee80211_tx_status *tx_status;
        struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
        u32  status = le32_to_cpu(tx_resp->status);
@@ -2715,8 +2715,8 @@ static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv,
        struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif);
 
        if (!report->state) {
-               IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
-                         "Spectrum Measure Notification: Start\n");
+               IWL_DEBUG(IWL_DL_11H,
+                       "Spectrum Measure Notification: Start\n");
                return;
        }
 
@@ -3095,12 +3095,12 @@ void iwl_rx_handle(struct iwl_priv *priv)
 
        /* uCode's read index (stored in shared DRAM) indicates the last Rx
         * buffer that the driver may process (last buffer filled by ucode). */
-       r = iwl4965_hw_get_rx_read(priv);
+       r = priv->cfg->ops->lib->shared_mem_rx_idx(priv);
        i = rxq->read;
 
        /* Rx interrupt, but nothing sent from uCode */
        if (i == r)
-               IWL_DEBUG(IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d\n", r, i);
+               IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d\n", r, i);
 
        if (iwl_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2))
                fill_rx = 1;
@@ -3137,13 +3137,12 @@ void iwl_rx_handle(struct iwl_priv *priv)
                 *   handle those that need handling via function in
                 *   rx_handlers table.  See iwl4965_setup_rx_handlers() */
                if (priv->rx_handlers[pkt->hdr.cmd]) {
-                       IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
-                               "r = %d, i = %d, %s, 0x%02x\n", r, i,
-                               get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
+                       IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r,
+                               i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
                        priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
                } else {
                        /* No handling needed */
-                       IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
+                       IWL_DEBUG(IWL_DL_RX,
                                "r %d i %d No handler needed for %s, 0x%02x\n",
                                r, i, get_cmd_string(pkt->hdr.cmd),
                                pkt->hdr.cmd);
@@ -3273,7 +3272,7 @@ int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm)
  * iwl4965_tx_queue_update_write_ptr - Send new write index to hardware
  */
 static int iwl4965_tx_queue_update_write_ptr(struct iwl_priv *priv,
-                                 struct iwl4965_tx_queue *txq)
+                                 struct iwl_tx_queue *txq)
 {
        u32 reg = 0;
        int rc = 0;
@@ -3562,7 +3561,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
        clear_bit(STATUS_READY, &priv->status);
 
        if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
+               IWL_DEBUG(IWL_DL_FW_ERRORS,
                          "Restarting adapter due to uCode error.\n");
 
                if (iwl_is_associated(priv)) {
@@ -3570,7 +3569,8 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
                               sizeof(priv->recovery_rxon));
                        priv->error_recovering = 1;
                }
-               queue_work(priv->workqueue, &priv->restart);
+               if (priv->cfg->mod_params->restart_fw)
+                       queue_work(priv->workqueue, &priv->restart);
        }
 }
 
@@ -3670,8 +3670,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
                                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
                        hw_rf_kill = 1;
 
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL | IWL_DL_ISR,
-                               "RF_KILL bit toggled to %s.\n",
+               IWL_DEBUG(IWL_DL_RF_KILL, "RF_KILL bit toggled to %s.\n",
                                hw_rf_kill ? "disable radio":"enable radio");
 
                /* Queue restart only if RF_KILL switch was set to "kill"
@@ -4516,7 +4515,7 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
        mutex_lock(&priv->mutex);
 
        if (!iwl_is_rfkill(priv)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
+               IWL_DEBUG(IWL_DL_RF_KILL,
                          "HW and/or SW RF Kill no longer active, restarting "
                          "device\n");
                if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -4539,6 +4538,24 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
        mutex_unlock(&priv->mutex);
 }
 
+static void iwl4965_bg_set_monitor(struct work_struct *work)
+{
+       struct iwl_priv *priv = container_of(work,
+                               struct iwl_priv, set_monitor);
+
+       IWL_DEBUG(IWL_DL_STATE, "setting monitor mode\n");
+
+       mutex_lock(&priv->mutex);
+
+       if (!iwl_is_ready(priv))
+               IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n");
+       else
+               if (iwl4965_set_mode(priv, IEEE80211_IF_TYPE_MNTR) != 0)
+                       IWL_ERROR("iwl4965_set_mode() failed\n");
+
+       mutex_unlock(&priv->mutex);
+}
+
 #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
 
 static void iwl4965_bg_scan_check(struct work_struct *data)
@@ -4552,9 +4569,9 @@ static void iwl4965_bg_scan_check(struct work_struct *data)
        mutex_lock(&priv->mutex);
        if (test_bit(STATUS_SCANNING, &priv->status) ||
            test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
-                         "Scan completion watchdog resetting adapter (%dms)\n",
-                         jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
+               IWL_DEBUG(IWL_DL_SCAN, "Scan completion watchdog resetting "
+                       "adapter (%dms)\n",
+                       jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
 
                if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
                        iwl4965_send_scan_abort(priv);
@@ -4955,7 +4972,7 @@ static void iwl4965_bg_scan_completed(struct work_struct *work)
        struct iwl_priv *priv =
            container_of(work, struct iwl_priv, scan_completed);
 
-       IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n");
+       IWL_DEBUG(IWL_DL_SCAN, "SCAN complete scan\n");
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -5428,7 +5445,22 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw,
         * XXX: dummy
         * see also iwl4965_connection_init_rx_config
         */
-       *total_flags = 0;
+       struct iwl_priv *priv = hw->priv;
+       int new_flags = 0;
+       if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+               if (*total_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+                       IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n",
+                                          IEEE80211_IF_TYPE_MNTR,
+                                          changed_flags, *total_flags);
+                       /* queue work 'cuz mac80211 is holding a lock which
+                        * prevents us from issuing (synchronous) f/w cmds */
+                       queue_work(priv->workqueue, &priv->set_monitor);
+                       new_flags &= FIF_PROMISC_IN_BSS |
+                                    FIF_OTHER_BSS |
+                                    FIF_ALLMULTI;
+               }
+       }
+       *total_flags = new_flags;
 }
 
 static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
@@ -5750,7 +5782,7 @@ static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw,
 {
        struct iwl_priv *priv = hw->priv;
        int i, avail;
-       struct iwl4965_tx_queue *txq;
+       struct iwl_tx_queue *txq;
        struct iwl4965_queue *q;
        unsigned long flags;
 
@@ -5930,13 +5962,18 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
  * See the level definitions in iwl for details.
  */
 
-static ssize_t show_debug_level(struct device_driver *d, char *buf)
+static ssize_t show_debug_level(struct device *d,
+                               struct device_attribute *attr, char *buf)
 {
-       return sprintf(buf, "0x%08X\n", iwl_debug_level);
+       struct iwl_priv *priv = d->driver_data;
+
+       return sprintf(buf, "0x%08X\n", priv->debug_level);
 }
-static ssize_t store_debug_level(struct device_driver *d,
+static ssize_t store_debug_level(struct device *d,
+                               struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
+       struct iwl_priv *priv = d->driver_data;
        char *p = (char *)buf;
        u32 val;
 
@@ -5945,17 +5982,37 @@ static ssize_t store_debug_level(struct device_driver *d,
                printk(KERN_INFO DRV_NAME
                       ": %s is not in hex or decimal form.\n", buf);
        else
-               iwl_debug_level = val;
+               priv->debug_level = val;
 
        return strnlen(buf, count);
 }
 
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
-                  show_debug_level, store_debug_level);
+static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
+                       show_debug_level, store_debug_level);
+
 
 #endif /* CONFIG_IWLWIFI_DEBUG */
 
 
+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;
+
+       if (palive->is_valid)
+               return sprintf(buf, "fw version: 0x%01X.0x%01X.0x%01X.0x%01X\n"
+                                   "fw type: 0x%01X 0x%01X\n",
+                               palive->ucode_major, palive->ucode_minor,
+                               palive->sw_rev[0], palive->sw_rev[1],
+                               palive->ver_type, palive->ver_subtype);
+
+       else
+               return sprintf(buf, "fw not loaded\n");
+}
+
+static DEVICE_ATTR(version, S_IWUSR | S_IRUGO, show_version, NULL);
+
 static ssize_t show_temperature(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
@@ -6359,6 +6416,7 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv)
        INIT_WORK(&priv->abort_scan, iwl4965_bg_abort_scan);
        INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill);
        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);
@@ -6397,6 +6455,10 @@ static struct attribute *iwl4965_sysfs_entries[] = {
        &dev_attr_status.attr,
        &dev_attr_temperature.attr,
        &dev_attr_tx_power.attr,
+#ifdef CONFIG_IWLWIFI_DEBUG
+       &dev_attr_debug_level.attr,
+#endif
+       &dev_attr_version.attr,
 
        NULL
 };
@@ -6543,7 +6605,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        if (err)
                goto out_iounmap;
 
-       /* MAC Address location in EEPROM same for 3945/4965 */
+       /* extract MAC Address */
        iwl_eeprom_get_mac(priv, priv->mac_addr);
        IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));
        SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
@@ -6783,18 +6845,11 @@ static int __init iwl4965_init(void)
                IWL_ERROR("Unable to initialize PCI module\n");
                goto error_register;
        }
-#ifdef CONFIG_IWLWIFI_DEBUG
-       ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level);
-       if (ret) {
-               IWL_ERROR("Unable to create driver sysfs file\n");
-               goto error_debug;
-       }
-#endif
 
        return ret;
 
+
 #ifdef CONFIG_IWLWIFI_DEBUG
-error_debug:
        pci_unregister_driver(&iwl_driver);
 #endif
 error_register:
@@ -6804,9 +6859,6 @@ error_register:
 
 static void __exit iwl4965_exit(void)
 {
-#ifdef CONFIG_IWLWIFI_DEBUG
-       driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level);
-#endif
        pci_unregister_driver(&iwl_driver);
        iwl4965_rate_control_unregister();
 }
This page took 0.044885 seconds and 5 git commands to generate.