aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-24 10:46:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-24 10:46:51 -0400
commit3e241ff0c57cb610301009fe8c3b9da4c6877800 (patch)
tree9663c4ebd8e431a052675b19585e1cc9471b2ef3 /drivers/net
parentdc0046c7586da5db7561dd8b8e09b40d29ade5fa (diff)
parent29fe1b481283a1bada994a69f65736db4ae6f35f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (94 commits) netfilter: ctnetlink: fix gcc warning during compilation net/netrom: Fix socket locking netlabel: Always remove the correct address selector ucc_geth.c: Fix upsmr setting in RMII mode 8139too: fix HW initial flow af_iucv: Fix race when queuing incoming iucv messages af_iucv: Test additional sk states in iucv_sock_shutdown af_iucv: Reject incoming msgs if RECV_SHUTDOWN is set af_iucv: fix oops in iucv_sock_recvmsg() for MSG_PEEK flag af_iucv: consider state IUCV_CLOSING when closing a socket iwlwifi: DMA fixes iwlwifi: add debugging for TX path mwl8: fix build warning. mac80211: fix alignment calculation bug mac80211: do not print WARN if config interface iwl3945: use cancel_delayed_work_sync to cancel rfkill_poll iwlwifi: fix EEPROM validation mask to include OTP only devices atmel: fix netdev ops conversion pcnet_cs: add cis(firmware) of the Allied Telesis LA-PCM mlx4_en: Fix cleanup if workqueue create in mlx4_en_add() fails ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/8139too.c10
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c44
-rw-r--r--drivers/net/cxgb3/t3_hw.c11
-rw-r--r--drivers/net/e1000/e1000_main.c6
-rw-r--r--drivers/net/e1000e/netdev.c8
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.c28
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c54
-rw-r--r--drivers/net/macb.c28
-rw-r--r--drivers/net/macvlan.c9
-rw-r--r--drivers/net/mlx4/en_main.c5
-rw-r--r--drivers/net/mlx4/en_netdev.c21
-rw-r--r--drivers/net/mlx4/en_port.c45
-rw-r--r--drivers/net/mlx4/en_resources.c6
-rw-r--r--drivers/net/mlx4/en_rx.c12
-rw-r--r--drivers/net/mlx4/en_tx.c1
-rw-r--r--drivers/net/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/ps3_gelic_wireless.c3
-rw-r--r--drivers/net/tg3.c26
-rw-r--r--drivers/net/tun.c47
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/usb/pegasus.c1
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/ar9170/hw.h8
-rw-r--r--drivers/net/wireless/ar9170/usb.c114
-rw-r--r--drivers/net/wireless/at76c50x-usb.c2
-rw-r--r--drivers/net/wireless/ath9k/recv.c4
-rw-r--r--drivers/net/wireless/atmel.c1
-rw-r--r--drivers/net/wireless/b43/dma.c50
-rw-r--r--drivers/net/wireless/b43/main.c5
-rw-r--r--drivers/net/wireless/b43/phy_common.c16
-rw-r--r--drivers/net/wireless/b43/phy_common.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c99
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c152
-rw-r--r--drivers/net/wireless/libertas/rx.c2
-rw-r--r--drivers/net/wireless/mwl8k.c7
-rw-r--r--drivers/net/wireless/orinoco/hw.c8
-rw-r--r--drivers/net/wireless/p54/p54.h12
-rw-r--r--drivers/net/wireless/p54/p54common.c2
-rw-r--r--drivers/net/wireless/p54/p54spi.c25
-rw-r--r--drivers/net/wireless/p54/p54usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
51 files changed, 571 insertions, 380 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 29df398b7727..1fc45431a620 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1383,6 +1383,11 @@ static void rtl8139_hw_start (struct net_device *dev)
1383 RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); 1383 RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
1384 RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4))); 1384 RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4)));
1385 1385
1386 tp->cur_rx = 0;
1387
1388 /* init Rx ring buffer DMA address */
1389 RTL_W32_F (RxBuf, tp->rx_ring_dma);
1390
1386 /* Must enable Tx/Rx before setting transfer thresholds! */ 1391 /* Must enable Tx/Rx before setting transfer thresholds! */
1387 RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb); 1392 RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb);
1388 1393
@@ -1390,8 +1395,6 @@ static void rtl8139_hw_start (struct net_device *dev)
1390 RTL_W32 (RxConfig, tp->rx_config); 1395 RTL_W32 (RxConfig, tp->rx_config);
1391 RTL_W32 (TxConfig, rtl8139_tx_config); 1396 RTL_W32 (TxConfig, rtl8139_tx_config);
1392 1397
1393 tp->cur_rx = 0;
1394
1395 rtl_check_media (dev, 1); 1398 rtl_check_media (dev, 1);
1396 1399
1397 if (tp->chipset >= CH_8139B) { 1400 if (tp->chipset >= CH_8139B) {
@@ -1406,9 +1409,6 @@ static void rtl8139_hw_start (struct net_device *dev)
1406 /* Lock Config[01234] and BMCR register writes */ 1409 /* Lock Config[01234] and BMCR register writes */
1407 RTL_W8 (Cfg9346, Cfg9346_Lock); 1410 RTL_W8 (Cfg9346, Cfg9346_Lock);
1408 1411
1409 /* init Rx ring buffer DMA address */
1410 RTL_W32_F (RxBuf, tp->rx_ring_dma);
1411
1412 /* init Tx buffer DMA addresses */ 1412 /* init Tx buffer DMA addresses */
1413 for (i = 0; i < NUM_TX_DESC; i++) 1413 for (i = 0; i < NUM_TX_DESC; i++)
1414 RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); 1414 RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs));
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9e921544ba20..214a92d1ef75 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -28,9 +28,9 @@ if NETDEVICES
28 28
29config COMPAT_NET_DEV_OPS 29config COMPAT_NET_DEV_OPS
30 default y 30 default y
31 bool "Enable older network device API compatiablity" 31 bool "Enable older network device API compatibility"
32 ---help--- 32 ---help---
33 This option enables kernel compatiability with older network devices 33 This option enables kernel compatibility with older network devices
34 that do not use net_device_ops interface. 34 that do not use net_device_ops interface.
35 35
36 If unsure, say Y. 36 If unsure, say Y.
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index ab0e5febef83..7ea48414c6cb 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1117,8 +1117,8 @@ static void cxgb_down(struct adapter *adapter)
1117 spin_unlock_irq(&adapter->work_lock); 1117 spin_unlock_irq(&adapter->work_lock);
1118 1118
1119 free_irq_resources(adapter); 1119 free_irq_resources(adapter);
1120 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */
1121 quiesce_rx(adapter); 1120 quiesce_rx(adapter);
1121 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */
1122} 1122}
1123 1123
1124static void schedule_chk_task(struct adapter *adap) 1124static void schedule_chk_task(struct adapter *adap)
@@ -1187,6 +1187,9 @@ static int offload_close(struct t3cdev *tdev)
1187 1187
1188 sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group); 1188 sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group);
1189 1189
1190 /* Flush work scheduled while releasing TIDs */
1191 flush_scheduled_work();
1192
1190 tdev->lldev = NULL; 1193 tdev->lldev = NULL;
1191 cxgb3_set_dummy_ops(tdev); 1194 cxgb3_set_dummy_ops(tdev);
1192 t3_tp_set_offload_mode(adapter, 0); 1195 t3_tp_set_offload_mode(adapter, 0);
@@ -1232,6 +1235,10 @@ static int cxgb_close(struct net_device *dev)
1232 struct port_info *pi = netdev_priv(dev); 1235 struct port_info *pi = netdev_priv(dev);
1233 struct adapter *adapter = pi->adapter; 1236 struct adapter *adapter = pi->adapter;
1234 1237
1238
1239 if (!adapter->open_device_map)
1240 return 0;
1241
1235 /* Stop link fault interrupts */ 1242 /* Stop link fault interrupts */
1236 t3_xgm_intr_disable(adapter, pi->port_id); 1243 t3_xgm_intr_disable(adapter, pi->port_id);
1237 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); 1244 t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset);
@@ -1247,8 +1254,7 @@ static int cxgb_close(struct net_device *dev)
1247 spin_unlock_irq(&adapter->work_lock); 1254 spin_unlock_irq(&adapter->work_lock);
1248 1255
1249 if (!(adapter->open_device_map & PORT_MASK)) 1256 if (!(adapter->open_device_map & PORT_MASK))
1250 cancel_rearming_delayed_workqueue(cxgb3_wq, 1257 cancel_delayed_work_sync(&adapter->adap_check_task);
1251 &adapter->adap_check_task);
1252 1258
1253 if (!adapter->open_device_map) 1259 if (!adapter->open_device_map)
1254 cxgb_down(adapter); 1260 cxgb_down(adapter);
@@ -2493,6 +2499,7 @@ static void check_link_status(struct adapter *adapter)
2493 2499
2494 spin_lock_irq(&adapter->work_lock); 2500 spin_lock_irq(&adapter->work_lock);
2495 if (p->link_fault) { 2501 if (p->link_fault) {
2502 t3_link_fault(adapter, i);
2496 spin_unlock_irq(&adapter->work_lock); 2503 spin_unlock_irq(&adapter->work_lock);
2497 continue; 2504 continue;
2498 } 2505 }
@@ -2554,9 +2561,7 @@ static void t3_adap_check_task(struct work_struct *work)
2554 2561
2555 adapter->check_task_cnt++; 2562 adapter->check_task_cnt++;
2556 2563
2557 /* Check link status for PHYs without interrupts */ 2564 check_link_status(adapter);
2558 if (p->linkpoll_period)
2559 check_link_status(adapter);
2560 2565
2561 /* Accumulate MAC stats if needed */ 2566 /* Accumulate MAC stats if needed */
2562 if (!p->linkpoll_period || 2567 if (!p->linkpoll_period ||
@@ -2680,21 +2685,6 @@ void t3_os_ext_intr_handler(struct adapter *adapter)
2680 spin_unlock(&adapter->work_lock); 2685 spin_unlock(&adapter->work_lock);
2681} 2686}
2682 2687
2683static void link_fault_task(struct work_struct *work)
2684{
2685 struct adapter *adapter = container_of(work, struct adapter,
2686 link_fault_handler_task);
2687 int i;
2688
2689 for_each_port(adapter, i) {
2690 struct net_device *netdev = adapter->port[i];
2691 struct port_info *pi = netdev_priv(netdev);
2692
2693 if (pi->link_fault)
2694 t3_link_fault(adapter, i);
2695 }
2696}
2697
2698void t3_os_link_fault_handler(struct adapter *adapter, int port_id) 2688void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
2699{ 2689{
2700 struct net_device *netdev = adapter->port[port_id]; 2690 struct net_device *netdev = adapter->port[port_id];
@@ -2702,7 +2692,6 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id)
2702 2692
2703 spin_lock(&adapter->work_lock); 2693 spin_lock(&adapter->work_lock);
2704 pi->link_fault = 1; 2694 pi->link_fault = 1;
2705 queue_work(cxgb3_wq, &adapter->link_fault_handler_task);
2706 spin_unlock(&adapter->work_lock); 2695 spin_unlock(&adapter->work_lock);
2707} 2696}
2708 2697
@@ -2838,6 +2827,9 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
2838 struct adapter *adapter = pci_get_drvdata(pdev); 2827 struct adapter *adapter = pci_get_drvdata(pdev);
2839 int ret; 2828 int ret;
2840 2829
2830 if (state == pci_channel_io_perm_failure)
2831 return PCI_ERS_RESULT_DISCONNECT;
2832
2841 ret = t3_adapter_error(adapter, 0); 2833 ret = t3_adapter_error(adapter, 0);
2842 2834
2843 /* Request a slot reset. */ 2835 /* Request a slot reset. */
@@ -2932,8 +2924,13 @@ static int __devinit cxgb_enable_msix(struct adapter *adap)
2932 while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0) 2924 while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
2933 vectors = err; 2925 vectors = err;
2934 2926
2935 if (!err && vectors < (adap->params.nports + 1)) 2927 if (err < 0)
2928 pci_disable_msix(adap->pdev);
2929
2930 if (!err && vectors < (adap->params.nports + 1)) {
2931 pci_disable_msix(adap->pdev);
2936 err = -1; 2932 err = -1;
2933 }
2937 2934
2938 if (!err) { 2935 if (!err) {
2939 for (i = 0; i < vectors; ++i) 2936 for (i = 0; i < vectors; ++i)
@@ -3082,7 +3079,6 @@ static int __devinit init_one(struct pci_dev *pdev,
3082 3079
3083 INIT_LIST_HEAD(&adapter->adapter_list); 3080 INIT_LIST_HEAD(&adapter->adapter_list);
3084 INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task); 3081 INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task);
3085 INIT_WORK(&adapter->link_fault_handler_task, link_fault_task);
3086 INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task); 3082 INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task);
3087 INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task); 3083 INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task);
3088 3084
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 31ed31a3428b..e1bd690ff831 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1202,7 +1202,6 @@ void t3_link_changed(struct adapter *adapter, int port_id)
1202 struct cphy *phy = &pi->phy; 1202 struct cphy *phy = &pi->phy;
1203 struct cmac *mac = &pi->mac; 1203 struct cmac *mac = &pi->mac;
1204 struct link_config *lc = &pi->link_config; 1204 struct link_config *lc = &pi->link_config;
1205 int force_link_down = 0;
1206 1205
1207 phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); 1206 phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc);
1208 1207
@@ -1218,14 +1217,9 @@ void t3_link_changed(struct adapter *adapter, int port_id)
1218 status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset); 1217 status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset);
1219 if (status & F_LINKFAULTCHANGE) { 1218 if (status & F_LINKFAULTCHANGE) {
1220 mac->stats.link_faults++; 1219 mac->stats.link_faults++;
1221 force_link_down = 1; 1220 pi->link_fault = 1;
1222 } 1221 }
1223 t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low); 1222 t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low);
1224
1225 if (force_link_down) {
1226 t3_os_link_fault_handler(adapter, port_id);
1227 return;
1228 }
1229 } 1223 }
1230 1224
1231 if (lc->requested_fc & PAUSE_AUTONEG) 1225 if (lc->requested_fc & PAUSE_AUTONEG)
@@ -1292,9 +1286,6 @@ void t3_link_fault(struct adapter *adapter, int port_id)
1292 /* Account link faults only when the phy reports a link up */ 1286 /* Account link faults only when the phy reports a link up */
1293 if (link_ok) 1287 if (link_ok)
1294 mac->stats.link_faults++; 1288 mac->stats.link_faults++;
1295
1296 msleep(1000);
1297 t3_os_link_fault_handler(adapter, port_id);
1298 } else { 1289 } else {
1299 if (link_ok) 1290 if (link_ok)
1300 t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset, 1291 t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset,
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ef12931d302a..6a46ceed9436 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3834,7 +3834,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3834 struct e1000_buffer *buffer_info; 3834 struct e1000_buffer *buffer_info;
3835 unsigned int i, eop; 3835 unsigned int i, eop;
3836 unsigned int count = 0; 3836 unsigned int count = 0;
3837 bool cleaned = false;
3838 unsigned int total_tx_bytes=0, total_tx_packets=0; 3837 unsigned int total_tx_bytes=0, total_tx_packets=0;
3839 3838
3840 i = tx_ring->next_to_clean; 3839 i = tx_ring->next_to_clean;
@@ -3843,7 +3842,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3843 3842
3844 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && 3843 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
3845 (count < tx_ring->count)) { 3844 (count < tx_ring->count)) {
3846 for (cleaned = false; !cleaned; count++) { 3845 bool cleaned = false;
3846 for ( ; !cleaned; count++) {
3847 tx_desc = E1000_TX_DESC(*tx_ring, i); 3847 tx_desc = E1000_TX_DESC(*tx_ring, i);
3848 buffer_info = &tx_ring->buffer_info[i]; 3848 buffer_info = &tx_ring->buffer_info[i];
3849 cleaned = (i == eop); 3849 cleaned = (i == eop);
@@ -3871,7 +3871,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3871 tx_ring->next_to_clean = i; 3871 tx_ring->next_to_clean = i;
3872 3872
3873#define TX_WAKE_THRESHOLD 32 3873#define TX_WAKE_THRESHOLD 32
3874 if (unlikely(cleaned && netif_carrier_ok(netdev) && 3874 if (unlikely(count && netif_carrier_ok(netdev) &&
3875 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) { 3875 E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) {
3876 /* Make sure that anybody stopping the queue after this 3876 /* Make sure that anybody stopping the queue after this
3877 * sees the new next_to_clean. 3877 * sees the new next_to_clean.
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 1693ed116b16..ca82f19a7ed1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -621,7 +621,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
621 struct e1000_buffer *buffer_info; 621 struct e1000_buffer *buffer_info;
622 unsigned int i, eop; 622 unsigned int i, eop;
623 unsigned int count = 0; 623 unsigned int count = 0;
624 bool cleaned = false;
625 unsigned int total_tx_bytes = 0, total_tx_packets = 0; 624 unsigned int total_tx_bytes = 0, total_tx_packets = 0;
626 625
627 i = tx_ring->next_to_clean; 626 i = tx_ring->next_to_clean;
@@ -630,7 +629,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
630 629
631 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && 630 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
632 (count < tx_ring->count)) { 631 (count < tx_ring->count)) {
633 for (cleaned = 0; !cleaned; count++) { 632 bool cleaned = false;
633 for (; !cleaned; count++) {
634 tx_desc = E1000_TX_DESC(*tx_ring, i); 634 tx_desc = E1000_TX_DESC(*tx_ring, i);
635 buffer_info = &tx_ring->buffer_info[i]; 635 buffer_info = &tx_ring->buffer_info[i];
636 cleaned = (i == eop); 636 cleaned = (i == eop);
@@ -661,8 +661,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
661 tx_ring->next_to_clean = i; 661 tx_ring->next_to_clean = i;
662 662
663#define TX_WAKE_THRESHOLD 32 663#define TX_WAKE_THRESHOLD 32
664 if (cleaned && netif_carrier_ok(netdev) && 664 if (count && netif_carrier_ok(netdev) &&
665 e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { 665 e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) {
666 /* Make sure that anybody stopping the queue after this 666 /* Make sure that anybody stopping the queue after this
667 * sees the new next_to_clean. 667 * sees the new next_to_clean.
668 */ 668 */
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c
index 470b676c1dae..f4417fc3b0fd 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c
@@ -290,7 +290,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
290s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, 290s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw,
291 struct ixgbe_dcb_config *dcb_config) 291 struct ixgbe_dcb_config *dcb_config)
292{ 292{
293 u32 i, reg; 293 u32 i, reg, rx_pba_size;
294 294
295 /* If PFC is disabled globally then fall back to LFC. */ 295 /* If PFC is disabled globally then fall back to LFC. */
296 if (!dcb_config->pfc_mode_enable) { 296 if (!dcb_config->pfc_mode_enable) {
@@ -301,17 +301,23 @@ s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw,
301 301
302 /* Configure PFC Tx thresholds per TC */ 302 /* Configure PFC Tx thresholds per TC */
303 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 303 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
304 /* Config and remember Tx */ 304 if (dcb_config->rx_pba_cfg == pba_equal)
305 rx_pba_size = IXGBE_RXPBSIZE_64KB;
306 else
307 rx_pba_size = (i < 4) ? IXGBE_RXPBSIZE_80KB
308 : IXGBE_RXPBSIZE_48KB;
309
310 reg = ((rx_pba_size >> 5) & 0xFFE0);
305 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || 311 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full ||
306 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) { 312 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx)
307 reg = hw->fc.high_water | IXGBE_FCRTH_FCEN; 313 reg |= IXGBE_FCRTL_XONE;
308 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); 314 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg);
309 reg = hw->fc.low_water | IXGBE_FCRTL_XONE; 315
310 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); 316 reg = ((rx_pba_size >> 2) & 0xFFE0);
311 } else { 317 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full ||
312 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), 0); 318 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx)
313 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); 319 reg |= IXGBE_FCRTH_FCEN;
314 } 320 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg);
315 } 321 }
316 322
317 /* Configure pause time (2 TCs per register) */ 323 /* Configure pause time (2 TCs per register) */
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index febde45cf9fa..01884256f4c9 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2841,11 +2841,55 @@ static inline bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter)
2841 } 2841 }
2842 ret = true; 2842 ret = true;
2843 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 2843 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
2844 for (i = 0; i < dcb_i; i++) { 2844 if (dcb_i == 8) {
2845 adapter->rx_ring[i].reg_idx = i << 4; 2845 /*
2846 adapter->tx_ring[i].reg_idx = i << 4; 2846 * Tx TC0 starts at: descriptor queue 0
2847 * Tx TC1 starts at: descriptor queue 32
2848 * Tx TC2 starts at: descriptor queue 64
2849 * Tx TC3 starts at: descriptor queue 80
2850 * Tx TC4 starts at: descriptor queue 96
2851 * Tx TC5 starts at: descriptor queue 104
2852 * Tx TC6 starts at: descriptor queue 112
2853 * Tx TC7 starts at: descriptor queue 120
2854 *
2855 * Rx TC0-TC7 are offset by 16 queues each
2856 */
2857 for (i = 0; i < 3; i++) {
2858 adapter->tx_ring[i].reg_idx = i << 5;
2859 adapter->rx_ring[i].reg_idx = i << 4;
2860 }
2861 for ( ; i < 5; i++) {
2862 adapter->tx_ring[i].reg_idx =
2863 ((i + 2) << 4);
2864 adapter->rx_ring[i].reg_idx = i << 4;
2865 }
2866 for ( ; i < dcb_i; i++) {
2867 adapter->tx_ring[i].reg_idx =
2868 ((i + 8) << 3);
2869 adapter->rx_ring[i].reg_idx = i << 4;
2870 }
2871
2872 ret = true;
2873 } else if (dcb_i == 4) {
2874 /*
2875 * Tx TC0 starts at: descriptor queue 0
2876 * Tx TC1 starts at: descriptor queue 64
2877 * Tx TC2 starts at: descriptor queue 96
2878 * Tx TC3 starts at: descriptor queue 112
2879 *
2880 * Rx TC0-TC3 are offset by 32 queues each
2881 */
2882 adapter->tx_ring[0].reg_idx = 0;
2883 adapter->tx_ring[1].reg_idx = 64;
2884 adapter->tx_ring[2].reg_idx = 96;
2885 adapter->tx_ring[3].reg_idx = 112;
2886 for (i = 0 ; i < dcb_i; i++)
2887 adapter->rx_ring[i].reg_idx = i << 5;
2888
2889 ret = true;
2890 } else {
2891 ret = false;
2847 } 2892 }
2848 ret = true;
2849 } else { 2893 } else {
2850 ret = false; 2894 ret = false;
2851 } 2895 }
@@ -3946,7 +3990,7 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
3946 } 3990 }
3947 hw->mac.ops.setup_sfp(hw); 3991 hw->mac.ops.setup_sfp(hw);
3948 3992
3949 if (!adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK) 3993 if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK))
3950 /* This will also work for DA Twinax connections */ 3994 /* This will also work for DA Twinax connections */
3951 schedule_work(&adapter->multispeed_fiber_task); 3995 schedule_work(&adapter->multispeed_fiber_task);
3952 adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK; 3996 adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 46073de290cf..e82aee41d77e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -316,10 +316,11 @@ static void macb_tx(struct macb *bp)
316 dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", 316 dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n",
317 (unsigned long)status); 317 (unsigned long)status);
318 318
319 if (status & MACB_BIT(UND)) { 319 if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
320 int i; 320 int i;
321 printk(KERN_ERR "%s: TX underrun, resetting buffers\n", 321 printk(KERN_ERR "%s: TX %s, resetting buffers\n",
322 bp->dev->name); 322 bp->dev->name, status & MACB_BIT(UND) ?
323 "underrun" : "retry limit exceeded");
323 324
324 /* Transfer ongoing, disable transmitter, to avoid confusion */ 325 /* Transfer ongoing, disable transmitter, to avoid confusion */
325 if (status & MACB_BIT(TGO)) 326 if (status & MACB_BIT(TGO))
@@ -520,27 +521,10 @@ static int macb_poll(struct napi_struct *napi, int budget)
520 macb_writel(bp, RSR, status); 521 macb_writel(bp, RSR, status);
521 522
522 work_done = 0; 523 work_done = 0;
523 if (!status) {
524 /*
525 * This may happen if an interrupt was pending before
526 * this function was called last time, and no packets
527 * have been received since.
528 */
529 napi_complete(napi);
530 goto out;
531 }
532 524
533 dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", 525 dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
534 (unsigned long)status, budget); 526 (unsigned long)status, budget);
535 527
536 if (!(status & MACB_BIT(REC))) {
537 dev_warn(&bp->pdev->dev,
538 "No RX buffers complete, status = %02lx\n",
539 (unsigned long)status);
540 napi_complete(napi);
541 goto out;
542 }
543
544 work_done = macb_rx(bp, budget); 528 work_done = macb_rx(bp, budget);
545 if (work_done < budget) 529 if (work_done < budget)
546 napi_complete(napi); 530 napi_complete(napi);
@@ -549,7 +533,6 @@ static int macb_poll(struct napi_struct *napi, int budget)
549 * We've done what we can to clean the buffers. Make sure we 533 * We've done what we can to clean the buffers. Make sure we
550 * get notified when new packets arrive. 534 * get notified when new packets arrive.
551 */ 535 */
552out:
553 macb_writel(bp, IER, MACB_RX_INT_FLAGS); 536 macb_writel(bp, IER, MACB_RX_INT_FLAGS);
554 537
555 /* TODO: Handle errors */ 538 /* TODO: Handle errors */
@@ -590,7 +573,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
590 } 573 }
591 } 574 }
592 575
593 if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND))) 576 if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND) |
577 MACB_BIT(ISR_RLE)))
594 macb_tx(bp); 578 macb_tx(bp);
595 579
596 /* 580 /*
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 70d3ef4a2c5f..214a8cf2b708 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -376,7 +376,8 @@ static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev)
376 const struct macvlan_dev *vlan = netdev_priv(dev); 376 const struct macvlan_dev *vlan = netdev_priv(dev);
377 struct net_device *lowerdev = vlan->lowerdev; 377 struct net_device *lowerdev = vlan->lowerdev;
378 378
379 if (lowerdev->ethtool_ops->get_rx_csum == NULL) 379 if (lowerdev->ethtool_ops == NULL ||
380 lowerdev->ethtool_ops->get_rx_csum == NULL)
380 return 0; 381 return 0;
381 return lowerdev->ethtool_ops->get_rx_csum(lowerdev); 382 return lowerdev->ethtool_ops->get_rx_csum(lowerdev);
382} 383}
@@ -387,7 +388,8 @@ static int macvlan_ethtool_get_settings(struct net_device *dev,
387 const struct macvlan_dev *vlan = netdev_priv(dev); 388 const struct macvlan_dev *vlan = netdev_priv(dev);
388 struct net_device *lowerdev = vlan->lowerdev; 389 struct net_device *lowerdev = vlan->lowerdev;
389 390
390 if (!lowerdev->ethtool_ops->get_settings) 391 if (!lowerdev->ethtool_ops ||
392 !lowerdev->ethtool_ops->get_settings)
391 return -EOPNOTSUPP; 393 return -EOPNOTSUPP;
392 394
393 return lowerdev->ethtool_ops->get_settings(lowerdev, cmd); 395 return lowerdev->ethtool_ops->get_settings(lowerdev, cmd);
@@ -398,7 +400,8 @@ static u32 macvlan_ethtool_get_flags(struct net_device *dev)
398 const struct macvlan_dev *vlan = netdev_priv(dev); 400 const struct macvlan_dev *vlan = netdev_priv(dev);
399 struct net_device *lowerdev = vlan->lowerdev; 401 struct net_device *lowerdev = vlan->lowerdev;
400 402
401 if (!lowerdev->ethtool_ops->get_flags) 403 if (!lowerdev->ethtool_ops ||
404 !lowerdev->ethtool_ops->get_flags)
402 return 0; 405 return 0;
403 return lowerdev->ethtool_ops->get_flags(lowerdev); 406 return lowerdev->ethtool_ops->get_flags(lowerdev);
404} 407}
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index eda72dd2120f..510633fd57f6 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -181,7 +181,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
181 mdev->workqueue = create_singlethread_workqueue("mlx4_en"); 181 mdev->workqueue = create_singlethread_workqueue("mlx4_en");
182 if (!mdev->workqueue) { 182 if (!mdev->workqueue) {
183 err = -ENOMEM; 183 err = -ENOMEM;
184 goto err_close_nic; 184 goto err_mr;
185 } 185 }
186 186
187 /* At this stage all non-port specific tasks are complete: 187 /* At this stage all non-port specific tasks are complete:
@@ -214,9 +214,8 @@ err_free_netdev:
214 flush_workqueue(mdev->workqueue); 214 flush_workqueue(mdev->workqueue);
215 215
216 /* Stop event queue before we drop down to release shared SW state */ 216 /* Stop event queue before we drop down to release shared SW state */
217
218err_close_nic:
219 destroy_workqueue(mdev->workqueue); 217 destroy_workqueue(mdev->workqueue);
218
220err_mr: 219err_mr:
221 mlx4_mr_free(dev, &mdev->mr); 220 mlx4_mr_free(dev, &mdev->mr);
222err_uar: 221err_uar:
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 303c23de6cac..438678ab2a10 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
348 if (netif_msg_timer(priv)) 348 if (netif_msg_timer(priv))
349 mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port); 349 mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port);
350 350
351 if (netif_carrier_ok(dev)) { 351 priv->port_stats.tx_timeout++;
352 priv->port_stats.tx_timeout++; 352 mlx4_dbg(DRV, priv, "Scheduling watchdog\n");
353 mlx4_dbg(DRV, priv, "Scheduling watchdog\n"); 353 queue_work(mdev->workqueue, &priv->watchdog_task);
354 queue_work(mdev->workqueue, &priv->watchdog_task);
355 }
356} 354}
357 355
358 356
@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work)
761 struct net_device *dev = priv->dev; 759 struct net_device *dev = priv->dev;
762 760
763 mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port); 761 mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port);
764 mlx4_en_stop_port(dev); 762
765 if (mlx4_en_start_port(dev)) 763 mutex_lock(&mdev->state_lock);
766 mlx4_err(mdev, "Failed restarting port %d\n", priv->port); 764 if (priv->port_up) {
765 mlx4_en_stop_port(dev);
766 if (mlx4_en_start_port(dev))
767 mlx4_err(mdev, "Failed restarting port %d\n", priv->port);
768 }
769 mutex_unlock(&mdev->state_lock);
767} 770}
768 771
769 772
@@ -1054,7 +1057,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1054 * Set driver features 1057 * Set driver features
1055 */ 1058 */
1056 dev->features |= NETIF_F_SG; 1059 dev->features |= NETIF_F_SG;
1057 dev->features |= NETIF_F_HW_CSUM; 1060 dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
1058 dev->features |= NETIF_F_HIGHDMA; 1061 dev->features |= NETIF_F_HIGHDMA;
1059 dev->features |= NETIF_F_HW_VLAN_TX | 1062 dev->features |= NETIF_F_HW_VLAN_TX |
1060 NETIF_F_HW_VLAN_RX | 1063 NETIF_F_HW_VLAN_RX |
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c
index c5a4c0389752..a29abe845d2e 100644
--- a/drivers/net/mlx4/en_port.c
+++ b/drivers/net/mlx4/en_port.c
@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
151 struct mlx4_cmd_mailbox *mailbox; 151 struct mlx4_cmd_mailbox *mailbox;
152 u64 in_mod = reset << 8 | port; 152 u64 in_mod = reset << 8 | port;
153 int err; 153 int err;
154 int i;
154 155
155 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); 156 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
156 if (IS_ERR(mailbox)) 157 if (IS_ERR(mailbox))
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
165 166
166 spin_lock_bh(&priv->stats_lock); 167 spin_lock_bh(&priv->stats_lock);
167 168
168 stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) - 169 stats->rx_packets = 0;
169 be32_to_cpu(mlx4_en_stats->RDROP); 170 stats->rx_bytes = 0;
170 stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) + 171 for (i = 0; i < priv->rx_ring_num; i++) {
171 be64_to_cpu(mlx4_en_stats->TTOT_prio_1) + 172 stats->rx_packets += priv->rx_ring[i].packets;
172 be64_to_cpu(mlx4_en_stats->TTOT_prio_2) + 173 stats->rx_bytes += priv->rx_ring[i].bytes;
173 be64_to_cpu(mlx4_en_stats->TTOT_prio_3) + 174 }
174 be64_to_cpu(mlx4_en_stats->TTOT_prio_4) + 175 stats->tx_packets = 0;
175 be64_to_cpu(mlx4_en_stats->TTOT_prio_5) + 176 stats->tx_bytes = 0;
176 be64_to_cpu(mlx4_en_stats->TTOT_prio_6) + 177 for (i = 0; i <= priv->tx_ring_num; i++) {
177 be64_to_cpu(mlx4_en_stats->TTOT_prio_7) + 178 stats->tx_packets += priv->tx_ring[i].packets;
178 be64_to_cpu(mlx4_en_stats->TTOT_novlan) + 179 stats->tx_bytes += priv->tx_ring[i].bytes;
179 be64_to_cpu(mlx4_en_stats->TTOT_loopbk); 180 }
180 stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) +
181 be64_to_cpu(mlx4_en_stats->ROCT_prio_1) +
182 be64_to_cpu(mlx4_en_stats->ROCT_prio_2) +
183 be64_to_cpu(mlx4_en_stats->ROCT_prio_3) +
184 be64_to_cpu(mlx4_en_stats->ROCT_prio_4) +
185 be64_to_cpu(mlx4_en_stats->ROCT_prio_5) +
186 be64_to_cpu(mlx4_en_stats->ROCT_prio_6) +
187 be64_to_cpu(mlx4_en_stats->ROCT_prio_7) +
188 be64_to_cpu(mlx4_en_stats->ROCT_novlan);
189
190 stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) +
191 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) +
192 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) +
193 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) +
194 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) +
195 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) +
196 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) +
197 be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) +
198 be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) +
199 be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk);
200 181
201 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + 182 stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) +
202 be32_to_cpu(mlx4_en_stats->RdropLength) + 183 be32_to_cpu(mlx4_en_stats->RdropLength) +
diff --git a/drivers/net/mlx4/en_resources.c b/drivers/net/mlx4/en_resources.c
index a0545209e507..65ca706c04bb 100644
--- a/drivers/net/mlx4/en_resources.c
+++ b/drivers/net/mlx4/en_resources.c
@@ -94,3 +94,9 @@ void mlx4_en_unmap_buffer(struct mlx4_buf *buf)
94 94
95 vunmap(buf->direct.buf); 95 vunmap(buf->direct.buf);
96} 96}
97
98void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event)
99{
100 return;
101}
102
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 7e40741fb7d8..0cbb78ca7b29 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -436,8 +436,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
436 /* Initialize page allocators */ 436 /* Initialize page allocators */
437 err = mlx4_en_init_allocator(priv, ring); 437 err = mlx4_en_init_allocator(priv, ring);
438 if (err) { 438 if (err) {
439 mlx4_err(mdev, "Failed initializing ring allocator\n"); 439 mlx4_err(mdev, "Failed initializing ring allocator\n");
440 goto err_allocator; 440 ring_ind--;
441 goto err_allocator;
441 } 442 }
442 443
443 /* Fill Rx buffers */ 444 /* Fill Rx buffers */
@@ -467,6 +468,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
467 ring->wqres.db.dma, &ring->srq); 468 ring->wqres.db.dma, &ring->srq);
468 if (err){ 469 if (err){
469 mlx4_err(mdev, "Failed to allocate srq\n"); 470 mlx4_err(mdev, "Failed to allocate srq\n");
471 ring_ind--;
470 goto err_srq; 472 goto err_srq;
471 } 473 }
472 ring->srq.event = mlx4_en_srq_event; 474 ring->srq.event = mlx4_en_srq_event;
@@ -926,12 +928,6 @@ void mlx4_en_set_default_rss_map(struct mlx4_en_priv *priv,
926 } 928 }
927} 929}
928 930
929static void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event)
930{
931 return;
932}
933
934
935static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, 931static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv,
936 int qpn, int srqn, int cqn, 932 int qpn, int srqn, int cqn,
937 enum mlx4_qp_state *state, 933 enum mlx4_qp_state *state,
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 4afd5993e31c..ac6fc499b280 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -112,6 +112,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
112 mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn); 112 mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn);
113 goto err_reserve; 113 goto err_reserve;
114 } 114 }
115 ring->qp.event = mlx4_en_sqp_event;
115 116
116 return 0; 117 return 0;
117 118
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
index e9af32d41ca4..ef840abbcd39 100644
--- a/drivers/net/mlx4/mlx4_en.h
+++ b/drivers/net/mlx4/mlx4_en.h
@@ -538,6 +538,7 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);
538void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, 538void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
539 int is_tx, int rss, int qpn, int cqn, int srqn, 539 int is_tx, int rss, int qpn, int cqn, int srqn,
540 struct mlx4_qp_context *context); 540 struct mlx4_qp_context *context);
541void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event);
541int mlx4_en_map_buffer(struct mlx4_buf *buf); 542int mlx4_en_map_buffer(struct mlx4_buf *buf);
542void mlx4_en_unmap_buffer(struct mlx4_buf *buf); 543void mlx4_en_unmap_buffer(struct mlx4_buf *buf);
543 544
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 2fbf9f9ddd37..652a36888361 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1758,7 +1758,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), 1758 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"),
1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), 1759 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"),
1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), 1760 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"),
1761 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "LA-PCM.cis"), 1761 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"),
1762 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1762 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"),
1763 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), 1763 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
1764 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1764 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index a5ac2bd58b5b..4f3ada622f9b 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -2101,6 +2101,9 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl,
2101 if (ret) { 2101 if (ret) {
2102 pr_debug("%s: WEP/WPA setup failed %d\n", __func__, 2102 pr_debug("%s: WEP/WPA setup failed %d\n", __func__,
2103 ret); 2103 ret);
2104 ret = -EPERM;
2105 gelic_wl_send_iwap_event(wl, NULL);
2106 goto out;
2104 } 2107 }
2105 2108
2106 /* start association */ 2109 /* start association */
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 7a837c465960..201be425643a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2190,7 +2190,14 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
2190 if (!(tmp & EEPROM_ADDR_COMPLETE)) 2190 if (!(tmp & EEPROM_ADDR_COMPLETE))
2191 return -EBUSY; 2191 return -EBUSY;
2192 2192
2193 *val = tr32(GRC_EEPROM_DATA); 2193 tmp = tr32(GRC_EEPROM_DATA);
2194
2195 /*
2196 * The data will always be opposite the native endian
2197 * format. Perform a blind byteswap to compensate.
2198 */
2199 *val = swab32(tmp);
2200
2194 return 0; 2201 return 0;
2195} 2202}
2196 2203
@@ -10663,7 +10670,13 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
10663 10670
10664 memcpy(&data, buf + i, 4); 10671 memcpy(&data, buf + i, 4);
10665 10672
10666 tw32(GRC_EEPROM_DATA, be32_to_cpu(data)); 10673 /*
10674 * The SEEPROM interface expects the data to always be opposite
10675 * the native endian format. We accomplish this by reversing
10676 * all the operations that would have been performed on the
10677 * data from a call to tg3_nvram_read_be32().
10678 */
10679 tw32(GRC_EEPROM_DATA, swab32(be32_to_cpu(data)));
10667 10680
10668 val = tr32(GRC_EEPROM_ADDR); 10681 val = tr32(GRC_EEPROM_ADDR);
10669 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); 10682 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
@@ -12443,13 +12456,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
12443 /* Next, try NVRAM. */ 12456 /* Next, try NVRAM. */
12444 if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && 12457 if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) &&
12445 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { 12458 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) {
12446 dev->dev_addr[0] = ((hi >> 16) & 0xff); 12459 memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2);
12447 dev->dev_addr[1] = ((hi >> 24) & 0xff); 12460 memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo));
12448 dev->dev_addr[2] = ((lo >> 0) & 0xff);
12449 dev->dev_addr[3] = ((lo >> 8) & 0xff);
12450 dev->dev_addr[4] = ((lo >> 16) & 0xff);
12451 dev->dev_addr[5] = ((lo >> 24) & 0xff);
12452
12453 } 12461 }
12454 /* Finally just fetch it out of the MAC control regs. */ 12462 /* Finally just fetch it out of the MAC control regs. */
12455 else { 12463 else {
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 16716aef184c..735bf41c654a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -93,7 +93,6 @@ struct tun_file {
93 atomic_t count; 93 atomic_t count;
94 struct tun_struct *tun; 94 struct tun_struct *tun;
95 struct net *net; 95 struct net *net;
96 wait_queue_head_t read_wait;
97}; 96};
98 97
99struct tun_sock; 98struct tun_sock;
@@ -156,6 +155,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
156 tfile->tun = tun; 155 tfile->tun = tun;
157 tun->tfile = tfile; 156 tun->tfile = tfile;
158 dev_hold(tun->dev); 157 dev_hold(tun->dev);
158 sock_hold(tun->sk);
159 atomic_inc(&tfile->count); 159 atomic_inc(&tfile->count);
160 160
161out: 161out:
@@ -165,11 +165,8 @@ out:
165 165
166static void __tun_detach(struct tun_struct *tun) 166static void __tun_detach(struct tun_struct *tun)
167{ 167{
168 struct tun_file *tfile = tun->tfile;
169
170 /* Detach from net device */ 168 /* Detach from net device */
171 netif_tx_lock_bh(tun->dev); 169 netif_tx_lock_bh(tun->dev);
172 tfile->tun = NULL;
173 tun->tfile = NULL; 170 tun->tfile = NULL;
174 netif_tx_unlock_bh(tun->dev); 171 netif_tx_unlock_bh(tun->dev);
175 172
@@ -333,12 +330,19 @@ static void tun_net_uninit(struct net_device *dev)
333 /* Inform the methods they need to stop using the dev. 330 /* Inform the methods they need to stop using the dev.
334 */ 331 */
335 if (tfile) { 332 if (tfile) {
336 wake_up_all(&tfile->read_wait); 333 wake_up_all(&tun->socket.wait);
337 if (atomic_dec_and_test(&tfile->count)) 334 if (atomic_dec_and_test(&tfile->count))
338 __tun_detach(tun); 335 __tun_detach(tun);
339 } 336 }
340} 337}
341 338
339static void tun_free_netdev(struct net_device *dev)
340{
341 struct tun_struct *tun = netdev_priv(dev);
342
343 sock_put(tun->sk);
344}
345
342/* Net device open. */ 346/* Net device open. */
343static int tun_net_open(struct net_device *dev) 347static int tun_net_open(struct net_device *dev)
344{ 348{
@@ -393,7 +397,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
393 /* Notify and wake up reader process */ 397 /* Notify and wake up reader process */
394 if (tun->flags & TUN_FASYNC) 398 if (tun->flags & TUN_FASYNC)
395 kill_fasync(&tun->fasync, SIGIO, POLL_IN); 399 kill_fasync(&tun->fasync, SIGIO, POLL_IN);
396 wake_up_interruptible(&tun->tfile->read_wait); 400 wake_up_interruptible(&tun->socket.wait);
397 return 0; 401 return 0;
398 402
399drop: 403drop:
@@ -490,7 +494,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
490 494
491 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); 495 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
492 496
493 poll_wait(file, &tfile->read_wait, wait); 497 poll_wait(file, &tun->socket.wait, wait);
494 498
495 if (!skb_queue_empty(&tun->readq)) 499 if (!skb_queue_empty(&tun->readq))
496 mask |= POLLIN | POLLRDNORM; 500 mask |= POLLIN | POLLRDNORM;
@@ -763,7 +767,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
763 goto out; 767 goto out;
764 } 768 }
765 769
766 add_wait_queue(&tfile->read_wait, &wait); 770 add_wait_queue(&tun->socket.wait, &wait);
767 while (len) { 771 while (len) {
768 current->state = TASK_INTERRUPTIBLE; 772 current->state = TASK_INTERRUPTIBLE;
769 773
@@ -794,7 +798,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
794 } 798 }
795 799
796 current->state = TASK_RUNNING; 800 current->state = TASK_RUNNING;
797 remove_wait_queue(&tfile->read_wait, &wait); 801 remove_wait_queue(&tun->socket.wait, &wait);
798 802
799out: 803out:
800 tun_put(tun); 804 tun_put(tun);
@@ -811,7 +815,7 @@ static void tun_setup(struct net_device *dev)
811 tun->group = -1; 815 tun->group = -1;
812 816
813 dev->ethtool_ops = &tun_ethtool_ops; 817 dev->ethtool_ops = &tun_ethtool_ops;
814 dev->destructor = free_netdev; 818 dev->destructor = tun_free_netdev;
815} 819}
816 820
817/* Trivial set of netlink ops to allow deleting tun or tap 821/* Trivial set of netlink ops to allow deleting tun or tap
@@ -848,7 +852,7 @@ static void tun_sock_write_space(struct sock *sk)
848 852
849static void tun_sock_destruct(struct sock *sk) 853static void tun_sock_destruct(struct sock *sk)
850{ 854{
851 dev_put(container_of(sk, struct tun_sock, sk)->tun->dev); 855 free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev);
852} 856}
853 857
854static struct proto tun_proto = { 858static struct proto tun_proto = {
@@ -862,7 +866,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
862 struct sock *sk; 866 struct sock *sk;
863 struct tun_struct *tun; 867 struct tun_struct *tun;
864 struct net_device *dev; 868 struct net_device *dev;
865 struct tun_file *tfile = file->private_data;
866 int err; 869 int err;
867 870
868 dev = __dev_get_by_name(net, ifr->ifr_name); 871 dev = __dev_get_by_name(net, ifr->ifr_name);
@@ -920,13 +923,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
920 if (!sk) 923 if (!sk)
921 goto err_free_dev; 924 goto err_free_dev;
922 925
923 /* This ref count is for tun->sk. */ 926 init_waitqueue_head(&tun->socket.wait);
924 dev_hold(dev);
925 sock_init_data(&tun->socket, sk); 927 sock_init_data(&tun->socket, sk);
926 sk->sk_write_space = tun_sock_write_space; 928 sk->sk_write_space = tun_sock_write_space;
927 sk->sk_destruct = tun_sock_destruct;
928 sk->sk_sndbuf = INT_MAX; 929 sk->sk_sndbuf = INT_MAX;
929 sk->sk_sleep = &tfile->read_wait;
930 930
931 tun->sk = sk; 931 tun->sk = sk;
932 container_of(sk, struct tun_sock, sk)->tun = tun; 932 container_of(sk, struct tun_sock, sk)->tun = tun;
@@ -942,11 +942,13 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
942 err = -EINVAL; 942 err = -EINVAL;
943 err = register_netdevice(tun->dev); 943 err = register_netdevice(tun->dev);
944 if (err < 0) 944 if (err < 0)
945 goto err_free_dev; 945 goto err_free_sk;
946
947 sk->sk_destruct = tun_sock_destruct;
946 948
947 err = tun_attach(tun, file); 949 err = tun_attach(tun, file);
948 if (err < 0) 950 if (err < 0)
949 goto err_free_dev; 951 goto failed;
950 } 952 }
951 953
952 DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name); 954 DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name);
@@ -1266,7 +1268,6 @@ static int tun_chr_open(struct inode *inode, struct file * file)
1266 atomic_set(&tfile->count, 0); 1268 atomic_set(&tfile->count, 0);
1267 tfile->tun = NULL; 1269 tfile->tun = NULL;
1268 tfile->net = get_net(current->nsproxy->net_ns); 1270 tfile->net = get_net(current->nsproxy->net_ns);
1269 init_waitqueue_head(&tfile->read_wait);
1270 file->private_data = tfile; 1271 file->private_data = tfile;
1271 return 0; 1272 return 0;
1272} 1273}
@@ -1284,14 +1285,16 @@ static int tun_chr_close(struct inode *inode, struct file *file)
1284 __tun_detach(tun); 1285 __tun_detach(tun);
1285 1286
1286 /* If desireable, unregister the netdevice. */ 1287 /* If desireable, unregister the netdevice. */
1287 if (!(tun->flags & TUN_PERSIST)) { 1288 if (!(tun->flags & TUN_PERSIST))
1288 sock_put(tun->sk);
1289 unregister_netdevice(tun->dev); 1289 unregister_netdevice(tun->dev);
1290 }
1291 1290
1292 rtnl_unlock(); 1291 rtnl_unlock();
1293 } 1292 }
1294 1293
1294 tun = tfile->tun;
1295 if (tun)
1296 sock_put(tun->sk);
1297
1295 put_net(tfile->net); 1298 put_net(tfile->net);
1296 kfree(tfile); 1299 kfree(tfile);
1297 1300
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index d3f39e86eb95..44f8392da117 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1394,7 +1394,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
1394 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || 1394 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
1395 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || 1395 (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
1396 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { 1396 (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
1397 upsmr |= UCC_GETH_UPSMR_RPM; 1397 if (ugeth->phy_interface != PHY_INTERFACE_MODE_RMII)
1398 upsmr |= UCC_GETH_UPSMR_RPM;
1398 switch (ugeth->max_speed) { 1399 switch (ugeth->max_speed) {
1399 case SPEED_10: 1400 case SPEED_10:
1400 upsmr |= UCC_GETH_UPSMR_R10M; 1401 upsmr |= UCC_GETH_UPSMR_R10M;
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index a8228d87c8cf..2138535f2339 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -899,6 +899,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
899 /* cleanup should already have been scheduled */ 899 /* cleanup should already have been scheduled */
900 break; 900 break;
901 case -ENODEV: /* disconnect() upcoming */ 901 case -ENODEV: /* disconnect() upcoming */
902 case -EPERM:
902 netif_device_detach(pegasus->net); 903 netif_device_detach(pegasus->net);
903 break; 904 break;
904 default: 905 default:
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index f21a6171c691..c36d3a3d655f 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6713,11 +6713,11 @@ static int airo_set_auth(struct net_device *dev,
6713 local->config.authType = AUTH_ENCRYPT; 6713 local->config.authType = AUTH_ENCRYPT;
6714 } else 6714 } else
6715 return -EINVAL; 6715 return -EINVAL;
6716 break;
6717 6716
6718 /* Commit the changes to flags if needed */ 6717 /* Commit the changes to flags if needed */
6719 if (local->config.authType != currentAuthType) 6718 if (local->config.authType != currentAuthType)
6720 set_bit (FLAG_COMMIT, &local->flags); 6719 set_bit (FLAG_COMMIT, &local->flags);
6720 break;
6721 } 6721 }
6722 6722
6723 case IW_AUTH_WPA_ENABLED: 6723 case IW_AUTH_WPA_ENABLED:
diff --git a/drivers/net/wireless/ar9170/hw.h b/drivers/net/wireless/ar9170/hw.h
index 13091bd9d815..53e250a4278f 100644
--- a/drivers/net/wireless/ar9170/hw.h
+++ b/drivers/net/wireless/ar9170/hw.h
@@ -310,7 +310,7 @@ struct ar9170_tx_control {
310 310
311struct ar9170_rx_head { 311struct ar9170_rx_head {
312 u8 plcp[12]; 312 u8 plcp[12];
313}; 313} __packed;
314 314
315struct ar9170_rx_tail { 315struct ar9170_rx_tail {
316 union { 316 union {
@@ -318,16 +318,16 @@ struct ar9170_rx_tail {
318 u8 rssi_ant0, rssi_ant1, rssi_ant2, 318 u8 rssi_ant0, rssi_ant1, rssi_ant2,
319 rssi_ant0x, rssi_ant1x, rssi_ant2x, 319 rssi_ant0x, rssi_ant1x, rssi_ant2x,
320 rssi_combined; 320 rssi_combined;
321 }; 321 } __packed;
322 u8 rssi[7]; 322 u8 rssi[7];
323 }; 323 } __packed;
324 324
325 u8 evm_stream0[6], evm_stream1[6]; 325 u8 evm_stream0[6], evm_stream1[6];
326 u8 phy_err; 326 u8 phy_err;
327 u8 SAidx, DAidx; 327 u8 SAidx, DAidx;
328 u8 error; 328 u8 error;
329 u8 status; 329 u8 status;
330}; 330} __packed;
331 331
332#define AR9170_ENC_ALG_NONE 0x0 332#define AR9170_ENC_ALG_NONE 0x0
333#define AR9170_ENC_ALG_WEP64 0x1 333#define AR9170_ENC_ALG_WEP64 0x1
diff --git a/drivers/net/wireless/ar9170/usb.c b/drivers/net/wireless/ar9170/usb.c
index ad296840893e..fddda477095c 100644
--- a/drivers/net/wireless/ar9170/usb.c
+++ b/drivers/net/wireless/ar9170/usb.c
@@ -59,6 +59,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
59 { USB_DEVICE(0x0cf3, 0x9170) }, 59 { USB_DEVICE(0x0cf3, 0x9170) },
60 /* Atheros TG121N */ 60 /* Atheros TG121N */
61 { USB_DEVICE(0x0cf3, 0x1001) }, 61 { USB_DEVICE(0x0cf3, 0x1001) },
62 /* Cace Airpcap NX */
63 { USB_DEVICE(0xcace, 0x0300) },
62 /* D-Link DWA 160A */ 64 /* D-Link DWA 160A */
63 { USB_DEVICE(0x07d1, 0x3c10) }, 65 { USB_DEVICE(0x07d1, 0x3c10) },
64 /* Netgear WNDA3100 */ 66 /* Netgear WNDA3100 */
@@ -67,6 +69,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
67 { USB_DEVICE(0x0846, 0x9001) }, 69 { USB_DEVICE(0x0846, 0x9001) },
68 /* Zydas ZD1221 */ 70 /* Zydas ZD1221 */
69 { USB_DEVICE(0x0ace, 0x1221) }, 71 { USB_DEVICE(0x0ace, 0x1221) },
72 /* ZyXEL NWD271N */
73 { USB_DEVICE(0x0586, 0x3417) },
70 /* Z-Com UB81 BG */ 74 /* Z-Com UB81 BG */
71 { USB_DEVICE(0x0cde, 0x0023) }, 75 { USB_DEVICE(0x0cde, 0x0023) },
72 /* Z-Com UB82 ABG */ 76 /* Z-Com UB82 ABG */
@@ -619,6 +623,39 @@ static int ar9170_usb_open(struct ar9170 *ar)
619 return 0; 623 return 0;
620} 624}
621 625
626static int ar9170_usb_init_device(struct ar9170_usb *aru)
627{
628 int err;
629
630 err = ar9170_usb_alloc_rx_irq_urb(aru);
631 if (err)
632 goto err_out;
633
634 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
635 if (err)
636 goto err_unrx;
637
638 err = ar9170_usb_upload_firmware(aru);
639 if (err) {
640 err = ar9170_echo_test(&aru->common, 0x60d43110);
641 if (err) {
642 /* force user invention, by disabling the device */
643 err = usb_driver_set_configuration(aru->udev, -1);
644 dev_err(&aru->udev->dev, "device is in a bad state. "
645 "please reconnect it!\n");
646 goto err_unrx;
647 }
648 }
649
650 return 0;
651
652err_unrx:
653 ar9170_usb_cancel_urbs(aru);
654
655err_out:
656 return err;
657}
658
622static int ar9170_usb_probe(struct usb_interface *intf, 659static int ar9170_usb_probe(struct usb_interface *intf,
623 const struct usb_device_id *id) 660 const struct usb_device_id *id)
624{ 661{
@@ -654,32 +691,16 @@ static int ar9170_usb_probe(struct usb_interface *intf,
654 691
655 err = ar9170_usb_reset(aru); 692 err = ar9170_usb_reset(aru);
656 if (err) 693 if (err)
657 goto err_unlock; 694 goto err_freehw;
658 695
659 err = ar9170_usb_request_firmware(aru); 696 err = ar9170_usb_request_firmware(aru);
660 if (err) 697 if (err)
661 goto err_unlock; 698 goto err_freehw;
662 699
663 err = ar9170_usb_alloc_rx_irq_urb(aru); 700 err = ar9170_usb_init_device(aru);
664 if (err) 701 if (err)
665 goto err_freefw; 702 goto err_freefw;
666 703
667 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
668 if (err)
669 goto err_unrx;
670
671 err = ar9170_usb_upload_firmware(aru);
672 if (err) {
673 err = ar9170_echo_test(&aru->common, 0x60d43110);
674 if (err) {
675 /* force user invention, by disabling the device */
676 err = usb_driver_set_configuration(aru->udev, -1);
677 dev_err(&aru->udev->dev, "device is in a bad state. "
678 "please reconnect it!\n");
679 goto err_unrx;
680 }
681 }
682
683 err = ar9170_usb_open(ar); 704 err = ar9170_usb_open(ar);
684 if (err) 705 if (err)
685 goto err_unrx; 706 goto err_unrx;
@@ -699,7 +720,7 @@ err_freefw:
699 release_firmware(aru->init_values); 720 release_firmware(aru->init_values);
700 release_firmware(aru->firmware); 721 release_firmware(aru->firmware);
701 722
702err_unlock: 723err_freehw:
703 usb_set_intfdata(intf, NULL); 724 usb_set_intfdata(intf, NULL);
704 usb_put_dev(udev); 725 usb_put_dev(udev);
705 ieee80211_free_hw(ar->hw); 726 ieee80211_free_hw(ar->hw);
@@ -726,12 +747,65 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
726 ieee80211_free_hw(aru->common.hw); 747 ieee80211_free_hw(aru->common.hw);
727} 748}
728 749
750#ifdef CONFIG_PM
751static int ar9170_suspend(struct usb_interface *intf,
752 pm_message_t message)
753{
754 struct ar9170_usb *aru = usb_get_intfdata(intf);
755
756 if (!aru)
757 return -ENODEV;
758
759 aru->common.state = AR9170_IDLE;
760 ar9170_usb_cancel_urbs(aru);
761
762 return 0;
763}
764
765static int ar9170_resume(struct usb_interface *intf)
766{
767 struct ar9170_usb *aru = usb_get_intfdata(intf);
768 int err;
769
770 if (!aru)
771 return -ENODEV;
772
773 usb_unpoison_anchored_urbs(&aru->rx_submitted);
774 usb_unpoison_anchored_urbs(&aru->tx_submitted);
775
776 /*
777 * FIXME: firmware upload will fail on resume.
778 * but this is better than a hang!
779 */
780
781 err = ar9170_usb_init_device(aru);
782 if (err)
783 goto err_unrx;
784
785 err = ar9170_usb_open(&aru->common);
786 if (err)
787 goto err_unrx;
788
789 return 0;
790
791err_unrx:
792 aru->common.state = AR9170_IDLE;
793 ar9170_usb_cancel_urbs(aru);
794
795 return err;
796}
797#endif /* CONFIG_PM */
798
729static struct usb_driver ar9170_driver = { 799static struct usb_driver ar9170_driver = {
730 .name = "ar9170usb", 800 .name = "ar9170usb",
731 .probe = ar9170_usb_probe, 801 .probe = ar9170_usb_probe,
732 .disconnect = ar9170_usb_disconnect, 802 .disconnect = ar9170_usb_disconnect,
733 .id_table = ar9170_usb_ids, 803 .id_table = ar9170_usb_ids,
734 .soft_unbind = 1, 804 .soft_unbind = 1,
805#ifdef CONFIG_PM
806 .suspend = ar9170_suspend,
807 .resume = ar9170_resume,
808#endif /* CONFIG_PM */
735}; 809};
736 810
737static int __init ar9170_init(void) 811static int __init ar9170_init(void)
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 0c02f1c2bd94..744f4f4dd3d1 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -250,6 +250,8 @@ static struct usb_device_id dev_table[] = {
250 { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) }, 250 { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) },
251 /* Siemens Gigaset USB WLAN Adapter 11 */ 251 /* Siemens Gigaset USB WLAN Adapter 11 */
252 { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) }, 252 { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) },
253 /* OQO Model 01+ Internal Wi-Fi */
254 { USB_DEVICE(0x1557, 0x0002), USB_DEVICE_DATA(BOARD_505A) },
253 /* 255 /*
254 * at76c505amx-rfmd 256 * at76c505amx-rfmd
255 */ 257 */
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 71cb18d6757d..dd1f30156740 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -493,6 +493,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
493 int hdrlen, padsize, retval; 493 int hdrlen, padsize, retval;
494 bool decrypt_error = false; 494 bool decrypt_error = false;
495 u8 keyix; 495 u8 keyix;
496 __le16 fc;
496 497
497 spin_lock_bh(&sc->rx.rxbuflock); 498 spin_lock_bh(&sc->rx.rxbuflock);
498 499
@@ -606,6 +607,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
606 /* see if any padding is done by the hw and remove it */ 607 /* see if any padding is done by the hw and remove it */
607 hdr = (struct ieee80211_hdr *)skb->data; 608 hdr = (struct ieee80211_hdr *)skb->data;
608 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 609 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
610 fc = hdr->frame_control;
609 611
610 /* The MAC header is padded to have 32-bit boundary if the 612 /* The MAC header is padded to have 32-bit boundary if the
611 * packet payload is non-zero. The general calculation for 613 * packet payload is non-zero. The general calculation for
@@ -690,7 +692,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
690 sc->rx.rxotherant = 0; 692 sc->rx.rxotherant = 0;
691 } 693 }
692 694
693 if (ieee80211_is_beacon(hdr->frame_control) && 695 if (ieee80211_is_beacon(fc) &&
694 (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) { 696 (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) {
695 sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON; 697 sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON;
696 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); 698 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 857d84148b1d..27eef8fb7107 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1502,7 +1502,6 @@ static const struct net_device_ops atmel_netdev_ops = {
1502 .ndo_set_mac_address = atmel_set_mac_address, 1502 .ndo_set_mac_address = atmel_set_mac_address,
1503 .ndo_start_xmit = start_tx, 1503 .ndo_start_xmit = start_tx,
1504 .ndo_do_ioctl = atmel_ioctl, 1504 .ndo_do_ioctl = atmel_ioctl,
1505 .ndo_change_mtu = eth_change_mtu,
1506 .ndo_validate_addr = eth_validate_addr, 1505 .ndo_validate_addr = eth_validate_addr,
1507}; 1506};
1508 1507
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index e228c1de6e11..eae680b53052 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -555,11 +555,32 @@ address_error:
555 return 1; 555 return 1;
556} 556}
557 557
558static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)
559{
560 unsigned char *f = skb->data + ring->frameoffset;
561
562 return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF);
563}
564
565static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb)
566{
567 struct b43_rxhdr_fw4 *rxhdr;
568 unsigned char *frame;
569
570 /* This poisons the RX buffer to detect DMA failures. */
571
572 rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
573 rxhdr->frame_len = 0;
574
575 B43_WARN_ON(ring->rx_buffersize < ring->frameoffset + sizeof(struct b43_plcp_hdr6) + 2);
576 frame = skb->data + ring->frameoffset;
577 memset(frame, 0xFF, sizeof(struct b43_plcp_hdr6) + 2 /* padding */);
578}
579
558static int setup_rx_descbuffer(struct b43_dmaring *ring, 580static int setup_rx_descbuffer(struct b43_dmaring *ring,
559 struct b43_dmadesc_generic *desc, 581 struct b43_dmadesc_generic *desc,
560 struct b43_dmadesc_meta *meta, gfp_t gfp_flags) 582 struct b43_dmadesc_meta *meta, gfp_t gfp_flags)
561{ 583{
562 struct b43_rxhdr_fw4 *rxhdr;
563 dma_addr_t dmaaddr; 584 dma_addr_t dmaaddr;
564 struct sk_buff *skb; 585 struct sk_buff *skb;
565 586
@@ -568,6 +589,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
568 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); 589 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
569 if (unlikely(!skb)) 590 if (unlikely(!skb))
570 return -ENOMEM; 591 return -ENOMEM;
592 b43_poison_rx_buffer(ring, skb);
571 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); 593 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
572 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { 594 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
573 /* ugh. try to realloc in zone_dma */ 595 /* ugh. try to realloc in zone_dma */
@@ -578,6 +600,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
578 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); 600 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
579 if (unlikely(!skb)) 601 if (unlikely(!skb))
580 return -ENOMEM; 602 return -ENOMEM;
603 b43_poison_rx_buffer(ring, skb);
581 dmaaddr = map_descbuffer(ring, skb->data, 604 dmaaddr = map_descbuffer(ring, skb->data,
582 ring->rx_buffersize, 0); 605 ring->rx_buffersize, 0);
583 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { 606 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
@@ -592,9 +615,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
592 ring->ops->fill_descriptor(ring, desc, dmaaddr, 615 ring->ops->fill_descriptor(ring, desc, dmaaddr,
593 ring->rx_buffersize, 0, 0, 0); 616 ring->rx_buffersize, 0, 0, 0);
594 617
595 rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
596 rxhdr->frame_len = 0;
597
598 return 0; 618 return 0;
599} 619}
600 620
@@ -1483,12 +1503,17 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1483 len = le16_to_cpu(rxhdr->frame_len); 1503 len = le16_to_cpu(rxhdr->frame_len);
1484 } while (len == 0 && i++ < 5); 1504 } while (len == 0 && i++ < 5);
1485 if (unlikely(len == 0)) { 1505 if (unlikely(len == 0)) {
1486 /* recycle the descriptor buffer. */ 1506 dmaaddr = meta->dmaaddr;
1487 sync_descbuffer_for_device(ring, meta->dmaaddr, 1507 goto drop_recycle_buffer;
1488 ring->rx_buffersize);
1489 goto drop;
1490 } 1508 }
1491 } 1509 }
1510 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
1511 /* Something went wrong with the DMA.
1512 * The device did not touch the buffer and did not overwrite the poison. */
1513 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
1514 dmaaddr = meta->dmaaddr;
1515 goto drop_recycle_buffer;
1516 }
1492 if (unlikely(len > ring->rx_buffersize)) { 1517 if (unlikely(len > ring->rx_buffersize)) {
1493 /* The data did not fit into one descriptor buffer 1518 /* The data did not fit into one descriptor buffer
1494 * and is split over multiple buffers. 1519 * and is split over multiple buffers.
@@ -1501,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1501 while (1) { 1526 while (1) {
1502 desc = ops->idx2desc(ring, *slot, &meta); 1527 desc = ops->idx2desc(ring, *slot, &meta);
1503 /* recycle the descriptor buffer. */ 1528 /* recycle the descriptor buffer. */
1529 b43_poison_rx_buffer(ring, meta->skb);
1504 sync_descbuffer_for_device(ring, meta->dmaaddr, 1530 sync_descbuffer_for_device(ring, meta->dmaaddr,
1505 ring->rx_buffersize); 1531 ring->rx_buffersize);
1506 *slot = next_slot(ring, *slot); 1532 *slot = next_slot(ring, *slot);
@@ -1519,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1519 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); 1545 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
1520 if (unlikely(err)) { 1546 if (unlikely(err)) {
1521 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); 1547 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
1522 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); 1548 goto drop_recycle_buffer;
1523 goto drop;
1524 } 1549 }
1525 1550
1526 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); 1551 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
@@ -1530,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1530 b43_rx(ring->dev, skb, rxhdr); 1555 b43_rx(ring->dev, skb, rxhdr);
1531drop: 1556drop:
1532 return; 1557 return;
1558
1559drop_recycle_buffer:
1560 /* Poison and recycle the RX buffer. */
1561 b43_poison_rx_buffer(ring, skb);
1562 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
1533} 1563}
1534 1564
1535void b43_dma_rx(struct b43_dmaring *ring) 1565void b43_dma_rx(struct b43_dmaring *ring)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 4896e0831114..79b685e300c7 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3974,6 +3974,11 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
3974 phy->next_txpwr_check_time = jiffies; 3974 phy->next_txpwr_check_time = jiffies;
3975 /* PHY TX errors counter. */ 3975 /* PHY TX errors counter. */
3976 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 3976 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
3977
3978#if B43_DEBUG
3979 phy->phy_locked = 0;
3980 phy->radio_locked = 0;
3981#endif
3977} 3982}
3978 3983
3979static void setup_struct_wldev_for_init(struct b43_wldev *dev) 3984static void setup_struct_wldev_for_init(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 026b61c03fb9..e176b6e0d9cf 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -131,12 +131,16 @@ void b43_radio_lock(struct b43_wldev *dev)
131{ 131{
132 u32 macctl; 132 u32 macctl;
133 133
134#if B43_DEBUG
135 B43_WARN_ON(dev->phy.radio_locked);
136 dev->phy.radio_locked = 1;
137#endif
138
134 macctl = b43_read32(dev, B43_MMIO_MACCTL); 139 macctl = b43_read32(dev, B43_MMIO_MACCTL);
135 B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK);
136 macctl |= B43_MACCTL_RADIOLOCK; 140 macctl |= B43_MACCTL_RADIOLOCK;
137 b43_write32(dev, B43_MMIO_MACCTL, macctl); 141 b43_write32(dev, B43_MMIO_MACCTL, macctl);
138 /* Commit the write and wait for the device 142 /* Commit the write and wait for the firmware
139 * to exit any radio register access. */ 143 * to finish any radio register access. */
140 b43_read32(dev, B43_MMIO_MACCTL); 144 b43_read32(dev, B43_MMIO_MACCTL);
141 udelay(10); 145 udelay(10);
142} 146}
@@ -145,11 +149,15 @@ void b43_radio_unlock(struct b43_wldev *dev)
145{ 149{
146 u32 macctl; 150 u32 macctl;
147 151
152#if B43_DEBUG
153 B43_WARN_ON(!dev->phy.radio_locked);
154 dev->phy.radio_locked = 0;
155#endif
156
148 /* Commit any write */ 157 /* Commit any write */
149 b43_read16(dev, B43_MMIO_PHY_VER); 158 b43_read16(dev, B43_MMIO_PHY_VER);
150 /* unlock */ 159 /* unlock */
151 macctl = b43_read32(dev, B43_MMIO_MACCTL); 160 macctl = b43_read32(dev, B43_MMIO_MACCTL);
152 B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK));
153 macctl &= ~B43_MACCTL_RADIOLOCK; 161 macctl &= ~B43_MACCTL_RADIOLOCK;
154 b43_write32(dev, B43_MMIO_MACCTL, macctl); 162 b43_write32(dev, B43_MMIO_MACCTL, macctl);
155} 163}
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index c9f5430d1d7d..b2d99101947b 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -245,8 +245,10 @@ struct b43_phy {
245 atomic_t txerr_cnt; 245 atomic_t txerr_cnt;
246 246
247#ifdef CONFIG_B43_DEBUG 247#ifdef CONFIG_B43_DEBUG
248 /* PHY registers locked by b43_phy_lock()? */ 248 /* PHY registers locked (w.r.t. firmware) */
249 bool phy_locked; 249 bool phy_locked;
250 /* Radio registers locked (w.r.t. firmware) */
251 bool radio_locked;
250#endif /* B43_DEBUG */ 252#endif /* B43_DEBUG */
251}; 253};
252 254
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 2399328e8de7..527525cc0919 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1192,7 +1192,7 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)
1192 return -ENOMEM; 1192 return -ENOMEM;
1193 } 1193 }
1194 } else 1194 } else
1195 iwl_rx_queue_reset(priv, rxq); 1195 iwl3945_rx_queue_reset(priv, rxq);
1196 1196
1197 iwl3945_rx_replenish(priv); 1197 iwl3945_rx_replenish(priv);
1198 1198
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index ab7aaf6872c7..55188844657b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -215,6 +215,7 @@ extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
215extern int iwl3945_tx_queue_init(struct iwl_priv *priv, 215extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
216 struct iwl_tx_queue *txq, int count, u32 id); 216 struct iwl_tx_queue *txq, int count, u32 id);
217extern void iwl3945_rx_replenish(void *data); 217extern void iwl3945_rx_replenish(void *data);
218extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
218extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); 219extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
219extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, 220extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
220 const void *data); 221 const void *data);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 3889158b359c..1ef4192207a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -976,11 +976,9 @@ void iwl_rx_handle(struct iwl_priv *priv)
976 976
977 rxq->queue[i] = NULL; 977 rxq->queue[i] = NULL;
978 978
979 dma_sync_single_range_for_cpu( 979 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
980 &priv->pci_dev->dev, rxb->real_dma_addr, 980 priv->hw_params.rx_buf_size + 256,
981 rxb->aligned_dma_addr - rxb->real_dma_addr, 981 PCI_DMA_FROMDEVICE);
982 priv->hw_params.rx_buf_size,
983 PCI_DMA_FROMDEVICE);
984 pkt = (struct iwl_rx_packet *)rxb->skb->data; 982 pkt = (struct iwl_rx_packet *)rxb->skb->data;
985 983
986 /* Reclaim a command buffer only if this packet is a response 984 /* Reclaim a command buffer only if this packet is a response
@@ -1031,9 +1029,6 @@ void iwl_rx_handle(struct iwl_priv *priv)
1031 rxb->skb = NULL; 1029 rxb->skb = NULL;
1032 } 1030 }
1033 1031
1034 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1035 priv->hw_params.rx_buf_size + 256,
1036 PCI_DMA_FROMDEVICE);
1037 spin_lock_irqsave(&rxq->lock, flags); 1032 spin_lock_irqsave(&rxq->lock, flags);
1038 list_add_tail(&rxb->list, &priv->rxq.rx_used); 1033 list_add_tail(&rxb->list, &priv->rxq.rx_used);
1039 spin_unlock_irqrestore(&rxq->lock, flags); 1034 spin_unlock_irqrestore(&rxq->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index 2f1242447b3b..6e983149b83b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -223,7 +223,7 @@
223#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) 223#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000)
224 224
225/* EEPROM GP */ 225/* EEPROM GP */
226#define CSR_EEPROM_GP_VALID_MSK (0x00000006) 226#define CSR_EEPROM_GP_VALID_MSK (0x00000007)
227#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) 227#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000)
228#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) 228#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
229 229
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ec9a13846edd..cf7f0db58fcf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -360,12 +360,16 @@ struct iwl_host_cmd {
360 360
361/** 361/**
362 * struct iwl_rx_queue - Rx queue 362 * struct iwl_rx_queue - Rx queue
363 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
364 * @dma_addr: bus address of buffer of receive buffer descriptors (rbd)
363 * @read: Shared index to newest available Rx buffer 365 * @read: Shared index to newest available Rx buffer
364 * @write: Shared index to oldest written Rx packet 366 * @write: Shared index to oldest written Rx packet
365 * @free_count: Number of pre-allocated buffers in rx_free 367 * @free_count: Number of pre-allocated buffers in rx_free
366 * @rx_free: list of free SKBs for use 368 * @rx_free: list of free SKBs for use
367 * @rx_used: List of Rx buffers with no SKB 369 * @rx_used: List of Rx buffers with no SKB
368 * @need_update: flag to indicate we need to update read/write index 370 * @need_update: flag to indicate we need to update read/write index
371 * @rb_stts: driver's pointer to receive buffer status
372 * @rb_stts_dma: bus address of receive buffer status
369 * 373 *
370 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers 374 * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
371 */ 375 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 1f117a49c569..71d5b8a1a73e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -799,6 +799,22 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
799 /* Copy MAC header from skb into command buffer */ 799 /* Copy MAC header from skb into command buffer */
800 memcpy(tx_cmd->hdr, hdr, hdr_len); 800 memcpy(tx_cmd->hdr, hdr, hdr_len);
801 801
802
803 /* Total # bytes to be transmitted */
804 len = (u16)skb->len;
805 tx_cmd->len = cpu_to_le16(len);
806
807 if (info->control.hw_key)
808 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
809
810 /* TODO need this for burst mode later on */
811 iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id);
812
813 /* set is_hcca to 0; it probably will never be implemented */
814 iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0);
815
816 iwl_update_tx_stats(priv, le16_to_cpu(fc), len);
817
802 /* 818 /*
803 * Use the first empty entry in this queue's command buffer array 819 * Use the first empty entry in this queue's command buffer array
804 * to contain the Tx command and MAC header concatenated together 820 * to contain the Tx command and MAC header concatenated together
@@ -819,21 +835,30 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
819 else 835 else
820 len_org = 0; 836 len_org = 0;
821 837
838 /* Tell NIC about any 2-byte padding after MAC header */
839 if (len_org)
840 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
841
822 /* Physical address of this Tx command's header (not MAC header!), 842 /* Physical address of this Tx command's header (not MAC header!),
823 * within command buffer array. */ 843 * within command buffer array. */
824 txcmd_phys = pci_map_single(priv->pci_dev, 844 txcmd_phys = pci_map_single(priv->pci_dev,
825 out_cmd, sizeof(struct iwl_cmd), 845 &out_cmd->hdr, len,
826 PCI_DMA_BIDIRECTIONAL); 846 PCI_DMA_BIDIRECTIONAL);
827 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); 847 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
828 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); 848 pci_unmap_len_set(&out_cmd->meta, len, len);
829 /* Add buffer containing Tx command and MAC(!) header to TFD's 849 /* Add buffer containing Tx command and MAC(!) header to TFD's
830 * first entry */ 850 * first entry */
831 txcmd_phys += offsetof(struct iwl_cmd, hdr);
832 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 851 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
833 txcmd_phys, len, 1, 0); 852 txcmd_phys, len, 1, 0);
834 853
835 if (info->control.hw_key) 854 if (!ieee80211_has_morefrags(hdr->frame_control)) {
836 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); 855 txq->need_update = 1;
856 if (qc)
857 priv->stations[sta_id].tid[tid].seq_number = seq_number;
858 } else {
859 wait_write_ptr = 1;
860 txq->need_update = 0;
861 }
837 862
838 /* Set up TFD's 2nd entry to point directly to remainder of skb, 863 /* Set up TFD's 2nd entry to point directly to remainder of skb,
839 * if any (802.11 null frames have no payload). */ 864 * if any (802.11 null frames have no payload). */
@@ -846,41 +871,29 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
846 0, 0); 871 0, 0);
847 } 872 }
848 873
849 /* Tell NIC about any 2-byte padding after MAC header */
850 if (len_org)
851 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
852
853 /* Total # bytes to be transmitted */
854 len = (u16)skb->len;
855 tx_cmd->len = cpu_to_le16(len);
856 /* TODO need this for burst mode later on */
857 iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id);
858
859 /* set is_hcca to 0; it probably will never be implemented */
860 iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0);
861
862 iwl_update_tx_stats(priv, le16_to_cpu(fc), len);
863
864 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + 874 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
865 offsetof(struct iwl_tx_cmd, scratch); 875 offsetof(struct iwl_tx_cmd, scratch);
876
877 len = sizeof(struct iwl_tx_cmd) +
878 sizeof(struct iwl_cmd_header) + hdr_len;
879 /* take back ownership of DMA buffer to enable update */
880 pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys,
881 len, PCI_DMA_BIDIRECTIONAL);
866 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); 882 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
867 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); 883 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
868 884
869 if (!ieee80211_has_morefrags(hdr->frame_control)) { 885 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
870 txq->need_update = 1; 886 le16_to_cpu(out_cmd->hdr.sequence));
871 if (qc) 887 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx_cmd->tx_flags));
872 priv->stations[sta_id].tid[tid].seq_number = seq_number;
873 } else {
874 wait_write_ptr = 1;
875 txq->need_update = 0;
876 }
877
878 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); 888 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd));
879
880 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); 889 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len);
881 890
882 /* Set up entry for this TFD in Tx byte-count array */ 891 /* Set up entry for this TFD in Tx byte-count array */
883 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, len); 892 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq,
893 le16_to_cpu(tx_cmd->len));
894
895 pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
896 len, PCI_DMA_BIDIRECTIONAL);
884 897
885 /* Tell device the write index *just past* this latest filled TFD */ 898 /* Tell device the write index *just past* this latest filled TFD */
886 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 899 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
@@ -968,18 +981,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
968 INDEX_TO_SEQ(q->write_ptr)); 981 INDEX_TO_SEQ(q->write_ptr));
969 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 982 if (out_cmd->meta.flags & CMD_SIZE_HUGE)
970 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; 983 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
971 len = (idx == TFD_CMD_SLOTS) ? 984 len = sizeof(struct iwl_cmd) - sizeof(struct iwl_cmd_meta);
972 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 985 len += (idx == TFD_CMD_SLOTS) ? IWL_MAX_SCAN_SIZE : 0;
973
974 phys_addr = pci_map_single(priv->pci_dev, out_cmd,
975 len, PCI_DMA_BIDIRECTIONAL);
976 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
977 pci_unmap_len_set(&out_cmd->meta, len, len);
978 phys_addr += offsetof(struct iwl_cmd, hdr);
979 986
980 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
981 phys_addr, fix_size, 1,
982 U32_PAD(cmd->len));
983 987
984#ifdef CONFIG_IWLWIFI_DEBUG 988#ifdef CONFIG_IWLWIFI_DEBUG
985 switch (out_cmd->hdr.cmd) { 989 switch (out_cmd->hdr.cmd) {
@@ -1007,6 +1011,15 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1007 /* Set up entry in queue's byte count circular buffer */ 1011 /* Set up entry in queue's byte count circular buffer */
1008 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0); 1012 priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
1009 1013
1014 phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr,
1015 fix_size, PCI_DMA_BIDIRECTIONAL);
1016 pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
1017 pci_unmap_len_set(&out_cmd->meta, len, fix_size);
1018
1019 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
1020 phys_addr, fix_size, 1,
1021 U32_PAD(cmd->len));
1022
1010 /* Increment and update queue's write index */ 1023 /* Increment and update queue's write index */
1011 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1024 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
1012 ret = iwl_txq_update_write_ptr(priv, txq); 1025 ret = iwl_txq_update_write_ptr(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index ce729281ff62..617c4235d971 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -972,7 +972,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
972 dma_addr_t phys_addr; 972 dma_addr_t phys_addr;
973 dma_addr_t txcmd_phys; 973 dma_addr_t txcmd_phys;
974 int txq_id = skb_get_queue_mapping(skb); 974 int txq_id = skb_get_queue_mapping(skb);
975 u16 len, idx, len_org, hdr_len; 975 u16 len, idx, len_org, hdr_len; /* TODO: len_org is not used */
976 u8 id; 976 u8 id;
977 u8 unicast; 977 u8 unicast;
978 u8 sta_id; 978 u8 sta_id;
@@ -1074,6 +1074,40 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1074 /* Copy MAC header from skb into command buffer */ 1074 /* Copy MAC header from skb into command buffer */
1075 memcpy(tx->hdr, hdr, hdr_len); 1075 memcpy(tx->hdr, hdr, hdr_len);
1076 1076
1077
1078 if (info->control.hw_key)
1079 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
1080
1081 /* TODO need this for burst mode later on */
1082 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
1083
1084 /* set is_hcca to 0; it probably will never be implemented */
1085 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
1086
1087 /* Total # bytes to be transmitted */
1088 len = (u16)skb->len;
1089 tx->len = cpu_to_le16(len);
1090
1091
1092 tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
1093 tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
1094
1095 if (!ieee80211_has_morefrags(hdr->frame_control)) {
1096 txq->need_update = 1;
1097 if (qc)
1098 priv->stations_39[sta_id].tid[tid].seq_number = seq_number;
1099 } else {
1100 wait_write_ptr = 1;
1101 txq->need_update = 0;
1102 }
1103
1104 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
1105 le16_to_cpu(out_cmd->hdr.sequence));
1106 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx->tx_flags));
1107 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
1108 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
1109 ieee80211_hdrlen(fc));
1110
1077 /* 1111 /*
1078 * Use the first empty entry in this queue's command buffer array 1112 * Use the first empty entry in this queue's command buffer array
1079 * to contain the Tx command and MAC header concatenated together 1113 * to contain the Tx command and MAC header concatenated together
@@ -1096,22 +1130,18 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1096 1130
1097 /* Physical address of this Tx command's header (not MAC header!), 1131 /* Physical address of this Tx command's header (not MAC header!),
1098 * within command buffer array. */ 1132 * within command buffer array. */
1099 txcmd_phys = pci_map_single(priv->pci_dev, 1133 txcmd_phys = pci_map_single(priv->pci_dev, &out_cmd->hdr,
1100 out_cmd, sizeof(struct iwl_cmd), 1134 len, PCI_DMA_TODEVICE);
1101 PCI_DMA_TODEVICE); 1135 /* we do not map meta data ... so we can safely access address to
1136 * provide to unmap command*/
1102 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); 1137 pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
1103 pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); 1138 pci_unmap_len_set(&out_cmd->meta, len, len);
1104 /* Add buffer containing Tx command and MAC(!) header to TFD's
1105 * first entry */
1106 txcmd_phys += offsetof(struct iwl_cmd, hdr);
1107 1139
1108 /* Add buffer containing Tx command and MAC(!) header to TFD's 1140 /* Add buffer containing Tx command and MAC(!) header to TFD's
1109 * first entry */ 1141 * first entry */
1110 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, 1142 priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
1111 txcmd_phys, len, 1, 0); 1143 txcmd_phys, len, 1, 0);
1112 1144
1113 if (info->control.hw_key)
1114 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
1115 1145
1116 /* Set up TFD's 2nd entry to point directly to remainder of skb, 1146 /* Set up TFD's 2nd entry to point directly to remainder of skb,
1117 * if any (802.11 null frames have no payload). */ 1147 * if any (802.11 null frames have no payload). */
@@ -1124,32 +1154,6 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1124 0, U32_PAD(len)); 1154 0, U32_PAD(len));
1125 } 1155 }
1126 1156
1127 /* Total # bytes to be transmitted */
1128 len = (u16)skb->len;
1129 tx->len = cpu_to_le16(len);
1130
1131 /* TODO need this for burst mode later on */
1132 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
1133
1134 /* set is_hcca to 0; it probably will never be implemented */
1135 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
1136
1137 tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
1138 tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
1139
1140 if (!ieee80211_has_morefrags(hdr->frame_control)) {
1141 txq->need_update = 1;
1142 if (qc)
1143 priv->stations_39[sta_id].tid[tid].seq_number = seq_number;
1144 } else {
1145 wait_write_ptr = 1;
1146 txq->need_update = 0;
1147 }
1148
1149 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
1150
1151 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
1152 ieee80211_hdrlen(fc));
1153 1157
1154 /* Tell device the write index *just past* this latest filled TFD */ 1158 /* Tell device the write index *just past* this latest filled TFD */
1155 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1159 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
@@ -1661,6 +1665,37 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
1661 spin_unlock_irqrestore(&rxq->lock, flags); 1665 spin_unlock_irqrestore(&rxq->lock, flags);
1662} 1666}
1663 1667
1668void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1669{
1670 unsigned long flags;
1671 int i;
1672 spin_lock_irqsave(&rxq->lock, flags);
1673 INIT_LIST_HEAD(&rxq->rx_free);
1674 INIT_LIST_HEAD(&rxq->rx_used);
1675 /* Fill the rx_used queue with _all_ of the Rx buffers */
1676 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {
1677 /* In the reset function, these buffers may have been allocated
1678 * to an SKB, so we need to unmap and free potential storage */
1679 if (rxq->pool[i].skb != NULL) {
1680 pci_unmap_single(priv->pci_dev,
1681 rxq->pool[i].real_dma_addr,
1682 priv->hw_params.rx_buf_size,
1683 PCI_DMA_FROMDEVICE);
1684 priv->alloc_rxb_skb--;
1685 dev_kfree_skb(rxq->pool[i].skb);
1686 rxq->pool[i].skb = NULL;
1687 }
1688 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
1689 }
1690
1691 /* Set us so that we have processed and used all buffers, but have
1692 * not restocked the Rx queue with fresh buffers */
1693 rxq->read = rxq->write = 0;
1694 rxq->free_count = 0;
1695 spin_unlock_irqrestore(&rxq->lock, flags);
1696}
1697EXPORT_SYMBOL(iwl3945_rx_queue_reset);
1698
1664/* 1699/*
1665 * this should be called while priv->lock is locked 1700 * this should be called while priv->lock is locked
1666 */ 1701 */
@@ -1685,6 +1720,34 @@ void iwl3945_rx_replenish(void *data)
1685 spin_unlock_irqrestore(&priv->lock, flags); 1720 spin_unlock_irqrestore(&priv->lock, flags);
1686} 1721}
1687 1722
1723/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
1724 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
1725 * This free routine walks the list of POOL entries and if SKB is set to
1726 * non NULL it is unmapped and freed
1727 */
1728static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1729{
1730 int i;
1731 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
1732 if (rxq->pool[i].skb != NULL) {
1733 pci_unmap_single(priv->pci_dev,
1734 rxq->pool[i].real_dma_addr,
1735 priv->hw_params.rx_buf_size,
1736 PCI_DMA_FROMDEVICE);
1737 dev_kfree_skb(rxq->pool[i].skb);
1738 }
1739 }
1740
1741 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1742 rxq->dma_addr);
1743 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status),
1744 rxq->rb_stts, rxq->rb_stts_dma);
1745 rxq->bd = NULL;
1746 rxq->rb_stts = NULL;
1747}
1748EXPORT_SYMBOL(iwl3945_rx_queue_free);
1749
1750
1688/* Convert linear signal-to-noise ratio into dB */ 1751/* Convert linear signal-to-noise ratio into dB */
1689static u8 ratio2dB[100] = { 1752static u8 ratio2dB[100] = {
1690/* 0 1 2 3 4 5 6 7 8 9 */ 1753/* 0 1 2 3 4 5 6 7 8 9 */
@@ -1802,9 +1865,9 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1802 1865
1803 rxq->queue[i] = NULL; 1866 rxq->queue[i] = NULL;
1804 1867
1805 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->real_dma_addr, 1868 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1806 priv->hw_params.rx_buf_size, 1869 priv->hw_params.rx_buf_size,
1807 PCI_DMA_FROMDEVICE); 1870 PCI_DMA_FROMDEVICE);
1808 pkt = (struct iwl_rx_packet *)rxb->skb->data; 1871 pkt = (struct iwl_rx_packet *)rxb->skb->data;
1809 1872
1810 /* Reclaim a command buffer only if this packet is a response 1873 /* Reclaim a command buffer only if this packet is a response
@@ -1852,9 +1915,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1852 rxb->skb = NULL; 1915 rxb->skb = NULL;
1853 } 1916 }
1854 1917
1855 pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
1856 priv->hw_params.rx_buf_size,
1857 PCI_DMA_FROMDEVICE);
1858 spin_lock_irqsave(&rxq->lock, flags); 1918 spin_lock_irqsave(&rxq->lock, flags);
1859 list_add_tail(&rxb->list, &priv->rxq.rx_used); 1919 list_add_tail(&rxb->list, &priv->rxq.rx_used);
1860 spin_unlock_irqrestore(&rxq->lock, flags); 1920 spin_unlock_irqrestore(&rxq->lock, flags);
@@ -4075,7 +4135,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
4075 if (!static_key) { 4135 if (!static_key) {
4076 sta_id = iwl3945_hw_find_station(priv, addr); 4136 sta_id = iwl3945_hw_find_station(priv, addr);
4077 if (sta_id == IWL_INVALID_STATION) { 4137 if (sta_id == IWL_INVALID_STATION) {
4078 IWL_DEBUG_MAC80211(priv, "leave - %pMnot in station map.\n", 4138 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
4079 addr); 4139 addr);
4080 return -EINVAL; 4140 return -EINVAL;
4081 } 4141 }
@@ -4913,6 +4973,8 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
4913 4973
4914 hw->wiphy->custom_regulatory = true; 4974 hw->wiphy->custom_regulatory = true;
4915 4975
4976 hw->wiphy->max_scan_ssids = 1; /* WILL FIX */
4977
4916 /* Default value; 4 EDCA QOS priorities */ 4978 /* Default value; 4 EDCA QOS priorities */
4917 hw->queues = 4; 4979 hw->queues = 4;
4918 4980
@@ -5194,12 +5256,12 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
5194 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 5256 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
5195 5257
5196 iwl_rfkill_unregister(priv); 5258 iwl_rfkill_unregister(priv);
5197 cancel_delayed_work(&priv->rfkill_poll); 5259 cancel_delayed_work_sync(&priv->rfkill_poll);
5198 5260
5199 iwl3945_dealloc_ucode_pci(priv); 5261 iwl3945_dealloc_ucode_pci(priv);
5200 5262
5201 if (priv->rxq.bd) 5263 if (priv->rxq.bd)
5202 iwl_rx_queue_free(priv, &priv->rxq); 5264 iwl3945_rx_queue_free(priv, &priv->rxq);
5203 iwl3945_hw_txq_ctx_free(priv); 5265 iwl3945_hw_txq_ctx_free(priv);
5204 5266
5205 iwl3945_unset_hw_params(priv); 5267 iwl3945_unset_hw_params(priv);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 63d7e19ce9bd..8e669775cb5d 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -170,6 +170,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
170 lbs_deb_rx("rx err: frame received with bad length\n"); 170 lbs_deb_rx("rx err: frame received with bad length\n");
171 dev->stats.rx_length_errors++; 171 dev->stats.rx_length_errors++;
172 ret = 0; 172 ret = 0;
173 dev_kfree_skb(skb);
173 goto done; 174 goto done;
174 } 175 }
175 176
@@ -181,6 +182,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
181 lbs_pr_alert("rxpd not ok\n"); 182 lbs_pr_alert("rxpd not ok\n");
182 dev->stats.rx_errors++; 183 dev->stats.rx_errors++;
183 ret = 0; 184 ret = 0;
185 dev_kfree_skb(skb);
184 goto done; 186 goto done;
185 } 187 }
186 188
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 57a0268d1bae..a9a970469c2a 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -893,8 +893,7 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index)
893 rx_desc->next_rx_desc_phys_addr = 893 rx_desc->next_rx_desc_phys_addr =
894 cpu_to_le32(rxq->rx_desc_dma 894 cpu_to_le32(rxq->rx_desc_dma
895 + nexti * sizeof(*rx_desc)); 895 + nexti * sizeof(*rx_desc));
896 rx_desc->rx_ctrl = 896 rx_desc->rx_ctrl = MWL8K_RX_CTRL_OWNED_BY_HOST;
897 cpu_to_le32(MWL8K_RX_CTRL_OWNED_BY_HOST);
898 } 897 }
899 898
900 return 0; 899 return 0;
@@ -3720,12 +3719,12 @@ err_free_reg:
3720 return rc; 3719 return rc;
3721} 3720}
3722 3721
3723static void __devexit mwl8k_remove(struct pci_dev *pdev) 3722static void __devexit mwl8k_shutdown(struct pci_dev *pdev)
3724{ 3723{
3725 printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__); 3724 printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__);
3726} 3725}
3727 3726
3728static void __devexit mwl8k_shutdown(struct pci_dev *pdev) 3727static void __devexit mwl8k_remove(struct pci_dev *pdev)
3729{ 3728{
3730 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 3729 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
3731 struct mwl8k_priv *priv; 3730 struct mwl8k_priv *priv;
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 081428d9409e..632fac86a308 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -372,15 +372,13 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
372 } 372 }
373 373
374 /* Wait upto 100ms for tx queue to empty */ 374 /* Wait upto 100ms for tx queue to empty */
375 k = 100; 375 for (k = 100; k > 0; k--) {
376 do {
377 k--;
378 udelay(1000); 376 udelay(1000);
379 ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY, 377 ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
380 &xmitting); 378 &xmitting);
381 if (ret) 379 if (ret || !xmitting)
382 break; 380 break;
383 } while ((k > 0) && xmitting); 381 }
384 382
385 if (k == 0) 383 if (k == 0)
386 ret = -ETIMEDOUT; 384 ret = -ETIMEDOUT;
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 2dda5fe418b6..ecf8b6ed5a47 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -14,9 +14,9 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#ifdef CONFIG_MAC80211_LEDS 17#ifdef CONFIG_P54_LEDS
18#include <linux/leds.h> 18#include <linux/leds.h>
19#endif /* CONFIG_MAC80211_LEDS */ 19#endif /* CONFIG_P54_LEDS */
20 20
21enum p54_control_frame_types { 21enum p54_control_frame_types {
22 P54_CONTROL_TYPE_SETUP = 0, 22 P54_CONTROL_TYPE_SETUP = 0,
@@ -116,7 +116,7 @@ enum fw_state {
116 FW_STATE_RESETTING, 116 FW_STATE_RESETTING,
117}; 117};
118 118
119#ifdef CONFIG_MAC80211_LEDS 119#ifdef CONFIG_P54_LEDS
120 120
121#define P54_LED_MAX_NAME_LEN 31 121#define P54_LED_MAX_NAME_LEN 31
122 122
@@ -129,7 +129,7 @@ struct p54_led_dev {
129 unsigned int registered; 129 unsigned int registered;
130}; 130};
131 131
132#endif /* CONFIG_MAC80211_LEDS */ 132#endif /* CONFIG_P54_LEDS */
133 133
134struct p54_common { 134struct p54_common {
135 struct ieee80211_hw *hw; 135 struct ieee80211_hw *hw;
@@ -177,10 +177,10 @@ struct p54_common {
177 u8 privacy_caps; 177 u8 privacy_caps;
178 u8 rx_keycache_size; 178 u8 rx_keycache_size;
179 /* LED management */ 179 /* LED management */
180 #ifdef CONFIG_MAC80211_LEDS 180#ifdef CONFIG_P54_LEDS
181 struct p54_led_dev assoc_led; 181 struct p54_led_dev assoc_led;
182 struct p54_led_dev tx_led; 182 struct p54_led_dev tx_led;
183 #endif /* CONFIG_MAC80211_LEDS */ 183#endif /* CONFIG_P54_LEDS */
184 u16 softled_state; /* bit field of glowing LEDs */ 184 u16 softled_state; /* bit field of glowing LEDs */
185}; 185};
186 186
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 0c1b0577d4ee..c8f0232ee5e0 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -2543,8 +2543,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
2543 priv->basic_rate_mask = 0x15f; 2543 priv->basic_rate_mask = 0x15f;
2544 skb_queue_head_init(&priv->tx_queue); 2544 skb_queue_head_init(&priv->tx_queue);
2545 dev->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2545 dev->flags = IEEE80211_HW_RX_INCLUDES_FCS |
2546 IEEE80211_HW_SUPPORTS_PS |
2547 IEEE80211_HW_PS_NULLFUNC_STACK |
2548 IEEE80211_HW_SIGNAL_DBM | 2546 IEEE80211_HW_SIGNAL_DBM |
2549 IEEE80211_HW_NOISE_DBM; 2547 IEEE80211_HW_NOISE_DBM;
2550 2548
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 2b222aaa6f0a..d1fe577de3d4 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -457,9 +457,10 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
457 struct ieee80211_tx_info *info; 457 struct ieee80211_tx_info *info;
458 struct p54_tx_info *minfo; 458 struct p54_tx_info *minfo;
459 struct p54s_tx_info *dinfo; 459 struct p54s_tx_info *dinfo;
460 unsigned long flags;
460 int ret = 0; 461 int ret = 0;
461 462
462 spin_lock_bh(&priv->tx_lock); 463 spin_lock_irqsave(&priv->tx_lock, flags);
463 464
464 while (!list_empty(&priv->tx_pending)) { 465 while (!list_empty(&priv->tx_pending)) {
465 entry = list_entry(priv->tx_pending.next, 466 entry = list_entry(priv->tx_pending.next,
@@ -467,7 +468,7 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
467 468
468 list_del_init(&entry->tx_list); 469 list_del_init(&entry->tx_list);
469 470
470 spin_unlock_bh(&priv->tx_lock); 471 spin_unlock_irqrestore(&priv->tx_lock, flags);
471 472
472 dinfo = container_of((void *) entry, struct p54s_tx_info, 473 dinfo = container_of((void *) entry, struct p54s_tx_info,
473 tx_list); 474 tx_list);
@@ -479,16 +480,14 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
479 480
480 ret = p54spi_tx_frame(priv, skb); 481 ret = p54spi_tx_frame(priv, skb);
481 482
482 spin_lock_bh(&priv->tx_lock);
483
484 if (ret < 0) { 483 if (ret < 0) {
485 p54_free_skb(priv->hw, skb); 484 p54_free_skb(priv->hw, skb);
486 goto out; 485 return ret;
487 } 486 }
488 }
489 487
490out: 488 spin_lock_irqsave(&priv->tx_lock, flags);
491 spin_unlock_bh(&priv->tx_lock); 489 }
490 spin_unlock_irqrestore(&priv->tx_lock, flags);
492 return ret; 491 return ret;
493} 492}
494 493
@@ -498,12 +497,13 @@ static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
498 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 497 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
499 struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; 498 struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data;
500 struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; 499 struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data;
500 unsigned long flags;
501 501
502 BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); 502 BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data)));
503 503
504 spin_lock_bh(&priv->tx_lock); 504 spin_lock_irqsave(&priv->tx_lock, flags);
505 list_add_tail(&di->tx_list, &priv->tx_pending); 505 list_add_tail(&di->tx_list, &priv->tx_pending);
506 spin_unlock_bh(&priv->tx_lock); 506 spin_unlock_irqrestore(&priv->tx_lock, flags);
507 507
508 queue_work(priv->hw->workqueue, &priv->work); 508 queue_work(priv->hw->workqueue, &priv->work);
509} 509}
@@ -604,6 +604,7 @@ out:
604static void p54spi_op_stop(struct ieee80211_hw *dev) 604static void p54spi_op_stop(struct ieee80211_hw *dev)
605{ 605{
606 struct p54s_priv *priv = dev->priv; 606 struct p54s_priv *priv = dev->priv;
607 unsigned long flags;
607 608
608 if (mutex_lock_interruptible(&priv->mutex)) { 609 if (mutex_lock_interruptible(&priv->mutex)) {
609 /* FIXME: how to handle this error? */ 610 /* FIXME: how to handle this error? */
@@ -615,9 +616,9 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
615 cancel_work_sync(&priv->work); 616 cancel_work_sync(&priv->work);
616 617
617 p54spi_power_off(priv); 618 p54spi_power_off(priv);
618 spin_lock_bh(&priv->tx_lock); 619 spin_lock_irqsave(&priv->tx_lock, flags);
619 INIT_LIST_HEAD(&priv->tx_pending); 620 INIT_LIST_HEAD(&priv->tx_pending);
620 spin_unlock_bh(&priv->tx_lock); 621 spin_unlock_irqrestore(&priv->tx_lock, flags);
621 622
622 priv->fw_state = FW_STATE_OFF; 623 priv->fw_state = FW_STATE_OFF;
623 mutex_unlock(&priv->mutex); 624 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index da6640afc835..6cc6cbc9234f 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -71,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
71 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ 71 {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */
72 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ 72 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */
73 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 73 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
74 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
74 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 75 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
75 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 76 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
76 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ 77 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 05f94e21b423..5752aaae906b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -646,10 +646,8 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
646 * Register HW. 646 * Register HW.
647 */ 647 */
648 status = ieee80211_register_hw(rt2x00dev->hw); 648 status = ieee80211_register_hw(rt2x00dev->hw);
649 if (status) { 649 if (status)
650 rt2x00lib_remove_hw(rt2x00dev);
651 return status; 650 return status;
652 }
653 651
654 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); 652 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags);
655 653
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 43fa0f849003..9730b4f8fd26 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -369,8 +369,6 @@ int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
369 if (retval) 369 if (retval)
370 return retval; 370 return retval;
371 371
372 rt2x00pci_free_reg(rt2x00dev);
373
374 pci_save_state(pci_dev); 372 pci_save_state(pci_dev);
375 pci_disable_device(pci_dev); 373 pci_disable_device(pci_dev);
376 return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); 374 return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
@@ -381,7 +379,6 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
381{ 379{
382 struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); 380 struct ieee80211_hw *hw = pci_get_drvdata(pci_dev);
383 struct rt2x00_dev *rt2x00dev = hw->priv; 381 struct rt2x00_dev *rt2x00dev = hw->priv;
384 int retval;
385 382
386 if (pci_set_power_state(pci_dev, PCI_D0) || 383 if (pci_set_power_state(pci_dev, PCI_D0) ||
387 pci_enable_device(pci_dev) || 384 pci_enable_device(pci_dev) ||
@@ -390,20 +387,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
390 return -EIO; 387 return -EIO;
391 } 388 }
392 389
393 retval = rt2x00pci_alloc_reg(rt2x00dev); 390 return rt2x00lib_resume(rt2x00dev);
394 if (retval)
395 return retval;
396
397 retval = rt2x00lib_resume(rt2x00dev);
398 if (retval)
399 goto exit_free_reg;
400
401 return 0;
402
403exit_free_reg:
404 rt2x00pci_free_reg(rt2x00dev);
405
406 return retval;
407} 391}
408EXPORT_SYMBOL_GPL(rt2x00pci_resume); 392EXPORT_SYMBOL_GPL(rt2x00pci_resume);
409#endif /* CONFIG_PM */ 393#endif /* CONFIG_PM */
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 7d50ca82375e..501544882c2c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -702,8 +702,6 @@ int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state)
702 if (retval) 702 if (retval)
703 return retval; 703 return retval;
704 704
705 rt2x00usb_free_reg(rt2x00dev);
706
707 /* 705 /*
708 * Decrease usbdev refcount. 706 * Decrease usbdev refcount.
709 */ 707 */
@@ -717,24 +715,10 @@ int rt2x00usb_resume(struct usb_interface *usb_intf)
717{ 715{
718 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); 716 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
719 struct rt2x00_dev *rt2x00dev = hw->priv; 717 struct rt2x00_dev *rt2x00dev = hw->priv;
720 int retval;
721 718
722 usb_get_dev(interface_to_usbdev(usb_intf)); 719 usb_get_dev(interface_to_usbdev(usb_intf));
723 720
724 retval = rt2x00usb_alloc_reg(rt2x00dev); 721 return rt2x00lib_resume(rt2x00dev);
725 if (retval)
726 return retval;
727
728 retval = rt2x00lib_resume(rt2x00dev);
729 if (retval)
730 goto exit_free_reg;
731
732 return 0;
733
734exit_free_reg:
735 rt2x00usb_free_reg(rt2x00dev);
736
737 return retval;
738} 722}
739EXPORT_SYMBOL_GPL(rt2x00usb_resume); 723EXPORT_SYMBOL_GPL(rt2x00usb_resume);
740#endif /* CONFIG_PM */ 724#endif /* CONFIG_PM */
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 420fff42c0dd..853b2b279b64 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2369,6 +2369,8 @@ static struct usb_device_id rt73usb_device_table[] = {
2369 /* Buffalo */ 2369 /* Buffalo */
2370 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, 2370 { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
2371 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2371 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2372 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
2373 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
2372 /* CNet */ 2374 /* CNet */
2373 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2375 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
2374 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2376 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },