Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorDavid S. Miller <davem@davemloft.net>
Wed, 2 Dec 2009 06:13:38 +0000 (22:13 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Dec 2009 06:13:38 +0000 (22:13 -0800)
Conflicts:
net/mac80211/ht.c

16 files changed:
1  2 
MAINTAINERS
drivers/net/e100.c
drivers/net/r8169.c
drivers/net/smc91x.c
drivers/net/smsc9420.c
drivers/net/wan/cosa.c
drivers/net/wireless/iwlwifi/iwl-tx.c
include/net/mac80211.h
net/ipv4/ip_fragment.c
net/ipv4/ip_output.c
net/ipv4/tcp.c
net/mac80211/agg-rx.c
net/mac80211/agg-tx.c
net/mac80211/ht.c
net/mac80211/ieee80211_i.h
net/xfrm/xfrm_algo.c

diff --combined MAINTAINERS
@@@ -512,10 -512,32 +512,32 @@@ W:      http://www.arm.linux.org.uk
  S:    Maintained
  F:    arch/arm/
  
+ ARM PRIMECELL AACI PL041 DRIVER
+ M:    Russell King <linux@arm.linux.org.uk>
+ S:    Maintained
+ F:    sound/arm/aaci.*
+ ARM PRIMECELL CLCD PL110 DRIVER
+ M:    Russell King <linux@arm.linux.org.uk>
+ S:    Maintained
+ F:    drivers/video/amba-clcd.*
+ ARM PRIMECELL KMI PL050 DRIVER
+ M:    Russell King <linux@arm.linux.org.uk>
+ S:    Maintained
+ F:    drivers/input/serio/ambakmi.*
+ F:    include/linux/amba/kmi.h
  ARM PRIMECELL MMCI PL180/1 DRIVER
  S:    Orphan
  F:    drivers/mmc/host/mmci.*
  
+ ARM PRIMECELL BUS SUPPORT
+ M:    Russell King <linux@arm.linux.org.uk>
+ S:    Maintained
+ F:    drivers/amba/
+ F:    include/linux/amba/bus.h
  ARM/ADI ROADRUNNER MACHINE SUPPORT
  M:    Lennert Buytenhek <kernel@wantstofly.org>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -1027,7 -1049,7 +1049,7 @@@ F:      drivers/serial/atmel_serial.
  
  ATMEL LCDFB DRIVER
  M:    Nicolas Ferre <nicolas.ferre@atmel.com>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/atmel_lcdfb.c
  F:    include/video/atmel_lcdc.h
@@@ -1098,6 -1120,7 +1120,6 @@@ F:      include/net/ax25.
  F:    net/ax25/
  
  B43 WIRELESS DRIVER
 -M:    Michael Buesch <mb@bu3sch.de>
  M:    Stefano Brivio <stefano.brivio@polimi.it>
  L:    linux-wireless@vger.kernel.org
  W:    http://linuxwireless.org/en/users/Drivers/b43
@@@ -2112,7 -2135,7 +2134,7 @@@ F:      drivers/net/wan/dlci.
  F:    drivers/net/wan/sdla.c
  
  FRAMEBUFFER LAYER
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  W:    http://linux-fbdev.sourceforge.net/
  S:    Orphan
  F:    Documentation/fb/
@@@ -2135,7 -2158,7 +2157,7 @@@ F:      drivers/i2c/busses/i2c-cpm.
  
  FREESCALE IMX / MXC FRAMEBUFFER DRIVER
  M:    Sascha Hauer <kernel@pengutronix.de>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/plat-mxc/include/mach/imxfb.h
@@@ -2311,6 -2334,13 +2333,13 @@@ T:    git git://git.kernel.org/pub/scm/lin
  S:    Maintained
  F:    drivers/media/video/gspca/finepix.c
  
+ GSPCA GL860 SUBDRIVER
+ M:    Olivier Lorin <o.lorin@laposte.net>
+ L:    linux-media@vger.kernel.org
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+ S:    Maintained
+ F:    drivers/media/video/gspca/gl860/
  GSPCA M5602 SUBDRIVER
  M:    Erik Andren <erik.andren@gmail.com>
  L:    linux-media@vger.kernel.org
@@@ -2532,8 -2562,7 +2561,7 @@@ S:      Maintaine
  F:    Documentation/i2c/
  F:    drivers/i2c/
  F:    include/linux/i2c.h
- F:    include/linux/i2c-dev.h
- F:    include/linux/i2c-id.h
+ F:    include/linux/i2c-*.h
  
  I2C-TINY-USB DRIVER
  M:    Till Harbaum <till@harbaum.org>
@@@ -2634,7 -2663,7 +2662,7 @@@ S:      Supporte
  F:    security/integrity/ima/
  
  IMS TWINTURBO FRAMEBUFFER DRIVER
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Orphan
  F:    drivers/video/imsttfb.c
  
@@@ -2669,14 -2698,14 +2697,14 @@@ F:   drivers/input
  
  INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
  M:    Sylvain Meyer <sylvain.meyer@worldonline.fr>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    Documentation/fb/intelfb.txt
  F:    drivers/video/intelfb/
  
  INTEL 810/815 FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/i810/
  
@@@ -3390,7 -3419,7 +3418,7 @@@ S:      Supporte
  
  MATROX FRAMEBUFFER DRIVER
  M:    Petr Vandrovec <vandrove@vc.cvut.cz>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/matrox/matroxfb_*
  F:    include/linux/matroxfb.h
@@@ -3715,9 -3744,9 +3743,9 @@@ F:      include/linux/if_
  F:    include/linux/*device.h
  
  NETXEN (1/10) GbE SUPPORT
 -M:    Dhananjay Phadke <dhananjay@netxen.com>
 +M:    Amit Kumar Salecha <amit.salecha@qlogic.com>
  L:    netdev@vger.kernel.org
 -W:    http://www.netxen.com
 +W:    http://www.qlogic.com
  S:    Supported
  F:    drivers/net/netxen/
  
@@@ -3777,7 -3806,7 +3805,7 @@@ F:      fs/ntfs
  
  NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/riva/
  F:    drivers/video/nvidia/
@@@ -3812,7 -3841,7 +3840,7 @@@ F:      sound/soc/omap
  
  OMAP FRAMEBUFFER SUPPORT
  M:    Imre Deak <imre.deak@nokia.com>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  L:    linux-omap@vger.kernel.org
  S:    Maintained
  F:    drivers/video/omap/
@@@ -4318,14 -4347,14 +4346,14 @@@ F:   include/linux/qnxtypes.
  
  RADEON FRAMEBUFFER DISPLAY DRIVER
  M:    Benjamin Herrenschmidt <benh@kernel.crashing.org>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/aty/radeon*
  F:    include/linux/radeonfb.h
  
  RAGE128 FRAMEBUFFER DISPLAY DRIVER
  M:    Paul Mackerras <paulus@samba.org>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/aty/aty128fb.c
  
@@@ -4464,7 -4493,7 +4492,7 @@@ F:      drivers/net/wireless/rtl818x/rtl8187
  
  S3 SAVAGE FRAMEBUFFER DRIVER
  M:    Antonino Daplas <adaplas@gmail.com>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/savage/
  
@@@ -5627,7 -5656,7 +5655,7 @@@ S:      Maintaine
  
  UVESAFB DRIVER
  M:    Michal Januszewski <spock@gentoo.org>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  W:    http://dev.gentoo.org/~spock/projects/uvesafb/
  S:    Maintained
  F:    Documentation/fb/uvesafb.txt
@@@ -5660,7 -5689,7 +5688,7 @@@ F:      drivers/mmc/host/via-sdmmc.
  VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER
  M:    Joseph Chan <JosephChan@via.com.tw>
  M:    Scott Fang <ScottFang@viatech.com.cn>
- L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+ L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/via/
  
diff --combined drivers/net/e100.c
  #include <linux/init.h>
  #include <linux/pci.h>
  #include <linux/dma-mapping.h>
+ #include <linux/dmapool.h>
  #include <linux/netdevice.h>
  #include <linux/etherdevice.h>
  #include <linux/mii.h>
@@@ -602,6 -603,7 +603,7 @@@ struct nic 
        struct mem *mem;
        dma_addr_t dma_addr;
  
+       struct pci_pool *cbs_pool;
        dma_addr_t cbs_dma_addr;
        u8 adaptive_ifs;
        u8 tx_threshold;
        u16 eeprom_wc;
        __le16 eeprom[256];
        spinlock_t mdio_lock;
 +      const struct firmware *fw;
  };
  
  static inline void e100_write_flush(struct nic *nic)
@@@ -1224,9 -1225,9 +1226,9 @@@ static void e100_configure(struct nic *
  static const struct firmware *e100_request_firmware(struct nic *nic)
  {
        const char *fw_name;
 -      const struct firmware *fw;
 +      const struct firmware *fw = nic->fw;
        u8 timer, bundle, min_size;
 -      int err;
 +      int err = 0;
  
        /* do not load u-code for ICH devices */
        if (nic->flags & ich)
        else /* No ucode on other devices */
                return NULL;
  
 -      err = request_firmware(&fw, fw_name, &nic->pdev->dev);
 +      /* If the firmware has not previously been loaded, request a pointer
 +       * to it. If it was previously loaded, we are reinitializing the
 +       * adapter, possibly in a resume from hibernate, in which case
 +       * request_firmware() cannot be used.
 +       */
 +      if (!fw)
 +              err = request_firmware(&fw, fw_name, &nic->pdev->dev);
 +
        if (err) {
                DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n",
                        fw_name, err);
                return ERR_PTR(err);
        }
 +
        /* Firmware should be precisely UCODE_SIZE (words) plus three bytes
           indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */
        if (fw->size != UCODE_SIZE * 4 + 3) {
                release_firmware(fw);
                return ERR_PTR(-EINVAL);
        }
 -      /* OK, firmware is validated and ready to use... */
 +
 +      /* OK, firmware is validated and ready to use. Save a pointer
 +       * to it in the nic */
 +      nic->fw = fw;
        return fw;
  }
  
@@@ -1805,9 -1795,7 +1807,7 @@@ static void e100_clean_cbs(struct nic *
                        nic->cb_to_clean = nic->cb_to_clean->next;
                        nic->cbs_avail++;
                }
-               pci_free_consistent(nic->pdev,
-                       sizeof(struct cb) * nic->params.cbs.count,
-                       nic->cbs, nic->cbs_dma_addr);
+               pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
                nic->cbs = NULL;
                nic->cbs_avail = 0;
        }
@@@ -1825,8 -1813,8 +1825,8 @@@ static int e100_alloc_cbs(struct nic *n
        nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL;
        nic->cbs_avail = 0;
  
-       nic->cbs = pci_alloc_consistent(nic->pdev,
-               sizeof(struct cb) * count, &nic->cbs_dma_addr);
+       nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL,
+                                 &nic->cbs_dma_addr);
        if (!nic->cbs)
                return -ENOMEM;
  
@@@ -1864,10 -1852,11 +1864,10 @@@ static inline void e100_start_receiver(
  #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
  static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
  {
 -      if (!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN)))
 +      if (!(rx->skb = netdev_alloc_skb_ip_align(nic->netdev, RFD_BUF_LEN)))
                return -ENOMEM;
  
 -      /* Align, init, and map the RFD. */
 -      skb_reserve(rx->skb, NET_IP_ALIGN);
 +      /* Init, and map the RFD. */
        skb_copy_to_linear_data(rx->skb, &nic->blank_rfd, sizeof(struct rfd));
        rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
                RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
@@@ -2852,7 -2841,11 +2852,11 @@@ static int __devinit e100_probe(struct 
                DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
                goto err_out_free;
        }
+       nic->cbs_pool = pci_pool_create(netdev->name,
+                          nic->pdev,
+                          nic->params.cbs.count * sizeof(struct cb),
+                          sizeof(u32),
+                          0);
        DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n",
                (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
                pdev->irq, netdev->dev_addr);
@@@ -2882,6 -2875,7 +2886,7 @@@ static void __devexit e100_remove(struc
                unregister_netdev(netdev);
                e100_free(nic);
                pci_iounmap(pdev, nic->csr);
+               pci_pool_destroy(nic->cbs_pool);
                free_netdev(netdev);
                pci_release_regions(pdev);
                pci_disable_device(pdev);
diff --combined drivers/net/r8169.c
@@@ -794,7 -794,7 +794,7 @@@ static int rtl8169_set_wol(struct net_d
        struct rtl8169_private *tp = netdev_priv(dev);
        void __iomem *ioaddr = tp->mmio_addr;
        unsigned int i;
 -      static struct {
 +      static const struct {
                u32 opt;
                u16 reg;
                u8  mask;
@@@ -1277,7 -1277,7 +1277,7 @@@ static void rtl8169_get_mac_version(str
         *
         * (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec
         */
 -      const struct {
 +      static const struct {
                u32 mask;
                u32 val;
                int mac_version;
@@@ -1351,7 -1351,7 +1351,7 @@@ struct phy_reg 
        u16 val;
  };
  
 -static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len)
 +static void rtl_phy_write(void __iomem *ioaddr, const struct phy_reg *regs, int len)
  {
        while (len-- > 0) {
                mdio_write(ioaddr, regs->reg, regs->val);
  
  static void rtl8169s_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x06, 0x006e },
                { 0x08, 0x0708 },
  
  static void rtl8169sb_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0002 },
                { 0x01, 0x90d0 },
                { 0x1f, 0x0000 }
@@@ -1457,7 -1457,7 +1457,7 @@@ static void rtl8169scd_hw_phy_config_qu
  static void rtl8169scd_hw_phy_config(struct rtl8169_private *tp,
                                     void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x04, 0x0000 },
                { 0x03, 0x00a1 },
  
  static void rtl8169sce_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x04, 0x0000 },
                { 0x03, 0x00a1 },
  
  static void rtl8168bb_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x10, 0xf41b },
                { 0x1f, 0x0000 }
        };
  
  static void rtl8168bef_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x10, 0xf41b },
                { 0x1f, 0x0000 }
  
  static void rtl8168cp_1_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0000 },
                { 0x1d, 0x0f00 },
                { 0x1f, 0x0002 },
  
  static void rtl8168cp_2_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x1d, 0x3d98 },
                { 0x1f, 0x0000 }
  
  static void rtl8168c_1_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x12, 0x2300 },
                { 0x1f, 0x0002 },
  
  static void rtl8168c_2_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x12, 0x2300 },
                { 0x03, 0x802f },
  
  static void rtl8168c_3_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0001 },
                { 0x12, 0x2300 },
                { 0x1d, 0x3d98 },
@@@ -1693,7 -1693,7 +1693,7 @@@ static void rtl8168c_4_hw_phy_config(vo
  
  static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr)
  {
 -      static struct phy_reg phy_reg_init_0[] = {
 +      static const struct phy_reg phy_reg_init_0[] = {
                { 0x1f, 0x0001 },
                { 0x06, 0x4064 },
                { 0x07, 0x2863 },
                { 0x1a, 0x05ad },
                { 0x14, 0x94c0 }
        };
 -      static struct phy_reg phy_reg_init_1[] = {
 +      static const struct phy_reg phy_reg_init_1[] = {
                { 0x1f, 0x0002 },
                { 0x06, 0x5561 },
                { 0x1f, 0x0005 },
                { 0x05, 0x8332 },
                { 0x06, 0x5561 }
        };
 -      static struct phy_reg phy_reg_init_2[] = {
 +      static const struct phy_reg phy_reg_init_2[] = {
                { 0x1f, 0x0005 },
                { 0x05, 0xffc2 },
                { 0x1f, 0x0005 },
        rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1));
  
        if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) {
 -              struct phy_reg phy_reg_init[] = {
 +              static const struct phy_reg phy_reg_init[] = {
                        { 0x1f, 0x0002 },
                        { 0x05, 0x669a },
                        { 0x1f, 0x0005 },
                val = mdio_read(ioaddr, 0x0d);
  
                if ((val & 0x00ff) != 0x006c) {
 -                      u32 set[] = {
 +                      static const u32 set[] = {
                                0x0065, 0x0066, 0x0067, 0x0068,
                                0x0069, 0x006a, 0x006b, 0x006c
                        };
                                mdio_write(ioaddr, 0x0d, val | set[i]);
                }
        } else {
 -              struct phy_reg phy_reg_init[] = {
 +              static const struct phy_reg phy_reg_init[] = {
                        { 0x1f, 0x0002 },
                        { 0x05, 0x6662 },
                        { 0x1f, 0x0005 },
  
  static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr)
  {
 -      static struct phy_reg phy_reg_init_0[] = {
 +      static const struct phy_reg phy_reg_init_0[] = {
                { 0x1f, 0x0001 },
                { 0x06, 0x4064 },
                { 0x07, 0x2863 },
                { 0x05, 0x8332 },
                { 0x06, 0x5561 }
        };
 -      static struct phy_reg phy_reg_init_1[] = {
 +      static const struct phy_reg phy_reg_init_1[] = {
                { 0x1f, 0x0005 },
                { 0x05, 0xffc2 },
                { 0x1f, 0x0005 },
        rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
  
        if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) {
 -              struct phy_reg phy_reg_init[] = {
 +              static const struct phy_reg phy_reg_init[] = {
                        { 0x1f, 0x0002 },
                        { 0x05, 0x669a },
                        { 0x1f, 0x0005 },
                                mdio_write(ioaddr, 0x0d, val | set[i]);
                }
        } else {
 -              struct phy_reg phy_reg_init[] = {
 +              static const struct phy_reg phy_reg_init[] = {
                        { 0x1f, 0x0002 },
                        { 0x05, 0x2642 },
                        { 0x1f, 0x0005 },
  
  static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0002 },
                { 0x10, 0x0008 },
                { 0x0d, 0x006c },
  
  static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
  {
 -      struct phy_reg phy_reg_init[] = {
 +      static const struct phy_reg phy_reg_init[] = {
                { 0x1f, 0x0003 },
                { 0x08, 0x441d },
                { 0x01, 0x9100 },
@@@ -3235,6 -3235,10 +3235,10 @@@ static void __devexit rtl8169_remove_on
        flush_scheduled_work();
  
        unregister_netdev(dev);
+       /* restore original MAC address */
+       rtl_rar_set(tp, dev->perm_addr);
        rtl_disable_msi(pdev, tp);
        rtl8169_release_board(pdev, dev, tp->mmio_addr);
        pci_set_drvdata(pdev, NULL);
@@@ -3384,7 -3388,7 +3388,7 @@@ static void rtl_set_rx_max_size(void __
  
  static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
  {
 -      struct {
 +      static const struct {
                u32 mac_version;
                u32 clk;
                u32 val;
@@@ -3508,7 -3512,7 +3512,7 @@@ struct ephy_info 
        u16 bits;
  };
  
 -static void rtl_ephy_init(void __iomem *ioaddr, struct ephy_info *e, int len)
 +static void rtl_ephy_init(void __iomem *ioaddr, const struct ephy_info *e, int len)
  {
        u16 w;
  
@@@ -3579,7 -3583,7 +3583,7 @@@ static void __rtl_hw_start_8168cp(void 
  
  static void rtl_hw_start_8168cp_1(void __iomem *ioaddr, struct pci_dev *pdev)
  {
 -      static struct ephy_info e_info_8168cp[] = {
 +      static const struct ephy_info e_info_8168cp[] = {
                { 0x01, 0,      0x0001 },
                { 0x02, 0x0800, 0x1000 },
                { 0x03, 0,      0x0042 },
@@@ -3623,7 -3627,7 +3627,7 @@@ static void rtl_hw_start_8168cp_3(void 
  
  static void rtl_hw_start_8168c_1(void __iomem *ioaddr, struct pci_dev *pdev)
  {
 -      static struct ephy_info e_info_8168c_1[] = {
 +      static const struct ephy_info e_info_8168c_1[] = {
                { 0x02, 0x0800, 0x1000 },
                { 0x03, 0,      0x0002 },
                { 0x06, 0x0080, 0x0000 }
  
  static void rtl_hw_start_8168c_2(void __iomem *ioaddr, struct pci_dev *pdev)
  {
 -      static struct ephy_info e_info_8168c_2[] = {
 +      static const struct ephy_info e_info_8168c_2[] = {
                { 0x01, 0,      0x0001 },
                { 0x03, 0x0400, 0x0220 }
        };
@@@ -3783,7 -3787,7 +3787,7 @@@ static void rtl_hw_start_8168(struct ne
  
  static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev)
  {
 -      static struct ephy_info e_info_8102e_1[] = {
 +      static const struct ephy_info e_info_8102e_1[] = {
                { 0x01, 0, 0x6e65 },
                { 0x02, 0, 0x091f },
                { 0x03, 0, 0xc2f9 },
@@@ -4443,12 -4447,13 +4447,12 @@@ static inline bool rtl8169_try_rx_copy(
        if (pkt_size >= rx_copybreak)
                goto out;
  
 -      skb = netdev_alloc_skb(tp->dev, pkt_size + NET_IP_ALIGN);
 +      skb = netdev_alloc_skb_ip_align(tp->dev, pkt_size);
        if (!skb)
                goto out;
  
        pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size,
                                    PCI_DMA_FROMDEVICE);
 -      skb_reserve(skb, NET_IP_ALIGN);
        skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size);
        *sk_buff = skb;
        done = true;
@@@ -4880,6 -4885,9 +4884,9 @@@ static void rtl_shutdown(struct pci_de
  
        rtl8169_net_suspend(dev);
  
+       /* restore original MAC address */
+       rtl_rar_set(tp, dev->perm_addr);
        spin_lock_irq(&tp->lock);
  
        rtl8169_asic_down(ioaddr);
diff --combined drivers/net/smc91x.c
@@@ -2031,7 -2031,7 +2031,7 @@@ static int __devinit smc_probe(struct n
        }
  
        /* Grab the IRQ */
 -      retval = request_irq(dev->irq, &smc_interrupt, irq_flags, dev->name, dev);
 +      retval = request_irq(dev->irq, smc_interrupt, irq_flags, dev->name, dev);
                if (retval)
                        goto err_out;
  
@@@ -2283,7 -2283,7 +2283,7 @@@ static int __devinit smc_drv_probe(stru
  
        ndev->irq = ires->start;
  
-       if (ires->flags & IRQF_TRIGGER_MASK)
+       if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK)
                irq_flags = ires->flags & IRQF_TRIGGER_MASK;
  
        ret = smc_request_attrib(pdev, ndev);
@@@ -2365,10 -2365,9 +2365,10 @@@ static int __devexit smc_drv_remove(str
        return 0;
  }
  
 -static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
 +static int smc_drv_suspend(struct device *dev)
  {
 -      struct net_device *ndev = platform_get_drvdata(dev);
 +      struct platform_device *pdev = to_platform_device(dev);
 +      struct net_device *ndev = platform_get_drvdata(pdev);
  
        if (ndev) {
                if (netif_running(ndev)) {
        return 0;
  }
  
 -static int smc_drv_resume(struct platform_device *dev)
 +static int smc_drv_resume(struct device *dev)
  {
 -      struct net_device *ndev = platform_get_drvdata(dev);
 +      struct platform_device *pdev = to_platform_device(dev);
 +      struct net_device *ndev = platform_get_drvdata(pdev);
  
        if (ndev) {
                struct smc_local *lp = netdev_priv(ndev);
        return 0;
  }
  
 +static struct dev_pm_ops smc_drv_pm_ops = {
 +      .suspend        = smc_drv_suspend,
 +      .resume         = smc_drv_resume,
 +};
 +
  static struct platform_driver smc_driver = {
        .probe          = smc_drv_probe,
        .remove         = __devexit_p(smc_drv_remove),
        .driver         = {
                .name   = CARDNAME,
                .owner  = THIS_MODULE,
 +              .pm     = &smc_drv_pm_ops,
        },
  };
  
diff --combined drivers/net/smsc9420.c
@@@ -252,6 -252,9 +252,9 @@@ static int smsc9420_ethtool_get_setting
  {
        struct smsc9420_pdata *pd = netdev_priv(dev);
  
+       if (!pd->phy_dev)
+               return -ENODEV;
        cmd->maxtxpkt = 1;
        cmd->maxrxpkt = 1;
        return phy_ethtool_gset(pd->phy_dev, cmd);
@@@ -262,6 -265,9 +265,9 @@@ static int smsc9420_ethtool_set_setting
  {
        struct smsc9420_pdata *pd = netdev_priv(dev);
  
+       if (!pd->phy_dev)
+               return -ENODEV;
        return phy_ethtool_sset(pd->phy_dev, cmd);
  }
  
@@@ -290,6 -296,10 +296,10 @@@ static void smsc9420_ethtool_set_msglev
  static int smsc9420_ethtool_nway_reset(struct net_device *netdev)
  {
        struct smsc9420_pdata *pd = netdev_priv(netdev);
+       if (!pd->phy_dev)
+               return -ENODEV;
        return phy_start_aneg(pd->phy_dev);
  }
  
@@@ -312,6 -322,10 +322,10 @@@ smsc9420_ethtool_getregs(struct net_dev
        for (i = 0; i < 0x100; i += (sizeof(u32)))
                data[j++] = smsc9420_reg_read(pd, i);
  
+       // cannot read phy registers if the net device is down
+       if (!phy_dev)
+               return;
        for (i = 0; i <= 31; i++)
                data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i);
  }
@@@ -1161,7 -1175,7 +1175,7 @@@ static int smsc9420_mii_probe(struct ne
                phydev->phy_id);
  
        phydev = phy_connect(dev, dev_name(&phydev->dev),
 -              &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII);
 +              smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII);
  
        if (IS_ERR(phydev)) {
                pr_err("%s: Could not attach to PHY\n", dev->name);
diff --combined drivers/net/wan/cosa.c
@@@ -297,8 -297,8 +297,8 @@@ static ssize_t cosa_write(struct file *
  static unsigned int cosa_poll(struct file *file, poll_table *poll);
  static int cosa_open(struct inode *inode, struct file *file);
  static int cosa_release(struct inode *inode, struct file *file);
 -static int cosa_chardev_ioctl(struct inode *inode, struct file *file,
 -      unsigned int cmd, unsigned long arg);
 +static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
 +                              unsigned long arg);
  #ifdef COSA_FASYNC_WORKING
  static int cosa_fasync(struct inode *inode, struct file *file, int on);
  #endif
@@@ -309,7 -309,7 +309,7 @@@ static const struct file_operations cos
        .read           = cosa_read,
        .write          = cosa_write,
        .poll           = cosa_poll,
 -      .ioctl          = cosa_chardev_ioctl,
 +      .unlocked_ioctl = cosa_chardev_ioctl,
        .open           = cosa_open,
        .release        = cosa_release,
  #ifdef COSA_FASYNC_WORKING
@@@ -907,6 -907,7 +907,7 @@@ static ssize_t cosa_write(struct file *
                        current->state = TASK_RUNNING;
                        chan->tx_status = 1;
                        spin_unlock_irqrestore(&cosa->lock, flags);
+                       up(&chan->wsem);
                        return -ERESTARTSYS;
                }
        }
@@@ -1204,18 -1205,12 +1205,18 @@@ static int cosa_net_ioctl(struct net_de
        return hdlc_ioctl(dev, ifr, cmd);
  }
  
 -static int cosa_chardev_ioctl(struct inode *inode, struct file *file,
 -      unsigned int cmd, unsigned long arg)
 +static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
 +                                                      unsigned long arg)
  {
        struct channel_data *channel = file->private_data;
 -      struct cosa_data *cosa = channel->cosa;
 -      return cosa_ioctl_common(cosa, channel, cmd, arg);
 +      struct cosa_data *cosa;
 +      long ret;
 +
 +      lock_kernel();
 +      cosa = channel->cosa;
 +      ret = cosa_ioctl_common(cosa, channel, cmd, arg);
 +      unlock_kernel();
 +      return ret;
  }
  
  \f
@@@ -97,8 -97,7 +97,8 @@@ int iwl_txq_update_write_ptr(struct iwl
                reg = iwl_read32(priv, CSR_UCODE_DRV_GP1);
  
                if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
 -                      IWL_DEBUG_INFO(priv, "Requesting wakeup, GP1 = 0x%x\n", reg);
 +                      IWL_DEBUG_INFO(priv, "Tx queue %d requesting wakeup, GP1 = 0x%x\n",
 +                                    txq_id, reg);
                        iwl_set_bit(priv, CSR_GP_CNTRL,
                                    CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
                        return ret;
@@@ -133,7 -132,7 +133,7 @@@ void iwl_tx_queue_free(struct iwl_priv 
        struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct iwl_queue *q = &txq->q;
        struct pci_dev *dev = priv->pci_dev;
 -      int i, len;
 +      int i;
  
        if (q->n_bd == 0)
                return;
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
                priv->cfg->ops->lib->txq_free_tfd(priv, txq);
  
 -      len = sizeof(struct iwl_device_cmd) * q->n_window;
 -
        /* De-alloc array of command/tx buffers */
        for (i = 0; i < TFD_TX_CMD_SLOTS; i++)
                kfree(txq->cmd[i]);
@@@ -180,11 -181,14 +180,11 @@@ void iwl_cmd_queue_free(struct iwl_pri
        struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
        struct iwl_queue *q = &txq->q;
        struct pci_dev *dev = priv->pci_dev;
 -      int i, len;
 +      int i;
  
        if (q->n_bd == 0)
                return;
  
 -      len = sizeof(struct iwl_device_cmd) * q->n_window;
 -      len += IWL_MAX_SCAN_SIZE;
 -
        /* De-alloc array of command/tx buffers */
        for (i = 0; i <= TFD_CMD_SLOTS; i++)
                kfree(txq->cmd[i]);
@@@ -366,13 -370,8 +366,13 @@@ int iwl_tx_queue_init(struct iwl_priv *
  
        txq->need_update = 0;
  
 -      /* aggregation TX queues will get their ID when aggregation begins */
 -      if (txq_id <= IWL_TX_FIFO_AC3)
 +      /*
 +       * Aggregation TX queues will get their ID when aggregation begins;
 +       * they overwrite the setting done here. The command FIFO doesn't
 +       * need an swq_id so don't set one to catch errors, all others can
 +       * be set up to the identity mapping.
 +       */
 +      if (txq_id != IWL_CMD_QUEUE_NUM)
                txq->swq_id = txq_id;
  
        /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
@@@ -407,19 -406,15 +407,19 @@@ void iwl_hw_txq_ctx_free(struct iwl_pri
        int txq_id;
  
        /* Tx queues */
 -      for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++)
 -              if (txq_id == IWL_CMD_QUEUE_NUM)
 -                      iwl_cmd_queue_free(priv);
 -              else
 -                      iwl_tx_queue_free(priv, txq_id);
 -
 +      if (priv->txq)
 +              for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
 +                   txq_id++)
 +                      if (txq_id == IWL_CMD_QUEUE_NUM)
 +                              iwl_cmd_queue_free(priv);
 +                      else
 +                              iwl_tx_queue_free(priv, txq_id);
        iwl_free_dma_ptr(priv, &priv->kw);
  
        iwl_free_dma_ptr(priv, &priv->scd_bc_tbls);
 +
 +      /* free tx queue structure */
 +      iwl_free_txq_mem(priv);
  }
  EXPORT_SYMBOL(iwl_hw_txq_ctx_free);
  
@@@ -451,12 -446,6 +451,12 @@@ int iwl_txq_ctx_reset(struct iwl_priv *
                IWL_ERR(priv, "Keep Warm allocation failed\n");
                goto error_kw;
        }
 +
 +      /* allocate tx queue structure */
 +      ret = iwl_alloc_txq_mem(priv);
 +      if (ret)
 +              goto error;
 +
        spin_lock_irqsave(&priv->lock, flags);
  
        /* Turn off all Tx DMA fifos */
@@@ -593,7 -582,9 +593,7 @@@ static void iwl_tx_cmd_build_rate(struc
        u8 rate_plcp;
  
        /* Set retry limit on DATA packets and Probe Responses*/
 -      if (priv->data_retry_limit != -1)
 -              data_retry_limit = priv->data_retry_limit;
 -      else if (ieee80211_is_probe_resp(fc))
 +      if (ieee80211_is_probe_resp(fc))
                data_retry_limit = 3;
        else
                data_retry_limit = IWL_DEFAULT_TX_RETRY;
@@@ -710,8 -701,6 +710,8 @@@ int iwl_tx_skb(struct iwl_priv *priv, s
  {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 +      struct ieee80211_sta *sta = info->control.sta;
 +      struct iwl_station_priv *sta_priv = NULL;
        struct iwl_tx_queue *txq;
        struct iwl_queue *q;
        struct iwl_device_cmd *out_cmd;
        dma_addr_t phys_addr;
        dma_addr_t txcmd_phys;
        dma_addr_t scratch_phys;
 -      u16 len, len_org;
 +      u16 len, len_org, firstlen, secondlen;
        u16 seq_number = 0;
        __le16 fc;
        u8 hdr_len;
  
        IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
  
 +      if (sta)
 +              sta_priv = (void *)sta->drv_priv;
 +
 +      if (sta_priv && sta_id != priv->hw_params.bcast_sta_id &&
 +          sta_priv->asleep) {
 +              WARN_ON(!(info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE));
 +              /*
 +               * This sends an asynchronous command to the device,
 +               * but we can rely on it being processed before the
 +               * next frame is processed -- and the next frame to
 +               * this station is the one that will consume this
 +               * counter.
 +               * For now set the counter to just 1 since we do not
 +               * support uAPSD yet.
 +               */
 +              iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
 +      }
 +
        txq_id = skb_get_queue_mapping(skb);
        if (ieee80211_is_data_qos(fc)) {
                qc = ieee80211_get_qos_ctl(hdr);
                sizeof(struct iwl_cmd_header) + hdr_len;
  
        len_org = len;
 -      len = (len + 3) & ~3;
 +      firstlen = len = (len + 3) & ~3;
  
        if (len_org != len)
                len_org = 1;
  
        /* Set up TFD's 2nd entry to point directly to remainder of skb,
         * if any (802.11 null frames have no payload). */
 -      len = skb->len - hdr_len;
 +      secondlen = len = skb->len - hdr_len;
        if (len) {
                phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
                                           len, PCI_DMA_TODEVICE);
        pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
                                       len, PCI_DMA_BIDIRECTIONAL);
  
 +      trace_iwlwifi_dev_tx(priv,
 +                           &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr],
 +                           sizeof(struct iwl_tfd),
 +                           &out_cmd->hdr, firstlen,
 +                           skb->data + hdr_len, secondlen);
 +
        /* Tell device the write index *just past* this latest filled TFD */
        q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
        ret = iwl_txq_update_write_ptr(priv, txq);
        spin_unlock_irqrestore(&priv->lock, flags);
  
 +      /*
 +       * At this point the frame is "transmitted" successfully
 +       * and we will get a TX status notification eventually,
 +       * regardless of the value of ret. "ret" only indicates
 +       * whether or not we should update the write pointer.
 +       */
 +
 +      /* avoid atomic ops if it isn't an associated client */
 +      if (sta_priv && sta_priv->client)
 +              atomic_inc(&sta_priv->pending_frames);
 +
        if (ret)
                return ret;
  
@@@ -1016,20 -970,13 +1016,20 @@@ int iwl_enqueue_hcmd(struct iwl_priv *p
        BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
               !(cmd->flags & CMD_SIZE_HUGE));
  
 -      if (iwl_is_rfkill(priv)) {
 -              IWL_DEBUG_INFO(priv, "Not sending command - RF KILL\n");
 +      if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
 +              IWL_WARN(priv, "Not sending command - %s KILL\n",
 +                       iwl_is_rfkill(priv) ? "RF" : "CT");
                return -EIO;
        }
  
        if (iwl_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
 -              IWL_ERR(priv, "No space for Tx\n");
 +              IWL_ERR(priv, "No space in command queue\n");
 +              if (iwl_within_ct_kill_margin(priv))
 +                      iwl_tt_enter_ct_kill(priv);
 +              else {
 +                      IWL_ERR(priv, "Restarting adapter due to queue full\n");
 +                      queue_work(priv->workqueue, &priv->restart);
 +              }
                return -ENOSPC;
        }
  
        pci_unmap_addr_set(out_meta, mapping, phys_addr);
        pci_unmap_len_set(out_meta, len, fix_size);
  
 +      trace_iwlwifi_dev_hcmd(priv, &out_cmd->hdr, fix_size, cmd->flags);
 +
        priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
                                                   phys_addr, fix_size, 1,
                                                   U32_PAD(cmd->len));
        return ret ? ret : idx;
  }
  
 +static void iwl_tx_status(struct iwl_priv *priv, struct sk_buff *skb)
 +{
 +      struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 +      struct ieee80211_sta *sta;
 +      struct iwl_station_priv *sta_priv;
 +
 +      sta = ieee80211_find_sta(priv->vif, hdr->addr1);
 +      if (sta) {
 +              sta_priv = (void *)sta->drv_priv;
 +              /* avoid atomic ops if this isn't a client */
 +              if (sta_priv->client &&
 +                  atomic_dec_return(&sta_priv->pending_frames) == 0)
 +                      ieee80211_sta_block_awake(priv->hw, sta, false);
 +      }
 +
 +      ieee80211_tx_status_irqsafe(priv->hw, skb);
 +}
 +
  int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
  {
        struct iwl_tx_queue *txq = &priv->txq[txq_id];
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
  
                tx_info = &txq->txb[txq->q.read_ptr];
 -              ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]);
 +              iwl_tx_status(priv, tx_info->skb[0]);
                tx_info->skb[0] = NULL;
  
                if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
@@@ -1178,6 -1105,11 +1178,6 @@@ static void iwl_hcmd_queue_reclaim(stru
                return;
        }
  
 -      pci_unmap_single(priv->pci_dev,
 -              pci_unmap_addr(&txq->meta[cmd_idx], mapping),
 -              pci_unmap_len(&txq->meta[cmd_idx], len),
 -              PCI_DMA_BIDIRECTIONAL);
 -
        for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
  
   */
  void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
  {
 -      struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
 +      struct iwl_rx_packet *pkt = rxb_addr(rxb);
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
        cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
        meta = &priv->txq[IWL_CMD_QUEUE_NUM].meta[cmd_index];
  
 +      pci_unmap_single(priv->pci_dev,
 +                       pci_unmap_addr(meta, mapping),
 +                       pci_unmap_len(meta, len),
 +                       PCI_DMA_BIDIRECTIONAL);
 +
        /* Input error checking is done when commands are added to queue. */
        if (meta->flags & CMD_WANT_SKB) {
 -              meta->source->reply_skb = rxb->skb;
 -              rxb->skb = NULL;
 +              meta->source->reply_page = (unsigned long)rxb_addr(rxb);
 +              rxb->page = NULL;
        } else if (meta->callback)
 -              meta->callback(priv, cmd, rxb->skb);
 +              meta->callback(priv, cmd, pkt);
  
        iwl_hcmd_queue_reclaim(priv, txq_id, index, cmd_index);
  
@@@ -1313,7 -1240,7 +1313,7 @@@ int iwl_tx_agg_start(struct iwl_priv *p
        if (tid_data->tfds_in_queue == 0) {
                IWL_DEBUG_HT(priv, "HW queue is empty\n");
                tid_data->agg.state = IWL_AGG_ON;
 -              ieee80211_start_tx_ba_cb_irqsafe(priv->hw, ra, tid);
 +              ieee80211_start_tx_ba_cb_irqsafe(priv->vif, ra, tid);
        } else {
                IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n",
                             tid_data->tfds_in_queue);
@@@ -1350,8 -1277,16 +1350,16 @@@ int iwl_tx_agg_stop(struct iwl_priv *pr
                return -ENXIO;
        }
  
+       if (priv->stations[sta_id].tid[tid].agg.state ==
+                               IWL_EMPTYING_HW_QUEUE_ADDBA) {
+               IWL_DEBUG_HT(priv, "AGG stop before setup done\n");
+               ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid);
+               priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
+               return 0;
+       }
        if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
-               IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
+               IWL_WARN(priv, "Stopping AGG while state not ON or starting\n");
  
        tid_data = &priv->stations[sta_id].tid[tid];
        ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
        if (ret)
                return ret;
  
 -      ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid);
 +      ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, ra, tid);
  
        return 0;
  }
@@@ -1402,7 -1337,7 +1410,7 @@@ int iwl_txq_check_empty(struct iwl_pri
                        priv->cfg->ops->lib->txq_agg_disable(priv, txq_id,
                                                             ssn, tx_fifo);
                        tid_data->agg.state = IWL_AGG_OFF;
 -                      ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, addr, tid);
 +                      ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, addr, tid);
                }
                break;
        case IWL_EMPTYING_HW_QUEUE_ADDBA:
                if (tid_data->tfds_in_queue == 0) {
                        IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n");
                        tid_data->agg.state = IWL_AGG_ON;
 -                      ieee80211_start_tx_ba_cb_irqsafe(priv->hw, addr, tid);
 +                      ieee80211_start_tx_ba_cb_irqsafe(priv->vif, addr, tid);
                }
                break;
        }
@@@ -1474,7 -1409,7 +1482,7 @@@ static int iwl_tx_status_reply_compress
  
        info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb[0]);
        memset(&info->status, 0, sizeof(info->status));
 -      info->flags = IEEE80211_TX_STAT_ACK;
 +      info->flags |= IEEE80211_TX_STAT_ACK;
        info->flags |= IEEE80211_TX_STAT_AMPDU;
        info->status.ampdu_ack_map = successes;
        info->status.ampdu_ack_len = agg->frame_count;
  void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
                                           struct iwl_rx_mem_buffer *rxb)
  {
 -      struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
 +      struct iwl_rx_packet *pkt = rxb_addr(rxb);
        struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
        struct iwl_tx_queue *txq = NULL;
        struct iwl_ht_agg *agg;
diff --combined include/net/mac80211.h
@@@ -219,7 -219,7 +219,7 @@@ struct ieee80211_bss_conf 
   *
   * These flags are used with the @flags member of &ieee80211_tx_info.
   *
 - * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
 + * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
   * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
   *    number to this frame, taking care of not overwriting the fragment
   *    number and increasing the sequence number only when the
@@@ -390,12 -390,10 +390,12 @@@ struct ieee80211_tx_rate 
   * @control: union for control data
   * @status: union for status data
   * @driver_data: array of driver_data pointers
 - * @ampdu_ack_len: number of aggregated frames.
 + * @ampdu_ack_len: number of acked aggregated frames.
   *    relevant only if IEEE80211_TX_STATUS_AMPDU was set.
   * @ampdu_ack_map: block ack bit map for the aggregation.
   *    relevant only if IEEE80211_TX_STATUS_AMPDU was set.
 + * @ampdu_len: number of aggregated frames.
 + *    relevant only if IEEE80211_TX_STATUS_AMPDU was set.
   * @ack_signal: signal strength of the ACK frame
   */
  struct ieee80211_tx_info {
                        u8 ampdu_ack_len;
                        u64 ampdu_ack_map;
                        int ack_signal;
 -                      /* 8 bytes free */
 +                      u8 ampdu_len;
 +                      /* 7 bytes free */
                } status;
                struct {
                        struct ieee80211_tx_rate driver_rates[
@@@ -497,6 -494,7 +497,6 @@@ ieee80211_tx_info_clear_status(struct i
   * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
   *    Use together with %RX_FLAG_MMIC_STRIPPED.
   * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
 - * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header.
   * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
   *    verification has been done by the hardware.
   * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame.
  enum mac80211_rx_flags {
        RX_FLAG_MMIC_ERROR      = 1<<0,
        RX_FLAG_DECRYPTED       = 1<<1,
 -      RX_FLAG_RADIOTAP        = 1<<2,
        RX_FLAG_MMIC_STRIPPED   = 1<<3,
        RX_FLAG_IV_STRIPPED     = 1<<4,
        RX_FLAG_FAILED_FCS_CRC  = 1<<5,
@@@ -555,7 -554,7 +555,7 @@@ struct ieee80211_rx_status 
        int freq;
        int signal;
        int noise;
 -      int qual;
 +      int __deprecated qual;
        int antenna;
        int rate_idx;
        int flag;
   *
   * Flags to define PHY configuration options
   *
 - * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
 + * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
 + *    to determine for example whether to calculate timestamps for packets
 + *    or not, do not use instead of filter flags!
   * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
   * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
   *    the driver should be prepared to handle configuration requests but
   *    it can also be unset in that case when monitor interfaces are active.
   */
  enum ieee80211_conf_flags {
 -      IEEE80211_CONF_RADIOTAP         = (1<<0),
 +      IEEE80211_CONF_MONITOR          = (1<<0),
        IEEE80211_CONF_PS               = (1<<1),
        IEEE80211_CONF_IDLE             = (1<<2),
  };
   * enum ieee80211_conf_changed - denotes which configuration changed
   *
   * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
 - * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
 + * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
   * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
   * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
   * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
   */
  enum ieee80211_conf_changed {
        IEEE80211_CONF_CHANGE_LISTEN_INTERVAL   = BIT(2),
 -      IEEE80211_CONF_CHANGE_RADIOTAP          = BIT(3),
 +      IEEE80211_CONF_CHANGE_MONITOR           = BIT(3),
        IEEE80211_CONF_CHANGE_PS                = BIT(4),
        IEEE80211_CONF_CHANGE_POWER             = BIT(5),
        IEEE80211_CONF_CHANGE_CHANNEL           = BIT(6),
@@@ -855,19 -852,6 +855,19 @@@ enum ieee80211_tkip_key_type 
   * any particular flags. There are some exceptions to this rule,
   * however, so you are advised to review these flags carefully.
   *
 + * @IEEE80211_HW_HAS_RATE_CONTROL:
 + *    The hardware or firmware includes rate control, and cannot be
 + *    controlled by the stack. As such, no rate control algorithm
 + *    should be instantiated, and the TX rate reported to userspace
 + *    will be taken from the TX status instead of the rate control
 + *    algorithm.
 + *    Note that this requires that the driver implement a number of
 + *    callbacks so it has the correct information, it needs to have
 + *    the @set_rts_threshold callback and must look at the BSS config
 + *    @use_cts_prot for G/N protection, @use_short_slot for slot
 + *    timing in 2.4 GHz and @use_short_preamble for preambles for
 + *    CCK frames.
 + *
   * @IEEE80211_HW_RX_INCLUDES_FCS:
   *    Indicates that received frames passed to the stack include
   *    the FCS at the end.
   *    avoid waking up cpu.
   */
  enum ieee80211_hw_flags {
 +      IEEE80211_HW_HAS_RATE_CONTROL                   = 1<<0,
        IEEE80211_HW_RX_INCLUDES_FCS                    = 1<<1,
        IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING        = 1<<2,
        IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE          = 1<<3,
@@@ -1300,6 -1283,12 +1300,12 @@@ enum ieee80211_filter_flags 
   *
   * These flags are used with the ampdu_action() callback in
   * &struct ieee80211_ops to indicate which action is needed.
+  *
+  * Note that drivers MUST be able to deal with a TX aggregation
+  * session being stopped even before they OK'ed starting it by
+  * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer
+  * might receive the addBA frame and send a delBA right away!
+  *
   * @IEEE80211_AMPDU_RX_START: start Rx aggregation
   * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
   * @IEEE80211_AMPDU_TX_START: start Tx aggregation
@@@ -1522,7 -1511,6 +1528,7 @@@ struct ieee80211_ops 
        void (*reset_tsf)(struct ieee80211_hw *hw);
        int (*tx_last_beacon)(struct ieee80211_hw *hw);
        int (*ampdu_action)(struct ieee80211_hw *hw,
 +                          struct ieee80211_vif *vif,
                            enum ieee80211_ampdu_mlme_action action,
                            struct ieee80211_sta *sta, u16 tid, u16 *ssn);
  
@@@ -1679,14 -1667,15 +1685,14 @@@ void ieee80211_restart_hw(struct ieee80
   * ieee80211_rx - receive frame
   *
   * Use this function to hand received frames to mac80211. The receive
 - * buffer in @skb must start with an IEEE 802.11 header or a radiotap
 - * header if %RX_FLAG_RADIOTAP is set in the @status flags.
 + * buffer in @skb must start with an IEEE 802.11 header.
   *
   * This function may not be called in IRQ context. Calls to this function
 - * for a single hardware must be synchronized against each other. Calls
 - * to this function and ieee80211_rx_irqsafe() may not be mixed for a
 - * single hardware.
 + * for a single hardware must be synchronized against each other. Calls to
 + * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
 + * mixed for a single hardware.
   *
 - * Note that right now, this function must be called with softirqs disabled.
 + * In process context use instead ieee80211_rx_ni().
   *
   * @hw: the hardware this frame came in on
   * @skb: the buffer to receive, owned by mac80211 after this call
@@@ -1699,8 -1688,8 +1705,8 @@@ void ieee80211_rx(struct ieee80211_hw *
   * Like ieee80211_rx() but can be called in IRQ context
   * (internally defers to a tasklet.)
   *
 - * Calls to this function and ieee80211_rx() may not be mixed for a
 - * single hardware.
 + * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
 + * be mixed for a single hardware.
   *
   * @hw: the hardware this frame came in on
   * @skb: the buffer to receive, owned by mac80211 after this call
  void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
  
  /**
 + * ieee80211_rx_ni - receive frame (in process context)
 + *
 + * Like ieee80211_rx() but can be called in process context
 + * (internally disables bottom halves).
 + *
 + * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
 + * not be mixed for a single hardware.
 + *
 + * @hw: the hardware this frame came in on
 + * @skb: the buffer to receive, owned by mac80211 after this call
 + */
 +static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
 +                                 struct sk_buff *skb)
 +{
 +      local_bh_disable();
 +      ieee80211_rx(hw, skb);
 +      local_bh_enable();
 +}
 +
 +/**
   * ieee80211_tx_status - transmit status callback
   *
   * Call this function for all transmitted frames after they have been
@@@ -1761,45 -1730,19 +1767,45 @@@ void ieee80211_tx_status_irqsafe(struc
                                 struct sk_buff *skb);
  
  /**
 - * ieee80211_beacon_get - beacon generation function
 + * ieee80211_beacon_get_tim - beacon generation function
   * @hw: pointer obtained from ieee80211_alloc_hw().
   * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
 + * @tim_offset: pointer to variable that will receive the TIM IE offset.
 + *    Set to 0 if invalid (in non-AP modes).
 + * @tim_length: pointer to variable that will receive the TIM IE length,
 + *    (including the ID and length bytes!).
 + *    Set to 0 if invalid (in non-AP modes).
 + *
 + * If the driver implements beaconing modes, it must use this function to
 + * obtain the beacon frame/template.
   *
   * If the beacon frames are generated by the host system (i.e., not in
 - * hardware/firmware), the low-level driver uses this function to receive
 - * the next beacon frame from the 802.11 code. The low-level is responsible
 - * for calling this function before beacon data is needed (e.g., based on
 - * hardware interrupt). Returned skb is used only once and low-level driver
 - * is responsible for freeing it.
 + * hardware/firmware), the driver uses this function to get each beacon
 + * frame from mac80211 -- it is responsible for calling this function
 + * before the beacon is needed (e.g. based on hardware interrupt).
 + *
 + * If the beacon frames are generated by the device, then the driver
 + * must use the returned beacon as the template and change the TIM IE
 + * according to the current DTIM parameters/TIM bitmap.
 + *
 + * The driver is responsible for freeing the returned skb.
   */
 -struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
 -                                   struct ieee80211_vif *vif);
 +struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 +                                       struct ieee80211_vif *vif,
 +                                       u16 *tim_offset, u16 *tim_length);
 +
 +/**
 + * ieee80211_beacon_get - beacon generation function
 + * @hw: pointer obtained from ieee80211_alloc_hw().
 + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
 + *
 + * See ieee80211_beacon_get_tim().
 + */
 +static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
 +                                                 struct ieee80211_vif *vif)
 +{
 +      return ieee80211_beacon_get_tim(hw, vif, NULL, NULL);
 +}
  
  /**
   * ieee80211_rts_get - RTS frame generation function
@@@ -2044,7 -1987,8 +2050,7 @@@ void ieee80211_queue_delayed_work(struc
  
  /**
   * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 - * @ra: receiver address of the BA session recipient
 + * @sta: the station for which to start a BA session
   * @tid: the TID to BA on.
   *
   * Return: success if addBA request was sent, failure otherwise
   * the need to start aggregation on a certain RA/TID, the session level
   * will be managed by the mac80211.
   */
 -int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid);
 +int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
  
  /**
   * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf
   * @ra: receiver address of the BA session recipient.
   * @tid: the TID to BA on.
   *
   * This function must be called by low level driver once it has
   * finished with preparations for the BA session.
   */
 -void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid);
 +void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
  
  /**
   * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf
   * @ra: receiver address of the BA session recipient.
   * @tid: the TID to BA on.
   *
   * finished with preparations for the BA session.
   * This version of the function is IRQ-safe.
   */
 -void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
 +void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
                                      u16 tid);
  
  /**
   * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 - * @ra: receiver address of the BA session recipient
 + * @sta: the station whose BA session to stop
   * @tid: the TID to stop BA.
   * @initiator: if indicates initiator DELBA frame will be sent.
   *
   * the need to stop aggregation on a certain RA/TID, the session level
   * will be managed by the mac80211.
   */
 -int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
 -                               u8 *ra, u16 tid,
 +int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
                                 enum ieee80211_back_parties initiator);
  
  /**
   * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf
   * @ra: receiver address of the BA session recipient.
   * @tid: the desired TID to BA on.
   *
   * This function must be called by low level driver once it has
   * finished with preparations for the BA session tear down.
   */
 -void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid);
 +void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
  
  /**
   * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
 - * @hw: pointer as obtained from ieee80211_alloc_hw().
 + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf
   * @ra: receiver address of the BA session recipient.
   * @tid: the desired TID to BA on.
   *
   * finished with preparations for the BA session tear down.
   * This version of the function is IRQ-safe.
   */
 -void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
 +void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
                                     u16 tid);
  
  /**
   * ieee80211_find_sta - find a station
   *
 - * @hw: pointer as obtained from ieee80211_alloc_hw()
 + * @vif: virtual interface to look for station on
   * @addr: station's address
   *
   * This function must be called under RCU lock and the
   * resulting pointer is only valid under RCU lock as well.
   */
 -struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
 +struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
                                         const u8 *addr);
  
  /**
 + * ieee80211_find_sta_by_hw - find a station on hardware
 + *
 + * @hw: pointer as obtained from ieee80211_alloc_hw()
 + * @addr: station's address
 + *
 + * This function must be called under RCU lock and the
 + * resulting pointer is only valid under RCU lock as well.
 + *
 + * NOTE: This function should not be used! When mac80211 is converted
 + *     internally to properly keep track of stations on multiple
 + *     virtual interfaces, it will not always know which station to
 + *     return here since a single address might be used by multiple
 + *     logical stations (e.g. consider a station connecting to another
 + *     BSSID on the same AP hardware without disconnecting first).
 + *
 + * DO NOT USE THIS FUNCTION.
 + */
 +struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
 +                                             const u8 *addr);
 +
 +/**
 + * ieee80211_sta_block_awake - block station from waking up
 + * @hw: the hardware
 + * @pubsta: the station
 + * @block: whether to block or unblock
 + *
 + * Some devices require that all frames that are on the queues
 + * for a specific station that went to sleep are flushed before
 + * a poll response or frames after the station woke up can be
 + * delivered to that it. Note that such frames must be rejected
 + * by the driver as filtered, with the appropriate status flag.
 + *
 + * This function allows implementing this mode in a race-free
 + * manner.
 + *
 + * To do this, a driver must keep track of the number of frames
 + * still enqueued for a specific station. If this number is not
 + * zero when the station goes to sleep, the driver must call
 + * this function to force mac80211 to consider the station to
 + * be asleep regardless of the station's actual state. Once the
 + * number of outstanding frames reaches zero, the driver must
 + * call this function again to unblock the station. That will
 + * cause mac80211 to be able to send ps-poll responses, and if
 + * the station queried in the meantime then frames will also
 + * be sent out as a result of this. Additionally, the driver
 + * will be notified that the station woke up some time after
 + * it is unblocked, regardless of whether the station actually
 + * woke up while blocked or not.
 + */
 +void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
 +                             struct ieee80211_sta *pubsta, bool block);
 +
 +/**
   * ieee80211_beacon_loss - inform hardware does not receive beacons
   *
   * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
diff --combined net/ipv4/ip_fragment.c
@@@ -206,11 -206,10 +206,11 @@@ static void ip_expire(unsigned long arg
                struct sk_buff *head = qp->q.fragments;
  
                /* Send an ICMP "Fragment Reassembly Timeout" message. */
 -              if ((head->dev = dev_get_by_index(net, qp->iif)) != NULL) {
 +              rcu_read_lock();
 +              head->dev = dev_get_by_index_rcu(net, qp->iif);
 +              if (head->dev)
                        icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
 -                      dev_put(head->dev);
 -              }
 +              rcu_read_unlock();
        }
  out:
        spin_unlock(&qp->q.lock);
@@@ -564,7 -563,7 +564,7 @@@ out_oversize
                printk(KERN_INFO "Oversized IP packet from %pI4.\n",
                        &qp->saddr);
  out_fail:
-       IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS);
+       IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
        return err;
  }
  
@@@ -658,7 -657,7 +658,7 @@@ static int ip4_frags_ns_ctl_register(st
        struct ctl_table_header *hdr;
  
        table = ip4_frags_ns_ctl_table;
 -      if (net != &init_net) {
 +      if (!net_eq(net, &init_net)) {
                table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
                if (table == NULL)
                        goto err_alloc;
        return 0;
  
  err_reg:
 -      if (net != &init_net)
 +      if (!net_eq(net, &init_net))
                kfree(table);
  err_alloc:
        return -ENOMEM;
diff --combined net/ipv4/ip_output.c
@@@ -264,11 -264,9 +264,11 @@@ int ip_mc_output(struct sk_buff *skb
  
                   This check is duplicated in ip_mr_input at the moment.
                 */
 -                  && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED))
 +                  &&
 +                  ((rt->rt_flags & RTCF_LOCAL) ||
 +                   !(IPCB(skb)->flags & IPSKB_FORWARDED))
  #endif
 -              ) {
 +                 ) {
                        struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
                        if (newskb)
                                NF_HOOK(PF_INET, NF_INET_POST_ROUTING, newskb,
@@@ -331,7 -329,7 +331,7 @@@ int ip_queue_xmit(struct sk_buff *skb, 
                __be32 daddr;
  
                /* Use correct destination address if we have options. */
 -              daddr = inet->daddr;
 +              daddr = inet->inet_daddr;
                if(opt && opt->srr)
                        daddr = opt->faddr;
  
                                            .mark = sk->sk_mark,
                                            .nl_u = { .ip4_u =
                                                      { .daddr = daddr,
 -                                                      .saddr = inet->saddr,
 +                                                      .saddr = inet->inet_saddr,
                                                        .tos = RT_CONN_FLAGS(sk) } },
                                            .proto = sk->sk_protocol,
                                            .flags = inet_sk_flowi_flags(sk),
                                            .uli_u = { .ports =
 -                                                     { .sport = inet->sport,
 -                                                       .dport = inet->dport } } };
 +                                                     { .sport = inet->inet_sport,
 +                                                       .dport = inet->inet_dport } } };
  
                        /* If this fails, retransmit mechanism of transport layer will
                         * keep trying until route appears or the connection times
@@@ -381,7 -379,7 +381,7 @@@ packet_routed
  
        if (opt && opt->optlen) {
                iph->ihl += opt->optlen >> 2;
 -              ip_options_build(skb, opt, inet->daddr, rt, 0);
 +              ip_options_build(skb, opt, inet->inet_daddr, rt, 0);
        }
  
        ip_select_ident_more(iph, &rt->u.dst, sk,
@@@ -503,8 -501,8 +503,8 @@@ int ip_fragment(struct sk_buff *skb, in
                        if (skb->sk) {
                                frag->sk = skb->sk;
                                frag->destructor = sock_wfree;
-                               truesizes += frag->truesize;
                        }
+                       truesizes += frag->truesize;
                }
  
                /* Everything is OK. Generate! */
@@@ -848,8 -846,7 +848,8 @@@ int ip_append_data(struct sock *sk
        maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen;
  
        if (inet->cork.length + length > 0xFFFF - fragheaderlen) {
 -              ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->dport, mtu-exthdrlen);
 +              ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport,
 +                             mtu-exthdrlen);
                return -EMSGSIZE;
        }
  
@@@ -1103,7 -1100,7 +1103,7 @@@ ssize_t ip_append_page(struct sock *sk
        maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen;
  
        if (inet->cork.length + size > 0xFFFF - fragheaderlen) {
 -              ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->dport, mtu);
 +              ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, mtu);
                return -EMSGSIZE;
        }
  
diff --combined net/ipv4/tcp.c
@@@ -2042,7 -2042,7 +2042,7 @@@ int tcp_disconnect(struct sock *sk, in
        __skb_queue_purge(&sk->sk_async_wait_queue);
  #endif
  
 -      inet->dport = 0;
 +      inet->inet_dport = 0;
  
        if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
                inet_reset_saddr(sk);
        tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
        tp->snd_cwnd_cnt = 0;
        tp->bytes_acked = 0;
+       tp->window_clamp = 0;
        tcp_set_ca_state(sk, TCP_CA_Open);
        tcp_clear_retrans(tp);
        inet_csk_delack_init(sk);
        memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
        __sk_dst_reset(sk);
  
 -      WARN_ON(inet->num && !icsk->icsk_bind_hash);
 +      WARN_ON(inet->inet_num && !icsk->icsk_bind_hash);
  
        sk->sk_error_report(sk);
        return err;
@@@ -2903,10 -2904,11 +2904,10 @@@ void __init tcp_init(void
                                        (totalram_pages >= 128 * 1024) ?
                                        13 : 15,
                                        0,
 -                                      &tcp_hashinfo.ehash_size,
                                        NULL,
 +                                      &tcp_hashinfo.ehash_mask,
                                        thash_entries ? 0 : 512 * 1024);
 -      tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size;
 -      for (i = 0; i < tcp_hashinfo.ehash_size; i++) {
 +      for (i = 0; i <= tcp_hashinfo.ehash_mask; i++) {
                INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i);
                INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].twchain, i);
        }
        tcp_hashinfo.bhash =
                alloc_large_system_hash("TCP bind",
                                        sizeof(struct inet_bind_hashbucket),
 -                                      tcp_hashinfo.ehash_size,
 +                                      tcp_hashinfo.ehash_mask + 1,
                                        (totalram_pages >= 128 * 1024) ?
                                        13 : 15,
                                        0,
        sysctl_tcp_rmem[2] = max(87380, max_share);
  
        printk(KERN_INFO "TCP: Hash tables configured "
 -             "(established %d bind %d)\n",
 -             tcp_hashinfo.ehash_size, tcp_hashinfo.bhash_size);
 +             "(established %u bind %u)\n",
 +             tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size);
  
        tcp_register_congestion_control(&tcp_reno);
  }
diff --combined net/mac80211/agg-rx.c
@@@ -41,8 -41,7 +41,8 @@@ void __ieee80211_stop_rx_ba_session(str
               sta->sta.addr, tid);
  #endif /* CONFIG_MAC80211_HT_DEBUG */
  
 -      if (drv_ampdu_action(local, IEEE80211_AMPDU_RX_STOP,
 +      if (drv_ampdu_action(local, &sta->sdata->vif,
 +                           IEEE80211_AMPDU_RX_STOP,
                             &sta->sta, tid, NULL))
                printk(KERN_DEBUG "HW problem - can not stop rx "
                                "aggregation for tid %d\n", tid);
@@@ -86,10 -85,6 +86,6 @@@ void ieee80211_sta_stop_rx_ba_session(s
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
  
-       /* stop HW Rx aggregation. ampdu_action existence
-        * already verified in session init so we add the BUG_ON */
-       BUG_ON(!local->ops->ampdu_action);
        rcu_read_lock();
  
        sta = sta_info_get(local, ra);
@@@ -171,7 -166,7 +167,7 @@@ static void ieee80211_send_addba_resp(s
        mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout);
        mgmt->u.action.u.addba_resp.status = cpu_to_le16(status);
  
 -      ieee80211_tx_skb(sdata, skb, 1);
 +      ieee80211_tx_skb(sdata, skb);
  }
  
  void ieee80211_process_addba_request(struct ieee80211_local *local,
         * check if configuration can support the BA policy
         * and if buffer size does not exceeds max value */
        /* XXX: check own ht delayed BA capability?? */
 -      if (((ba_policy != 1)
 -              && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA)))
 -              || (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
 +      if (((ba_policy != 1) &&
 +           (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) ||
 +          (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
                status = WLAN_STATUS_INVALID_QOS_PARAM;
  #ifdef CONFIG_MAC80211_HT_DEBUG
                if (net_ratelimit())
                goto end;
        }
  
 -      ret = drv_ampdu_action(local, IEEE80211_AMPDU_RX_START,
 +      ret = drv_ampdu_action(local, &sta->sdata->vif,
 +                             IEEE80211_AMPDU_RX_START,
                               &sta->sta, tid, &start_seq_num);
  #ifdef CONFIG_MAC80211_HT_DEBUG
        printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret);
diff --combined net/mac80211/agg-tx.c
@@@ -91,7 -91,7 +91,7 @@@ static void ieee80211_send_addba_reques
        mgmt->u.action.u.addba_req.start_seq_num =
                                        cpu_to_le16(start_seq_num << 4);
  
 -      ieee80211_tx_skb(sdata, skb, 1);
 +      ieee80211_tx_skb(sdata, skb);
  }
  
  void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn)
        bar->control = cpu_to_le16(bar_control);
        bar->start_seq_num = cpu_to_le16(ssn);
  
 -      ieee80211_tx_skb(sdata, skb, 0);
 +      IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 +      ieee80211_tx_skb(sdata, skb);
  }
  
static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
-                                          enum ieee80211_back_parties initiator)
+ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+                                   enum ieee80211_back_parties initiator)
  {
        struct ieee80211_local *local = sta->local;
        int ret;
        u8 *state;
  
+ #ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
+              sta->sta.addr, tid);
+ #endif /* CONFIG_MAC80211_HT_DEBUG */
        state = &sta->ampdu_mlme.tid_state_tx[tid];
  
        if (*state == HT_AGG_STATE_OPERATIONAL)
        *state = HT_AGG_STATE_REQ_STOP_BA_MSK |
                (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
  
 -      ret = drv_ampdu_action(local, IEEE80211_AMPDU_TX_STOP,
 +      ret = drv_ampdu_action(local, &sta->sdata->vif,
 +                             IEEE80211_AMPDU_TX_STOP,
                               &sta->sta, tid, NULL);
  
        /* HW shall not deny going back to legacy */
        if (WARN_ON(ret)) {
-               *state = HT_AGG_STATE_OPERATIONAL;
                /*
                 * We may have pending packets get stuck in this case...
                 * Not bothering with a workaround for now.
@@@ -200,11 -202,11 +204,11 @@@ static inline int ieee80211_ac_from_tid
        return ieee802_1d_to_ac[tid & 7];
  }
  
 -int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
 +int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 -      struct sta_info *sta;
 -      struct ieee80211_sub_if_data *sdata;
 +      struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
 +      struct ieee80211_sub_if_data *sdata = sta->sdata;
 +      struct ieee80211_local *local = sdata->local;
        u8 *state;
        int ret = 0;
        u16 start_seq_num;
        if (WARN_ON(!local->ops->ampdu_action))
                return -EINVAL;
  
 -      if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION))
 +      if ((tid >= STA_TID_NUM) ||
 +          !(local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION))
                return -EINVAL;
  
  #ifdef CONFIG_MAC80211_HT_DEBUG
        printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n",
 -             ra, tid);
 +             pubsta->addr, tid);
  #endif /* CONFIG_MAC80211_HT_DEBUG */
  
 -      rcu_read_lock();
 -
 -      sta = sta_info_get(local, ra);
 -      if (!sta) {
 -#ifdef CONFIG_MAC80211_HT_DEBUG
 -              printk(KERN_DEBUG "Could not find the station\n");
 -#endif
 -              ret = -ENOENT;
 -              goto unlock;
 -      }
 -
        /*
         * The aggregation code is not prepared to handle
         * anything but STA/AP due to the BSSID handling.
         * IBSS could work in the code but isn't supported
         * by drivers or the standard.
         */
 -      if (sta->sdata->vif.type != NL80211_IFTYPE_STATION &&
 -          sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
 -          sta->sdata->vif.type != NL80211_IFTYPE_AP) {
 -              ret = -EINVAL;
 -              goto unlock;
 -      }
 +      if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 +          sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
 +          sdata->vif.type != NL80211_IFTYPE_AP)
 +              return -EINVAL;
  
        if (test_sta_flags(sta, WLAN_STA_SUSPEND)) {
  #ifdef CONFIG_MAC80211_HT_DEBUG
                printk(KERN_DEBUG "Suspend in progress. "
                       "Denying BA session request\n");
  #endif
 -              ret = -EINVAL;
 -              goto unlock;
 +              return -EINVAL;
        }
  
        spin_lock_bh(&sta->lock);
        spin_lock(&local->ampdu_lock);
  
 -      sdata = sta->sdata;
 -
        /* we have tried too many times, receiver does not want A-MPDU */
        if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) {
                ret = -EBUSY;
  
        start_seq_num = sta->tid_seq[tid];
  
 -      ret = drv_ampdu_action(local, IEEE80211_AMPDU_TX_START,
 -                             &sta->sta, tid, &start_seq_num);
 +      ret = drv_ampdu_action(local, &sdata->vif,
 +                             IEEE80211_AMPDU_TX_START,
 +                             pubsta, tid, &start_seq_num);
  
        if (ret) {
  #ifdef CONFIG_MAC80211_HT_DEBUG
                        sta->ampdu_mlme.dialog_token_allocator;
        sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num;
  
 -      ieee80211_send_addba_request(sta->sdata, ra, tid,
 +      ieee80211_send_addba_request(sdata, pubsta->addr, tid,
                         sta->ampdu_mlme.tid_tx[tid]->dialog_token,
                         sta->ampdu_mlme.tid_tx[tid]->ssn,
                         0x40, 5000);
  #ifdef CONFIG_MAC80211_HT_DEBUG
        printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
  #endif
 -      goto unlock;
 +      return 0;
  
   err_free:
        kfree(sta->ampdu_mlme.tid_tx[tid]);
   err_unlock_sta:
        spin_unlock(&local->ampdu_lock);
        spin_unlock_bh(&sta->lock);
 - unlock:
 -      rcu_read_unlock();
        return ret;
  }
  EXPORT_SYMBOL(ieee80211_start_tx_ba_session);
@@@ -416,15 -434,13 +420,15 @@@ static void ieee80211_agg_tx_operationa
        ieee80211_agg_splice_finish(local, sta, tid);
        spin_unlock(&local->ampdu_lock);
  
 -      drv_ampdu_action(local, IEEE80211_AMPDU_TX_OPERATIONAL,
 +      drv_ampdu_action(local, &sta->sdata->vif,
 +                       IEEE80211_AMPDU_TX_OPERATIONAL,
                         &sta->sta, tid, NULL);
  }
  
 -void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
 +void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 +      struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 +      struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
        u8 *state;
  
  }
  EXPORT_SYMBOL(ieee80211_start_tx_ba_cb);
  
 -void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
 +void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
                                      const u8 *ra, u16 tid)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 +      struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 +      struct ieee80211_local *local = sdata->local;
        struct ieee80211_ra_tid *ra_tid;
        struct sk_buff *skb = dev_alloc_skb(0);
  
        ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
        memcpy(&ra_tid->ra, ra, ETH_ALEN);
        ra_tid->tid = tid;
 +      ra_tid->vif = vif;
  
        skb->pkt_type = IEEE80211_ADDBA_MSG;
        skb_queue_tail(&local->skb_queue, skb);
@@@ -515,11 -529,6 +519,6 @@@ int __ieee80211_stop_tx_ba_session(stru
                goto unlock;
        }
  
- #ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
-              sta->sta.addr, tid);
- #endif /* CONFIG_MAC80211_HT_DEBUG */
        ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator);
  
   unlock:
        return ret;
  }
  
 -int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
 -                               u8 *ra, u16 tid,
 +int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
                                 enum ieee80211_back_parties initiator)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 -      struct sta_info *sta;
 -      int ret = 0;
 +      struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
 +      struct ieee80211_sub_if_data *sdata = sta->sdata;
 +      struct ieee80211_local *local = sdata->local;
  
-       if (WARN_ON(!local->ops->ampdu_action))
+       if (!local->ops->ampdu_action)
                return -EINVAL;
  
        if (tid >= STA_TID_NUM)
                return -EINVAL;
  
 -      rcu_read_lock();
 -      sta = sta_info_get(local, ra);
 -      if (!sta) {
 -              rcu_read_unlock();
 -              return -ENOENT;
 -      }
 -
 -      ret = __ieee80211_stop_tx_ba_session(sta, tid, initiator);
 -      rcu_read_unlock();
 -      return ret;
 +      return __ieee80211_stop_tx_ba_session(sta, tid, initiator);
  }
  EXPORT_SYMBOL(ieee80211_stop_tx_ba_session);
  
 -void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
 +void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 +      struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 +      struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
        u8 *state;
  
  }
  EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb);
  
 -void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
 +void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
                                     const u8 *ra, u16 tid)
  {
 -      struct ieee80211_local *local = hw_to_local(hw);
 +      struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 +      struct ieee80211_local *local = sdata->local;
        struct ieee80211_ra_tid *ra_tid;
        struct sk_buff *skb = dev_alloc_skb(0);
  
        ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
        memcpy(&ra_tid->ra, ra, ETH_ALEN);
        ra_tid->tid = tid;
 +      ra_tid->vif = vif;
  
        skb->pkt_type = IEEE80211_DELBA_MSG;
        skb_queue_tail(&local->skb_queue, skb);
diff --combined net/mac80211/ht.c
@@@ -134,7 -134,7 +134,7 @@@ void ieee80211_send_delba(struct ieee80
        mgmt->u.action.u.delba.params = cpu_to_le16(params);
        mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code);
  
 -      ieee80211_tx_skb(sdata, skb, 1);
 +      ieee80211_tx_skb(sdata, skb);
  }
  
  void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
                                                 WLAN_BACK_INITIATOR, 0);
        else { /* WLAN_BACK_RECIPIENT */
                spin_lock_bh(&sta->lock);
-               sta->ampdu_mlme.tid_state_tx[tid] =
-                               HT_AGG_STATE_OPERATIONAL;
+               if (sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK)
+                       ___ieee80211_stop_tx_ba_session(sta, tid,
+                                                       WLAN_BACK_RECIPIENT);
                spin_unlock_bh(&sta->lock);
-               ieee80211_stop_tx_ba_session(&sta->sta, tid,
-                                            WLAN_BACK_RECIPIENT);
        }
  }
@@@ -23,7 -23,6 +23,7 @@@
  #include <linux/types.h>
  #include <linux/spinlock.h>
  #include <linux/etherdevice.h>
 +#include <net/ieee80211_radiotap.h>
  #include <net/cfg80211.h>
  #include <net/mac80211.h>
  #include "key.h"
@@@ -168,12 -167,16 +168,12 @@@ typedef unsigned __bitwise__ ieee80211_
  
  struct ieee80211_rx_data {
        struct sk_buff *skb;
 -      struct net_device *dev;
        struct ieee80211_local *local;
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
        struct ieee80211_key *key;
 -      struct ieee80211_rx_status *status;
 -      struct ieee80211_rate *rate;
  
        unsigned int flags;
 -      int sent_ps_buffered;
        int queue;
        u32 tkip_iv32;
        u16 tkip_iv16;
@@@ -206,9 -209,6 +206,9 @@@ struct ieee80211_if_wds 
  
  struct ieee80211_if_vlan {
        struct list_head list;
 +
 +      /* used for all tx if the VLAN is configured to 4-addr mode */
 +      struct sta_info *sta;
  };
  
  struct mesh_stats {
@@@ -312,8 -312,6 +312,8 @@@ struct ieee80211_if_managed 
        } mfp; /* management frame protection */
  
        int wmm_last_param_set;
 +
 +      u8 use_4addr;
  };
  
  enum ieee80211_ibss_request {
@@@ -355,7 -353,6 +355,7 @@@ struct ieee80211_if_mesh 
        struct work_struct work;
        struct timer_list housekeeping_timer;
        struct timer_list mesh_path_timer;
 +      struct timer_list mesh_path_root_timer;
        struct sk_buff_head skb_queue;
  
        unsigned long timers_running;
        u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
        size_t mesh_id_len;
        /* Active Path Selection Protocol Identifier */
 -      u8 mesh_pp_id[4];
 +      u8 mesh_pp_id;
        /* Active Path Selection Metric Identifier */
 -      u8 mesh_pm_id[4];
 +      u8 mesh_pm_id;
        /* Congestion Control Mode Identifier */
 -      u8 mesh_cc_id[4];
 +      u8 mesh_cc_id;
        /* Synchronization Protocol Identifier */
 -      u8 mesh_sp_id[4];
 +      u8 mesh_sp_id;
        /* Authentication Protocol Identifier */
 -      u8 mesh_auth_id[4];
 -      /* Local mesh Destination Sequence Number */
 -      u32 dsn;
 +      u8 mesh_auth_id;
 +      /* Local mesh Sequence Number */
 +      u32 sn;
        /* Last used PREQ ID */
        u32 preq_id;
        atomic_t mpaths;
 -      /* Timestamp of last DSN update */
 -      unsigned long last_dsn_update;
 -      /* Timestamp of last DSN sent */
 +      /* Timestamp of last SN update */
 +      unsigned long last_sn_update;
 +      /* Timestamp of last SN sent */
        unsigned long last_preq;
        struct mesh_rmc *rmc;
        spinlock_t mesh_preq_queue_lock;
@@@ -474,11 -471,74 +474,11 @@@ struct ieee80211_sub_if_data 
        } u;
  
  #ifdef CONFIG_MAC80211_DEBUGFS
 -      struct dentry *debugfsdir;
 -      union {
 -              struct {
 -                      struct dentry *drop_unencrypted;
 -                      struct dentry *bssid;
 -                      struct dentry *aid;
 -                      struct dentry *capab;
 -                      struct dentry *force_unicast_rateidx;
 -                      struct dentry *max_ratectrl_rateidx;
 -              } sta;
 -              struct {
 -                      struct dentry *drop_unencrypted;
 -                      struct dentry *num_sta_ps;
 -                      struct dentry *dtim_count;
 -                      struct dentry *force_unicast_rateidx;
 -                      struct dentry *max_ratectrl_rateidx;
 -                      struct dentry *num_buffered_multicast;
 -              } ap;
 -              struct {
 -                      struct dentry *drop_unencrypted;
 -                      struct dentry *peer;
 -                      struct dentry *force_unicast_rateidx;
 -                      struct dentry *max_ratectrl_rateidx;
 -              } wds;
 -              struct {
 -                      struct dentry *drop_unencrypted;
 -                      struct dentry *force_unicast_rateidx;
 -                      struct dentry *max_ratectrl_rateidx;
 -              } vlan;
 -              struct {
 -                      struct dentry *mode;
 -              } monitor;
 -      } debugfs;
        struct {
 +              struct dentry *dir;
                struct dentry *default_key;
                struct dentry *default_mgmt_key;
 -      } common_debugfs;
 -
 -#ifdef CONFIG_MAC80211_MESH
 -      struct dentry *mesh_stats_dir;
 -      struct {
 -              struct dentry *fwded_mcast;
 -              struct dentry *fwded_unicast;
 -              struct dentry *fwded_frames;
 -              struct dentry *dropped_frames_ttl;
 -              struct dentry *dropped_frames_no_route;
 -              struct dentry *estab_plinks;
 -              struct timer_list mesh_path_timer;
 -      } mesh_stats;
 -
 -      struct dentry *mesh_config_dir;
 -      struct {
 -              struct dentry *dot11MeshRetryTimeout;
 -              struct dentry *dot11MeshConfirmTimeout;
 -              struct dentry *dot11MeshHoldingTimeout;
 -              struct dentry *dot11MeshMaxRetries;
 -              struct dentry *dot11MeshTTL;
 -              struct dentry *auto_open_plinks;
 -              struct dentry *dot11MeshMaxPeerLinks;
 -              struct dentry *dot11MeshHWMPactivePathTimeout;
 -              struct dentry *dot11MeshHWMPpreqMinInterval;
 -              struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
 -              struct dentry *dot11MeshHWMPmaxPREQretries;
 -              struct dentry *path_refresh_time;
 -              struct dentry *min_discovery_timeout;
 -      } mesh_config;
 -#endif
 -
 +      } debugfs;
  #endif
        /* must be last, dynamically sized area in this! */
        struct ieee80211_vif vif;
@@@ -579,6 -639,7 +579,6 @@@ struct ieee80211_local 
        /* number of interfaces with corresponding FIF_ flags */
        int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll;
        unsigned int filter_flags; /* FIF_* */
 -      struct iw_statistics wstats;
  
        /* protects the aggregated multicast list and filter calls */
        spinlock_t filter_lock;
        unsigned long scanning;
        struct cfg80211_ssid scan_ssid;
        struct cfg80211_scan_request *int_scan_req;
 -      struct cfg80211_scan_request *scan_req;
 +      struct cfg80211_scan_request *scan_req, *hw_scan_req;
        struct ieee80211_channel *scan_channel;
 -      const u8 *orig_ies;
 -      int orig_ies_len;
 +      enum ieee80211_band hw_scan_band;
        int scan_channel_idx;
        int scan_ies_len;
  
  #ifdef CONFIG_MAC80211_DEBUGFS
        struct local_debugfsdentries {
                struct dentry *rcdir;
 -              struct dentry *rcname;
 -              struct dentry *frequency;
 -              struct dentry *total_ps_buffered;
 -              struct dentry *wep_iv;
 -              struct dentry *tsf;
 -              struct dentry *queues;
 -              struct dentry *reset;
 -              struct dentry *noack;
 -              struct dentry *statistics;
 -              struct local_debugfsdentries_statsdentries {
 -                      struct dentry *transmitted_fragment_count;
 -                      struct dentry *multicast_transmitted_frame_count;
 -                      struct dentry *failed_count;
 -                      struct dentry *retry_count;
 -                      struct dentry *multiple_retry_count;
 -                      struct dentry *frame_duplicate_count;
 -                      struct dentry *received_fragment_count;
 -                      struct dentry *multicast_received_frame_count;
 -                      struct dentry *transmitted_frame_count;
 -                      struct dentry *wep_undecryptable_count;
 -                      struct dentry *num_scans;
 -#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
 -                      struct dentry *tx_handlers_drop;
 -                      struct dentry *tx_handlers_queued;
 -                      struct dentry *tx_handlers_drop_unencrypted;
 -                      struct dentry *tx_handlers_drop_fragment;
 -                      struct dentry *tx_handlers_drop_wep;
 -                      struct dentry *tx_handlers_drop_not_assoc;
 -                      struct dentry *tx_handlers_drop_unauth_port;
 -                      struct dentry *rx_handlers_drop;
 -                      struct dentry *rx_handlers_queued;
 -                      struct dentry *rx_handlers_drop_nullfunc;
 -                      struct dentry *rx_handlers_drop_defrag;
 -                      struct dentry *rx_handlers_drop_short;
 -                      struct dentry *rx_handlers_drop_passive_scan;
 -                      struct dentry *tx_expand_skb_head;
 -                      struct dentry *tx_expand_skb_head_cloned;
 -                      struct dentry *rx_expand_skb_head;
 -                      struct dentry *rx_expand_skb_head2;
 -                      struct dentry *rx_handlers_fragments;
 -                      struct dentry *tx_status_drop;
 -#endif
 -                      struct dentry *dot11ACKFailureCount;
 -                      struct dentry *dot11RTSFailureCount;
 -                      struct dentry *dot11FCSErrorCount;
 -                      struct dentry *dot11RTSSuccessCount;
 -              } stats;
                struct dentry *stations;
                struct dentry *keys;
        } debugfs;
@@@ -776,9 -885,8 +776,9 @@@ IEEE80211_DEV_TO_SUB_IF(struct net_devi
        return netdev_priv(dev);
  }
  
 -/* this struct represents 802.11n's RA/TID combination */
 +/* this struct represents 802.11n's RA/TID combination along with our vif */
  struct ieee80211_ra_tid {
 +      struct ieee80211_vif *vif;
        u8 ra[ETH_ALEN];
        u16 tid;
  };
@@@ -805,13 -913,12 +805,13 @@@ struct ieee802_11_elems 
        u8 *wmm_param;
        struct ieee80211_ht_cap *ht_cap_elem;
        struct ieee80211_ht_info *ht_info_elem;
 -      u8 *mesh_config;
 +      struct ieee80211_meshconf_ie *mesh_config;
        u8 *mesh_id;
        u8 *peer_link;
        u8 *preq;
        u8 *prep;
        u8 *perr;
 +      struct ieee80211_rann_ie *rann;
        u8 *ch_switch_elem;
        u8 *country_elem;
        u8 *pwr_constr_elem;
        u8 ext_supp_rates_len;
        u8 wmm_info_len;
        u8 wmm_param_len;
 -      u8 mesh_config_len;
        u8 mesh_id_len;
        u8 peer_link_len;
        u8 preq_len;
@@@ -955,18 -1063,6 +955,18 @@@ netdev_tx_t ieee80211_monitor_start_xmi
  netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
                                       struct net_device *dev);
  
 +/*
 + * radiotap header for status frames
 + */
 +struct ieee80211_tx_status_rtap_hdr {
 +      struct ieee80211_radiotap_header hdr;
 +      u8 rate;
 +      u8 padding_for_rate;
 +      __le16 tx_flags;
 +      u8 data_retries;
 +} __attribute__ ((packed));
 +
 +
  /* HT */
  void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
                                       struct ieee80211_ht_cap *ht_cap_ie,
@@@ -995,6 -1091,8 +995,8 @@@ void ieee80211_process_addba_request(st
  
  int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
                                   enum ieee80211_back_parties initiator);
+ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+                                   enum ieee80211_back_parties initiator);
  
  /* Spectrum management */
  void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
@@@ -1034,7 -1132,8 +1036,7 @@@ void mac80211_ev_michael_mic_failure(st
                                     struct ieee80211_hdr *hdr, const u8 *tsc,
                                     gfp_t gfp);
  void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
 -void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
 -                    int encrypt);
 +void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  void ieee802_11_parse_elems(u8 *start, size_t len,
                            struct ieee802_11_elems *elems);
  u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
@@@ -1071,8 -1170,7 +1073,8 @@@ void ieee80211_send_auth(struct ieee802
                         u8 *extra, size_t extra_len, const u8 *bssid,
                         const u8 *key, u8 key_len, u8 key_idx);
  int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
 -                           const u8 *ie, size_t ie_len);
 +                           const u8 *ie, size_t ie_len,
 +                           enum ieee80211_band band);
  void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                              const u8 *ssid, size_t ssid_len,
                              const u8 *ie, size_t ie_len);
diff --combined net/xfrm/xfrm_algo.c
@@@ -200,40 -200,6 +200,40 @@@ static struct xfrm_algo_desc aalg_list[
        }
  },
  {
 +      .name = "hmac(sha384)",
 +
 +      .uinfo = {
 +              .auth = {
 +                      .icv_truncbits = 192,
 +                      .icv_fullbits = 384,
 +              }
 +      },
 +
 +      .desc = {
 +              .sadb_alg_id = SADB_X_AALG_SHA2_384HMAC,
 +              .sadb_alg_ivlen = 0,
 +              .sadb_alg_minbits = 384,
 +              .sadb_alg_maxbits = 384
 +      }
 +},
 +{
 +      .name = "hmac(sha512)",
 +
 +      .uinfo = {
 +              .auth = {
 +                      .icv_truncbits = 256,
 +                      .icv_fullbits = 512,
 +              }
 +      },
 +
 +      .desc = {
 +              .sadb_alg_id = SADB_X_AALG_SHA2_512HMAC,
 +              .sadb_alg_ivlen = 0,
 +              .sadb_alg_minbits = 512,
 +              .sadb_alg_maxbits = 512
 +      }
 +},
 +{
        .name = "hmac(rmd160)",
        .compat = "rmd160",
  
@@@ -399,6 -365,7 +399,7 @@@ static struct xfrm_algo_desc ealg_list[
  },
  {
        .name = "cbc(camellia)",
+       .compat = "camellia",
  
        .uinfo = {
                .encr = {
@@@ -723,6 -690,84 +724,6 @@@ int xfrm_count_enc_supported(void
  }
  EXPORT_SYMBOL_GPL(xfrm_count_enc_supported);
  
 -/* Move to common area: it is shared with AH. */
 -
 -int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
 -               int offset, int len, icv_update_fn_t icv_update)
 -{
 -      int start = skb_headlen(skb);
 -      int i, copy = start - offset;
 -      struct sk_buff *frag_iter;
 -      struct scatterlist sg;
 -      int err;
 -
 -      /* Checksum header. */
 -      if (copy > 0) {
 -              if (copy > len)
 -                      copy = len;
 -
 -              sg_init_one(&sg, skb->data + offset, copy);
 -
 -              err = icv_update(desc, &sg, copy);
 -              if (unlikely(err))
 -                      return err;
 -
 -              if ((len -= copy) == 0)
 -                      return 0;
 -              offset += copy;
 -      }
 -
 -      for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 -              int end;
 -
 -              WARN_ON(start > offset + len);
 -
 -              end = start + skb_shinfo(skb)->frags[i].size;
 -              if ((copy = end - offset) > 0) {
 -                      skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 -
 -                      if (copy > len)
 -                              copy = len;
 -
 -                      sg_init_table(&sg, 1);
 -                      sg_set_page(&sg, frag->page, copy,
 -                                  frag->page_offset + offset-start);
 -
 -                      err = icv_update(desc, &sg, copy);
 -                      if (unlikely(err))
 -                              return err;
 -
 -                      if (!(len -= copy))
 -                              return 0;
 -                      offset += copy;
 -              }
 -              start = end;
 -      }
 -
 -      skb_walk_frags(skb, frag_iter) {
 -              int end;
 -
 -              WARN_ON(start > offset + len);
 -
 -              end = start + frag_iter->len;
 -              if ((copy = end - offset) > 0) {
 -                      if (copy > len)
 -                              copy = len;
 -                      err = skb_icv_walk(frag_iter, desc, offset-start,
 -                                         copy, icv_update);
 -                      if (unlikely(err))
 -                              return err;
 -                      if ((len -= copy) == 0)
 -                              return 0;
 -                      offset += copy;
 -              }
 -              start = end;
 -      }
 -      BUG_ON(len);
 -      return 0;
 -}
 -EXPORT_SYMBOL_GPL(skb_icv_walk);
 -
  #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
  
  void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)