iwlwifi: print rx_on config to help debug
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-agn.c
index 0cb95bf..1710815 100644 (file)
@@ -133,6 +133,7 @@ int iwl_commit_rxon(struct iwl_priv *priv)
                }
 
                memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
+               iwl_print_rx_config_cmd(priv);
                return 0;
        }
 
@@ -190,11 +191,7 @@ int iwl_commit_rxon(struct iwl_priv *priv)
        priv->start_calib = 0;
 
        /* Add the broadcast address so we can send broadcast frames */
-       if (iwl_rxon_add_station(priv, iwl_bcast_addr, 0) ==
-                                               IWL_INVALID_STATION) {
-               IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n");
-               return -EIO;
-       }
+       iwl_add_bcast_station(priv);
 
        /* If we have set the ASSOC_MSK and we are in BSS mode then
         * add the IWL_AP_ID to the station rate table */
@@ -232,6 +229,7 @@ int iwl_commit_rxon(struct iwl_priv *priv)
                }
                memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
        }
+       iwl_print_rx_config_cmd(priv);
 
        iwl_init_sensitivity(priv);
 
@@ -2524,7 +2522,7 @@ void iwl_config_ap(struct iwl_priv *priv)
                spin_lock_irqsave(&priv->lock, flags);
                iwl_activate_qos(priv, 1);
                spin_unlock_irqrestore(&priv->lock, flags);
-               iwl_rxon_add_station(priv, iwl_bcast_addr, 0);
+               iwl_add_bcast_station(priv);
        }
        iwl_send_beacon_cmd(priv);
 
@@ -2972,6 +2970,100 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
        del_timer_sync(&priv->statistics_periodic);
 }
 
+static void iwl_init_hw_rates(struct iwl_priv *priv,
+                             struct ieee80211_rate *rates)
+{
+       int i;
+
+       for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) {
+               rates[i].bitrate = iwl_rates[i].ieee * 5;
+               rates[i].hw_value = i; /* Rate scaling will work on indexes */
+               rates[i].hw_value_short = i;
+               rates[i].flags = 0;
+               if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) {
+                       /*
+                        * If CCK != 1M then set short preamble rate flag.
+                        */
+                       rates[i].flags |=
+                               (iwl_rates[i].plcp == IWL_RATE_1M_PLCP) ?
+                                       0 : IEEE80211_RATE_SHORT_PREAMBLE;
+               }
+       }
+}
+
+static int iwl_init_drv(struct iwl_priv *priv)
+{
+       int ret;
+
+       priv->ibss_beacon = NULL;
+
+       spin_lock_init(&priv->lock);
+       spin_lock_init(&priv->sta_lock);
+       spin_lock_init(&priv->hcmd_lock);
+
+       INIT_LIST_HEAD(&priv->free_frames);
+
+       mutex_init(&priv->mutex);
+
+       /* Clear the driver's (not device's) station table */
+       iwl_clear_stations_table(priv);
+
+       priv->ieee_channels = NULL;
+       priv->ieee_rates = NULL;
+       priv->band = IEEE80211_BAND_2GHZ;
+
+       priv->iw_mode = NL80211_IFTYPE_STATION;
+       if (priv->cfg->support_sm_ps)
+               priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DYNAMIC;
+       else
+               priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED;
+
+       /* Choose which receivers/antennas to use */
+       if (priv->cfg->ops->hcmd->set_rxon_chain)
+               priv->cfg->ops->hcmd->set_rxon_chain(priv);
+
+       iwl_init_scan_params(priv);
+
+       iwl_reset_qos(priv);
+
+       priv->qos_data.qos_active = 0;
+       priv->qos_data.qos_cap.val = 0;
+
+       priv->rates_mask = IWL_RATES_MASK;
+       /* Set the tx_power_user_lmt to the lowest power level
+        * this value will get overwritten by channel max power avg
+        * from eeprom */
+       priv->tx_power_user_lmt = IWL_TX_POWER_TARGET_POWER_MIN;
+
+       ret = iwl_init_channel_map(priv);
+       if (ret) {
+               IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
+               goto err;
+       }
+
+       ret = iwlcore_init_geos(priv);
+       if (ret) {
+               IWL_ERR(priv, "initializing geos failed: %d\n", ret);
+               goto err_free_channel_map;
+       }
+       iwl_init_hw_rates(priv, priv->ieee_rates);
+
+       return 0;
+
+err_free_channel_map:
+       iwl_free_channel_map(priv);
+err:
+       return ret;
+}
+
+static void iwl_uninit_drv(struct iwl_priv *priv)
+{
+       iwl_calib_free_results(priv);
+       iwlcore_free_geos(priv);
+       iwl_free_channel_map(priv);
+       kfree(priv->scan);
+}
+
 static struct attribute *iwl_sysfs_entries[] = {
        &dev_attr_flags.attr,
        &dev_attr_filter_flags.attr,