aboutsummaryrefslogtreecommitdiffstats
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
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 ...
-rw-r--r--MAINTAINERS11
-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
-rw-r--r--firmware/Makefile1
-rw-r--r--firmware/WHENCE10
-rw-r--r--firmware/cis/LA-PCM.cis.ihex20
-rw-r--r--include/net/netfilter/nf_nat.h1
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/ax25/ax25_uid.c12
-rw-r--r--net/bluetooth/hci_event.c38
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/can/af_can.c4
-rw-r--r--net/core/dev.c13
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c3
-rw-r--r--net/ipv4/tcp.c6
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/iucv/af_iucv.c24
-rw-r--r--net/mac80211/Kconfig7
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c38
-rw-r--r--net/mac80211/pm.c15
-rw-r--r--net/mac80211/rx.c15
-rw-r--r--net/mac80211/wext.c43
-rw-r--r--net/netfilter/nf_conntrack_helper.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c14
-rw-r--r--net/netfilter/nf_log.c4
-rw-r--r--net/netfilter/nfnetlink.c2
-rw-r--r--net/netlabel/netlabel_addrlist.c26
-rw-r--r--net/netrom/af_netrom.c6
-rw-r--r--net/sched/sch_netem.c8
-rw-r--r--net/wireless/core.h2
-rw-r--r--net/wireless/nl80211.c4
-rw-r--r--net/wireless/reg.c5
-rw-r--r--net/wireless/scan.c40
83 files changed, 849 insertions, 485 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 698c4608c715..d58027ed1349 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3991,8 +3991,8 @@ NETWORKING [GENERAL]
3991P: David S. Miller 3991P: David S. Miller
3992M: davem@davemloft.net 3992M: davem@davemloft.net
3993L: netdev@vger.kernel.org 3993L: netdev@vger.kernel.org
3994W: http://linux-net.osdl.org/ 3994W: http://www.linuxfoundation.org/en/Net
3995T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git 3995T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
3996S: Maintained 3996S: Maintained
3997F: net/ 3997F: net/
3998F: include/net/ 3998F: include/net/
@@ -4033,6 +4033,13 @@ F: net/wireless/
4033F: include/net/ieee80211* 4033F: include/net/ieee80211*
4034F: include/net/wireless.h 4034F: include/net/wireless.h
4035 4035
4036NETWORKING DRIVERS
4037L: netdev@vger.kernel.org
4038W: http://www.linuxfoundation.org/en/Net
4039T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
4040S: Odd Fixes
4041F: drivers/net/
4042
4036NETXEN (1/10) GbE SUPPORT 4043NETXEN (1/10) GbE SUPPORT
4037P: Dhananjay Phadke 4044P: Dhananjay Phadke
4038M: dhananjay@netxen.com 4045M: dhananjay@netxen.com
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) },
diff --git a/firmware/Makefile b/firmware/Makefile
index 142c17ab9e57..25200d106ee8 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -46,6 +46,7 @@ fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
46fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \ 46fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
47 e100/d102e_ucode.bin 47 e100/d102e_ucode.bin
48fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin 48fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin
49fw-shipped-$(CONFIG_PCMCIA_PCNET) += cis/LA-PCM.cis
49fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin 50fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin
50fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \ 51fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \
51 advansys/3550.bin advansys/38C0800.bin 52 advansys/3550.bin advansys/38C0800.bin
diff --git a/firmware/WHENCE b/firmware/WHENCE
index 10f61c9e5a8a..4c52984a8319 100644
--- a/firmware/WHENCE
+++ b/firmware/WHENCE
@@ -576,6 +576,16 @@ Found in hex form in kernel source.
576 576
577-------------------------------------------------------------------------- 577--------------------------------------------------------------------------
578 578
579Driver: PCMCIA_PCNET - NE2000 compatible PCMCIA adapter
580
581File: cis/LA-PCM.cis
582
583Licence: GPL
584
585Originally developed by the pcmcia-cs project
586
587--------------------------------------------------------------------------
588
579Driver: PCMCIA_SMC91C92 - SMC 91Cxx PCMCIA 589Driver: PCMCIA_SMC91C92 - SMC 91Cxx PCMCIA
580 590
581File: ositech/Xilinx7OD.bin 591File: ositech/Xilinx7OD.bin
diff --git a/firmware/cis/LA-PCM.cis.ihex b/firmware/cis/LA-PCM.cis.ihex
new file mode 100644
index 000000000000..a0ff0c7b393d
--- /dev/null
+++ b/firmware/cis/LA-PCM.cis.ihex
@@ -0,0 +1,20 @@
1:100000000105D4F953E9FF17035338FF20040FC04B
2:1000100002002102060315390401416C6C69656414
3:100020002054656C657369732C4B2E4B00457468C6
4:1000300065726E6574204C414E20436172640043CA
5:10004000656E747265434F4D004C412D50434D0019
6:10005000FF1A0602100000020B1B08810108E06075
7:1000600000021F1B08820108E06020021F1B08839A
8:100070000108E06040021F1B08840108E060600284
9:100080001F1B08850108E06080021F1B088601080D
10:10009000E060A0021F1B08870108E060C0021F1B70
11:1000A00008880108E060E0021F1B08890108E06081
12:1000B00000031F1B088A0108E06020031F1B088B38
13:1000C0000108E06040031F1B088C0108E06060032A
14:1000D0001F1B088D0108E06080031F1B088E0108AC
15:1000E000E060A0031F1B088F0108E060C0031F1B16
16:0D00F00008900108E060E0031F1400FF000D
17:00000001FF
18#
19# Replacement CIS for Allied Telesis LA-PCM
20#
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 9dc1039ff78b..8df0b7f7fc6e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -18,6 +18,7 @@ enum nf_nat_manip_type
18#define IP_NAT_RANGE_MAP_IPS 1 18#define IP_NAT_RANGE_MAP_IPS 1
19#define IP_NAT_RANGE_PROTO_SPECIFIED 2 19#define IP_NAT_RANGE_PROTO_SPECIFIED 2
20#define IP_NAT_RANGE_PROTO_RANDOM 4 20#define IP_NAT_RANGE_PROTO_RANDOM 4
21#define IP_NAT_RANGE_PERSISTENT 8
21 22
22/* NAT sequence number modifications */ 23/* NAT sequence number modifications */
23struct nf_nat_seq { 24struct nf_nat_seq {
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1b34135cf990..6b0921364014 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -668,7 +668,8 @@ static int vlan_ethtool_get_settings(struct net_device *dev,
668 const struct vlan_dev_info *vlan = vlan_dev_info(dev); 668 const struct vlan_dev_info *vlan = vlan_dev_info(dev);
669 struct net_device *real_dev = vlan->real_dev; 669 struct net_device *real_dev = vlan->real_dev;
670 670
671 if (!real_dev->ethtool_ops->get_settings) 671 if (!real_dev->ethtool_ops ||
672 !real_dev->ethtool_ops->get_settings)
672 return -EOPNOTSUPP; 673 return -EOPNOTSUPP;
673 674
674 return real_dev->ethtool_ops->get_settings(real_dev, cmd); 675 return real_dev->ethtool_ops->get_settings(real_dev, cmd);
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 57aeba729bae..832bcf092a01 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -148,9 +148,13 @@ static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
148{ 148{
149 struct ax25_uid_assoc *pt; 149 struct ax25_uid_assoc *pt;
150 struct hlist_node *node; 150 struct hlist_node *node;
151 int i = 0; 151 int i = 1;
152 152
153 read_lock(&ax25_uid_lock); 153 read_lock(&ax25_uid_lock);
154
155 if (*pos == 0)
156 return SEQ_START_TOKEN;
157
154 ax25_uid_for_each(pt, node, &ax25_uid_list) { 158 ax25_uid_for_each(pt, node, &ax25_uid_list) {
155 if (i == *pos) 159 if (i == *pos)
156 return pt; 160 return pt;
@@ -162,8 +166,10 @@ static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
162static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos) 166static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
163{ 167{
164 ++*pos; 168 ++*pos;
165 169 if (v == SEQ_START_TOKEN)
166 return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next, 170 return ax25_uid_list.first;
171 else
172 return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next,
167 ax25_uid_assoc, uid_node); 173 ax25_uid_assoc, uid_node);
168} 174}
169 175
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 55534244c3a0..15f40ea8d544 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -866,8 +866,16 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
866 hci_dev_lock(hdev); 866 hci_dev_lock(hdev);
867 867
868 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 868 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
869 if (!conn) 869 if (!conn) {
870 goto unlock; 870 if (ev->link_type != SCO_LINK)
871 goto unlock;
872
873 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr);
874 if (!conn)
875 goto unlock;
876
877 conn->type = SCO_LINK;
878 }
871 879
872 if (!ev->status) { 880 if (!ev->status) {
873 conn->handle = __le16_to_cpu(ev->handle); 881 conn->handle = __le16_to_cpu(ev->handle);
@@ -1646,20 +1654,28 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
1646 conn->type = SCO_LINK; 1654 conn->type = SCO_LINK;
1647 } 1655 }
1648 1656
1649 if (conn->out && ev->status == 0x1c && conn->attempt < 2) { 1657 switch (ev->status) {
1650 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | 1658 case 0x00:
1651 (hdev->esco_type & EDR_ESCO_MASK);
1652 hci_setup_sync(conn, conn->link->handle);
1653 goto unlock;
1654 }
1655
1656 if (!ev->status) {
1657 conn->handle = __le16_to_cpu(ev->handle); 1659 conn->handle = __le16_to_cpu(ev->handle);
1658 conn->state = BT_CONNECTED; 1660 conn->state = BT_CONNECTED;
1659 1661
1660 hci_conn_add_sysfs(conn); 1662 hci_conn_add_sysfs(conn);
1661 } else 1663 break;
1664
1665 case 0x1c: /* SCO interval rejected */
1666 case 0x1f: /* Unspecified error */
1667 if (conn->out && conn->attempt < 2) {
1668 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
1669 (hdev->esco_type & EDR_ESCO_MASK);
1670 hci_setup_sync(conn, conn->link->handle);
1671 goto unlock;
1672 }
1673 /* fall through */
1674
1675 default:
1662 conn->state = BT_CLOSED; 1676 conn->state = BT_CLOSED;
1677 break;
1678 }
1663 1679
1664 hci_proto_connect_cfm(conn, ev->status); 1680 hci_proto_connect_cfm(conn, ev->status);
1665 if (ev->status) 1681 if (ev->status)
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 1d0fb0f23c63..374536e050aa 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1194,6 +1194,8 @@ void rfcomm_dlc_accept(struct rfcomm_dlc *d)
1194 1194
1195 rfcomm_send_ua(d->session, d->dlci); 1195 rfcomm_send_ua(d->session, d->dlci);
1196 1196
1197 rfcomm_dlc_clear_timer(d);
1198
1197 rfcomm_dlc_lock(d); 1199 rfcomm_dlc_lock(d);
1198 d->state = BT_CONNECTED; 1200 d->state = BT_CONNECTED;
1199 d->state_change(d, 0); 1201 d->state_change(d, 0);
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 547bafc79e28..10f0528c3bf5 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -674,8 +674,8 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
674 674
675 rcu_read_unlock(); 675 rcu_read_unlock();
676 676
677 /* free the skbuff allocated by the netdevice driver */ 677 /* consume the skbuff allocated by the netdevice driver */
678 kfree_skb(skb); 678 consume_skb(skb);
679 679
680 if (matches > 0) { 680 if (matches > 0) {
681 can_stats.matches++; 681 can_stats.matches++;
diff --git a/net/core/dev.c b/net/core/dev.c
index 343883f65ea7..308a7d0c277f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1336,7 +1336,12 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1336{ 1336{
1337 struct packet_type *ptype; 1337 struct packet_type *ptype;
1338 1338
1339#ifdef CONFIG_NET_CLS_ACT
1340 if (!(skb->tstamp.tv64 && (G_TC_FROM(skb->tc_verd) & AT_INGRESS)))
1341 net_timestamp(skb);
1342#else
1339 net_timestamp(skb); 1343 net_timestamp(skb);
1344#endif
1340 1345
1341 rcu_read_lock(); 1346 rcu_read_lock();
1342 list_for_each_entry_rcu(ptype, &ptype_all, list) { 1347 list_for_each_entry_rcu(ptype, &ptype_all, list) {
@@ -2540,9 +2545,9 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
2540 } 2545 }
2541 2546
2542 BUG_ON(info->nr_frags > MAX_SKB_FRAGS); 2547 BUG_ON(info->nr_frags > MAX_SKB_FRAGS);
2543 frag = &info->frags[info->nr_frags - 1]; 2548 frag = info->frags;
2544 2549
2545 for (i = skb_shinfo(skb)->nr_frags; i < info->nr_frags; i++) { 2550 for (i = 0; i < info->nr_frags; i++) {
2546 skb_fill_page_desc(skb, i, frag->page, frag->page_offset, 2551 skb_fill_page_desc(skb, i, frag->page, frag->page_offset,
2547 frag->size); 2552 frag->size);
2548 frag++; 2553 frag++;
@@ -4400,7 +4405,7 @@ int register_netdevice(struct net_device *dev)
4400 dev->iflink = -1; 4405 dev->iflink = -1;
4401 4406
4402#ifdef CONFIG_COMPAT_NET_DEV_OPS 4407#ifdef CONFIG_COMPAT_NET_DEV_OPS
4403 /* Netdevice_ops API compatiability support. 4408 /* Netdevice_ops API compatibility support.
4404 * This is temporary until all network devices are converted. 4409 * This is temporary until all network devices are converted.
4405 */ 4410 */
4406 if (dev->netdev_ops) { 4411 if (dev->netdev_ops) {
@@ -4411,7 +4416,7 @@ int register_netdevice(struct net_device *dev)
4411 dev->name, netdev_drivername(dev, drivername, 64)); 4416 dev->name, netdev_drivername(dev, drivername, 64));
4412 4417
4413 /* This works only because net_device_ops and the 4418 /* This works only because net_device_ops and the
4414 compatiablity structure are the same. */ 4419 compatibility structure are the same. */
4415 dev->netdev_ops = (void *) &(dev->init); 4420 dev->netdev_ops = (void *) &(dev->init);
4416 } 4421 }
4417#endif 4422#endif
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index fe65187810f0..3229e0a81ba6 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -211,7 +211,8 @@ find_best_ips_proto(struct nf_conntrack_tuple *tuple,
211 minip = ntohl(range->min_ip); 211 minip = ntohl(range->min_ip);
212 maxip = ntohl(range->max_ip); 212 maxip = ntohl(range->max_ip);
213 j = jhash_2words((__force u32)tuple->src.u3.ip, 213 j = jhash_2words((__force u32)tuple->src.u3.ip,
214 (__force u32)tuple->dst.u3.ip, 0); 214 range->flags & IP_NAT_RANGE_PERSISTENT ?
215 (__force u32)tuple->dst.u3.ip : 0, 0);
215 j = ((u64)j * (maxip - minip + 1)) >> 32; 216 j = ((u64)j * (maxip - minip + 1)) >> 32;
216 *var_ipp = htonl(minip + j); 217 *var_ipp = htonl(minip + j);
217} 218}
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index fafbec8b073e..1d7f49c6f0ca 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2511,6 +2511,7 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2511 struct sk_buff *p; 2511 struct sk_buff *p;
2512 struct tcphdr *th; 2512 struct tcphdr *th;
2513 struct tcphdr *th2; 2513 struct tcphdr *th2;
2514 unsigned int len;
2514 unsigned int thlen; 2515 unsigned int thlen;
2515 unsigned int flags; 2516 unsigned int flags;
2516 unsigned int mss = 1; 2517 unsigned int mss = 1;
@@ -2531,6 +2532,7 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2531 2532
2532 skb_gro_pull(skb, thlen); 2533 skb_gro_pull(skb, thlen);
2533 2534
2535 len = skb_gro_len(skb);
2534 flags = tcp_flag_word(th); 2536 flags = tcp_flag_word(th);
2535 2537
2536 for (; (p = *head); head = &p->next) { 2538 for (; (p = *head); head = &p->next) {
@@ -2561,7 +2563,7 @@ found:
2561 2563
2562 mss = skb_shinfo(p)->gso_size; 2564 mss = skb_shinfo(p)->gso_size;
2563 2565
2564 flush |= (skb_gro_len(skb) > mss) | !skb_gro_len(skb); 2566 flush |= (len > mss) | !len;
2565 flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq); 2567 flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
2566 2568
2567 if (flush || skb_gro_receive(head, skb)) { 2569 if (flush || skb_gro_receive(head, skb)) {
@@ -2574,7 +2576,7 @@ found:
2574 tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH); 2576 tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH);
2575 2577
2576out_check_final: 2578out_check_final:
2577 flush = skb_gro_len(skb) < mss; 2579 flush = len < mss;
2578 flush |= flags & (TCP_FLAG_URG | TCP_FLAG_PSH | TCP_FLAG_RST | 2580 flush |= flags & (TCP_FLAG_URG | TCP_FLAG_PSH | TCP_FLAG_RST |
2579 TCP_FLAG_SYN | TCP_FLAG_FIN); 2581 TCP_FLAG_SYN | TCP_FLAG_FIN);
2580 2582
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 53300fa2359f..59aec609cec6 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -778,7 +778,7 @@ static void tcp_adjust_pcount(struct sock *sk, struct sk_buff *skb, int decr)
778 778
779 if (tp->lost_skb_hint && 779 if (tp->lost_skb_hint &&
780 before(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(tp->lost_skb_hint)->seq) && 780 before(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(tp->lost_skb_hint)->seq) &&
781 (tcp_is_fack(tp) || TCP_SKB_CB(skb)->sacked)) 781 (tcp_is_fack(tp) || (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)))
782 tp->lost_cnt_hint -= decr; 782 tp->lost_cnt_hint -= decr;
783 783
784 tcp_verify_left_out(tp); 784 tcp_verify_left_out(tp);
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 49e786535dc8..b51c9187c347 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -172,6 +172,7 @@ static void iucv_sock_close(struct sock *sk)
172 err = iucv_sock_wait_state(sk, IUCV_CLOSED, 0, timeo); 172 err = iucv_sock_wait_state(sk, IUCV_CLOSED, 0, timeo);
173 } 173 }
174 174
175 case IUCV_CLOSING: /* fall through */
175 sk->sk_state = IUCV_CLOSED; 176 sk->sk_state = IUCV_CLOSED;
176 sk->sk_state_change(sk); 177 sk->sk_state_change(sk);
177 178
@@ -224,6 +225,8 @@ static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio)
224 spin_lock_init(&iucv_sk(sk)->message_q.lock); 225 spin_lock_init(&iucv_sk(sk)->message_q.lock);
225 skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q); 226 skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q);
226 iucv_sk(sk)->send_tag = 0; 227 iucv_sk(sk)->send_tag = 0;
228 iucv_sk(sk)->path = NULL;
229 memset(&iucv_sk(sk)->src_user_id , 0, 32);
227 230
228 sk->sk_destruct = iucv_sock_destruct; 231 sk->sk_destruct = iucv_sock_destruct;
229 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT; 232 sk->sk_sndtimeo = IUCV_CONN_TIMEOUT;
@@ -811,6 +814,8 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
811 814
812 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 815 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
813 816
817 /* receive/dequeue next skb:
818 * the function understands MSG_PEEK and, thus, does not dequeue skb */
814 skb = skb_recv_datagram(sk, flags, noblock, &err); 819 skb = skb_recv_datagram(sk, flags, noblock, &err);
815 if (!skb) { 820 if (!skb) {
816 if (sk->sk_shutdown & RCV_SHUTDOWN) 821 if (sk->sk_shutdown & RCV_SHUTDOWN)
@@ -858,9 +863,7 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
858 iucv_process_message_q(sk); 863 iucv_process_message_q(sk);
859 spin_unlock_bh(&iucv->message_q.lock); 864 spin_unlock_bh(&iucv->message_q.lock);
860 } 865 }
861 866 }
862 } else
863 skb_queue_head(&sk->sk_receive_queue, skb);
864 867
865done: 868done:
866 return err ? : copied; 869 return err ? : copied;
@@ -934,6 +937,9 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
934 937
935 lock_sock(sk); 938 lock_sock(sk);
936 switch (sk->sk_state) { 939 switch (sk->sk_state) {
940 case IUCV_DISCONN:
941 case IUCV_CLOSING:
942 case IUCV_SEVERED:
937 case IUCV_CLOSED: 943 case IUCV_CLOSED:
938 err = -ENOTCONN; 944 err = -ENOTCONN;
939 goto fail; 945 goto fail;
@@ -1113,8 +1119,12 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
1113 struct sock_msg_q *save_msg; 1119 struct sock_msg_q *save_msg;
1114 int len; 1120 int len;
1115 1121
1116 if (sk->sk_shutdown & RCV_SHUTDOWN) 1122 if (sk->sk_shutdown & RCV_SHUTDOWN) {
1123 iucv_message_reject(path, msg);
1117 return; 1124 return;
1125 }
1126
1127 spin_lock(&iucv->message_q.lock);
1118 1128
1119 if (!list_empty(&iucv->message_q.list) || 1129 if (!list_empty(&iucv->message_q.list) ||
1120 !skb_queue_empty(&iucv->backlog_skb_q)) 1130 !skb_queue_empty(&iucv->backlog_skb_q))
@@ -1129,9 +1139,8 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
1129 if (!skb) 1139 if (!skb)
1130 goto save_message; 1140 goto save_message;
1131 1141
1132 spin_lock(&iucv->message_q.lock);
1133 iucv_process_message(sk, skb, path, msg); 1142 iucv_process_message(sk, skb, path, msg);
1134 spin_unlock(&iucv->message_q.lock); 1143 goto out_unlock;
1135 1144
1136 return; 1145 return;
1137 1146
@@ -1142,8 +1151,9 @@ save_message:
1142 save_msg->path = path; 1151 save_msg->path = path;
1143 save_msg->msg = *msg; 1152 save_msg->msg = *msg;
1144 1153
1145 spin_lock(&iucv->message_q.lock);
1146 list_add_tail(&save_msg->list, &iucv->message_q.list); 1154 list_add_tail(&save_msg->list, &iucv->message_q.list);
1155
1156out_unlock:
1147 spin_unlock(&iucv->message_q.lock); 1157 spin_unlock(&iucv->message_q.lock);
1148} 1158}
1149 1159
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index f3d9ae350fb6..ecc3faf9f11a 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -202,10 +202,3 @@ config MAC80211_DEBUG_COUNTERS
202 and show them in debugfs. 202 and show them in debugfs.
203 203
204 If unsure, say N. 204 If unsure, say N.
205
206config MAC80211_VERBOSE_SPECT_MGMT_DEBUG
207 bool "Verbose Spectrum Management (IEEE 802.11h)debugging"
208 depends on MAC80211_DEBUG_MENU
209 ---help---
210 Say Y here to print out verbose Spectrum Management (IEEE 802.11h)
211 debug messages.
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index a6f1d8a869bc..fbcbed6cad01 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -258,7 +258,7 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
258 (chan->max_power - local->power_constr_level) : 258 (chan->max_power - local->power_constr_level) :
259 chan->max_power; 259 chan->max_power;
260 260
261 if (local->user_power_level) 261 if (local->user_power_level >= 0)
262 power = min(power, local->user_power_level); 262 power = min(power, local->user_power_level);
263 263
264 if (local->hw.conf.power_level != power) { 264 if (local->hw.conf.power_level != power) {
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7ecda9d59d8a..132938b073dc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -441,6 +441,9 @@ static bool ieee80211_check_tim(struct ieee802_11_elems *elems, u16 aid)
441 u8 index, indexn1, indexn2; 441 u8 index, indexn1, indexn2;
442 struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *) elems->tim; 442 struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *) elems->tim;
443 443
444 if (unlikely(!tim || elems->tim_len < 4))
445 return false;
446
444 aid &= 0x3fff; 447 aid &= 0x3fff;
445 index = aid / 8; 448 index = aid / 8;
446 mask = 1 << (aid & 7); 449 mask = 1 << (aid & 7);
@@ -945,9 +948,13 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
945 u.mgd.beacon_loss_work); 948 u.mgd.beacon_loss_work);
946 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 949 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
947 950
948 printk(KERN_DEBUG "%s: driver reports beacon loss from AP %pM " 951#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
949 "- sending probe request\n", sdata->dev->name, 952 if (net_ratelimit()) {
950 sdata->u.mgd.bssid); 953 printk(KERN_DEBUG "%s: driver reports beacon loss from AP %pM "
954 "- sending probe request\n", sdata->dev->name,
955 sdata->u.mgd.bssid);
956 }
957#endif
951 958
952 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL; 959 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL;
953 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 960 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid,
@@ -1007,9 +1014,13 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata)
1007 (local->hw.conf.flags & IEEE80211_CONF_PS)) && 1014 (local->hw.conf.flags & IEEE80211_CONF_PS)) &&
1008 time_after(jiffies, 1015 time_after(jiffies,
1009 ifmgd->last_beacon + IEEE80211_MONITORING_INTERVAL)) { 1016 ifmgd->last_beacon + IEEE80211_MONITORING_INTERVAL)) {
1010 printk(KERN_DEBUG "%s: beacon loss from AP %pM " 1017#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1011 "- sending probe request\n", 1018 if (net_ratelimit()) {
1012 sdata->dev->name, ifmgd->bssid); 1019 printk(KERN_DEBUG "%s: beacon loss from AP %pM "
1020 "- sending probe request\n",
1021 sdata->dev->name, ifmgd->bssid);
1022 }
1023#endif
1013 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL; 1024 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL;
1014 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 1025 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid,
1015 ifmgd->ssid_len, NULL, 0); 1026 ifmgd->ssid_len, NULL, 0);
@@ -1355,7 +1366,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1355 1366
1356 for (i = 0; i < elems.ext_supp_rates_len; i++) { 1367 for (i = 0; i < elems.ext_supp_rates_len; i++) {
1357 int rate = (elems.ext_supp_rates[i] & 0x7f) * 5; 1368 int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;
1358 bool is_basic = !!(elems.supp_rates[i] & 0x80); 1369 bool is_basic = !!(elems.ext_supp_rates[i] & 0x80);
1359 1370
1360 if (rate > 110) 1371 if (rate > 110)
1361 have_higher_than_11mbit = true; 1372 have_higher_than_11mbit = true;
@@ -1902,9 +1913,17 @@ static void ieee80211_sta_work(struct work_struct *work)
1902 1913
1903static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) 1914static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
1904{ 1915{
1905 if (sdata->vif.type == NL80211_IFTYPE_STATION) 1916 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1917 /*
1918 * Need to update last_beacon to avoid beacon loss
1919 * test to trigger.
1920 */
1921 sdata->u.mgd.last_beacon = jiffies;
1922
1923
1906 queue_work(sdata->local->hw.workqueue, 1924 queue_work(sdata->local->hw.workqueue,
1907 &sdata->u.mgd.work); 1925 &sdata->u.mgd.work);
1926 }
1908} 1927}
1909 1928
1910/* interface setup */ 1929/* interface setup */
@@ -2105,12 +2124,13 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
2105 struct ieee80211_local *local = 2124 struct ieee80211_local *local =
2106 container_of(work, struct ieee80211_local, 2125 container_of(work, struct ieee80211_local,
2107 dynamic_ps_enable_work); 2126 dynamic_ps_enable_work);
2127 /* XXX: using scan_sdata is completely broken! */
2108 struct ieee80211_sub_if_data *sdata = local->scan_sdata; 2128 struct ieee80211_sub_if_data *sdata = local->scan_sdata;
2109 2129
2110 if (local->hw.conf.flags & IEEE80211_CONF_PS) 2130 if (local->hw.conf.flags & IEEE80211_CONF_PS)
2111 return; 2131 return;
2112 2132
2113 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) 2133 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK && sdata)
2114 ieee80211_send_nullfunc(local, sdata, 1); 2134 ieee80211_send_nullfunc(local, sdata, 1);
2115 2135
2116 local->hw.conf.flags |= IEEE80211_CONF_PS; 2136 local->hw.conf.flags |= IEEE80211_CONF_PS;
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 027302326498..81985d27cbda 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -156,8 +156,19 @@ int __ieee80211_resume(struct ieee80211_hw *hw)
156 case NL80211_IFTYPE_ADHOC: 156 case NL80211_IFTYPE_ADHOC:
157 case NL80211_IFTYPE_AP: 157 case NL80211_IFTYPE_AP:
158 case NL80211_IFTYPE_MESH_POINT: 158 case NL80211_IFTYPE_MESH_POINT:
159 WARN_ON(ieee80211_if_config(sdata, changed)); 159 /*
160 ieee80211_bss_info_change_notify(sdata, ~0); 160 * Driver's config_interface can fail if rfkill is
161 * enabled. Accommodate this return code.
162 * FIXME: When mac80211 has knowledge of rfkill
163 * state the code below can change back to:
164 * WARN(ieee80211_if_config(sdata, changed));
165 * ieee80211_bss_info_change_notify(sdata, ~0);
166 */
167 if (ieee80211_if_config(sdata, changed))
168 printk(KERN_DEBUG "%s: failed to configure interface during resume\n",
169 sdata->dev->name);
170 else
171 ieee80211_bss_info_change_notify(sdata, ~0);
161 break; 172 break;
162 case NL80211_IFTYPE_WDS: 173 case NL80211_IFTYPE_WDS:
163 break; 174 break;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 64ebe664effc..9776f73c51ad 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -29,6 +29,7 @@
29static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, 29static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
30 struct tid_ampdu_rx *tid_agg_rx, 30 struct tid_ampdu_rx *tid_agg_rx,
31 struct sk_buff *skb, 31 struct sk_buff *skb,
32 struct ieee80211_rx_status *status,
32 u16 mpdu_seq_num, 33 u16 mpdu_seq_num,
33 int bar_req); 34 int bar_req);
34/* 35/*
@@ -1396,7 +1397,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1396 * mac80211. That also explains the __skb_push() 1397 * mac80211. That also explains the __skb_push()
1397 * below. 1398 * below.
1398 */ 1399 */
1399 align = (unsigned long)skb->data & 4; 1400 align = (unsigned long)skb->data & 3;
1400 if (align) { 1401 if (align) {
1401 if (WARN_ON(skb_headroom(skb) < 3)) { 1402 if (WARN_ON(skb_headroom(skb) < 3)) {
1402 dev_kfree_skb(skb); 1403 dev_kfree_skb(skb);
@@ -1688,7 +1689,7 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
1688 /* manage reordering buffer according to requested */ 1689 /* manage reordering buffer according to requested */
1689 /* sequence number */ 1690 /* sequence number */
1690 rcu_read_lock(); 1691 rcu_read_lock();
1691 ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, NULL, 1692 ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, NULL, NULL,
1692 start_seq_num, 1); 1693 start_seq_num, 1);
1693 rcu_read_unlock(); 1694 rcu_read_unlock();
1694 return RX_DROP_UNUSABLE; 1695 return RX_DROP_UNUSABLE;
@@ -2293,6 +2294,7 @@ static inline u16 seq_sub(u16 sq1, u16 sq2)
2293static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, 2294static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2294 struct tid_ampdu_rx *tid_agg_rx, 2295 struct tid_ampdu_rx *tid_agg_rx,
2295 struct sk_buff *skb, 2296 struct sk_buff *skb,
2297 struct ieee80211_rx_status *rxstatus,
2296 u16 mpdu_seq_num, 2298 u16 mpdu_seq_num,
2297 int bar_req) 2299 int bar_req)
2298{ 2300{
@@ -2374,6 +2376,8 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2374 2376
2375 /* put the frame in the reordering buffer */ 2377 /* put the frame in the reordering buffer */
2376 tid_agg_rx->reorder_buf[index] = skb; 2378 tid_agg_rx->reorder_buf[index] = skb;
2379 memcpy(tid_agg_rx->reorder_buf[index]->cb, rxstatus,
2380 sizeof(*rxstatus));
2377 tid_agg_rx->stored_mpdu_num++; 2381 tid_agg_rx->stored_mpdu_num++;
2378 /* release the buffer until next missing frame */ 2382 /* release the buffer until next missing frame */
2379 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) 2383 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn)
@@ -2399,7 +2403,8 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
2399} 2403}
2400 2404
2401static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local, 2405static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
2402 struct sk_buff *skb) 2406 struct sk_buff *skb,
2407 struct ieee80211_rx_status *status)
2403{ 2408{
2404 struct ieee80211_hw *hw = &local->hw; 2409 struct ieee80211_hw *hw = &local->hw;
2405 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 2410 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -2448,7 +2453,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
2448 2453
2449 /* according to mpdu sequence number deal with reordering buffer */ 2454 /* according to mpdu sequence number deal with reordering buffer */
2450 mpdu_seq_num = (sc & IEEE80211_SCTL_SEQ) >> 4; 2455 mpdu_seq_num = (sc & IEEE80211_SCTL_SEQ) >> 4;
2451 ret = ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb, 2456 ret = ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb, status,
2452 mpdu_seq_num, 0); 2457 mpdu_seq_num, 0);
2453 end_reorder: 2458 end_reorder:
2454 return ret; 2459 return ret;
@@ -2512,7 +2517,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
2512 return; 2517 return;
2513 } 2518 }
2514 2519
2515 if (!ieee80211_rx_reorder_ampdu(local, skb)) 2520 if (!ieee80211_rx_reorder_ampdu(local, skb, status))
2516 __ieee80211_rx_handle_packet(hw, skb, status, rate); 2521 __ieee80211_rx_handle_packet(hw, skb, status, rate);
2517 2522
2518 rcu_read_unlock(); 2523 rcu_read_unlock();
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index deb4ecec122a..959aa8379ccf 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -417,6 +417,7 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
417{ 417{
418 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 418 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
419 struct ieee80211_channel* chan = local->hw.conf.channel; 419 struct ieee80211_channel* chan = local->hw.conf.channel;
420 bool reconf = false;
420 u32 reconf_flags = 0; 421 u32 reconf_flags = 0;
421 int new_power_level; 422 int new_power_level;
422 423
@@ -427,14 +428,38 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
427 if (!chan) 428 if (!chan)
428 return -EINVAL; 429 return -EINVAL;
429 430
430 if (data->txpower.fixed) 431 /* only change when not disabling */
431 new_power_level = min(data->txpower.value, chan->max_power); 432 if (!data->txpower.disabled) {
432 else /* Automatic power level setting */ 433 if (data->txpower.fixed) {
433 new_power_level = chan->max_power; 434 if (data->txpower.value < 0)
435 return -EINVAL;
436 new_power_level = data->txpower.value;
437 /*
438 * Debatable, but we cannot do a fixed power
439 * level above the regulatory constraint.
440 * Use "iwconfig wlan0 txpower 15dBm" instead.
441 */
442 if (new_power_level > chan->max_power)
443 return -EINVAL;
444 } else {
445 /*
446 * Automatic power level setting, max being the value
447 * passed in from userland.
448 */
449 if (data->txpower.value < 0)
450 new_power_level = -1;
451 else
452 new_power_level = data->txpower.value;
453 }
454
455 reconf = true;
434 456
435 local->user_power_level = new_power_level; 457 /*
436 if (local->hw.conf.power_level != new_power_level) 458 * ieee80211_hw_config() will limit to the channel's
437 reconf_flags |= IEEE80211_CONF_CHANGE_POWER; 459 * max power and possibly power constraint from AP.
460 */
461 local->user_power_level = new_power_level;
462 }
438 463
439 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { 464 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
440 local->hw.conf.radio_enabled = !(data->txpower.disabled); 465 local->hw.conf.radio_enabled = !(data->txpower.disabled);
@@ -442,7 +467,7 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
442 ieee80211_led_radio(local, local->hw.conf.radio_enabled); 467 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
443 } 468 }
444 469
445 if (reconf_flags) 470 if (reconf || reconf_flags)
446 ieee80211_hw_config(local, reconf_flags); 471 ieee80211_hw_config(local, reconf_flags);
447 472
448 return 0; 473 return 0;
@@ -530,7 +555,7 @@ static int ieee80211_ioctl_giwfrag(struct net_device *dev,
530 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 555 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
531 556
532 frag->value = local->fragmentation_threshold; 557 frag->value = local->fragmentation_threshold;
533 frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD); 558 frag->disabled = (frag->value >= IEEE80211_MAX_FRAG_THRESHOLD);
534 frag->fixed = 1; 559 frag->fixed = 1;
535 560
536 return 0; 561 return 0;
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 30b8e9009f99..0fa5a422959f 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -176,7 +176,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,
176 } 176 }
177 177
178 /* Get rid of expecteds, set helpers to NULL. */ 178 /* Get rid of expecteds, set helpers to NULL. */
179 hlist_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode) 179 hlist_nulls_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode)
180 unhelp(h, me); 180 unhelp(h, me);
181 for (i = 0; i < nf_conntrack_htable_size; i++) { 181 for (i = 0; i < nf_conntrack_htable_size; i++) {
182 hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode) 182 hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index c6439c77953c..f13fc57e1ecb 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -512,7 +512,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
512 512
513 skb = ctnetlink_alloc_skb(tuple(ct, IP_CT_DIR_ORIGINAL), GFP_ATOMIC); 513 skb = ctnetlink_alloc_skb(tuple(ct, IP_CT_DIR_ORIGINAL), GFP_ATOMIC);
514 if (!skb) 514 if (!skb)
515 return NOTIFY_DONE; 515 goto errout;
516 516
517 b = skb->tail; 517 b = skb->tail;
518 518
@@ -591,8 +591,9 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
591nla_put_failure: 591nla_put_failure:
592 rcu_read_unlock(); 592 rcu_read_unlock();
593nlmsg_failure: 593nlmsg_failure:
594 nfnetlink_set_err(0, group, -ENOBUFS);
595 kfree_skb(skb); 594 kfree_skb(skb);
595errout:
596 nfnetlink_set_err(0, group, -ENOBUFS);
596 return NOTIFY_DONE; 597 return NOTIFY_DONE;
597} 598}
598#endif /* CONFIG_NF_CONNTRACK_EVENTS */ 599#endif /* CONFIG_NF_CONNTRACK_EVENTS */
@@ -987,7 +988,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[])
987{ 988{
988 struct nf_conntrack_helper *helper; 989 struct nf_conntrack_helper *helper;
989 struct nf_conn_help *help = nfct_help(ct); 990 struct nf_conn_help *help = nfct_help(ct);
990 char *helpname; 991 char *helpname = NULL;
991 int err; 992 int err;
992 993
993 /* don't change helper of sibling connections */ 994 /* don't change helper of sibling connections */
@@ -1230,7 +1231,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1230 1231
1231 rcu_read_lock(); 1232 rcu_read_lock();
1232 if (cda[CTA_HELP]) { 1233 if (cda[CTA_HELP]) {
1233 char *helpname; 1234 char *helpname = NULL;
1234 1235
1235 err = ctnetlink_parse_help(cda[CTA_HELP], &helpname); 1236 err = ctnetlink_parse_help(cda[CTA_HELP], &helpname);
1236 if (err < 0) 1237 if (err < 0)
@@ -1564,7 +1565,7 @@ static int ctnetlink_expect_event(struct notifier_block *this,
1564 1565
1565 skb = alloc_skb(NLMSG_GOODSIZE, GFP_ATOMIC); 1566 skb = alloc_skb(NLMSG_GOODSIZE, GFP_ATOMIC);
1566 if (!skb) 1567 if (!skb)
1567 return NOTIFY_DONE; 1568 goto errout;
1568 1569
1569 b = skb->tail; 1570 b = skb->tail;
1570 1571
@@ -1589,8 +1590,9 @@ static int ctnetlink_expect_event(struct notifier_block *this,
1589nla_put_failure: 1590nla_put_failure:
1590 rcu_read_unlock(); 1591 rcu_read_unlock();
1591nlmsg_failure: 1592nlmsg_failure:
1592 nfnetlink_set_err(0, 0, -ENOBUFS);
1593 kfree_skb(skb); 1593 kfree_skb(skb);
1594errout:
1595 nfnetlink_set_err(0, 0, -ENOBUFS);
1594 return NOTIFY_DONE; 1596 return NOTIFY_DONE;
1595} 1597}
1596#endif 1598#endif
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 8bb998fe098b..beb37311e1a5 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -36,10 +36,14 @@ static struct nf_logger *__find_logger(int pf, const char *str_logger)
36int nf_log_register(u_int8_t pf, struct nf_logger *logger) 36int nf_log_register(u_int8_t pf, struct nf_logger *logger)
37{ 37{
38 const struct nf_logger *llog; 38 const struct nf_logger *llog;
39 int i;
39 40
40 if (pf >= ARRAY_SIZE(nf_loggers)) 41 if (pf >= ARRAY_SIZE(nf_loggers))
41 return -EINVAL; 42 return -EINVAL;
42 43
44 for (i = 0; i < ARRAY_SIZE(logger->list); i++)
45 INIT_LIST_HEAD(&logger->list[i]);
46
43 mutex_lock(&nf_log_mutex); 47 mutex_lock(&nf_log_mutex);
44 48
45 if (pf == NFPROTO_UNSPEC) { 49 if (pf == NFPROTO_UNSPEC) {
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 2785d66a7e38..b8ab37ad7ed5 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -203,7 +203,7 @@ static int __init nfnetlink_init(void)
203 nfnetlink_rcv, NULL, THIS_MODULE); 203 nfnetlink_rcv, NULL, THIS_MODULE);
204 if (!nfnl) { 204 if (!nfnl) {
205 printk(KERN_ERR "cannot initialize nfnetlink!\n"); 205 printk(KERN_ERR "cannot initialize nfnetlink!\n");
206 return -1; 206 return -ENOMEM;
207 } 207 }
208 208
209 return 0; 209 return 0;
diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c
index 834c6eb7f484..c0519139679e 100644
--- a/net/netlabel/netlabel_addrlist.c
+++ b/net/netlabel/netlabel_addrlist.c
@@ -256,13 +256,11 @@ struct netlbl_af4list *netlbl_af4list_remove(__be32 addr, __be32 mask,
256{ 256{
257 struct netlbl_af4list *entry; 257 struct netlbl_af4list *entry;
258 258
259 entry = netlbl_af4list_search(addr, head); 259 entry = netlbl_af4list_search_exact(addr, mask, head);
260 if (entry != NULL && entry->addr == addr && entry->mask == mask) { 260 if (entry == NULL)
261 netlbl_af4list_remove_entry(entry); 261 return NULL;
262 return entry; 262 netlbl_af4list_remove_entry(entry);
263 } 263 return entry;
264
265 return NULL;
266} 264}
267 265
268#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 266#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -299,15 +297,11 @@ struct netlbl_af6list *netlbl_af6list_remove(const struct in6_addr *addr,
299{ 297{
300 struct netlbl_af6list *entry; 298 struct netlbl_af6list *entry;
301 299
302 entry = netlbl_af6list_search(addr, head); 300 entry = netlbl_af6list_search_exact(addr, mask, head);
303 if (entry != NULL && 301 if (entry == NULL)
304 ipv6_addr_equal(&entry->addr, addr) && 302 return NULL;
305 ipv6_addr_equal(&entry->mask, mask)) { 303 netlbl_af6list_remove_entry(entry);
306 netlbl_af6list_remove_entry(entry); 304 return entry;
307 return entry;
308 }
309
310 return NULL;
311} 305}
312#endif /* IPv6 */ 306#endif /* IPv6 */
313 307
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 4e705f87969f..3be0e016ab7d 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1084,8 +1084,10 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
1084 1084
1085 /* Build a packet - the conventional user limit is 236 bytes. We can 1085 /* Build a packet - the conventional user limit is 236 bytes. We can
1086 do ludicrously large NetROM frames but must not overflow */ 1086 do ludicrously large NetROM frames but must not overflow */
1087 if (len > 65536) 1087 if (len > 65536) {
1088 return -EMSGSIZE; 1088 err = -EMSGSIZE;
1089 goto out;
1090 }
1089 1091
1090 SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); 1092 SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n");
1091 size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; 1093 size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index d876b8734848..2b88295cb7b7 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -280,6 +280,14 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
280 if (unlikely(!skb)) 280 if (unlikely(!skb))
281 return NULL; 281 return NULL;
282 282
283#ifdef CONFIG_NET_CLS_ACT
284 /*
285 * If it's at ingress let's pretend the delay is
286 * from the network (tstamp will be updated).
287 */
288 if (G_TC_FROM(skb->tc_verd) & AT_INGRESS)
289 skb->tstamp.tv64 = 0;
290#endif
283 pr_debug("netem_dequeue: return skb=%p\n", skb); 291 pr_debug("netem_dequeue: return skb=%p\n", skb);
284 sch->q.qlen--; 292 sch->q.qlen--;
285 return skb; 293 return skb;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index d43daa236ef9..0a592e4295f0 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -90,7 +90,7 @@ struct cfg80211_internal_bss {
90 struct rb_node rbn; 90 struct rb_node rbn;
91 unsigned long ts; 91 unsigned long ts;
92 struct kref ref; 92 struct kref ref;
93 bool hold; 93 bool hold, ies_allocated;
94 94
95 /* must be last because of priv member */ 95 /* must be last because of priv member */
96 struct cfg80211_bss pub; 96 struct cfg80211_bss pub;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 353e1a4ece83..2456e4ee445e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3334,7 +3334,7 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev,
3334 struct sk_buff *msg; 3334 struct sk_buff *msg;
3335 void *hdr; 3335 void *hdr;
3336 3336
3337 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 3337 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
3338 if (!msg) 3338 if (!msg)
3339 return; 3339 return;
3340 3340
@@ -3353,7 +3353,7 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev,
3353 return; 3353 return;
3354 } 3354 }
3355 3355
3356 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_KERNEL); 3356 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_ATOMIC);
3357 return; 3357 return;
3358 3358
3359 nla_put_failure: 3359 nla_put_failure:
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6327e1617acb..6c1993d99902 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2095,11 +2095,12 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2095/* Caller must hold cfg80211_mutex */ 2095/* Caller must hold cfg80211_mutex */
2096void reg_device_remove(struct wiphy *wiphy) 2096void reg_device_remove(struct wiphy *wiphy)
2097{ 2097{
2098 struct wiphy *request_wiphy; 2098 struct wiphy *request_wiphy = NULL;
2099 2099
2100 assert_cfg80211_lock(); 2100 assert_cfg80211_lock();
2101 2101
2102 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); 2102 if (last_request)
2103 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
2103 2104
2104 kfree(wiphy->regd); 2105 kfree(wiphy->regd);
2105 if (!last_request || !request_wiphy) 2106 if (!last_request || !request_wiphy)
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 2a00e362f5fe..2ae65b39b529 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -58,6 +58,10 @@ static void bss_release(struct kref *ref)
58 bss = container_of(ref, struct cfg80211_internal_bss, ref); 58 bss = container_of(ref, struct cfg80211_internal_bss, ref);
59 if (bss->pub.free_priv) 59 if (bss->pub.free_priv)
60 bss->pub.free_priv(&bss->pub); 60 bss->pub.free_priv(&bss->pub);
61
62 if (bss->ies_allocated)
63 kfree(bss->pub.information_elements);
64
61 kfree(bss); 65 kfree(bss);
62} 66}
63 67
@@ -360,19 +364,41 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
360 364
361 found = rb_find_bss(dev, res); 365 found = rb_find_bss(dev, res);
362 366
363 if (found && overwrite) { 367 if (found) {
364 list_replace(&found->list, &res->list);
365 rb_replace_node(&found->rbn, &res->rbn,
366 &dev->bss_tree);
367 kref_put(&found->ref, bss_release);
368 found = res;
369 } else if (found) {
370 kref_get(&found->ref); 368 kref_get(&found->ref);
371 found->pub.beacon_interval = res->pub.beacon_interval; 369 found->pub.beacon_interval = res->pub.beacon_interval;
372 found->pub.tsf = res->pub.tsf; 370 found->pub.tsf = res->pub.tsf;
373 found->pub.signal = res->pub.signal; 371 found->pub.signal = res->pub.signal;
374 found->pub.capability = res->pub.capability; 372 found->pub.capability = res->pub.capability;
375 found->ts = res->ts; 373 found->ts = res->ts;
374
375 /* overwrite IEs */
376 if (overwrite) {
377 size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
378 size_t ielen = res->pub.len_information_elements;
379
380 if (ksize(found) >= used + ielen) {
381 memcpy(found->pub.information_elements,
382 res->pub.information_elements, ielen);
383 found->pub.len_information_elements = ielen;
384 } else {
385 u8 *ies = found->pub.information_elements;
386
387 if (found->ies_allocated) {
388 if (ksize(ies) < ielen)
389 ies = krealloc(ies, ielen,
390 GFP_ATOMIC);
391 } else
392 ies = kmalloc(ielen, GFP_ATOMIC);
393
394 if (ies) {
395 memcpy(ies, res->pub.information_elements, ielen);
396 found->ies_allocated = true;
397 found->pub.information_elements = ies;
398 }
399 }
400 }
401
376 kref_put(&res->ref, bss_release); 402 kref_put(&res->ref, bss_release);
377 } else { 403 } else {
378 /* this "consumes" the reference */ 404 /* this "consumes" the reference */