aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c69
1 files changed, 33 insertions, 36 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 6b42ea2a1f1d..f6c1489a0c4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -551,7 +551,8 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
551 priv->rxon_timing.atim_window = 0; 551 priv->rxon_timing.atim_window = 0;
552 } else { 552 } else {
553 priv->rxon_timing.beacon_interval = 553 priv->rxon_timing.beacon_interval =
554 iwl3945_adjust_beacon_interval(conf->beacon_int); 554 iwl3945_adjust_beacon_interval(
555 priv->vif->bss_conf.beacon_int);
555 /* TODO: we need to get atim_window from upper stack 556 /* TODO: we need to get atim_window from upper stack
556 * for now we set to 0 */ 557 * for now we set to 0 */
557 priv->rxon_timing.atim_window = 0; 558 priv->rxon_timing.atim_window = 0;
@@ -1343,15 +1344,24 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
1343 struct list_head *element; 1344 struct list_head *element;
1344 struct iwl_rx_mem_buffer *rxb; 1345 struct iwl_rx_mem_buffer *rxb;
1345 unsigned long flags; 1346 unsigned long flags;
1346 spin_lock_irqsave(&rxq->lock, flags); 1347
1347 while (!list_empty(&rxq->rx_used)) { 1348 while (1) {
1349 spin_lock_irqsave(&rxq->lock, flags);
1350
1351 if (list_empty(&rxq->rx_used)) {
1352 spin_unlock_irqrestore(&rxq->lock, flags);
1353 return;
1354 }
1355
1348 element = rxq->rx_used.next; 1356 element = rxq->rx_used.next;
1349 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 1357 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1358 list_del(element);
1359 spin_unlock_irqrestore(&rxq->lock, flags);
1350 1360
1351 /* Alloc a new receive buffer */ 1361 /* Alloc a new receive buffer */
1352 rxb->skb = 1362 rxb->skb =
1353 alloc_skb(priv->hw_params.rx_buf_size, 1363 alloc_skb(priv->hw_params.rx_buf_size,
1354 __GFP_NOWARN | GFP_ATOMIC); 1364 GFP_KERNEL);
1355 if (!rxb->skb) { 1365 if (!rxb->skb) {
1356 if (net_ratelimit()) 1366 if (net_ratelimit())
1357 IWL_CRIT(priv, ": Can not allocate SKB buffers\n"); 1367 IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
@@ -1369,18 +1379,18 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
1369 */ 1379 */
1370 skb_reserve(rxb->skb, 4); 1380 skb_reserve(rxb->skb, 4);
1371 1381
1372 priv->alloc_rxb_skb++;
1373 list_del(element);
1374
1375 /* Get physical address of RB/SKB */ 1382 /* Get physical address of RB/SKB */
1376 rxb->real_dma_addr = pci_map_single(priv->pci_dev, 1383 rxb->real_dma_addr = pci_map_single(priv->pci_dev,
1377 rxb->skb->data, 1384 rxb->skb->data,
1378 priv->hw_params.rx_buf_size, 1385 priv->hw_params.rx_buf_size,
1379 PCI_DMA_FROMDEVICE); 1386 PCI_DMA_FROMDEVICE);
1387
1388 spin_lock_irqsave(&rxq->lock, flags);
1380 list_add_tail(&rxb->list, &rxq->rx_free); 1389 list_add_tail(&rxb->list, &rxq->rx_free);
1390 priv->alloc_rxb_skb++;
1381 rxq->free_count++; 1391 rxq->free_count++;
1392 spin_unlock_irqrestore(&rxq->lock, flags);
1382 } 1393 }
1383 spin_unlock_irqrestore(&rxq->lock, flags);
1384} 1394}
1385 1395
1386void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 1396void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
@@ -1413,18 +1423,6 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1413 spin_unlock_irqrestore(&rxq->lock, flags); 1423 spin_unlock_irqrestore(&rxq->lock, flags);
1414} 1424}
1415 1425
1416/*
1417 * this should be called while priv->lock is locked
1418 */
1419static void __iwl3945_rx_replenish(void *data)
1420{
1421 struct iwl_priv *priv = data;
1422
1423 iwl3945_rx_allocate(priv);
1424 iwl3945_rx_queue_restock(priv);
1425}
1426
1427
1428void iwl3945_rx_replenish(void *data) 1426void iwl3945_rx_replenish(void *data)
1429{ 1427{
1430 struct iwl_priv *priv = data; 1428 struct iwl_priv *priv = data;
@@ -1642,7 +1640,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1642 count++; 1640 count++;
1643 if (count >= 8) { 1641 if (count >= 8) {
1644 priv->rxq.read = i; 1642 priv->rxq.read = i;
1645 __iwl3945_rx_replenish(priv); 1643 iwl3945_rx_queue_restock(priv);
1646 count = 0; 1644 count = 0;
1647 } 1645 }
1648 } 1646 }
@@ -3596,7 +3594,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3596static ssize_t show_debug_level(struct device *d, 3594static ssize_t show_debug_level(struct device *d,
3597 struct device_attribute *attr, char *buf) 3595 struct device_attribute *attr, char *buf)
3598{ 3596{
3599 struct iwl_priv *priv = d->driver_data; 3597 struct iwl_priv *priv = dev_get_drvdata(d);
3600 3598
3601 return sprintf(buf, "0x%08X\n", priv->debug_level); 3599 return sprintf(buf, "0x%08X\n", priv->debug_level);
3602} 3600}
@@ -3604,7 +3602,7 @@ static ssize_t store_debug_level(struct device *d,
3604 struct device_attribute *attr, 3602 struct device_attribute *attr,
3605 const char *buf, size_t count) 3603 const char *buf, size_t count)
3606{ 3604{
3607 struct iwl_priv *priv = d->driver_data; 3605 struct iwl_priv *priv = dev_get_drvdata(d);
3608 unsigned long val; 3606 unsigned long val;
3609 int ret; 3607 int ret;
3610 3608
@@ -3625,7 +3623,7 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
3625static ssize_t show_temperature(struct device *d, 3623static ssize_t show_temperature(struct device *d,
3626 struct device_attribute *attr, char *buf) 3624 struct device_attribute *attr, char *buf)
3627{ 3625{
3628 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3626 struct iwl_priv *priv = dev_get_drvdata(d);
3629 3627
3630 if (!iwl_is_alive(priv)) 3628 if (!iwl_is_alive(priv))
3631 return -EAGAIN; 3629 return -EAGAIN;
@@ -3638,7 +3636,7 @@ static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
3638static ssize_t show_tx_power(struct device *d, 3636static ssize_t show_tx_power(struct device *d,
3639 struct device_attribute *attr, char *buf) 3637 struct device_attribute *attr, char *buf)
3640{ 3638{
3641 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3639 struct iwl_priv *priv = dev_get_drvdata(d);
3642 return sprintf(buf, "%d\n", priv->tx_power_user_lmt); 3640 return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
3643} 3641}
3644 3642
@@ -3646,7 +3644,7 @@ static ssize_t store_tx_power(struct device *d,
3646 struct device_attribute *attr, 3644 struct device_attribute *attr,
3647 const char *buf, size_t count) 3645 const char *buf, size_t count)
3648{ 3646{
3649 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3647 struct iwl_priv *priv = dev_get_drvdata(d);
3650 char *p = (char *)buf; 3648 char *p = (char *)buf;
3651 u32 val; 3649 u32 val;
3652 3650
@@ -3664,7 +3662,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
3664static ssize_t show_flags(struct device *d, 3662static ssize_t show_flags(struct device *d,
3665 struct device_attribute *attr, char *buf) 3663 struct device_attribute *attr, char *buf)
3666{ 3664{
3667 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3665 struct iwl_priv *priv = dev_get_drvdata(d);
3668 3666
3669 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); 3667 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
3670} 3668}
@@ -3673,7 +3671,7 @@ static ssize_t store_flags(struct device *d,
3673 struct device_attribute *attr, 3671 struct device_attribute *attr,
3674 const char *buf, size_t count) 3672 const char *buf, size_t count)
3675{ 3673{
3676 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3674 struct iwl_priv *priv = dev_get_drvdata(d);
3677 u32 flags = simple_strtoul(buf, NULL, 0); 3675 u32 flags = simple_strtoul(buf, NULL, 0);
3678 3676
3679 mutex_lock(&priv->mutex); 3677 mutex_lock(&priv->mutex);
@@ -3698,7 +3696,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
3698static ssize_t show_filter_flags(struct device *d, 3696static ssize_t show_filter_flags(struct device *d,
3699 struct device_attribute *attr, char *buf) 3697 struct device_attribute *attr, char *buf)
3700{ 3698{
3701 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3699 struct iwl_priv *priv = dev_get_drvdata(d);
3702 3700
3703 return sprintf(buf, "0x%04X\n", 3701 return sprintf(buf, "0x%04X\n",
3704 le32_to_cpu(priv->active_rxon.filter_flags)); 3702 le32_to_cpu(priv->active_rxon.filter_flags));
@@ -3708,7 +3706,7 @@ static ssize_t store_filter_flags(struct device *d,
3708 struct device_attribute *attr, 3706 struct device_attribute *attr,
3709 const char *buf, size_t count) 3707 const char *buf, size_t count)
3710{ 3708{
3711 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3709 struct iwl_priv *priv = dev_get_drvdata(d);
3712 u32 filter_flags = simple_strtoul(buf, NULL, 0); 3710 u32 filter_flags = simple_strtoul(buf, NULL, 0);
3713 3711
3714 mutex_lock(&priv->mutex); 3712 mutex_lock(&priv->mutex);
@@ -3993,7 +3991,7 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
3993static ssize_t show_status(struct device *d, 3991static ssize_t show_status(struct device *d,
3994 struct device_attribute *attr, char *buf) 3992 struct device_attribute *attr, char *buf)
3995{ 3993{
3996 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 3994 struct iwl_priv *priv = dev_get_drvdata(d);
3997 if (!iwl_is_alive(priv)) 3995 if (!iwl_is_alive(priv))
3998 return -EAGAIN; 3996 return -EAGAIN;
3999 return sprintf(buf, "0x%08x\n", (int)priv->status); 3997 return sprintf(buf, "0x%08x\n", (int)priv->status);
@@ -4005,10 +4003,11 @@ static ssize_t dump_error_log(struct device *d,
4005 struct device_attribute *attr, 4003 struct device_attribute *attr,
4006 const char *buf, size_t count) 4004 const char *buf, size_t count)
4007{ 4005{
4006 struct iwl_priv *priv = dev_get_drvdata(d);
4008 char *p = (char *)buf; 4007 char *p = (char *)buf;
4009 4008
4010 if (p[0] == '1') 4009 if (p[0] == '1')
4011 iwl3945_dump_nic_error_log((struct iwl_priv *)d->driver_data); 4010 iwl3945_dump_nic_error_log(priv);
4012 4011
4013 return strnlen(buf, count); 4012 return strnlen(buf, count);
4014} 4013}
@@ -4019,10 +4018,11 @@ static ssize_t dump_event_log(struct device *d,
4019 struct device_attribute *attr, 4018 struct device_attribute *attr,
4020 const char *buf, size_t count) 4019 const char *buf, size_t count)
4021{ 4020{
4021 struct iwl_priv *priv = dev_get_drvdata(d);
4022 char *p = (char *)buf; 4022 char *p = (char *)buf;
4023 4023
4024 if (p[0] == '1') 4024 if (p[0] == '1')
4025 iwl3945_dump_nic_event_log((struct iwl_priv *)d->driver_data); 4025 iwl3945_dump_nic_event_log(priv);
4026 4026
4027 return strnlen(buf, count); 4027 return strnlen(buf, count);
4028} 4028}
@@ -4104,7 +4104,6 @@ static struct ieee80211_ops iwl3945_hw_ops = {
4104 .add_interface = iwl_mac_add_interface, 4104 .add_interface = iwl_mac_add_interface,
4105 .remove_interface = iwl_mac_remove_interface, 4105 .remove_interface = iwl_mac_remove_interface,
4106 .config = iwl_mac_config, 4106 .config = iwl_mac_config,
4107 .config_interface = iwl_mac_config_interface,
4108 .configure_filter = iwl_configure_filter, 4107 .configure_filter = iwl_configure_filter,
4109 .set_key = iwl3945_mac_set_key, 4108 .set_key = iwl3945_mac_set_key,
4110 .get_tx_stats = iwl_mac_get_tx_stats, 4109 .get_tx_stats = iwl_mac_get_tx_stats,
@@ -4210,8 +4209,6 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
4210 /* Default value; 4 EDCA QOS priorities */ 4209 /* Default value; 4 EDCA QOS priorities */
4211 hw->queues = 4; 4210 hw->queues = 4;
4212 4211
4213 hw->conf.beacon_int = 100;
4214
4215 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 4212 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
4216 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 4213 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
4217 &priv->bands[IEEE80211_BAND_2GHZ]; 4214 &priv->bands[IEEE80211_BAND_2GHZ];