aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:32:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:32:36 -0400
commit13199a0845729492fc51d1ba87938cdfe341b141 (patch)
tree544267bc4076fff6b2eaae119372b13f23aa8932
parentaf56e0aa35f3ae2a4c1a6d1000702df1dd78cb76 (diff)
parent2e1d4a065a77d076a679df22a4eddbc7e33cad98 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking changes from David S. Miller: 1) Fix IPSEC header length calculation for transport mode in ESP. The issue is whether to do the calculation before or after alignment. Fix from Benjamin Poirier. 2) Fix regression in IPV6 IPSEC fragment length calculations, from Gao Feng. This is another transport vs tunnel mode issue. 3) Handle AF_UNSPEC connect()s properly in L2TP to avoid OOPSes. Fix from James Chapman. 4) Fix USB ASIX driver's reception of full sized VLAN packets, from Eric Dumazet. 5) Allow drop monitor (and, more generically, all generic netlink protocols) to be automatically loaded as a module. From Neil Horman. Fix up trivial conflict in Documentation/feature-removal-schedule.txt due to new entries added next to each other at the end. As usual. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits) net/smsc911x: Repair broken failure paths virtio-net: remove useless disable on freeze netdevice: Update netif_dbg for CONFIG_DYNAMIC_DEBUG drop_monitor: Add module alias to enable automatic module loading genetlink: Build a generic netlink family module alias net: add MODULE_ALIAS_NET_PF_PROTO_NAME r6040: Do a Proper deinit at errorpath and also when driver unloads (calling r6040_remove_one) r6040: disable pci device if the subsequent calls (after pci_enable_device) fails skb: avoid unnecessary reallocations in __skb_cow net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens asix: allow full size 8021Q frames to be received rds_rdma: don't assume infiniband device is PCI l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case mac80211: fix ADDBA declined after suspend with wowlan wlcore: fix undefined symbols when CONFIG_PM is not defined mac80211: fix flag check for QoS NOACK frames ath9k_hw: apply internal regulator settings on AR933x ath9k_hw: update AR933x initvals to fix issues with high power devices ath9k: fix a use-after-free-bug when ath_tx_setup_buffer() fails ath9k: stop rx dma before stopping tx ...
-rw-r--r--Documentation/feature-removal-schedule.txt6
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/atm/solos-pci.c4
-rw-r--r--drivers/net/ethernet/rdc/r6040.c15
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c8
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c7
-rw-r--r--drivers/net/usb/asix.c3
-rw-r--r--drivers/net/usb/qmi_wwan.c2
-rw-r--r--drivers/net/virtio_net.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h178
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c16
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c5
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig8
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.c288
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-phy-db.h129
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c4
-rw-r--r--drivers/net/wireless/ti/wl1251/sdio.c2
-rw-r--r--drivers/net/wireless/ti/wl1251/spi.c3
-rw-r--r--drivers/net/wireless/ti/wlcore/acx.c2
-rw-r--r--drivers/net/wireless/ti/wlcore/acx.h4
-rw-r--r--drivers/net/wireless/ti/wlcore/rx.c2
-rw-r--r--drivers/net/xen-netback/netback.c3
-rw-r--r--drivers/nfc/pn544_hci.c2
-rw-r--r--include/linux/genetlink.h3
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h8
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/net/dst.h1
-rw-r--r--net/core/drop_monitor.c1
-rw-r--r--net/ipv4/esp4.c24
-rw-r--r--net/ipv6/esp6.c18
-rw-r--r--net/ipv6/ip6_output.c68
-rw-r--r--net/l2tp/l2tp_ip.c24
-rw-r--r--net/l2tp/l2tp_ip6.c18
-rw-r--r--net/l2tp/l2tp_netlink.c3
-rw-r--r--net/mac80211/mlme.c3
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/mac80211/util.c12
-rw-r--r--net/netlink/genetlink.c2
-rw-r--r--net/rds/ib.h3
-rw-r--r--net/wanrouter/Kconfig2
-rw-r--r--net/xfrm/xfrm_policy.c3
55 files changed, 343 insertions, 645 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index ebaffe208ccb..56000b33340b 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -606,3 +606,9 @@ Why: There are two mci drivers: at91-mci and atmel-mci. The PDC support
606Who: Ludovic Desroches <ludovic.desroches@atmel.com> 606Who: Ludovic Desroches <ludovic.desroches@atmel.com>
607 607
608---------------------------- 608----------------------------
609
610What: net/wanrouter/
611When: June 2013
612Why: Unsupported/unmaintained/unused since 2.6
613
614----------------------------
diff --git a/MAINTAINERS b/MAINTAINERS
index 64e675d6d478..8cad55b9db99 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6657,7 +6657,7 @@ F: include/linux/taskstats*
6657F: kernel/taskstats.c 6657F: kernel/taskstats.c
6658 6658
6659TC CLASSIFIER 6659TC CLASSIFIER
6660M: Jamal Hadi Salim <hadi@cyberus.ca> 6660M: Jamal Hadi Salim <jhs@mojatatu.com>
6661L: netdev@vger.kernel.org 6661L: netdev@vger.kernel.org
6662S: Maintained 6662S: Maintained
6663F: include/linux/pkt_cls.h 6663F: include/linux/pkt_cls.h
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index e8cd652d2017..98510931c815 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -984,6 +984,7 @@ static uint32_t fpga_tx(struct solos_card *card)
984 } else if (skb && card->using_dma) { 984 } else if (skb && card->using_dma) {
985 SKB_CB(skb)->dma_addr = pci_map_single(card->dev, skb->data, 985 SKB_CB(skb)->dma_addr = pci_map_single(card->dev, skb->data,
986 skb->len, PCI_DMA_TODEVICE); 986 skb->len, PCI_DMA_TODEVICE);
987 card->tx_skb[port] = skb;
987 iowrite32(SKB_CB(skb)->dma_addr, 988 iowrite32(SKB_CB(skb)->dma_addr,
988 card->config_regs + TX_DMA_ADDR(port)); 989 card->config_regs + TX_DMA_ADDR(port));
989 } 990 }
@@ -1152,7 +1153,8 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
1152 db_fpga_upgrade = db_firmware_upgrade = 0; 1153 db_fpga_upgrade = db_firmware_upgrade = 0;
1153 } 1154 }
1154 1155
1155 if (card->fpga_version >= DMA_SUPPORTED){ 1156 if (card->fpga_version >= DMA_SUPPORTED) {
1157 pci_set_master(dev);
1156 card->using_dma = 1; 1158 card->using_dma = 1;
1157 } else { 1159 } else {
1158 card->using_dma = 0; 1160 card->using_dma = 0;
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 4de73643fec6..d1827e887f4e 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -1096,20 +1096,20 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1096 if (err) { 1096 if (err) {
1097 dev_err(&pdev->dev, "32-bit PCI DMA addresses" 1097 dev_err(&pdev->dev, "32-bit PCI DMA addresses"
1098 "not supported by the card\n"); 1098 "not supported by the card\n");
1099 goto err_out; 1099 goto err_out_disable_dev;
1100 } 1100 }
1101 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 1101 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1102 if (err) { 1102 if (err) {
1103 dev_err(&pdev->dev, "32-bit PCI DMA addresses" 1103 dev_err(&pdev->dev, "32-bit PCI DMA addresses"
1104 "not supported by the card\n"); 1104 "not supported by the card\n");
1105 goto err_out; 1105 goto err_out_disable_dev;
1106 } 1106 }
1107 1107
1108 /* IO Size check */ 1108 /* IO Size check */
1109 if (pci_resource_len(pdev, bar) < io_size) { 1109 if (pci_resource_len(pdev, bar) < io_size) {
1110 dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); 1110 dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
1111 err = -EIO; 1111 err = -EIO;
1112 goto err_out; 1112 goto err_out_disable_dev;
1113 } 1113 }
1114 1114
1115 pci_set_master(pdev); 1115 pci_set_master(pdev);
@@ -1117,7 +1117,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1117 dev = alloc_etherdev(sizeof(struct r6040_private)); 1117 dev = alloc_etherdev(sizeof(struct r6040_private));
1118 if (!dev) { 1118 if (!dev) {
1119 err = -ENOMEM; 1119 err = -ENOMEM;
1120 goto err_out; 1120 goto err_out_disable_dev;
1121 } 1121 }
1122 SET_NETDEV_DEV(dev, &pdev->dev); 1122 SET_NETDEV_DEV(dev, &pdev->dev);
1123 lp = netdev_priv(dev); 1123 lp = netdev_priv(dev);
@@ -1233,11 +1233,15 @@ err_out_mdio_irq:
1233err_out_mdio: 1233err_out_mdio:
1234 mdiobus_free(lp->mii_bus); 1234 mdiobus_free(lp->mii_bus);
1235err_out_unmap: 1235err_out_unmap:
1236 netif_napi_del(&lp->napi);
1237 pci_set_drvdata(pdev, NULL);
1236 pci_iounmap(pdev, ioaddr); 1238 pci_iounmap(pdev, ioaddr);
1237err_out_free_res: 1239err_out_free_res:
1238 pci_release_regions(pdev); 1240 pci_release_regions(pdev);
1239err_out_free_dev: 1241err_out_free_dev:
1240 free_netdev(dev); 1242 free_netdev(dev);
1243err_out_disable_dev:
1244 pci_disable_device(pdev);
1241err_out: 1245err_out:
1242 return err; 1246 return err;
1243} 1247}
@@ -1251,6 +1255,9 @@ static void __devexit r6040_remove_one(struct pci_dev *pdev)
1251 mdiobus_unregister(lp->mii_bus); 1255 mdiobus_unregister(lp->mii_bus);
1252 kfree(lp->mii_bus->irq); 1256 kfree(lp->mii_bus->irq);
1253 mdiobus_free(lp->mii_bus); 1257 mdiobus_free(lp->mii_bus);
1258 netif_napi_del(&lp->napi);
1259 pci_set_drvdata(pdev, NULL);
1260 pci_iounmap(pdev, lp->base);
1254 pci_release_regions(pdev); 1261 pci_release_regions(pdev);
1255 free_netdev(dev); 1262 free_netdev(dev);
1256 pci_disable_device(pdev); 1263 pci_disable_device(pdev);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index be3c22179161..667169b82526 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1101,8 +1101,12 @@ static int sh_eth_rx(struct net_device *ndev)
1101 1101
1102 /* Restart Rx engine if stopped. */ 1102 /* Restart Rx engine if stopped. */
1103 /* If we don't need to check status, don't. -KDU */ 1103 /* If we don't need to check status, don't. -KDU */
1104 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) 1104 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
1105 /* fix the values for the next receiving */
1106 mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) -
1107 sh_eth_read(ndev, RDLAR)) >> 4;
1105 sh_eth_write(ndev, EDRRR_R, EDRRR); 1108 sh_eth_write(ndev, EDRRR_R, EDRRR);
1109 }
1106 1110
1107 return 0; 1111 return 0;
1108} 1112}
@@ -1199,8 +1203,6 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1199 /* Receive Descriptor Empty int */ 1203 /* Receive Descriptor Empty int */
1200 ndev->stats.rx_over_errors++; 1204 ndev->stats.rx_over_errors++;
1201 1205
1202 if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R)
1203 sh_eth_write(ndev, EDRRR_R, EDRRR);
1204 if (netif_msg_rx_err(mdp)) 1206 if (netif_msg_rx_err(mdp))
1205 dev_err(&ndev->dev, "Receive Descriptor Empty\n"); 1207 dev_err(&ndev->dev, "Receive Descriptor Empty\n");
1206 } 1208 }
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index dab9c6f671ec..1466e5d2af44 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2390,11 +2390,11 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2390 2390
2391 retval = smsc911x_request_resources(pdev); 2391 retval = smsc911x_request_resources(pdev);
2392 if (retval) 2392 if (retval)
2393 goto out_return_resources; 2393 goto out_request_resources_fail;
2394 2394
2395 retval = smsc911x_enable_resources(pdev); 2395 retval = smsc911x_enable_resources(pdev);
2396 if (retval) 2396 if (retval)
2397 goto out_disable_resources; 2397 goto out_enable_resources_fail;
2398 2398
2399 if (pdata->ioaddr == NULL) { 2399 if (pdata->ioaddr == NULL) {
2400 SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); 2400 SMSC_WARN(pdata, probe, "Error smsc911x base address invalid");
@@ -2501,8 +2501,9 @@ out_free_irq:
2501 free_irq(dev->irq, dev); 2501 free_irq(dev->irq, dev);
2502out_disable_resources: 2502out_disable_resources:
2503 (void)smsc911x_disable_resources(pdev); 2503 (void)smsc911x_disable_resources(pdev);
2504out_return_resources: 2504out_enable_resources_fail:
2505 smsc911x_free_resources(pdev); 2505 smsc911x_free_resources(pdev);
2506out_request_resources_fail:
2506 platform_set_drvdata(pdev, NULL); 2507 platform_set_drvdata(pdev, NULL);
2507 iounmap(pdata->ioaddr); 2508 iounmap(pdata->ioaddr);
2508 free_netdev(dev); 2509 free_netdev(dev);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 71e2b0523bc2..3ae80eccd0ef 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -35,6 +35,7 @@
35#include <linux/crc32.h> 35#include <linux/crc32.h>
36#include <linux/usb/usbnet.h> 36#include <linux/usb/usbnet.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/if_vlan.h>
38 39
39#define DRIVER_VERSION "22-Dec-2011" 40#define DRIVER_VERSION "22-Dec-2011"
40#define DRIVER_NAME "asix" 41#define DRIVER_NAME "asix"
@@ -321,7 +322,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
321 return 0; 322 return 0;
322 } 323 }
323 324
324 if ((size > dev->net->mtu + ETH_HLEN) || 325 if ((size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) ||
325 (size + offset > skb->len)) { 326 (size + offset > skb->len)) {
326 netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n", 327 netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
327 size); 328 size);
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 380dbea6109d..3b206786b5e7 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -547,6 +547,8 @@ static const struct usb_device_id products[] = {
547 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ 547 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
548 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ 548 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
549 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ 549 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
550 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
551 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
550 { } /* END */ 552 { } /* END */
551}; 553};
552MODULE_DEVICE_TABLE(usb, products); 554MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9ce6995e8d08..5214b1eceb95 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1231,11 +1231,6 @@ static int virtnet_freeze(struct virtio_device *vdev)
1231 vi->config_enable = false; 1231 vi->config_enable = false;
1232 mutex_unlock(&vi->config_lock); 1232 mutex_unlock(&vi->config_lock);
1233 1233
1234 virtqueue_disable_cb(vi->rvq);
1235 virtqueue_disable_cb(vi->svq);
1236 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ))
1237 virtqueue_disable_cb(vi->cvq);
1238
1239 netif_device_detach(vi->dev); 1234 netif_device_detach(vi->dev);
1240 cancel_delayed_work_sync(&vi->refill); 1235 cancel_delayed_work_sync(&vi->refill);
1241 1236
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 0ba81a66061f..fbaa30930076 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2415,6 +2415,22 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
2415* Initialization routines * 2415* Initialization routines *
2416\*************************/ 2416\*************************/
2417 2417
2418static const struct ieee80211_iface_limit if_limits[] = {
2419 { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
2420 { .max = 4, .types =
2421#ifdef CONFIG_MAC80211_MESH
2422 BIT(NL80211_IFTYPE_MESH_POINT) |
2423#endif
2424 BIT(NL80211_IFTYPE_AP) },
2425};
2426
2427static const struct ieee80211_iface_combination if_comb = {
2428 .limits = if_limits,
2429 .n_limits = ARRAY_SIZE(if_limits),
2430 .max_interfaces = 2048,
2431 .num_different_channels = 1,
2432};
2433
2418int __devinit 2434int __devinit
2419ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) 2435ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
2420{ 2436{
@@ -2436,6 +2452,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
2436 BIT(NL80211_IFTYPE_ADHOC) | 2452 BIT(NL80211_IFTYPE_ADHOC) |
2437 BIT(NL80211_IFTYPE_MESH_POINT); 2453 BIT(NL80211_IFTYPE_MESH_POINT);
2438 2454
2455 hw->wiphy->iface_combinations = &if_comb;
2456 hw->wiphy->n_iface_combinations = 1;
2457
2439 /* SW support for IBSS_RSN is provided by mac80211 */ 2458 /* SW support for IBSS_RSN is provided by mac80211 */
2440 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; 2459 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
2441 2460
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index ac53d901801d..dfb0441f406c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3809,7 +3809,7 @@ static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set)
3809 return true; 3809 return true;
3810} 3810}
3811 3811
3812static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah) 3812void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
3813{ 3813{
3814 int internal_regulator = 3814 int internal_regulator =
3815 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR); 3815 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index 2505ac44f0c1..8396d150ce01 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -334,4 +334,7 @@ u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz);
334 334
335unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah, 335unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
336 struct ath9k_channel *chan); 336 struct ath9k_channel *chan);
337
338void ar9003_hw_internal_regulator_apply(struct ath_hw *ah);
339
337#endif 340#endif
diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h
index f11d9b2677fd..1bd3a3d22101 100644
--- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2011 Atheros Communications Inc. 2 * Copyright (c) 2010-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012 Qualcomm Atheros Inc.
3 * 4 *
4 * Permission to use, copy, modify, and/or distribute this software for any 5 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -18,7 +19,7 @@
18#define INITVALS_9330_1P1_H 19#define INITVALS_9330_1P1_H
19 20
20static const u32 ar9331_1p1_baseband_postamble[][5] = { 21static const u32 ar9331_1p1_baseband_postamble[][5] = {
21 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 22 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
22 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, 23 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005},
23 {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, 24 {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e},
24 {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, 25 {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0},
@@ -27,10 +28,10 @@ static const u32 ar9331_1p1_baseband_postamble[][5] = {
27 {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, 28 {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c},
28 {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, 29 {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044},
29 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a4, 0x037216a4}, 30 {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a4, 0x037216a4},
30 {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, 31 {0x00009e04, 0x00202020, 0x00202020, 0x00202020, 0x00202020},
31 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, 32 {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
32 {0x00009e10, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e}, 33 {0x00009e10, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e},
33 {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, 34 {0x00009e14, 0x31365d5e, 0x3136605e, 0x3136605e, 0x31365d5e},
34 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 35 {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
35 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, 36 {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
36 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, 37 {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
@@ -55,7 +56,7 @@ static const u32 ar9331_1p1_baseband_postamble[][5] = {
55 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 56 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
56 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 57 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
57 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 58 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
58 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071981}, 59 {0x0000a2d0, 0x00071982, 0x00071982, 0x00071982, 0x00071982},
59 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 60 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
60 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 61 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
61 {0x0000ae04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, 62 {0x0000ae04, 0x00802020, 0x00802020, 0x00802020, 0x00802020},
@@ -63,7 +64,7 @@ static const u32 ar9331_1p1_baseband_postamble[][5] = {
63}; 64};
64 65
65static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p1[][5] = { 66static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p1[][5] = {
66 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 67 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
67 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, 68 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
68 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, 69 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52},
69 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, 70 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84},
@@ -155,7 +156,7 @@ static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p1[][5] = {
155}; 156};
156 157
157static const u32 ar9331_modes_high_ob_db_tx_gain_1p1[][5] = { 158static const u32 ar9331_modes_high_ob_db_tx_gain_1p1[][5] = {
158 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 159 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
159 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, 160 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
160 {0x0000a2dc, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52}, 161 {0x0000a2dc, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52},
161 {0x0000a2e0, 0xffb31c84, 0xffb31c84, 0xffb31c84, 0xffb31c84}, 162 {0x0000a2e0, 0xffb31c84, 0xffb31c84, 0xffb31c84, 0xffb31c84},
@@ -245,7 +246,7 @@ static const u32 ar9331_modes_high_ob_db_tx_gain_1p1[][5] = {
245}; 246};
246 247
247static const u32 ar9331_modes_low_ob_db_tx_gain_1p1[][5] = { 248static const u32 ar9331_modes_low_ob_db_tx_gain_1p1[][5] = {
248 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 249 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
249 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, 250 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
250 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, 251 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52},
251 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, 252 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84},
@@ -377,14 +378,14 @@ static const u32 ar9331_1p1_radio_core[][2] = {
377 {0x000160b4, 0x92480040}, 378 {0x000160b4, 0x92480040},
378 {0x000160c0, 0x006db6db}, 379 {0x000160c0, 0x006db6db},
379 {0x000160c4, 0x0186db60}, 380 {0x000160c4, 0x0186db60},
380 {0x000160c8, 0x6db6db6c}, 381 {0x000160c8, 0x6db4db6c},
381 {0x000160cc, 0x6de6c300}, 382 {0x000160cc, 0x6de6c300},
382 {0x000160d0, 0x14500820}, 383 {0x000160d0, 0x14500820},
383 {0x00016100, 0x04cb0001}, 384 {0x00016100, 0x04cb0001},
384 {0x00016104, 0xfff80015}, 385 {0x00016104, 0xfff80015},
385 {0x00016108, 0x00080010}, 386 {0x00016108, 0x00080010},
386 {0x0001610c, 0x00170000}, 387 {0x0001610c, 0x00170000},
387 {0x00016140, 0x10804000}, 388 {0x00016140, 0x10800000},
388 {0x00016144, 0x01884080}, 389 {0x00016144, 0x01884080},
389 {0x00016148, 0x000080c0}, 390 {0x00016148, 0x000080c0},
390 {0x00016280, 0x01000015}, 391 {0x00016280, 0x01000015},
@@ -417,7 +418,7 @@ static const u32 ar9331_1p1_radio_core[][2] = {
417}; 418};
418 419
419static const u32 ar9331_1p1_soc_postamble[][5] = { 420static const u32 ar9331_1p1_soc_postamble[][5] = {
420 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 421 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
421 {0x00007010, 0x00000022, 0x00000022, 0x00000022, 0x00000022}, 422 {0x00007010, 0x00000022, 0x00000022, 0x00000022, 0x00000022},
422}; 423};
423 424
@@ -691,7 +692,7 @@ static const u32 ar9331_1p1_baseband_core[][2] = {
691}; 692};
692 693
693static const u32 ar9331_modes_high_power_tx_gain_1p1[][5] = { 694static const u32 ar9331_modes_high_power_tx_gain_1p1[][5] = {
694 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 695 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
695 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, 696 {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a},
696 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, 697 {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52},
697 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, 698 {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84},
@@ -783,7 +784,7 @@ static const u32 ar9331_modes_high_power_tx_gain_1p1[][5] = {
783}; 784};
784 785
785static const u32 ar9331_1p1_mac_postamble[][5] = { 786static const u32 ar9331_1p1_mac_postamble[][5] = {
786 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 787 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
787 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, 788 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
788 {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, 789 {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c},
789 {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, 790 {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38},
@@ -973,26 +974,27 @@ static const u32 ar9331_1p1_mac_core[][2] = {
973 974
974static const u32 ar9331_common_rx_gain_1p1[][2] = { 975static const u32 ar9331_common_rx_gain_1p1[][2] = {
975 /* Addr allmodes */ 976 /* Addr allmodes */
976 {0x0000a000, 0x00010000}, 977 {0x00009e18, 0x05000000},
977 {0x0000a004, 0x00030002}, 978 {0x0000a000, 0x00060005},
978 {0x0000a008, 0x00050004}, 979 {0x0000a004, 0x00810080},
979 {0x0000a00c, 0x00810080}, 980 {0x0000a008, 0x00830082},
980 {0x0000a010, 0x00830082}, 981 {0x0000a00c, 0x00850084},
981 {0x0000a014, 0x01810180}, 982 {0x0000a010, 0x01820181},
982 {0x0000a018, 0x01830182}, 983 {0x0000a014, 0x01840183},
983 {0x0000a01c, 0x01850184}, 984 {0x0000a018, 0x01880185},
984 {0x0000a020, 0x01890188}, 985 {0x0000a01c, 0x018a0189},
985 {0x0000a024, 0x018b018a}, 986 {0x0000a020, 0x02850284},
986 {0x0000a028, 0x018d018c}, 987 {0x0000a024, 0x02890288},
987 {0x0000a02c, 0x01910190}, 988 {0x0000a028, 0x028b028a},
988 {0x0000a030, 0x01930192}, 989 {0x0000a02c, 0x03850384},
989 {0x0000a034, 0x01950194}, 990 {0x0000a030, 0x03890388},
990 {0x0000a038, 0x038a0196}, 991 {0x0000a034, 0x038b038a},
991 {0x0000a03c, 0x038c038b}, 992 {0x0000a038, 0x038d038c},
992 {0x0000a040, 0x0390038d}, 993 {0x0000a03c, 0x03910390},
993 {0x0000a044, 0x03920391}, 994 {0x0000a040, 0x03930392},
994 {0x0000a048, 0x03940393}, 995 {0x0000a044, 0x03950394},
995 {0x0000a04c, 0x03960395}, 996 {0x0000a048, 0x00000396},
997 {0x0000a04c, 0x00000000},
996 {0x0000a050, 0x00000000}, 998 {0x0000a050, 0x00000000},
997 {0x0000a054, 0x00000000}, 999 {0x0000a054, 0x00000000},
998 {0x0000a058, 0x00000000}, 1000 {0x0000a058, 0x00000000},
@@ -1005,15 +1007,15 @@ static const u32 ar9331_common_rx_gain_1p1[][2] = {
1005 {0x0000a074, 0x00000000}, 1007 {0x0000a074, 0x00000000},
1006 {0x0000a078, 0x00000000}, 1008 {0x0000a078, 0x00000000},
1007 {0x0000a07c, 0x00000000}, 1009 {0x0000a07c, 0x00000000},
1008 {0x0000a080, 0x22222229}, 1010 {0x0000a080, 0x28282828},
1009 {0x0000a084, 0x1d1d1d1d}, 1011 {0x0000a084, 0x28282828},
1010 {0x0000a088, 0x1d1d1d1d}, 1012 {0x0000a088, 0x28282828},
1011 {0x0000a08c, 0x1d1d1d1d}, 1013 {0x0000a08c, 0x28282828},
1012 {0x0000a090, 0x171d1d1d}, 1014 {0x0000a090, 0x28282828},
1013 {0x0000a094, 0x11111717}, 1015 {0x0000a094, 0x24242428},
1014 {0x0000a098, 0x00030311}, 1016 {0x0000a098, 0x171e1e1e},
1015 {0x0000a09c, 0x00000000}, 1017 {0x0000a09c, 0x02020b0b},
1016 {0x0000a0a0, 0x00000000}, 1018 {0x0000a0a0, 0x02020202},
1017 {0x0000a0a4, 0x00000000}, 1019 {0x0000a0a4, 0x00000000},
1018 {0x0000a0a8, 0x00000000}, 1020 {0x0000a0a8, 0x00000000},
1019 {0x0000a0ac, 0x00000000}, 1021 {0x0000a0ac, 0x00000000},
@@ -1021,27 +1023,27 @@ static const u32 ar9331_common_rx_gain_1p1[][2] = {
1021 {0x0000a0b4, 0x00000000}, 1023 {0x0000a0b4, 0x00000000},
1022 {0x0000a0b8, 0x00000000}, 1024 {0x0000a0b8, 0x00000000},
1023 {0x0000a0bc, 0x00000000}, 1025 {0x0000a0bc, 0x00000000},
1024 {0x0000a0c0, 0x001f0000}, 1026 {0x0000a0c0, 0x22072208},
1025 {0x0000a0c4, 0x01000101}, 1027 {0x0000a0c4, 0x22052206},
1026 {0x0000a0c8, 0x011e011f}, 1028 {0x0000a0c8, 0x22032204},
1027 {0x0000a0cc, 0x011c011d}, 1029 {0x0000a0cc, 0x22012202},
1028 {0x0000a0d0, 0x02030204}, 1030 {0x0000a0d0, 0x221f2200},
1029 {0x0000a0d4, 0x02010202}, 1031 {0x0000a0d4, 0x221d221e},
1030 {0x0000a0d8, 0x021f0200}, 1032 {0x0000a0d8, 0x33023303},
1031 {0x0000a0dc, 0x0302021e}, 1033 {0x0000a0dc, 0x33003301},
1032 {0x0000a0e0, 0x03000301}, 1034 {0x0000a0e0, 0x331e331f},
1033 {0x0000a0e4, 0x031e031f}, 1035 {0x0000a0e4, 0x4402331d},
1034 {0x0000a0e8, 0x0402031d}, 1036 {0x0000a0e8, 0x44004401},
1035 {0x0000a0ec, 0x04000401}, 1037 {0x0000a0ec, 0x441e441f},
1036 {0x0000a0f0, 0x041e041f}, 1038 {0x0000a0f0, 0x55025503},
1037 {0x0000a0f4, 0x0502041d}, 1039 {0x0000a0f4, 0x55005501},
1038 {0x0000a0f8, 0x05000501}, 1040 {0x0000a0f8, 0x551e551f},
1039 {0x0000a0fc, 0x051e051f}, 1041 {0x0000a0fc, 0x6602551d},
1040 {0x0000a100, 0x06010602}, 1042 {0x0000a100, 0x66006601},
1041 {0x0000a104, 0x061f0600}, 1043 {0x0000a104, 0x661e661f},
1042 {0x0000a108, 0x061d061e}, 1044 {0x0000a108, 0x7703661d},
1043 {0x0000a10c, 0x07020703}, 1045 {0x0000a10c, 0x77017702},
1044 {0x0000a110, 0x07000701}, 1046 {0x0000a110, 0x00007700},
1045 {0x0000a114, 0x00000000}, 1047 {0x0000a114, 0x00000000},
1046 {0x0000a118, 0x00000000}, 1048 {0x0000a118, 0x00000000},
1047 {0x0000a11c, 0x00000000}, 1049 {0x0000a11c, 0x00000000},
@@ -1054,26 +1056,26 @@ static const u32 ar9331_common_rx_gain_1p1[][2] = {
1054 {0x0000a138, 0x00000000}, 1056 {0x0000a138, 0x00000000},
1055 {0x0000a13c, 0x00000000}, 1057 {0x0000a13c, 0x00000000},
1056 {0x0000a140, 0x001f0000}, 1058 {0x0000a140, 0x001f0000},
1057 {0x0000a144, 0x01000101}, 1059 {0x0000a144, 0x111f1100},
1058 {0x0000a148, 0x011e011f}, 1060 {0x0000a148, 0x111d111e},
1059 {0x0000a14c, 0x011c011d}, 1061 {0x0000a14c, 0x111b111c},
1060 {0x0000a150, 0x02030204}, 1062 {0x0000a150, 0x22032204},
1061 {0x0000a154, 0x02010202}, 1063 {0x0000a154, 0x22012202},
1062 {0x0000a158, 0x021f0200}, 1064 {0x0000a158, 0x221f2200},
1063 {0x0000a15c, 0x0302021e}, 1065 {0x0000a15c, 0x221d221e},
1064 {0x0000a160, 0x03000301}, 1066 {0x0000a160, 0x33013302},
1065 {0x0000a164, 0x031e031f}, 1067 {0x0000a164, 0x331f3300},
1066 {0x0000a168, 0x0402031d}, 1068 {0x0000a168, 0x4402331e},
1067 {0x0000a16c, 0x04000401}, 1069 {0x0000a16c, 0x44004401},
1068 {0x0000a170, 0x041e041f}, 1070 {0x0000a170, 0x441e441f},
1069 {0x0000a174, 0x0502041d}, 1071 {0x0000a174, 0x55015502},
1070 {0x0000a178, 0x05000501}, 1072 {0x0000a178, 0x551f5500},
1071 {0x0000a17c, 0x051e051f}, 1073 {0x0000a17c, 0x6602551e},
1072 {0x0000a180, 0x06010602}, 1074 {0x0000a180, 0x66006601},
1073 {0x0000a184, 0x061f0600}, 1075 {0x0000a184, 0x661e661f},
1074 {0x0000a188, 0x061d061e}, 1076 {0x0000a188, 0x7703661d},
1075 {0x0000a18c, 0x07020703}, 1077 {0x0000a18c, 0x77017702},
1076 {0x0000a190, 0x07000701}, 1078 {0x0000a190, 0x00007700},
1077 {0x0000a194, 0x00000000}, 1079 {0x0000a194, 0x00000000},
1078 {0x0000a198, 0x00000000}, 1080 {0x0000a198, 0x00000000},
1079 {0x0000a19c, 0x00000000}, 1081 {0x0000a19c, 0x00000000},
@@ -1100,14 +1102,14 @@ static const u32 ar9331_common_rx_gain_1p1[][2] = {
1100 {0x0000a1f0, 0x00000396}, 1102 {0x0000a1f0, 0x00000396},
1101 {0x0000a1f4, 0x00000396}, 1103 {0x0000a1f4, 0x00000396},
1102 {0x0000a1f8, 0x00000396}, 1104 {0x0000a1f8, 0x00000396},
1103 {0x0000a1fc, 0x00000196}, 1105 {0x0000a1fc, 0x00000296},
1104}; 1106};
1105 1107
1106static const u32 ar9331_common_tx_gain_offset1_1[][1] = { 1108static const u32 ar9331_common_tx_gain_offset1_1[][1] = {
1107 {0}, 1109 {0x00000000},
1108 {3}, 1110 {0x00000003},
1109 {0}, 1111 {0x00000000},
1110 {0}, 1112 {0x00000000},
1111}; 1113};
1112 1114
1113static const u32 ar9331_1p1_chansel_xtal_25M[] = { 1115static const u32 ar9331_1p1_chansel_xtal_25M[] = {
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index abe05ec85d50..7db1890448f2 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1468,6 +1468,9 @@ static bool ath9k_hw_chip_reset(struct ath_hw *ah,
1468 return false; 1468 return false;
1469 1469
1470 ah->chip_fullsleep = false; 1470 ah->chip_fullsleep = false;
1471
1472 if (AR_SREV_9330(ah))
1473 ar9003_hw_internal_regulator_apply(ah);
1471 ath9k_hw_init_pll(ah, chan); 1474 ath9k_hw_init_pll(ah, chan);
1472 ath9k_hw_set_rfmode(ah, chan); 1475 ath9k_hw_set_rfmode(ah, chan);
1473 1476
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index dfa78e8b6470..4de4473776ac 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -239,7 +239,7 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
239{ 239{
240 struct ath_hw *ah = sc->sc_ah; 240 struct ath_hw *ah = sc->sc_ah;
241 struct ath_common *common = ath9k_hw_common(ah); 241 struct ath_common *common = ath9k_hw_common(ah);
242 bool ret; 242 bool ret = true;
243 243
244 ieee80211_stop_queues(sc->hw); 244 ieee80211_stop_queues(sc->hw);
245 245
@@ -250,11 +250,12 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
250 ath9k_debug_samp_bb_mac(sc); 250 ath9k_debug_samp_bb_mac(sc);
251 ath9k_hw_disable_interrupts(ah); 251 ath9k_hw_disable_interrupts(ah);
252 252
253 ret = ath_drain_all_txq(sc, retry_tx);
254
255 if (!ath_stoprecv(sc)) 253 if (!ath_stoprecv(sc))
256 ret = false; 254 ret = false;
257 255
256 if (!ath_drain_all_txq(sc, retry_tx))
257 ret = false;
258
258 if (!flush) { 259 if (!flush) {
259 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) 260 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
260 ath_rx_tasklet(sc, 1, true); 261 ath_rx_tasklet(sc, 1, true);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 23eaa1b26ebe..d59dd01d6cde 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -64,7 +64,8 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
64static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 64static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
65 struct ath_txq *txq, 65 struct ath_txq *txq,
66 struct ath_atx_tid *tid, 66 struct ath_atx_tid *tid,
67 struct sk_buff *skb); 67 struct sk_buff *skb,
68 bool dequeue);
68 69
69enum { 70enum {
70 MCS_HT20, 71 MCS_HT20,
@@ -811,7 +812,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
811 fi = get_frame_info(skb); 812 fi = get_frame_info(skb);
812 bf = fi->bf; 813 bf = fi->bf;
813 if (!fi->bf) 814 if (!fi->bf)
814 bf = ath_tx_setup_buffer(sc, txq, tid, skb); 815 bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
815 816
816 if (!bf) 817 if (!bf)
817 continue; 818 continue;
@@ -1726,7 +1727,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
1726 return; 1727 return;
1727 } 1728 }
1728 1729
1729 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); 1730 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
1730 if (!bf) 1731 if (!bf)
1731 return; 1732 return;
1732 1733
@@ -1753,7 +1754,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
1753 1754
1754 bf = fi->bf; 1755 bf = fi->bf;
1755 if (!bf) 1756 if (!bf)
1756 bf = ath_tx_setup_buffer(sc, txq, tid, skb); 1757 bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
1757 1758
1758 if (!bf) 1759 if (!bf)
1759 return; 1760 return;
@@ -1814,7 +1815,8 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1814static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 1815static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1815 struct ath_txq *txq, 1816 struct ath_txq *txq,
1816 struct ath_atx_tid *tid, 1817 struct ath_atx_tid *tid,
1817 struct sk_buff *skb) 1818 struct sk_buff *skb,
1819 bool dequeue)
1818{ 1820{
1819 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1821 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1820 struct ath_frame_info *fi = get_frame_info(skb); 1822 struct ath_frame_info *fi = get_frame_info(skb);
@@ -1863,6 +1865,8 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1863 return bf; 1865 return bf;
1864 1866
1865error: 1867error:
1868 if (dequeue)
1869 __skb_unlink(skb, &tid->buf_q);
1866 dev_kfree_skb_any(skb); 1870 dev_kfree_skb_any(skb);
1867 return NULL; 1871 return NULL;
1868} 1872}
@@ -1893,7 +1897,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
1893 */ 1897 */
1894 ath_tx_send_ampdu(sc, tid, skb, txctl); 1898 ath_tx_send_ampdu(sc, tid, skb, txctl);
1895 } else { 1899 } else {
1896 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); 1900 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
1897 if (!bf) 1901 if (!bf)
1898 return; 1902 return;
1899 1903
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index c5a34ffe6459..a299d42da8e7 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -28,6 +28,7 @@
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/firmware.h> 29#include <linux/firmware.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/vmalloc.h>
31#include <net/cfg80211.h> 32#include <net/cfg80211.h>
32 33
33#include <defs.h> 34#include <defs.h>
@@ -1239,7 +1240,7 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo)
1239 return -EINVAL; 1240 return -EINVAL;
1240 } 1241 }
1241 1242
1242 devinfo->image = kmalloc(fw->size, GFP_ATOMIC); /* plus nvram */ 1243 devinfo->image = vmalloc(fw->size); /* plus nvram */
1243 if (!devinfo->image) 1244 if (!devinfo->image)
1244 return -ENOMEM; 1245 return -ENOMEM;
1245 1246
@@ -1603,7 +1604,7 @@ static struct usb_driver brcmf_usbdrvr = {
1603void brcmf_usb_exit(void) 1604void brcmf_usb_exit(void)
1604{ 1605{
1605 usb_deregister(&brcmf_usbdrvr); 1606 usb_deregister(&brcmf_usbdrvr);
1606 kfree(g_image.data); 1607 vfree(g_image.data);
1607 g_image.data = NULL; 1608 g_image.data = NULL;
1608 g_image.len = 0; 1609 g_image.len = 0;
1609} 1610}
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index db6c6e528022..2463c0626438 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -137,11 +137,3 @@ config IWLWIFI_EXPERIMENTAL_MFP
137 even if the microcode doesn't advertise it. 137 even if the microcode doesn't advertise it.
138 138
139 Say Y only if you want to experiment with MFP. 139 Say Y only if you want to experiment with MFP.
140
141config IWLWIFI_UCODE16
142 bool "support uCode 16.0"
143 depends on IWLWIFI
144 help
145 This option enables support for uCode version 16.0.
146
147 Say Y if you want to use 16.0 microcode.
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index 406f297a9a56..d615eacbf050 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -18,7 +18,6 @@ iwlwifi-objs += iwl-notif-wait.o
18iwlwifi-objs += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o 18iwlwifi-objs += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
19 19
20 20
21iwlwifi-$(CONFIG_IWLWIFI_UCODE16) += iwl-phy-db.o
22iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o 21iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
23iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o 22iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
24iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-testmode.o 23iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-testmode.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 7f793417c787..8133105ac645 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -79,7 +79,7 @@ static const struct iwl_base_params iwl2000_base_params = {
79 .chain_noise_scale = 1000, 79 .chain_noise_scale = 1000,
80 .wd_timeout = IWL_DEF_WD_TIMEOUT, 80 .wd_timeout = IWL_DEF_WD_TIMEOUT,
81 .max_event_log_size = 512, 81 .max_event_log_size = 512,
82 .shadow_reg_enable = true, 82 .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
83 .hd_v2 = true, 83 .hd_v2 = true,
84}; 84};
85 85
@@ -97,7 +97,7 @@ static const struct iwl_base_params iwl2030_base_params = {
97 .chain_noise_scale = 1000, 97 .chain_noise_scale = 1000,
98 .wd_timeout = IWL_LONG_WD_TIMEOUT, 98 .wd_timeout = IWL_LONG_WD_TIMEOUT,
99 .max_event_log_size = 512, 99 .max_event_log_size = 512,
100 .shadow_reg_enable = true, 100 .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
101 .hd_v2 = true, 101 .hd_v2 = true,
102}; 102};
103 103
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 381b02cf339c..19f7ee84ae89 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -86,7 +86,7 @@ static const struct iwl_base_params iwl6000_base_params = {
86 .chain_noise_scale = 1000, 86 .chain_noise_scale = 1000,
87 .wd_timeout = IWL_DEF_WD_TIMEOUT, 87 .wd_timeout = IWL_DEF_WD_TIMEOUT,
88 .max_event_log_size = 512, 88 .max_event_log_size = 512,
89 .shadow_reg_enable = true, 89 .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
90}; 90};
91 91
92static const struct iwl_base_params iwl6050_base_params = { 92static const struct iwl_base_params iwl6050_base_params = {
@@ -102,7 +102,7 @@ static const struct iwl_base_params iwl6050_base_params = {
102 .chain_noise_scale = 1500, 102 .chain_noise_scale = 1500,
103 .wd_timeout = IWL_DEF_WD_TIMEOUT, 103 .wd_timeout = IWL_DEF_WD_TIMEOUT,
104 .max_event_log_size = 1024, 104 .max_event_log_size = 1024,
105 .shadow_reg_enable = true, 105 .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
106}; 106};
107 107
108static const struct iwl_base_params iwl6000_g2_base_params = { 108static const struct iwl_base_params iwl6000_g2_base_params = {
@@ -118,7 +118,7 @@ static const struct iwl_base_params iwl6000_g2_base_params = {
118 .chain_noise_scale = 1000, 118 .chain_noise_scale = 1000,
119 .wd_timeout = IWL_LONG_WD_TIMEOUT, 119 .wd_timeout = IWL_LONG_WD_TIMEOUT,
120 .max_event_log_size = 512, 120 .max_event_log_size = 512,
121 .shadow_reg_enable = true, 121 .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
122}; 122};
123 123
124static const struct iwl_ht_params iwl6000_ht_params = { 124static const struct iwl_ht_params iwl6000_ht_params = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 51e1a69ffdda..8cebd7c363fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -884,6 +884,7 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
884 if ((priv->bt_traffic_load != priv->last_bt_traffic_load) || 884 if ((priv->bt_traffic_load != priv->last_bt_traffic_load) ||
885 (priv->bt_full_concurrent != full_concurrent)) { 885 (priv->bt_full_concurrent != full_concurrent)) {
886 priv->bt_full_concurrent = full_concurrent; 886 priv->bt_full_concurrent = full_concurrent;
887 priv->last_bt_traffic_load = priv->bt_traffic_load;
887 888
888 /* Update uCode's rate table. */ 889 /* Update uCode's rate table. */
889 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 890 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index b31584e87bc7..aea07aab3c9e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -772,7 +772,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
772 ~IWL_STA_DRIVER_ACTIVE; 772 ~IWL_STA_DRIVER_ACTIVE;
773 priv->stations[i].used &= 773 priv->stations[i].used &=
774 ~IWL_STA_UCODE_INPROGRESS; 774 ~IWL_STA_UCODE_INPROGRESS;
775 spin_unlock_bh(&priv->sta_lock); 775 continue;
776 } 776 }
777 /* 777 /*
778 * Rate scaling has already been initialized, send 778 * Rate scaling has already been initialized, send
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 3c72bad0ae56..d742900969ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -657,17 +657,17 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
657 return -EINVAL; 657 return -EINVAL;
658} 658}
659 659
660static int alloc_pci_desc(struct iwl_drv *drv, 660static int iwl_alloc_ucode(struct iwl_drv *drv,
661 struct iwl_firmware_pieces *pieces, 661 struct iwl_firmware_pieces *pieces,
662 enum iwl_ucode_type type) 662 enum iwl_ucode_type type)
663{ 663{
664 int i; 664 int i;
665 for (i = 0; 665 for (i = 0;
666 i < IWL_UCODE_SECTION_MAX && get_sec_size(pieces, type, i); 666 i < IWL_UCODE_SECTION_MAX && get_sec_size(pieces, type, i);
667 i++) 667 i++)
668 if (iwl_alloc_fw_desc(drv, &(drv->fw.img[type].sec[i]), 668 if (iwl_alloc_fw_desc(drv, &(drv->fw.img[type].sec[i]),
669 get_sec(pieces, type, i))) 669 get_sec(pieces, type, i)))
670 return -1; 670 return -ENOMEM;
671 return 0; 671 return 0;
672} 672}
673 673
@@ -825,8 +825,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
825 * 1) unmodified from disk 825 * 1) unmodified from disk
826 * 2) backup cache for save/restore during power-downs */ 826 * 2) backup cache for save/restore during power-downs */
827 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) 827 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
828 if (alloc_pci_desc(drv, &pieces, i)) 828 if (iwl_alloc_ucode(drv, &pieces, i))
829 goto err_pci_alloc; 829 goto out_free_fw;
830 830
831 /* Now that we can no longer fail, copy information */ 831 /* Now that we can no longer fail, copy information */
832 832
@@ -866,7 +866,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
866 drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw); 866 drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw);
867 867
868 if (!drv->op_mode) 868 if (!drv->op_mode)
869 goto out_unbind; 869 goto out_free_fw;
870 870
871 return; 871 return;
872 872
@@ -877,7 +877,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
877 goto out_unbind; 877 goto out_unbind;
878 return; 878 return;
879 879
880 err_pci_alloc: 880 out_free_fw:
881 IWL_ERR(drv, "failed to allocate pci memory\n"); 881 IWL_ERR(drv, "failed to allocate pci memory\n");
882 iwl_dealloc_ucode(drv); 882 iwl_dealloc_ucode(drv);
883 release_firmware(ucode_raw); 883 release_firmware(ucode_raw);
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c
deleted file mode 100644
index f166955340fe..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c
+++ /dev/null
@@ -1,288 +0,0 @@
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63
64#include <linux/slab.h>
65#include <linux/string.h>
66
67#include "iwl-debug.h"
68#include "iwl-dev.h"
69
70#include "iwl-phy-db.h"
71
72#define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */
73
74struct iwl_phy_db *iwl_phy_db_init(struct device *dev)
75{
76 struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db),
77 GFP_KERNEL);
78
79 if (!phy_db)
80 return phy_db;
81
82 phy_db->dev = dev;
83
84 /* TODO: add default values of the phy db. */
85 return phy_db;
86}
87
88/*
89 * get phy db section: returns a pointer to a phy db section specified by
90 * type and channel group id.
91 */
92static struct iwl_phy_db_entry *
93iwl_phy_db_get_section(struct iwl_phy_db *phy_db,
94 enum iwl_phy_db_section_type type,
95 u16 chg_id)
96{
97 if (!phy_db || type < 0 || type >= IWL_PHY_DB_MAX)
98 return NULL;
99
100 switch (type) {
101 case IWL_PHY_DB_CFG:
102 return &phy_db->cfg;
103 case IWL_PHY_DB_CALIB_NCH:
104 return &phy_db->calib_nch;
105 case IWL_PHY_DB_CALIB_CH:
106 return &phy_db->calib_ch;
107 case IWL_PHY_DB_CALIB_CHG_PAPD:
108 if (chg_id < 0 || chg_id >= IWL_NUM_PAPD_CH_GROUPS)
109 return NULL;
110 return &phy_db->calib_ch_group_papd[chg_id];
111 case IWL_PHY_DB_CALIB_CHG_TXP:
112 if (chg_id < 0 || chg_id >= IWL_NUM_TXP_CH_GROUPS)
113 return NULL;
114 return &phy_db->calib_ch_group_txp[chg_id];
115 default:
116 return NULL;
117 }
118 return NULL;
119}
120
121static void iwl_phy_db_free_section(struct iwl_phy_db *phy_db,
122 enum iwl_phy_db_section_type type,
123 u16 chg_id)
124{
125 struct iwl_phy_db_entry *entry =
126 iwl_phy_db_get_section(phy_db, type, chg_id);
127 if (!entry)
128 return;
129
130 kfree(entry->data);
131 entry->data = NULL;
132 entry->size = 0;
133}
134
135void iwl_phy_db_free(struct iwl_phy_db *phy_db)
136{
137 int i;
138
139 if (!phy_db)
140 return;
141
142 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CFG, 0);
143 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_NCH, 0);
144 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CH, 0);
145 for (i = 0; i < IWL_NUM_PAPD_CH_GROUPS; i++)
146 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_PAPD, i);
147 for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++)
148 iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_TXP, i);
149
150 kfree(phy_db);
151}
152
153int iwl_phy_db_set_section(struct iwl_phy_db *phy_db,
154 enum iwl_phy_db_section_type type, u8 *data,
155 u16 size, gfp_t alloc_ctx)
156{
157 struct iwl_phy_db_entry *entry;
158 u16 chg_id = 0;
159
160 if (!phy_db)
161 return -EINVAL;
162
163 if (type == IWL_PHY_DB_CALIB_CHG_PAPD ||
164 type == IWL_PHY_DB_CALIB_CHG_TXP)
165 chg_id = le16_to_cpup((__le16 *)data);
166
167 entry = iwl_phy_db_get_section(phy_db, type, chg_id);
168 if (!entry)
169 return -EINVAL;
170
171 kfree(entry->data);
172 entry->data = kmemdup(data, size, alloc_ctx);
173 if (!entry->data) {
174 entry->size = 0;
175 return -ENOMEM;
176 }
177
178 entry->size = size;
179
180 if (type == IWL_PHY_DB_CALIB_CH) {
181 phy_db->channel_num = le32_to_cpup((__le32 *)data);
182 phy_db->channel_size =
183 (size - CHANNEL_NUM_SIZE) / phy_db->channel_num;
184 }
185
186 return 0;
187}
188
189static int is_valid_channel(u16 ch_id)
190{
191 if (ch_id <= 14 ||
192 (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) ||
193 (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) ||
194 (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1))
195 return 1;
196 return 0;
197}
198
199static u8 ch_id_to_ch_index(u16 ch_id)
200{
201 if (WARN_ON(!is_valid_channel(ch_id)))
202 return 0xff;
203
204 if (ch_id <= 14)
205 return ch_id - 1;
206 if (ch_id <= 64)
207 return (ch_id + 20) / 4;
208 if (ch_id <= 140)
209 return (ch_id - 12) / 4;
210 return (ch_id - 13) / 4;
211}
212
213
214static u16 channel_id_to_papd(u16 ch_id)
215{
216 if (WARN_ON(!is_valid_channel(ch_id)))
217 return 0xff;
218
219 if (1 <= ch_id && ch_id <= 14)
220 return 0;
221 if (36 <= ch_id && ch_id <= 64)
222 return 1;
223 if (100 <= ch_id && ch_id <= 140)
224 return 2;
225 return 3;
226}
227
228static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id)
229{
230 struct iwl_phy_db_chg_txp *txp_chg;
231 int i;
232 u8 ch_index = ch_id_to_ch_index(ch_id);
233 if (ch_index == 0xff)
234 return 0xff;
235
236 for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++) {
237 txp_chg = (void *)phy_db->calib_ch_group_txp[i].data;
238 if (!txp_chg)
239 return 0xff;
240 /*
241 * Looking for the first channel group that its max channel is
242 * higher then wanted channel.
243 */
244 if (le16_to_cpu(txp_chg->max_channel_idx) >= ch_index)
245 return i;
246 }
247 return 0xff;
248}
249
250int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db,
251 enum iwl_phy_db_section_type type, u8 **data,
252 u16 *size, u16 ch_id)
253{
254 struct iwl_phy_db_entry *entry;
255 u32 channel_num;
256 u32 channel_size;
257 u16 ch_group_id = 0;
258 u16 index;
259
260 if (!phy_db)
261 return -EINVAL;
262
263 /* find wanted channel group */
264 if (type == IWL_PHY_DB_CALIB_CHG_PAPD)
265 ch_group_id = channel_id_to_papd(ch_id);
266 else if (type == IWL_PHY_DB_CALIB_CHG_TXP)
267 ch_group_id = channel_id_to_txp(phy_db, ch_id);
268
269 entry = iwl_phy_db_get_section(phy_db, type, ch_group_id);
270 if (!entry)
271 return -EINVAL;
272
273 if (type == IWL_PHY_DB_CALIB_CH) {
274 index = ch_id_to_ch_index(ch_id);
275 channel_num = phy_db->channel_num;
276 channel_size = phy_db->channel_size;
277 if (index >= channel_num) {
278 IWL_ERR(phy_db, "Wrong channel number %d", ch_id);
279 return -EINVAL;
280 }
281 *data = entry->data + CHANNEL_NUM_SIZE + index * channel_size;
282 *size = channel_size;
283 } else {
284 *data = entry->data;
285 *size = entry->size;
286 }
287 return 0;
288}
diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.h b/drivers/net/wireless/iwlwifi/iwl-phy-db.h
deleted file mode 100644
index c34c6a9303ab..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-phy-db.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63
64#ifndef __IWL_PHYDB_H__
65#define __IWL_PHYDB_H__
66
67#include <linux/types.h>
68
69#define IWL_NUM_PAPD_CH_GROUPS 4
70#define IWL_NUM_TXP_CH_GROUPS 8
71
72struct iwl_phy_db_entry {
73 u16 size;
74 u8 *data;
75};
76
77struct iwl_shared;
78
79/**
80 * struct iwl_phy_db - stores phy configuration and calibration data.
81 *
82 * @cfg: phy configuration.
83 * @calib_nch: non channel specific calibration data.
84 * @calib_ch: channel specific calibration data.
85 * @calib_ch_group_papd: calibration data related to papd channel group.
86 * @calib_ch_group_txp: calibration data related to tx power chanel group.
87 */
88struct iwl_phy_db {
89 struct iwl_phy_db_entry cfg;
90 struct iwl_phy_db_entry calib_nch;
91 struct iwl_phy_db_entry calib_ch;
92 struct iwl_phy_db_entry calib_ch_group_papd[IWL_NUM_PAPD_CH_GROUPS];
93 struct iwl_phy_db_entry calib_ch_group_txp[IWL_NUM_TXP_CH_GROUPS];
94
95 u32 channel_num;
96 u32 channel_size;
97
98 /* for an access to the logger */
99 struct device *dev;
100};
101
102enum iwl_phy_db_section_type {
103 IWL_PHY_DB_CFG = 1,
104 IWL_PHY_DB_CALIB_NCH,
105 IWL_PHY_DB_CALIB_CH,
106 IWL_PHY_DB_CALIB_CHG_PAPD,
107 IWL_PHY_DB_CALIB_CHG_TXP,
108 IWL_PHY_DB_MAX
109};
110
111/* for parsing of tx power channel group data that comes from the firmware*/
112struct iwl_phy_db_chg_txp {
113 __le32 space;
114 __le16 max_channel_idx;
115} __packed;
116
117struct iwl_phy_db *iwl_phy_db_init(struct device *dev);
118
119void iwl_phy_db_free(struct iwl_phy_db *phy_db);
120
121int iwl_phy_db_set_section(struct iwl_phy_db *phy_db,
122 enum iwl_phy_db_section_type type, u8 *data,
123 u16 size, gfp_t alloc_ctx);
124
125int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db,
126 enum iwl_phy_db_section_type type, u8 **data,
127 u16 *size, u16 ch_id);
128
129#endif /* __IWL_PHYDB_H__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 6213c05a4b52..e959207c630a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -347,7 +347,7 @@ void iwl_trans_tx_queue_set_status(struct iwl_trans *trans,
347void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int queue, int fifo, 347void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int queue, int fifo,
348 int sta_id, int tid, int frame_limit, u16 ssn); 348 int sta_id, int tid, int frame_limit, u16 ssn);
349void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, 349void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
350 int index, enum dma_data_direction dma_dir); 350 enum dma_data_direction dma_dir);
351int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, 351int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
352 struct sk_buff_head *skbs); 352 struct sk_buff_head *skbs);
353int iwl_queue_space(const struct iwl_queue *q); 353int iwl_queue_space(const struct iwl_queue *q);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index 21a8a672fbb2..a8750238ee09 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -204,33 +204,39 @@ static void iwlagn_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
204 for (i = 1; i < num_tbs; i++) 204 for (i = 1; i < num_tbs; i++)
205 dma_unmap_single(trans->dev, iwl_tfd_tb_get_addr(tfd, i), 205 dma_unmap_single(trans->dev, iwl_tfd_tb_get_addr(tfd, i),
206 iwl_tfd_tb_get_len(tfd, i), dma_dir); 206 iwl_tfd_tb_get_len(tfd, i), dma_dir);
207
208 tfd->num_tbs = 0;
207} 209}
208 210
209/** 211/**
210 * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] 212 * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
211 * @trans - transport private data 213 * @trans - transport private data
212 * @txq - tx queue 214 * @txq - tx queue
213 * @index - the index of the TFD to be freed 215 * @dma_dir - the direction of the DMA mapping
214 *@dma_dir - the direction of the DMA mapping
215 * 216 *
216 * Does NOT advance any TFD circular buffer read/write indexes 217 * Does NOT advance any TFD circular buffer read/write indexes
217 * Does NOT free the TFD itself (which is within circular buffer) 218 * Does NOT free the TFD itself (which is within circular buffer)
218 */ 219 */
219void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, 220void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
220 int index, enum dma_data_direction dma_dir) 221 enum dma_data_direction dma_dir)
221{ 222{
222 struct iwl_tfd *tfd_tmp = txq->tfds; 223 struct iwl_tfd *tfd_tmp = txq->tfds;
223 224
225 /* rd_ptr is bounded by n_bd and idx is bounded by n_window */
226 int rd_ptr = txq->q.read_ptr;
227 int idx = get_cmd_index(&txq->q, rd_ptr);
228
224 lockdep_assert_held(&txq->lock); 229 lockdep_assert_held(&txq->lock);
225 230
226 iwlagn_unmap_tfd(trans, &txq->entries[index].meta, 231 /* We have only q->n_window txq->entries, but we use q->n_bd tfds */
227 &tfd_tmp[index], dma_dir); 232 iwlagn_unmap_tfd(trans, &txq->entries[idx].meta,
233 &tfd_tmp[rd_ptr], dma_dir);
228 234
229 /* free SKB */ 235 /* free SKB */
230 if (txq->entries) { 236 if (txq->entries) {
231 struct sk_buff *skb; 237 struct sk_buff *skb;
232 238
233 skb = txq->entries[index].skb; 239 skb = txq->entries[idx].skb;
234 240
235 /* Can be called from irqs-disabled context 241 /* Can be called from irqs-disabled context
236 * If skb is not NULL, it means that the whole queue is being 242 * If skb is not NULL, it means that the whole queue is being
@@ -238,7 +244,7 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
238 */ 244 */
239 if (skb) { 245 if (skb) {
240 iwl_op_mode_free_skb(trans->op_mode, skb); 246 iwl_op_mode_free_skb(trans->op_mode, skb);
241 txq->entries[index].skb = NULL; 247 txq->entries[idx].skb = NULL;
242 } 248 }
243 } 249 }
244} 250}
@@ -973,7 +979,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
973 979
974 iwlagn_txq_inval_byte_cnt_tbl(trans, txq); 980 iwlagn_txq_inval_byte_cnt_tbl(trans, txq);
975 981
976 iwlagn_txq_free_tfd(trans, txq, txq->q.read_ptr, DMA_TO_DEVICE); 982 iwlagn_txq_free_tfd(trans, txq, DMA_TO_DEVICE);
977 freed++; 983 freed++;
978 } 984 }
979 985
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 2e57161854b9..ec6fb395b84d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -435,9 +435,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
435 435
436 spin_lock_bh(&txq->lock); 436 spin_lock_bh(&txq->lock);
437 while (q->write_ptr != q->read_ptr) { 437 while (q->write_ptr != q->read_ptr) {
438 /* The read_ptr needs to bound by q->n_window */ 438 iwlagn_txq_free_tfd(trans, txq, dma_dir);
439 iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr),
440 dma_dir);
441 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 439 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
442 } 440 }
443 spin_unlock_bh(&txq->lock); 441 spin_unlock_bh(&txq->lock);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
index 1b851f650e07..e2750a12c6f1 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
@@ -260,6 +260,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
260 } 260 }
261 261
262 if (wl->irq) { 262 if (wl->irq) {
263 irq_set_status_flags(wl->irq, IRQ_NOAUTOEN);
263 ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl); 264 ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl);
264 if (ret < 0) { 265 if (ret < 0) {
265 wl1251_error("request_irq() failed: %d", ret); 266 wl1251_error("request_irq() failed: %d", ret);
@@ -267,7 +268,6 @@ static int wl1251_sdio_probe(struct sdio_func *func,
267 } 268 }
268 269
269 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); 270 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
270 disable_irq(wl->irq);
271 271
272 wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq; 272 wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq;
273 wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq; 273 wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq;
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index 6248c354fc5c..87f6305bda2c 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -281,6 +281,7 @@ static int __devinit wl1251_spi_probe(struct spi_device *spi)
281 281
282 wl->use_eeprom = pdata->use_eeprom; 282 wl->use_eeprom = pdata->use_eeprom;
283 283
284 irq_set_status_flags(wl->irq, IRQ_NOAUTOEN);
284 ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl); 285 ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl);
285 if (ret < 0) { 286 if (ret < 0) {
286 wl1251_error("request_irq() failed: %d", ret); 287 wl1251_error("request_irq() failed: %d", ret);
@@ -289,8 +290,6 @@ static int __devinit wl1251_spi_probe(struct spi_device *spi)
289 290
290 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); 291 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
291 292
292 disable_irq(wl->irq);
293
294 ret = wl1251_init_ieee80211(wl); 293 ret = wl1251_init_ieee80211(wl);
295 if (ret) 294 if (ret)
296 goto out_irq; 295 goto out_irq;
diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
index 509aa881d790..f3d6fa508269 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -1715,6 +1715,7 @@ out:
1715 1715
1716} 1716}
1717 1717
1718#ifdef CONFIG_PM
1718/* Set the global behaviour of RX filters - On/Off + default action */ 1719/* Set the global behaviour of RX filters - On/Off + default action */
1719int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable, 1720int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable,
1720 enum rx_filter_action action) 1721 enum rx_filter_action action)
@@ -1794,3 +1795,4 @@ out:
1794 kfree(acx); 1795 kfree(acx);
1795 return ret; 1796 return ret;
1796} 1797}
1798#endif /* CONFIG_PM */
diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h
index 8106b2ebfe60..e6a74869a5ff 100644
--- a/drivers/net/wireless/ti/wlcore/acx.h
+++ b/drivers/net/wireless/ti/wlcore/acx.h
@@ -1330,9 +1330,11 @@ int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
1330int wl1271_acx_fm_coex(struct wl1271 *wl); 1330int wl1271_acx_fm_coex(struct wl1271 *wl);
1331int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl); 1331int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl);
1332int wl12xx_acx_config_hangover(struct wl1271 *wl); 1332int wl12xx_acx_config_hangover(struct wl1271 *wl);
1333
1334#ifdef CONFIG_PM
1333int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable, 1335int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable,
1334 enum rx_filter_action action); 1336 enum rx_filter_action action);
1335int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable, 1337int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable,
1336 struct wl12xx_rx_filter *filter); 1338 struct wl12xx_rx_filter *filter);
1337 1339#endif /* CONFIG_PM */
1338#endif /* __WL1271_ACX_H__ */ 1340#endif /* __WL1271_ACX_H__ */
diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c
index 1f1d9488dfb6..d6a3c6b07827 100644
--- a/drivers/net/wireless/ti/wlcore/rx.c
+++ b/drivers/net/wireless/ti/wlcore/rx.c
@@ -279,6 +279,7 @@ void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status *status)
279 wl12xx_rearm_rx_streaming(wl, active_hlids); 279 wl12xx_rearm_rx_streaming(wl, active_hlids);
280} 280}
281 281
282#ifdef CONFIG_PM
282int wl1271_rx_filter_enable(struct wl1271 *wl, 283int wl1271_rx_filter_enable(struct wl1271 *wl,
283 int index, bool enable, 284 int index, bool enable,
284 struct wl12xx_rx_filter *filter) 285 struct wl12xx_rx_filter *filter)
@@ -314,3 +315,4 @@ void wl1271_rx_filter_clear_all(struct wl1271 *wl)
314 wl1271_rx_filter_enable(wl, i, 0, NULL); 315 wl1271_rx_filter_enable(wl, i, 0, NULL);
315 } 316 }
316} 317}
318#endif /* CONFIG_PM */
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 2596401308a8..f4a6fcaeffb1 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -325,8 +325,7 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
325 unsigned int count; 325 unsigned int count;
326 int i, copy_off; 326 int i, copy_off;
327 327
328 count = DIV_ROUND_UP( 328 count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE);
329 offset_in_page(skb->data)+skb_headlen(skb), PAGE_SIZE);
330 329
331 copy_off = skb_headlen(skb) % PAGE_SIZE; 330 copy_off = skb_headlen(skb) % PAGE_SIZE;
332 331
diff --git a/drivers/nfc/pn544_hci.c b/drivers/nfc/pn544_hci.c
index 46f4a9f9f5e4..281f18c2fb82 100644
--- a/drivers/nfc/pn544_hci.c
+++ b/drivers/nfc/pn544_hci.c
@@ -232,7 +232,7 @@ static int pn544_hci_i2c_write(struct i2c_client *client, u8 *buf, int len)
232 232
233static int check_crc(u8 *buf, int buflen) 233static int check_crc(u8 *buf, int buflen)
234{ 234{
235 u8 len; 235 int len;
236 u16 crc; 236 u16 crc;
237 237
238 len = buf[0] + 1; 238 len = buf[0] + 1;
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 73c28dea10ae..7a114016ac7d 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -110,6 +110,9 @@ extern int lockdep_genl_is_held(void);
110#define genl_dereference(p) \ 110#define genl_dereference(p) \
111 rcu_dereference_protected(p, lockdep_genl_is_held()) 111 rcu_dereference_protected(p, lockdep_genl_is_held())
112 112
113#define MODULE_ALIAS_GENL_FAMILY(family)\
114 MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
115
113#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
114 117
115#endif /* __LINUX_GENERIC_NETLINK_H */ 118#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/net.h b/include/linux/net.h
index 2d7510f38934..e9ac2df079ba 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -313,5 +313,8 @@ extern int kernel_sock_shutdown(struct socket *sock,
313 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \ 313 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
314 "-type-" __stringify(type)) 314 "-type-" __stringify(type))
315 315
316#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \
317 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
318 name)
316#endif /* __KERNEL__ */ 319#endif /* __KERNEL__ */
317#endif /* _LINUX_NET_H */ 320#endif /* _LINUX_NET_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e7fd468f7126..d94cb1431519 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2795,15 +2795,15 @@ do { \
2795#define netif_info(priv, type, dev, fmt, args...) \ 2795#define netif_info(priv, type, dev, fmt, args...) \
2796 netif_level(info, priv, type, dev, fmt, ##args) 2796 netif_level(info, priv, type, dev, fmt, ##args)
2797 2797
2798#if defined(DEBUG) 2798#if defined(CONFIG_DYNAMIC_DEBUG)
2799#define netif_dbg(priv, type, dev, format, args...) \
2800 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
2801#elif defined(CONFIG_DYNAMIC_DEBUG)
2802#define netif_dbg(priv, type, netdev, format, args...) \ 2799#define netif_dbg(priv, type, netdev, format, args...) \
2803do { \ 2800do { \
2804 if (netif_msg_##type(priv)) \ 2801 if (netif_msg_##type(priv)) \
2805 dynamic_netdev_dbg(netdev, format, ##args); \ 2802 dynamic_netdev_dbg(netdev, format, ##args); \
2806} while (0) 2803} while (0)
2804#elif defined(DEBUG)
2805#define netif_dbg(priv, type, dev, format, args...) \
2806 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
2807#else 2807#else
2808#define netif_dbg(priv, type, dev, format, args...) \ 2808#define netif_dbg(priv, type, dev, format, args...) \
2809({ \ 2809({ \
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0e501714d47f..b534a1be540a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1896,8 +1896,6 @@ static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
1896{ 1896{
1897 int delta = 0; 1897 int delta = 0;
1898 1898
1899 if (headroom < NET_SKB_PAD)
1900 headroom = NET_SKB_PAD;
1901 if (headroom > skb_headroom(skb)) 1899 if (headroom > skb_headroom(skb))
1902 delta = headroom - skb_headroom(skb); 1900 delta = headroom - skb_headroom(skb);
1903 1901
diff --git a/include/net/dst.h b/include/net/dst.h
index bed833d9796a..8197eadca819 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -60,6 +60,7 @@ struct dst_entry {
60#define DST_NOCOUNT 0x0020 60#define DST_NOCOUNT 0x0020
61#define DST_NOPEER 0x0040 61#define DST_NOPEER 0x0040
62#define DST_FAKE_RTABLE 0x0080 62#define DST_FAKE_RTABLE 0x0080
63#define DST_XFRM_TUNNEL 0x0100
63 64
64 short error; 65 short error;
65 short obsolete; 66 short obsolete;
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 3252e7e0a005..ea5fb9fcc3f5 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -468,3 +468,4 @@ module_exit(exit_net_drop_monitor);
468 468
469MODULE_LICENSE("GPL v2"); 469MODULE_LICENSE("GPL v2");
470MODULE_AUTHOR("Neil Horman <nhorman@tuxdriver.com>"); 470MODULE_AUTHOR("Neil Horman <nhorman@tuxdriver.com>");
471MODULE_ALIAS_GENL_FAMILY("NET_DM");
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 89a47b35905d..cb982a61536f 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -459,28 +459,22 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
459 struct esp_data *esp = x->data; 459 struct esp_data *esp = x->data;
460 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); 460 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
461 u32 align = max_t(u32, blksize, esp->padlen); 461 u32 align = max_t(u32, blksize, esp->padlen);
462 u32 rem; 462 unsigned int net_adj;
463
464 mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
465 rem = mtu & (align - 1);
466 mtu &= ~(align - 1);
467 463
468 switch (x->props.mode) { 464 switch (x->props.mode) {
469 case XFRM_MODE_TUNNEL:
470 break;
471 default:
472 case XFRM_MODE_TRANSPORT: 465 case XFRM_MODE_TRANSPORT:
473 /* The worst case */
474 mtu -= blksize - 4;
475 mtu += min_t(u32, blksize - 4, rem);
476 break;
477 case XFRM_MODE_BEET: 466 case XFRM_MODE_BEET:
478 /* The worst case. */ 467 net_adj = sizeof(struct iphdr);
479 mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
480 break; 468 break;
469 case XFRM_MODE_TUNNEL:
470 net_adj = 0;
471 break;
472 default:
473 BUG();
481 } 474 }
482 475
483 return mtu - 2; 476 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
477 net_adj) & ~(align - 1)) + (net_adj - 2);
484} 478}
485 479
486static void esp4_err(struct sk_buff *skb, u32 info) 480static void esp4_err(struct sk_buff *skb, u32 info)
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 1e62b7557b00..db1521fcda5b 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -413,19 +413,15 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu)
413 struct esp_data *esp = x->data; 413 struct esp_data *esp = x->data;
414 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); 414 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
415 u32 align = max_t(u32, blksize, esp->padlen); 415 u32 align = max_t(u32, blksize, esp->padlen);
416 u32 rem; 416 unsigned int net_adj;
417 417
418 mtu -= x->props.header_len + crypto_aead_authsize(esp->aead); 418 if (x->props.mode != XFRM_MODE_TUNNEL)
419 rem = mtu & (align - 1); 419 net_adj = sizeof(struct ipv6hdr);
420 mtu &= ~(align - 1); 420 else
421 421 net_adj = 0;
422 if (x->props.mode != XFRM_MODE_TUNNEL) {
423 u32 padsize = ((blksize - 1) & 7) + 1;
424 mtu -= blksize - padsize;
425 mtu += min_t(u32, blksize - padsize, rem);
426 }
427 422
428 return mtu - 2; 423 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
424 net_adj) & ~(align - 1)) + (net_adj - 2);
429} 425}
430 426
431static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 427static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index d99fdc699625..17b8c67998bb 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1187,6 +1187,29 @@ static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src,
1187 return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL; 1187 return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
1188} 1188}
1189 1189
1190static void ip6_append_data_mtu(int *mtu,
1191 int *maxfraglen,
1192 unsigned int fragheaderlen,
1193 struct sk_buff *skb,
1194 struct rt6_info *rt)
1195{
1196 if (!(rt->dst.flags & DST_XFRM_TUNNEL)) {
1197 if (skb == NULL) {
1198 /* first fragment, reserve header_len */
1199 *mtu = *mtu - rt->dst.header_len;
1200
1201 } else {
1202 /*
1203 * this fragment is not first, the headers
1204 * space is regarded as data space.
1205 */
1206 *mtu = dst_mtu(rt->dst.path);
1207 }
1208 *maxfraglen = ((*mtu - fragheaderlen) & ~7)
1209 + fragheaderlen - sizeof(struct frag_hdr);
1210 }
1211}
1212
1190int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, 1213int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1191 int offset, int len, int odd, struct sk_buff *skb), 1214 int offset, int len, int odd, struct sk_buff *skb),
1192 void *from, int length, int transhdrlen, 1215 void *from, int length, int transhdrlen,
@@ -1196,7 +1219,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1196 struct inet_sock *inet = inet_sk(sk); 1219 struct inet_sock *inet = inet_sk(sk);
1197 struct ipv6_pinfo *np = inet6_sk(sk); 1220 struct ipv6_pinfo *np = inet6_sk(sk);
1198 struct inet_cork *cork; 1221 struct inet_cork *cork;
1199 struct sk_buff *skb; 1222 struct sk_buff *skb, *skb_prev = NULL;
1200 unsigned int maxfraglen, fragheaderlen; 1223 unsigned int maxfraglen, fragheaderlen;
1201 int exthdrlen; 1224 int exthdrlen;
1202 int dst_exthdrlen; 1225 int dst_exthdrlen;
@@ -1253,8 +1276,12 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1253 inet->cork.fl.u.ip6 = *fl6; 1276 inet->cork.fl.u.ip6 = *fl6;
1254 np->cork.hop_limit = hlimit; 1277 np->cork.hop_limit = hlimit;
1255 np->cork.tclass = tclass; 1278 np->cork.tclass = tclass;
1256 mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ? 1279 if (rt->dst.flags & DST_XFRM_TUNNEL)
1257 rt->dst.dev->mtu : dst_mtu(&rt->dst); 1280 mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
1281 rt->dst.dev->mtu : dst_mtu(&rt->dst);
1282 else
1283 mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
1284 rt->dst.dev->mtu : dst_mtu(rt->dst.path);
1258 if (np->frag_size < mtu) { 1285 if (np->frag_size < mtu) {
1259 if (np->frag_size) 1286 if (np->frag_size)
1260 mtu = np->frag_size; 1287 mtu = np->frag_size;
@@ -1350,25 +1377,27 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1350 unsigned int fraglen; 1377 unsigned int fraglen;
1351 unsigned int fraggap; 1378 unsigned int fraggap;
1352 unsigned int alloclen; 1379 unsigned int alloclen;
1353 struct sk_buff *skb_prev;
1354alloc_new_skb: 1380alloc_new_skb:
1355 skb_prev = skb;
1356
1357 /* There's no room in the current skb */ 1381 /* There's no room in the current skb */
1358 if (skb_prev) 1382 if (skb)
1359 fraggap = skb_prev->len - maxfraglen; 1383 fraggap = skb->len - maxfraglen;
1360 else 1384 else
1361 fraggap = 0; 1385 fraggap = 0;
1386 /* update mtu and maxfraglen if necessary */
1387 if (skb == NULL || skb_prev == NULL)
1388 ip6_append_data_mtu(&mtu, &maxfraglen,
1389 fragheaderlen, skb, rt);
1390
1391 skb_prev = skb;
1362 1392
1363 /* 1393 /*
1364 * If remaining data exceeds the mtu, 1394 * If remaining data exceeds the mtu,
1365 * we know we need more fragment(s). 1395 * we know we need more fragment(s).
1366 */ 1396 */
1367 datalen = length + fraggap; 1397 datalen = length + fraggap;
1368 if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen)
1369 datalen = maxfraglen - fragheaderlen;
1370 1398
1371 fraglen = datalen + fragheaderlen; 1399 if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen)
1400 datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len;
1372 if ((flags & MSG_MORE) && 1401 if ((flags & MSG_MORE) &&
1373 !(rt->dst.dev->features&NETIF_F_SG)) 1402 !(rt->dst.dev->features&NETIF_F_SG))
1374 alloclen = mtu; 1403 alloclen = mtu;
@@ -1377,13 +1406,16 @@ alloc_new_skb:
1377 1406
1378 alloclen += dst_exthdrlen; 1407 alloclen += dst_exthdrlen;
1379 1408
1380 /* 1409 if (datalen != length + fraggap) {
1381 * The last fragment gets additional space at tail. 1410 /*
1382 * Note: we overallocate on fragments with MSG_MODE 1411 * this is not the last fragment, the trailer
1383 * because we have no idea if we're the last one. 1412 * space is regarded as data space.
1384 */ 1413 */
1385 if (datalen == length + fraggap) 1414 datalen += rt->dst.trailer_len;
1386 alloclen += rt->dst.trailer_len; 1415 }
1416
1417 alloclen += rt->dst.trailer_len;
1418 fraglen = datalen + fragheaderlen;
1387 1419
1388 /* 1420 /*
1389 * We just reserve space for fragment header. 1421 * We just reserve space for fragment header.
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 889f5d13d7ba..70614e7affab 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -239,9 +239,16 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
239{ 239{
240 struct inet_sock *inet = inet_sk(sk); 240 struct inet_sock *inet = inet_sk(sk);
241 struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr; 241 struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr;
242 int ret = -EINVAL; 242 int ret;
243 int chk_addr_ret; 243 int chk_addr_ret;
244 244
245 if (!sock_flag(sk, SOCK_ZAPPED))
246 return -EINVAL;
247 if (addr_len < sizeof(struct sockaddr_l2tpip))
248 return -EINVAL;
249 if (addr->l2tp_family != AF_INET)
250 return -EINVAL;
251
245 ret = -EADDRINUSE; 252 ret = -EADDRINUSE;
246 read_lock_bh(&l2tp_ip_lock); 253 read_lock_bh(&l2tp_ip_lock);
247 if (__l2tp_ip_bind_lookup(&init_net, addr->l2tp_addr.s_addr, sk->sk_bound_dev_if, addr->l2tp_conn_id)) 254 if (__l2tp_ip_bind_lookup(&init_net, addr->l2tp_addr.s_addr, sk->sk_bound_dev_if, addr->l2tp_conn_id))
@@ -272,6 +279,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
272 sk_del_node_init(sk); 279 sk_del_node_init(sk);
273 write_unlock_bh(&l2tp_ip_lock); 280 write_unlock_bh(&l2tp_ip_lock);
274 ret = 0; 281 ret = 0;
282 sock_reset_flag(sk, SOCK_ZAPPED);
283
275out: 284out:
276 release_sock(sk); 285 release_sock(sk);
277 286
@@ -288,6 +297,9 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
288 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr; 297 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr;
289 int rc; 298 int rc;
290 299
300 if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
301 return -EINVAL;
302
291 if (addr_len < sizeof(*lsa)) 303 if (addr_len < sizeof(*lsa))
292 return -EINVAL; 304 return -EINVAL;
293 305
@@ -311,6 +323,14 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
311 return rc; 323 return rc;
312} 324}
313 325
326static int l2tp_ip_disconnect(struct sock *sk, int flags)
327{
328 if (sock_flag(sk, SOCK_ZAPPED))
329 return 0;
330
331 return udp_disconnect(sk, flags);
332}
333
314static int l2tp_ip_getname(struct socket *sock, struct sockaddr *uaddr, 334static int l2tp_ip_getname(struct socket *sock, struct sockaddr *uaddr,
315 int *uaddr_len, int peer) 335 int *uaddr_len, int peer)
316{ 336{
@@ -530,7 +550,7 @@ static struct proto l2tp_ip_prot = {
530 .close = l2tp_ip_close, 550 .close = l2tp_ip_close,
531 .bind = l2tp_ip_bind, 551 .bind = l2tp_ip_bind,
532 .connect = l2tp_ip_connect, 552 .connect = l2tp_ip_connect,
533 .disconnect = udp_disconnect, 553 .disconnect = l2tp_ip_disconnect,
534 .ioctl = udp_ioctl, 554 .ioctl = udp_ioctl,
535 .destroy = l2tp_ip_destroy_sock, 555 .destroy = l2tp_ip_destroy_sock,
536 .setsockopt = ip_setsockopt, 556 .setsockopt = ip_setsockopt,
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 0291d8d85f30..35e1e4bde587 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -258,6 +258,10 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
258 int addr_type; 258 int addr_type;
259 int err; 259 int err;
260 260
261 if (!sock_flag(sk, SOCK_ZAPPED))
262 return -EINVAL;
263 if (addr->l2tp_family != AF_INET6)
264 return -EINVAL;
261 if (addr_len < sizeof(*addr)) 265 if (addr_len < sizeof(*addr))
262 return -EINVAL; 266 return -EINVAL;
263 267
@@ -331,6 +335,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
331 sk_del_node_init(sk); 335 sk_del_node_init(sk);
332 write_unlock_bh(&l2tp_ip6_lock); 336 write_unlock_bh(&l2tp_ip6_lock);
333 337
338 sock_reset_flag(sk, SOCK_ZAPPED);
334 release_sock(sk); 339 release_sock(sk);
335 return 0; 340 return 0;
336 341
@@ -354,6 +359,9 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr,
354 int addr_type; 359 int addr_type;
355 int rc; 360 int rc;
356 361
362 if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
363 return -EINVAL;
364
357 if (addr_len < sizeof(*lsa)) 365 if (addr_len < sizeof(*lsa))
358 return -EINVAL; 366 return -EINVAL;
359 367
@@ -383,6 +391,14 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr,
383 return rc; 391 return rc;
384} 392}
385 393
394static int l2tp_ip6_disconnect(struct sock *sk, int flags)
395{
396 if (sock_flag(sk, SOCK_ZAPPED))
397 return 0;
398
399 return udp_disconnect(sk, flags);
400}
401
386static int l2tp_ip6_getname(struct socket *sock, struct sockaddr *uaddr, 402static int l2tp_ip6_getname(struct socket *sock, struct sockaddr *uaddr,
387 int *uaddr_len, int peer) 403 int *uaddr_len, int peer)
388{ 404{
@@ -689,7 +705,7 @@ static struct proto l2tp_ip6_prot = {
689 .close = l2tp_ip6_close, 705 .close = l2tp_ip6_close,
690 .bind = l2tp_ip6_bind, 706 .bind = l2tp_ip6_bind,
691 .connect = l2tp_ip6_connect, 707 .connect = l2tp_ip6_connect,
692 .disconnect = udp_disconnect, 708 .disconnect = l2tp_ip6_disconnect,
693 .ioctl = udp_ioctl, 709 .ioctl = udp_ioctl,
694 .destroy = l2tp_ip6_destroy_sock, 710 .destroy = l2tp_ip6_destroy_sock,
695 .setsockopt = ipv6_setsockopt, 711 .setsockopt = ipv6_setsockopt,
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 8577264378fe..ddc553e76671 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -923,5 +923,4 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
923MODULE_DESCRIPTION("L2TP netlink"); 923MODULE_DESCRIPTION("L2TP netlink");
924MODULE_LICENSE("GPL"); 924MODULE_LICENSE("GPL");
925MODULE_VERSION("1.0"); 925MODULE_VERSION("1.0");
926MODULE_ALIAS("net-pf-" __stringify(PF_NETLINK) "-proto-" \ 926MODULE_ALIAS_GENL_FAMILY("l2tp");
927 __stringify(NETLINK_GENERIC) "-type-" "l2tp");
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index b3b3c264ff66..04c306308987 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1522,6 +1522,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
1522 * anymore. The timeout will be reset if the frame is ACKed by 1522 * anymore. The timeout will be reset if the frame is ACKed by
1523 * the AP. 1523 * the AP.
1524 */ 1524 */
1525 ifmgd->probe_send_count++;
1526
1525 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1527 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
1526 ifmgd->nullfunc_failed = false; 1528 ifmgd->nullfunc_failed = false;
1527 ieee80211_send_nullfunc(sdata->local, sdata, 0); 1529 ieee80211_send_nullfunc(sdata->local, sdata, 0);
@@ -1538,7 +1540,6 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
1538 0, (u32) -1, true, false); 1540 0, (u32) -1, true, false);
1539 } 1541 }
1540 1542
1541 ifmgd->probe_send_count++;
1542 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); 1543 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms);
1543 run_again(ifmgd, ifmgd->probe_timeout); 1544 run_again(ifmgd, ifmgd->probe_timeout);
1544 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 1545 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 5f827a6b0d8d..847215bb2a6f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -153,7 +153,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
153 153
154 /* Don't calculate ACKs for QoS Frames with NoAck Policy set */ 154 /* Don't calculate ACKs for QoS Frames with NoAck Policy set */
155 if (ieee80211_is_data_qos(hdr->frame_control) && 155 if (ieee80211_is_data_qos(hdr->frame_control) &&
156 *(ieee80211_get_qos_ctl(hdr)) | IEEE80211_QOS_CTL_ACK_POLICY_NOACK) 156 *(ieee80211_get_qos_ctl(hdr)) & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
157 dur = 0; 157 dur = 0;
158 else 158 else
159 /* Time needed to transmit ACK 159 /* Time needed to transmit ACK
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 22f2216b397e..a44c6807df01 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1371,6 +1371,12 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1371 } 1371 }
1372 } 1372 }
1373 1373
1374 /* add back keys */
1375 list_for_each_entry(sdata, &local->interfaces, list)
1376 if (ieee80211_sdata_running(sdata))
1377 ieee80211_enable_keys(sdata);
1378
1379 wake_up:
1374 /* 1380 /*
1375 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation 1381 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation
1376 * sessions can be established after a resume. 1382 * sessions can be established after a resume.
@@ -1392,12 +1398,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1392 mutex_unlock(&local->sta_mtx); 1398 mutex_unlock(&local->sta_mtx);
1393 } 1399 }
1394 1400
1395 /* add back keys */
1396 list_for_each_entry(sdata, &local->interfaces, list)
1397 if (ieee80211_sdata_running(sdata))
1398 ieee80211_enable_keys(sdata);
1399
1400 wake_up:
1401 ieee80211_wake_queues_by_reason(hw, 1401 ieee80211_wake_queues_by_reason(hw,
1402 IEEE80211_QUEUE_STOP_REASON_SUSPEND); 1402 IEEE80211_QUEUE_STOP_REASON_SUSPEND);
1403 1403
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 8340ace837f2..2cc7c1ee7690 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -836,7 +836,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
836#ifdef CONFIG_MODULES 836#ifdef CONFIG_MODULES
837 if (res == NULL) { 837 if (res == NULL) {
838 genl_unlock(); 838 genl_unlock();
839 request_module("net-pf-%d-proto-%d-type-%s", 839 request_module("net-pf-%d-proto-%d-family-%s",
840 PF_NETLINK, NETLINK_GENERIC, name); 840 PF_NETLINK, NETLINK_GENERIC, name);
841 genl_lock(); 841 genl_lock();
842 res = genl_family_find_byname(name); 842 res = genl_family_find_byname(name);
diff --git a/net/rds/ib.h b/net/rds/ib.h
index edfaaaf164eb..8d2b3d5a7c21 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -186,8 +186,7 @@ struct rds_ib_device {
186 struct work_struct free_work; 186 struct work_struct free_work;
187}; 187};
188 188
189#define pcidev_to_node(pcidev) pcibus_to_node(pcidev->bus) 189#define ibdev_to_node(ibdev) dev_to_node(ibdev->dma_device)
190#define ibdev_to_node(ibdev) pcidev_to_node(to_pci_dev(ibdev->dma_device))
191#define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev) 190#define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev)
192 191
193/* bits for i_ack_flags */ 192/* bits for i_ack_flags */
diff --git a/net/wanrouter/Kconfig b/net/wanrouter/Kconfig
index 61ceae0b9566..a157a2e64e18 100644
--- a/net/wanrouter/Kconfig
+++ b/net/wanrouter/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5config WAN_ROUTER 5config WAN_ROUTER
6 tristate "WAN router" 6 tristate "WAN router (DEPRECATED)"
7 depends on EXPERIMENTAL 7 depends on EXPERIMENTAL
8 ---help--- 8 ---help---
9 Wide Area Networks (WANs), such as X.25, frame relay and leased 9 Wide Area Networks (WANs), such as X.25, frame relay and leased
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index c53e8f42aa75..ccfbd328a69d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1921,6 +1921,9 @@ no_transform:
1921 } 1921 }
1922ok: 1922ok:
1923 xfrm_pols_put(pols, drop_pols); 1923 xfrm_pols_put(pols, drop_pols);
1924 if (dst && dst->xfrm &&
1925 dst->xfrm->props.mode == XFRM_MODE_TUNNEL)
1926 dst->flags |= DST_XFRM_TUNNEL;
1924 return dst; 1927 return dst;
1925 1928
1926nopol: 1929nopol: