aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-nomadik.c40
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c1
-rw-r--r--drivers/net/arm/am79c961a.c126
-rw-r--r--drivers/net/arm/ep93xx_eth.c82
-rw-r--r--drivers/net/bonding/bond_main.c11
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/gianfar.c29
-rw-r--r--drivers/net/gianfar.h8
-rw-r--r--drivers/net/gianfar_ethtool.c64
-rw-r--r--drivers/net/igb/igb_main.c3
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c1
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c1
-rw-r--r--drivers/net/smc91x.c6
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c11
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c5
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c30
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h13
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c74
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c24
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c21
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c4
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c30
-rw-r--r--drivers/ssb/driver_pcicore.c10
35 files changed, 336 insertions, 372 deletions
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 4961ef9bc153..2c212c732d76 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 2008,2009 STMicroelectronics 4 * Copyright (C) 2008,2009 STMicroelectronics
5 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> 5 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
6 * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> 6 * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com>
7 * Copyright (C) 2011 Linus Walleij <linus.walleij@linaro.org>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -49,6 +50,7 @@ struct nmk_gpio_chip {
49 u32 (*get_secondary_status)(unsigned int bank); 50 u32 (*get_secondary_status)(unsigned int bank);
50 void (*set_ioforce)(bool enable); 51 void (*set_ioforce)(bool enable);
51 spinlock_t lock; 52 spinlock_t lock;
53 bool sleepmode;
52 /* Keep track of configured edges */ 54 /* Keep track of configured edges */
53 u32 edge_rising; 55 u32 edge_rising;
54 u32 edge_falling; 56 u32 edge_falling;
@@ -393,14 +395,25 @@ EXPORT_SYMBOL(nmk_config_pins_sleep);
393 * @gpio: pin number 395 * @gpio: pin number
394 * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, 396 * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE,
395 * 397 *
396 * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is 398 * This register is actually in the pinmux layer, not the GPIO block itself.
397 * changed to an input (with pullup/down enabled) in sleep and deep sleep. If 399 * The GPIO1B_SLPM register defines the GPIO mode when SLEEP/DEEP-SLEEP
398 * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was 400 * mode is entered (i.e. when signal IOFORCE is HIGH by the platform code).
399 * configured even when in sleep and deep sleep. 401 * Each GPIO can be configured to be forced into GPIO mode when IOFORCE is
402 * HIGH, overriding the normal setting defined by GPIO_AFSELx registers.
403 * When IOFORCE returns LOW (by software, after SLEEP/DEEP-SLEEP exit),
404 * the GPIOs return to the normal setting defined by GPIO_AFSELx registers.
400 * 405 *
401 * On DB8500v2 onwards, this setting loses the previous meaning and instead 406 * If @mode is NMK_GPIO_SLPM_INPUT, the corresponding GPIO is switched to GPIO
402 * indicates if wakeup detection is enabled on the pin. Note that 407 * mode when signal IOFORCE is HIGH (i.e. when SLEEP/DEEP-SLEEP mode is
403 * enable_irq_wake() will automatically enable wakeup detection. 408 * entered) regardless of the altfunction selected. Also wake-up detection is
409 * ENABLED.
410 *
411 * If @mode is NMK_GPIO_SLPM_NOCHANGE, the corresponding GPIO remains
412 * controlled by NMK_GPIO_DATC, NMK_GPIO_DATS, NMK_GPIO_DIR, NMK_GPIO_PDIS
413 * (for altfunction GPIO) or respective on-chip peripherals (for other
414 * altfuncs) when IOFORCE is HIGH. Also wake-up detection DISABLED.
415 *
416 * Note that enable_irq_wake() will automatically enable wakeup detection.
404 */ 417 */
405int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) 418int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode)
406{ 419{
@@ -551,6 +564,12 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
551static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, 564static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip,
552 int gpio, bool on) 565 int gpio, bool on)
553{ 566{
567 if (nmk_chip->sleepmode) {
568 __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base,
569 on ? NMK_GPIO_SLPM_WAKEUP_ENABLE
570 : NMK_GPIO_SLPM_WAKEUP_DISABLE);
571 }
572
554 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); 573 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on);
555} 574}
556 575
@@ -901,7 +920,7 @@ void nmk_gpio_wakeups_suspend(void)
901 writel(chip->fwimsc & chip->real_wake, 920 writel(chip->fwimsc & chip->real_wake,
902 chip->addr + NMK_GPIO_FWIMSC); 921 chip->addr + NMK_GPIO_FWIMSC);
903 922
904 if (cpu_is_u8500v2()) { 923 if (chip->sleepmode) {
905 chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); 924 chip->slpm = readl(chip->addr + NMK_GPIO_SLPC);
906 925
907 /* 0 -> wakeup enable */ 926 /* 0 -> wakeup enable */
@@ -923,7 +942,7 @@ void nmk_gpio_wakeups_resume(void)
923 writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); 942 writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC);
924 writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); 943 writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC);
925 944
926 if (cpu_is_u8500v2()) 945 if (chip->sleepmode)
927 writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); 946 writel(chip->slpm, chip->addr + NMK_GPIO_SLPC);
928 } 947 }
929} 948}
@@ -1010,6 +1029,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
1010 nmk_chip->secondary_parent_irq = secondary_irq; 1029 nmk_chip->secondary_parent_irq = secondary_irq;
1011 nmk_chip->get_secondary_status = pdata->get_secondary_status; 1030 nmk_chip->get_secondary_status = pdata->get_secondary_status;
1012 nmk_chip->set_ioforce = pdata->set_ioforce; 1031 nmk_chip->set_ioforce = pdata->set_ioforce;
1032 nmk_chip->sleepmode = pdata->supports_sleepmode;
1013 spin_lock_init(&nmk_chip->lock); 1033 spin_lock_init(&nmk_chip->lock);
1014 1034
1015 chip = &nmk_chip->chip; 1035 chip = &nmk_chip->chip;
@@ -1065,5 +1085,3 @@ core_initcall(nmk_gpio_init);
1065MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); 1085MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini");
1066MODULE_DESCRIPTION("Nomadik GPIO Driver"); 1086MODULE_DESCRIPTION("Nomadik GPIO Driver");
1067MODULE_LICENSE("GPL"); 1087MODULE_LICENSE("GPL");
1068
1069
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 3ccbff13eaf2..71a8eb6ef71e 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -283,6 +283,7 @@ hfcsusb_ph_info(struct hfcsusb *hw)
283 _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, 283 _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY,
284 sizeof(struct ph_info_dch) + dch->dev.nrbchan * 284 sizeof(struct ph_info_dch) + dch->dev.nrbchan *
285 sizeof(struct ph_info_ch), phi, GFP_ATOMIC); 285 sizeof(struct ph_info_ch), phi, GFP_ATOMIC);
286 kfree(phi);
286} 287}
287 288
288/* 289/*
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 0c9217f48b72..7b3e23f38913 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -50,7 +50,7 @@ static const char version[] =
50#ifdef __arm__ 50#ifdef __arm__
51static void write_rreg(u_long base, u_int reg, u_int val) 51static void write_rreg(u_long base, u_int reg, u_int val)
52{ 52{
53 __asm__( 53 asm volatile(
54 "str%?h %1, [%2] @ NET_RAP\n\t" 54 "str%?h %1, [%2] @ NET_RAP\n\t"
55 "str%?h %0, [%2, #-4] @ NET_RDP" 55 "str%?h %0, [%2, #-4] @ NET_RDP"
56 : 56 :
@@ -60,7 +60,7 @@ static void write_rreg(u_long base, u_int reg, u_int val)
60static inline unsigned short read_rreg(u_long base_addr, u_int reg) 60static inline unsigned short read_rreg(u_long base_addr, u_int reg)
61{ 61{
62 unsigned short v; 62 unsigned short v;
63 __asm__( 63 asm volatile(
64 "str%?h %1, [%2] @ NET_RAP\n\t" 64 "str%?h %1, [%2] @ NET_RAP\n\t"
65 "ldr%?h %0, [%2, #-4] @ NET_RDP" 65 "ldr%?h %0, [%2, #-4] @ NET_RDP"
66 : "=r" (v) 66 : "=r" (v)
@@ -70,7 +70,7 @@ static inline unsigned short read_rreg(u_long base_addr, u_int reg)
70 70
71static inline void write_ireg(u_long base, u_int reg, u_int val) 71static inline void write_ireg(u_long base, u_int reg, u_int val)
72{ 72{
73 __asm__( 73 asm volatile(
74 "str%?h %1, [%2] @ NET_RAP\n\t" 74 "str%?h %1, [%2] @ NET_RAP\n\t"
75 "str%?h %0, [%2, #8] @ NET_IDP" 75 "str%?h %0, [%2, #8] @ NET_IDP"
76 : 76 :
@@ -80,7 +80,7 @@ static inline void write_ireg(u_long base, u_int reg, u_int val)
80static inline unsigned short read_ireg(u_long base_addr, u_int reg) 80static inline unsigned short read_ireg(u_long base_addr, u_int reg)
81{ 81{
82 u_short v; 82 u_short v;
83 __asm__( 83 asm volatile(
84 "str%?h %1, [%2] @ NAT_RAP\n\t" 84 "str%?h %1, [%2] @ NAT_RAP\n\t"
85 "ldr%?h %0, [%2, #8] @ NET_IDP\n\t" 85 "ldr%?h %0, [%2, #8] @ NET_IDP\n\t"
86 : "=r" (v) 86 : "=r" (v)
@@ -91,47 +91,48 @@ static inline unsigned short read_ireg(u_long base_addr, u_int reg)
91#define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1)) 91#define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1))
92#define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1)) 92#define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1))
93 93
94static inline void 94static void
95am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) 95am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
96{ 96{
97 offset = ISAMEM_BASE + (offset << 1); 97 offset = ISAMEM_BASE + (offset << 1);
98 length = (length + 1) & ~1; 98 length = (length + 1) & ~1;
99 if ((int)buf & 2) { 99 if ((int)buf & 2) {
100 __asm__ __volatile__("str%?h %2, [%0], #4" 100 asm volatile("str%?h %2, [%0], #4"
101 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); 101 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
102 buf += 2; 102 buf += 2;
103 length -= 2; 103 length -= 2;
104 } 104 }
105 while (length > 8) { 105 while (length > 8) {
106 unsigned int tmp, tmp2; 106 register unsigned int tmp asm("r2"), tmp2 asm("r3");
107 __asm__ __volatile__( 107 asm volatile(
108 "ldm%?ia %1!, {%2, %3}\n\t" 108 "ldm%?ia %0!, {%1, %2}"
109 : "+r" (buf), "=&r" (tmp), "=&r" (tmp2));
110 length -= 8;
111 asm volatile(
112 "str%?h %1, [%0], #4\n\t"
113 "mov%? %1, %1, lsr #16\n\t"
114 "str%?h %1, [%0], #4\n\t"
109 "str%?h %2, [%0], #4\n\t" 115 "str%?h %2, [%0], #4\n\t"
110 "mov%? %2, %2, lsr #16\n\t" 116 "mov%? %2, %2, lsr #16\n\t"
111 "str%?h %2, [%0], #4\n\t" 117 "str%?h %2, [%0], #4"
112 "str%?h %3, [%0], #4\n\t" 118 : "+r" (offset), "=&r" (tmp), "=&r" (tmp2));
113 "mov%? %3, %3, lsr #16\n\t"
114 "str%?h %3, [%0], #4"
115 : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2)
116 : "0" (offset), "1" (buf));
117 length -= 8;
118 } 119 }
119 while (length > 0) { 120 while (length > 0) {
120 __asm__ __volatile__("str%?h %2, [%0], #4" 121 asm volatile("str%?h %2, [%0], #4"
121 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); 122 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
122 buf += 2; 123 buf += 2;
123 length -= 2; 124 length -= 2;
124 } 125 }
125} 126}
126 127
127static inline void 128static void
128am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) 129am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
129{ 130{
130 offset = ISAMEM_BASE + (offset << 1); 131 offset = ISAMEM_BASE + (offset << 1);
131 length = (length + 1) & ~1; 132 length = (length + 1) & ~1;
132 if ((int)buf & 2) { 133 if ((int)buf & 2) {
133 unsigned int tmp; 134 unsigned int tmp;
134 __asm__ __volatile__( 135 asm volatile(
135 "ldr%?h %2, [%0], #4\n\t" 136 "ldr%?h %2, [%0], #4\n\t"
136 "str%?b %2, [%1], #1\n\t" 137 "str%?b %2, [%1], #1\n\t"
137 "mov%? %2, %2, lsr #8\n\t" 138 "mov%? %2, %2, lsr #8\n\t"
@@ -140,12 +141,12 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned
140 length -= 2; 141 length -= 2;
141 } 142 }
142 while (length > 8) { 143 while (length > 8) {
143 unsigned int tmp, tmp2, tmp3; 144 register unsigned int tmp asm("r2"), tmp2 asm("r3"), tmp3;
144 __asm__ __volatile__( 145 asm volatile(
145 "ldr%?h %2, [%0], #4\n\t" 146 "ldr%?h %2, [%0], #4\n\t"
147 "ldr%?h %4, [%0], #4\n\t"
146 "ldr%?h %3, [%0], #4\n\t" 148 "ldr%?h %3, [%0], #4\n\t"
147 "orr%? %2, %2, %3, lsl #16\n\t" 149 "orr%? %2, %2, %4, lsl #16\n\t"
148 "ldr%?h %3, [%0], #4\n\t"
149 "ldr%?h %4, [%0], #4\n\t" 150 "ldr%?h %4, [%0], #4\n\t"
150 "orr%? %3, %3, %4, lsl #16\n\t" 151 "orr%? %3, %3, %4, lsl #16\n\t"
151 "stm%?ia %1!, {%2, %3}" 152 "stm%?ia %1!, {%2, %3}"
@@ -155,7 +156,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned
155 } 156 }
156 while (length > 0) { 157 while (length > 0) {
157 unsigned int tmp; 158 unsigned int tmp;
158 __asm__ __volatile__( 159 asm volatile(
159 "ldr%?h %2, [%0], #4\n\t" 160 "ldr%?h %2, [%0], #4\n\t"
160 "str%?b %2, [%1], #1\n\t" 161 "str%?b %2, [%1], #1\n\t"
161 "mov%? %2, %2, lsr #8\n\t" 162 "mov%? %2, %2, lsr #8\n\t"
@@ -196,6 +197,42 @@ am79c961_ramtest(struct net_device *dev, unsigned int val)
196 return errorcount; 197 return errorcount;
197} 198}
198 199
200static void am79c961_mc_hash(char *addr, u16 *hash)
201{
202 if (addr[0] & 0x01) {
203 int idx, bit;
204 u32 crc;
205
206 crc = ether_crc_le(ETH_ALEN, addr);
207
208 idx = crc >> 30;
209 bit = (crc >> 26) & 15;
210
211 hash[idx] |= 1 << bit;
212 }
213}
214
215static unsigned int am79c961_get_rx_mode(struct net_device *dev, u16 *hash)
216{
217 unsigned int mode = MODE_PORT_10BT;
218
219 if (dev->flags & IFF_PROMISC) {
220 mode |= MODE_PROMISC;
221 memset(hash, 0xff, 4 * sizeof(*hash));
222 } else if (dev->flags & IFF_ALLMULTI) {
223 memset(hash, 0xff, 4 * sizeof(*hash));
224 } else {
225 struct netdev_hw_addr *ha;
226
227 memset(hash, 0, 4 * sizeof(*hash));
228
229 netdev_for_each_mc_addr(ha, dev)
230 am79c961_mc_hash(ha->addr, hash);
231 }
232
233 return mode;
234}
235
199static void 236static void
200am79c961_init_for_open(struct net_device *dev) 237am79c961_init_for_open(struct net_device *dev)
201{ 238{
@@ -203,6 +240,7 @@ am79c961_init_for_open(struct net_device *dev)
203 unsigned long flags; 240 unsigned long flags;
204 unsigned char *p; 241 unsigned char *p;
205 u_int hdr_addr, first_free_addr; 242 u_int hdr_addr, first_free_addr;
243 u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash);
206 int i; 244 int i;
207 245
208 /* 246 /*
@@ -218,16 +256,12 @@ am79c961_init_for_open(struct net_device *dev)
218 write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */ 256 write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */
219 257
220 for (i = LADRL; i <= LADRH; i++) 258 for (i = LADRL; i <= LADRH; i++)
221 write_rreg (dev->base_addr, i, 0); 259 write_rreg (dev->base_addr, i, multi_hash[i - LADRL]);
222 260
223 for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2) 261 for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2)
224 write_rreg (dev->base_addr, i, p[0] | (p[1] << 8)); 262 write_rreg (dev->base_addr, i, p[0] | (p[1] << 8));
225 263
226 i = MODE_PORT_10BT; 264 write_rreg (dev->base_addr, MODE, mode);
227 if (dev->flags & IFF_PROMISC)
228 i |= MODE_PROMISC;
229
230 write_rreg (dev->base_addr, MODE, i);
231 write_rreg (dev->base_addr, POLLINT, 0); 265 write_rreg (dev->base_addr, POLLINT, 0);
232 write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS); 266 write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS);
233 write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS); 267 write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS);
@@ -340,21 +374,6 @@ am79c961_close(struct net_device *dev)
340 return 0; 374 return 0;
341} 375}
342 376
343static void am79c961_mc_hash(char *addr, unsigned short *hash)
344{
345 if (addr[0] & 0x01) {
346 int idx, bit;
347 u32 crc;
348
349 crc = ether_crc_le(ETH_ALEN, addr);
350
351 idx = crc >> 30;
352 bit = (crc >> 26) & 15;
353
354 hash[idx] |= 1 << bit;
355 }
356}
357
358/* 377/*
359 * Set or clear promiscuous/multicast mode filter for this adapter. 378 * Set or clear promiscuous/multicast mode filter for this adapter.
360 */ 379 */
@@ -362,24 +381,9 @@ static void am79c961_setmulticastlist (struct net_device *dev)
362{ 381{
363 struct dev_priv *priv = netdev_priv(dev); 382 struct dev_priv *priv = netdev_priv(dev);
364 unsigned long flags; 383 unsigned long flags;
365 unsigned short multi_hash[4], mode; 384 u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash);
366 int i, stopped; 385 int i, stopped;
367 386
368 mode = MODE_PORT_10BT;
369
370 if (dev->flags & IFF_PROMISC) {
371 mode |= MODE_PROMISC;
372 } else if (dev->flags & IFF_ALLMULTI) {
373 memset(multi_hash, 0xff, sizeof(multi_hash));
374 } else {
375 struct netdev_hw_addr *ha;
376
377 memset(multi_hash, 0x00, sizeof(multi_hash));
378
379 netdev_for_each_mc_addr(ha, dev)
380 am79c961_mc_hash(ha->addr, multi_hash);
381 }
382
383 spin_lock_irqsave(&priv->chip_lock, flags); 387 spin_lock_irqsave(&priv->chip_lock, flags);
384 388
385 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP; 389 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP;
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 5a77001b6d10..0b46b8ea0e80 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -283,10 +283,14 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
283 283
284 skb = dev_alloc_skb(length + 2); 284 skb = dev_alloc_skb(length + 2);
285 if (likely(skb != NULL)) { 285 if (likely(skb != NULL)) {
286 struct ep93xx_rdesc *rxd = &ep->descs->rdesc[entry];
286 skb_reserve(skb, 2); 287 skb_reserve(skb, 2);
287 dma_sync_single_for_cpu(NULL, ep->descs->rdesc[entry].buf_addr, 288 dma_sync_single_for_cpu(dev->dev.parent, rxd->buf_addr,
288 length, DMA_FROM_DEVICE); 289 length, DMA_FROM_DEVICE);
289 skb_copy_to_linear_data(skb, ep->rx_buf[entry], length); 290 skb_copy_to_linear_data(skb, ep->rx_buf[entry], length);
291 dma_sync_single_for_device(dev->dev.parent,
292 rxd->buf_addr, length,
293 DMA_FROM_DEVICE);
290 skb_put(skb, length); 294 skb_put(skb, length);
291 skb->protocol = eth_type_trans(skb, dev); 295 skb->protocol = eth_type_trans(skb, dev);
292 296
@@ -348,6 +352,7 @@ poll_some_more:
348static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) 352static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
349{ 353{
350 struct ep93xx_priv *ep = netdev_priv(dev); 354 struct ep93xx_priv *ep = netdev_priv(dev);
355 struct ep93xx_tdesc *txd;
351 int entry; 356 int entry;
352 357
353 if (unlikely(skb->len > MAX_PKT_SIZE)) { 358 if (unlikely(skb->len > MAX_PKT_SIZE)) {
@@ -359,11 +364,14 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
359 entry = ep->tx_pointer; 364 entry = ep->tx_pointer;
360 ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1); 365 ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1);
361 366
362 ep->descs->tdesc[entry].tdesc1 = 367 txd = &ep->descs->tdesc[entry];
363 TDESC1_EOF | (entry << 16) | (skb->len & 0xfff); 368
369 txd->tdesc1 = TDESC1_EOF | (entry << 16) | (skb->len & 0xfff);
370 dma_sync_single_for_cpu(dev->dev.parent, txd->buf_addr, skb->len,
371 DMA_TO_DEVICE);
364 skb_copy_and_csum_dev(skb, ep->tx_buf[entry]); 372 skb_copy_and_csum_dev(skb, ep->tx_buf[entry]);
365 dma_sync_single_for_cpu(NULL, ep->descs->tdesc[entry].buf_addr, 373 dma_sync_single_for_device(dev->dev.parent, txd->buf_addr, skb->len,
366 skb->len, DMA_TO_DEVICE); 374 DMA_TO_DEVICE);
367 dev_kfree_skb(skb); 375 dev_kfree_skb(skb);
368 376
369 spin_lock_irq(&ep->tx_pending_lock); 377 spin_lock_irq(&ep->tx_pending_lock);
@@ -457,89 +465,80 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id)
457 465
458static void ep93xx_free_buffers(struct ep93xx_priv *ep) 466static void ep93xx_free_buffers(struct ep93xx_priv *ep)
459{ 467{
468 struct device *dev = ep->dev->dev.parent;
460 int i; 469 int i;
461 470
462 for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { 471 for (i = 0; i < RX_QUEUE_ENTRIES; i++) {
463 dma_addr_t d; 472 dma_addr_t d;
464 473
465 d = ep->descs->rdesc[i].buf_addr; 474 d = ep->descs->rdesc[i].buf_addr;
466 if (d) 475 if (d)
467 dma_unmap_single(NULL, d, PAGE_SIZE, DMA_FROM_DEVICE); 476 dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_FROM_DEVICE);
468 477
469 if (ep->rx_buf[i] != NULL) 478 if (ep->rx_buf[i] != NULL)
470 free_page((unsigned long)ep->rx_buf[i]); 479 kfree(ep->rx_buf[i]);
471 } 480 }
472 481
473 for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { 482 for (i = 0; i < TX_QUEUE_ENTRIES; i++) {
474 dma_addr_t d; 483 dma_addr_t d;
475 484
476 d = ep->descs->tdesc[i].buf_addr; 485 d = ep->descs->tdesc[i].buf_addr;
477 if (d) 486 if (d)
478 dma_unmap_single(NULL, d, PAGE_SIZE, DMA_TO_DEVICE); 487 dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_TO_DEVICE);
479 488
480 if (ep->tx_buf[i] != NULL) 489 if (ep->tx_buf[i] != NULL)
481 free_page((unsigned long)ep->tx_buf[i]); 490 kfree(ep->tx_buf[i]);
482 } 491 }
483 492
484 dma_free_coherent(NULL, sizeof(struct ep93xx_descs), ep->descs, 493 dma_free_coherent(dev, sizeof(struct ep93xx_descs), ep->descs,
485 ep->descs_dma_addr); 494 ep->descs_dma_addr);
486} 495}
487 496
488/*
489 * The hardware enforces a sub-2K maximum packet size, so we put
490 * two buffers on every hardware page.
491 */
492static int ep93xx_alloc_buffers(struct ep93xx_priv *ep) 497static int ep93xx_alloc_buffers(struct ep93xx_priv *ep)
493{ 498{
499 struct device *dev = ep->dev->dev.parent;
494 int i; 500 int i;
495 501
496 ep->descs = dma_alloc_coherent(NULL, sizeof(struct ep93xx_descs), 502 ep->descs = dma_alloc_coherent(dev, sizeof(struct ep93xx_descs),
497 &ep->descs_dma_addr, GFP_KERNEL | GFP_DMA); 503 &ep->descs_dma_addr, GFP_KERNEL);
498 if (ep->descs == NULL) 504 if (ep->descs == NULL)
499 return 1; 505 return 1;
500 506
501 for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { 507 for (i = 0; i < RX_QUEUE_ENTRIES; i++) {
502 void *page; 508 void *buf;
503 dma_addr_t d; 509 dma_addr_t d;
504 510
505 page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); 511 buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL);
506 if (page == NULL) 512 if (buf == NULL)
507 goto err; 513 goto err;
508 514
509 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_FROM_DEVICE); 515 d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_FROM_DEVICE);
510 if (dma_mapping_error(NULL, d)) { 516 if (dma_mapping_error(dev, d)) {
511 free_page((unsigned long)page); 517 kfree(buf);
512 goto err; 518 goto err;
513 } 519 }
514 520
515 ep->rx_buf[i] = page; 521 ep->rx_buf[i] = buf;
516 ep->descs->rdesc[i].buf_addr = d; 522 ep->descs->rdesc[i].buf_addr = d;
517 ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE; 523 ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE;
518
519 ep->rx_buf[i + 1] = page + PKT_BUF_SIZE;
520 ep->descs->rdesc[i + 1].buf_addr = d + PKT_BUF_SIZE;
521 ep->descs->rdesc[i + 1].rdesc1 = ((i + 1) << 16) | PKT_BUF_SIZE;
522 } 524 }
523 525
524 for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { 526 for (i = 0; i < TX_QUEUE_ENTRIES; i++) {
525 void *page; 527 void *buf;
526 dma_addr_t d; 528 dma_addr_t d;
527 529
528 page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); 530 buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL);
529 if (page == NULL) 531 if (buf == NULL)
530 goto err; 532 goto err;
531 533
532 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_TO_DEVICE); 534 d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_TO_DEVICE);
533 if (dma_mapping_error(NULL, d)) { 535 if (dma_mapping_error(dev, d)) {
534 free_page((unsigned long)page); 536 kfree(buf);
535 goto err; 537 goto err;
536 } 538 }
537 539
538 ep->tx_buf[i] = page; 540 ep->tx_buf[i] = buf;
539 ep->descs->tdesc[i].buf_addr = d; 541 ep->descs->tdesc[i].buf_addr = d;
540
541 ep->tx_buf[i + 1] = page + PKT_BUF_SIZE;
542 ep->descs->tdesc[i + 1].buf_addr = d + PKT_BUF_SIZE;
543 } 542 }
544 543
545 return 0; 544 return 0;
@@ -829,6 +828,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev)
829 } 828 }
830 ep = netdev_priv(dev); 829 ep = netdev_priv(dev);
831 ep->dev = dev; 830 ep->dev = dev;
831 SET_NETDEV_DEV(dev, &pdev->dev);
832 netif_napi_add(dev, &ep->napi, ep93xx_poll, 64); 832 netif_napi_add(dev, &ep->napi, ep93xx_poll, 64);
833 833
834 platform_set_drvdata(pdev, dev); 834 platform_set_drvdata(pdev, dev);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 17b4dd94da90..652b30e525d0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -388,6 +388,8 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)
388 return next; 388 return next;
389} 389}
390 390
391#define bond_queue_mapping(skb) (*(u16 *)((skb)->cb))
392
391/** 393/**
392 * bond_dev_queue_xmit - Prepare skb for xmit. 394 * bond_dev_queue_xmit - Prepare skb for xmit.
393 * 395 *
@@ -400,6 +402,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
400{ 402{
401 skb->dev = slave_dev; 403 skb->dev = slave_dev;
402 skb->priority = 1; 404 skb->priority = 1;
405
406 skb->queue_mapping = bond_queue_mapping(skb);
407
403 if (unlikely(netpoll_tx_running(slave_dev))) 408 if (unlikely(netpoll_tx_running(slave_dev)))
404 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); 409 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
405 else 410 else
@@ -4206,6 +4211,7 @@ static inline int bond_slave_override(struct bonding *bond,
4206 return res; 4211 return res;
4207} 4212}
4208 4213
4214
4209static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) 4215static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
4210{ 4216{
4211 /* 4217 /*
@@ -4216,6 +4222,11 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
4216 */ 4222 */
4217 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0; 4223 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
4218 4224
4225 /*
4226 * Save the original txq to restore before passing to the driver
4227 */
4228 bond_queue_mapping(skb) = skb->queue_mapping;
4229
4219 if (unlikely(txq >= dev->real_num_tx_queues)) { 4230 if (unlikely(txq >= dev->real_num_tx_queues)) {
4220 do { 4231 do {
4221 txq -= dev->real_num_tx_queues; 4232 txq -= dev->real_num_tx_queues;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index c445457b66d5..23179dbcedd2 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -346,7 +346,7 @@ parse_eeprom (struct net_device *dev)
346 if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ 346 if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */
347 /* Check CRC */ 347 /* Check CRC */
348 crc = ~ether_crc_le (256 - 4, sromdata); 348 crc = ~ether_crc_le (256 - 4, sromdata);
349 if (psrom->crc != crc) { 349 if (psrom->crc != cpu_to_le32(crc)) {
350 printk (KERN_ERR "%s: EEPROM data CRC error.\n", 350 printk (KERN_ERR "%s: EEPROM data CRC error.\n",
351 dev->name); 351 dev->name);
352 return -1; 352 return -1;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index ff60b23a5b74..2dfcc8047847 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -10,7 +10,7 @@
10 * Maintainer: Kumar Gala 10 * Maintainer: Kumar Gala
11 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> 11 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com>
12 * 12 *
13 * Copyright 2002-2009 Freescale Semiconductor, Inc. 13 * Copyright 2002-2009, 2011 Freescale Semiconductor, Inc.
14 * Copyright 2007 MontaVista Software, Inc. 14 * Copyright 2007 MontaVista Software, Inc.
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify it 16 * This program is free software; you can redistribute it and/or modify it
@@ -476,9 +476,6 @@ static const struct net_device_ops gfar_netdev_ops = {
476#endif 476#endif
477}; 477};
478 478
479unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
480unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
481
482void lock_rx_qs(struct gfar_private *priv) 479void lock_rx_qs(struct gfar_private *priv)
483{ 480{
484 int i = 0x0; 481 int i = 0x0;
@@ -868,28 +865,28 @@ static u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar,
868 865
869 rqfar--; 866 rqfar--;
870 rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT; 867 rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT;
871 ftp_rqfpr[rqfar] = rqfpr; 868 priv->ftp_rqfpr[rqfar] = rqfpr;
872 ftp_rqfcr[rqfar] = rqfcr; 869 priv->ftp_rqfcr[rqfar] = rqfcr;
873 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 870 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
874 871
875 rqfar--; 872 rqfar--;
876 rqfcr = RQFCR_CMP_NOMATCH; 873 rqfcr = RQFCR_CMP_NOMATCH;
877 ftp_rqfpr[rqfar] = rqfpr; 874 priv->ftp_rqfpr[rqfar] = rqfpr;
878 ftp_rqfcr[rqfar] = rqfcr; 875 priv->ftp_rqfcr[rqfar] = rqfcr;
879 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 876 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
880 877
881 rqfar--; 878 rqfar--;
882 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND; 879 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND;
883 rqfpr = class; 880 rqfpr = class;
884 ftp_rqfcr[rqfar] = rqfcr; 881 priv->ftp_rqfcr[rqfar] = rqfcr;
885 ftp_rqfpr[rqfar] = rqfpr; 882 priv->ftp_rqfpr[rqfar] = rqfpr;
886 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 883 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
887 884
888 rqfar--; 885 rqfar--;
889 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND; 886 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND;
890 rqfpr = class; 887 rqfpr = class;
891 ftp_rqfcr[rqfar] = rqfcr; 888 priv->ftp_rqfcr[rqfar] = rqfcr;
892 ftp_rqfpr[rqfar] = rqfpr; 889 priv->ftp_rqfpr[rqfar] = rqfpr;
893 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 890 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
894 891
895 return rqfar; 892 return rqfar;
@@ -904,8 +901,8 @@ static void gfar_init_filer_table(struct gfar_private *priv)
904 901
905 /* Default rule */ 902 /* Default rule */
906 rqfcr = RQFCR_CMP_MATCH; 903 rqfcr = RQFCR_CMP_MATCH;
907 ftp_rqfcr[rqfar] = rqfcr; 904 priv->ftp_rqfcr[rqfar] = rqfcr;
908 ftp_rqfpr[rqfar] = rqfpr; 905 priv->ftp_rqfpr[rqfar] = rqfpr;
909 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 906 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
910 907
911 rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6); 908 rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6);
@@ -921,8 +918,8 @@ static void gfar_init_filer_table(struct gfar_private *priv)
921 /* Rest are masked rules */ 918 /* Rest are masked rules */
922 rqfcr = RQFCR_CMP_NOMATCH; 919 rqfcr = RQFCR_CMP_NOMATCH;
923 for (i = 0; i < rqfar; i++) { 920 for (i = 0; i < rqfar; i++) {
924 ftp_rqfcr[i] = rqfcr; 921 priv->ftp_rqfcr[i] = rqfcr;
925 ftp_rqfpr[i] = rqfpr; 922 priv->ftp_rqfpr[i] = rqfpr;
926 gfar_write_filer(priv, i, rqfcr, rqfpr); 923 gfar_write_filer(priv, i, rqfcr, rqfpr);
927 } 924 }
928} 925}
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index fc86f5195445..ba36dc7a3435 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -9,7 +9,7 @@
9 * Maintainer: Kumar Gala 9 * Maintainer: Kumar Gala
10 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> 10 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com>
11 * 11 *
12 * Copyright 2002-2009 Freescale Semiconductor, Inc. 12 * Copyright 2002-2009, 2011 Freescale Semiconductor, Inc.
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify it 14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the 15 * under the terms of the GNU General Public License as published by the
@@ -1107,10 +1107,12 @@ struct gfar_private {
1107 /* HW time stamping enabled flag */ 1107 /* HW time stamping enabled flag */
1108 int hwts_rx_en; 1108 int hwts_rx_en;
1109 int hwts_tx_en; 1109 int hwts_tx_en;
1110
1111 /*Filer table*/
1112 unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
1113 unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
1110}; 1114};
1111 1115
1112extern unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
1113extern unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
1114 1116
1115static inline int gfar_has_errata(struct gfar_private *priv, 1117static inline int gfar_has_errata(struct gfar_private *priv,
1116 enum gfar_errata err) 1118 enum gfar_errata err)
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 493d743839d9..239e3330495f 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -9,7 +9,7 @@
9 * Maintainer: Kumar Gala 9 * Maintainer: Kumar Gala
10 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> 10 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com>
11 * 11 *
12 * Copyright 2003-2006, 2008-2009 Freescale Semiconductor, Inc. 12 * Copyright 2003-2006, 2008-2009, 2011 Freescale Semiconductor, Inc.
13 * 13 *
14 * This software may be used and distributed according to 14 * This software may be used and distributed according to
15 * the terms of the GNU Public License, Version 2, incorporated herein 15 * the terms of the GNU Public License, Version 2, incorporated herein
@@ -609,15 +609,15 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
609 if (ethflow & RXH_L2DA) { 609 if (ethflow & RXH_L2DA) {
610 fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH | 610 fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH |
611 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; 611 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0;
612 ftp_rqfpr[priv->cur_filer_idx] = fpr; 612 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
613 ftp_rqfcr[priv->cur_filer_idx] = fcr; 613 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
614 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 614 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
615 priv->cur_filer_idx = priv->cur_filer_idx - 1; 615 priv->cur_filer_idx = priv->cur_filer_idx - 1;
616 616
617 fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH | 617 fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH |
618 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; 618 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0;
619 ftp_rqfpr[priv->cur_filer_idx] = fpr; 619 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
620 ftp_rqfcr[priv->cur_filer_idx] = fcr; 620 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
621 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 621 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
622 priv->cur_filer_idx = priv->cur_filer_idx - 1; 622 priv->cur_filer_idx = priv->cur_filer_idx - 1;
623 } 623 }
@@ -626,16 +626,16 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
626 fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH | 626 fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH |
627 RQFCR_AND | RQFCR_HASHTBL_0; 627 RQFCR_AND | RQFCR_HASHTBL_0;
628 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 628 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
629 ftp_rqfpr[priv->cur_filer_idx] = fpr; 629 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
630 ftp_rqfcr[priv->cur_filer_idx] = fcr; 630 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
631 priv->cur_filer_idx = priv->cur_filer_idx - 1; 631 priv->cur_filer_idx = priv->cur_filer_idx - 1;
632 } 632 }
633 633
634 if (ethflow & RXH_IP_SRC) { 634 if (ethflow & RXH_IP_SRC) {
635 fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | 635 fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH |
636 RQFCR_AND | RQFCR_HASHTBL_0; 636 RQFCR_AND | RQFCR_HASHTBL_0;
637 ftp_rqfpr[priv->cur_filer_idx] = fpr; 637 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
638 ftp_rqfcr[priv->cur_filer_idx] = fcr; 638 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
639 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 639 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
640 priv->cur_filer_idx = priv->cur_filer_idx - 1; 640 priv->cur_filer_idx = priv->cur_filer_idx - 1;
641 } 641 }
@@ -643,8 +643,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
643 if (ethflow & (RXH_IP_DST)) { 643 if (ethflow & (RXH_IP_DST)) {
644 fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | 644 fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH |
645 RQFCR_AND | RQFCR_HASHTBL_0; 645 RQFCR_AND | RQFCR_HASHTBL_0;
646 ftp_rqfpr[priv->cur_filer_idx] = fpr; 646 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
647 ftp_rqfcr[priv->cur_filer_idx] = fcr; 647 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
648 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 648 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
649 priv->cur_filer_idx = priv->cur_filer_idx - 1; 649 priv->cur_filer_idx = priv->cur_filer_idx - 1;
650 } 650 }
@@ -652,8 +652,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
652 if (ethflow & RXH_L3_PROTO) { 652 if (ethflow & RXH_L3_PROTO) {
653 fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH | 653 fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH |
654 RQFCR_AND | RQFCR_HASHTBL_0; 654 RQFCR_AND | RQFCR_HASHTBL_0;
655 ftp_rqfpr[priv->cur_filer_idx] = fpr; 655 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
656 ftp_rqfcr[priv->cur_filer_idx] = fcr; 656 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
657 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 657 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
658 priv->cur_filer_idx = priv->cur_filer_idx - 1; 658 priv->cur_filer_idx = priv->cur_filer_idx - 1;
659 } 659 }
@@ -661,8 +661,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
661 if (ethflow & RXH_L4_B_0_1) { 661 if (ethflow & RXH_L4_B_0_1) {
662 fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | 662 fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH |
663 RQFCR_AND | RQFCR_HASHTBL_0; 663 RQFCR_AND | RQFCR_HASHTBL_0;
664 ftp_rqfpr[priv->cur_filer_idx] = fpr; 664 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
665 ftp_rqfcr[priv->cur_filer_idx] = fcr; 665 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
666 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 666 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
667 priv->cur_filer_idx = priv->cur_filer_idx - 1; 667 priv->cur_filer_idx = priv->cur_filer_idx - 1;
668 } 668 }
@@ -670,8 +670,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
670 if (ethflow & RXH_L4_B_2_3) { 670 if (ethflow & RXH_L4_B_2_3) {
671 fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | 671 fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH |
672 RQFCR_AND | RQFCR_HASHTBL_0; 672 RQFCR_AND | RQFCR_HASHTBL_0;
673 ftp_rqfpr[priv->cur_filer_idx] = fpr; 673 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
674 ftp_rqfcr[priv->cur_filer_idx] = fcr; 674 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
675 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 675 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
676 priv->cur_filer_idx = priv->cur_filer_idx - 1; 676 priv->cur_filer_idx = priv->cur_filer_idx - 1;
677 } 677 }
@@ -705,12 +705,12 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
705 } 705 }
706 706
707 for (i = 0; i < MAX_FILER_IDX + 1; i++) { 707 for (i = 0; i < MAX_FILER_IDX + 1; i++) {
708 local_rqfpr[j] = ftp_rqfpr[i]; 708 local_rqfpr[j] = priv->ftp_rqfpr[i];
709 local_rqfcr[j] = ftp_rqfcr[i]; 709 local_rqfcr[j] = priv->ftp_rqfcr[i];
710 j--; 710 j--;
711 if ((ftp_rqfcr[i] == (RQFCR_PID_PARSE | 711 if ((priv->ftp_rqfcr[i] == (RQFCR_PID_PARSE |
712 RQFCR_CLE |RQFCR_AND)) && 712 RQFCR_CLE |RQFCR_AND)) &&
713 (ftp_rqfpr[i] == cmp_rqfpr)) 713 (priv->ftp_rqfpr[i] == cmp_rqfpr))
714 break; 714 break;
715 } 715 }
716 716
@@ -724,20 +724,22 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
724 * if it was already programmed, we need to overwrite these rules 724 * if it was already programmed, we need to overwrite these rules
725 */ 725 */
726 for (l = i+1; l < MAX_FILER_IDX; l++) { 726 for (l = i+1; l < MAX_FILER_IDX; l++) {
727 if ((ftp_rqfcr[l] & RQFCR_CLE) && 727 if ((priv->ftp_rqfcr[l] & RQFCR_CLE) &&
728 !(ftp_rqfcr[l] & RQFCR_AND)) { 728 !(priv->ftp_rqfcr[l] & RQFCR_AND)) {
729 ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT | 729 priv->ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT |
730 RQFCR_HASHTBL_0 | RQFCR_PID_MASK; 730 RQFCR_HASHTBL_0 | RQFCR_PID_MASK;
731 ftp_rqfpr[l] = FPR_FILER_MASK; 731 priv->ftp_rqfpr[l] = FPR_FILER_MASK;
732 gfar_write_filer(priv, l, ftp_rqfcr[l], ftp_rqfpr[l]); 732 gfar_write_filer(priv, l, priv->ftp_rqfcr[l],
733 priv->ftp_rqfpr[l]);
733 break; 734 break;
734 } 735 }
735 736
736 if (!(ftp_rqfcr[l] & RQFCR_CLE) && (ftp_rqfcr[l] & RQFCR_AND)) 737 if (!(priv->ftp_rqfcr[l] & RQFCR_CLE) &&
738 (priv->ftp_rqfcr[l] & RQFCR_AND))
737 continue; 739 continue;
738 else { 740 else {
739 local_rqfpr[j] = ftp_rqfpr[l]; 741 local_rqfpr[j] = priv->ftp_rqfpr[l];
740 local_rqfcr[j] = ftp_rqfcr[l]; 742 local_rqfcr[j] = priv->ftp_rqfcr[l];
741 j--; 743 j--;
742 } 744 }
743 } 745 }
@@ -750,8 +752,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
750 752
751 /* Write back the popped out rules again */ 753 /* Write back the popped out rules again */
752 for (k = j+1; k < MAX_FILER_IDX; k++) { 754 for (k = j+1; k < MAX_FILER_IDX; k++) {
753 ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k]; 755 priv->ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k];
754 ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k]; 756 priv->ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k];
755 gfar_write_filer(priv, priv->cur_filer_idx, 757 gfar_write_filer(priv, priv->cur_filer_idx,
756 local_rqfcr[k], local_rqfpr[k]); 758 local_rqfcr[k], local_rqfpr[k]);
757 if (!priv->cur_filer_idx) 759 if (!priv->cur_filer_idx)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 18fccf913635..2c28621eb30b 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2373,6 +2373,9 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
2373 } 2373 }
2374#endif /* CONFIG_PCI_IOV */ 2374#endif /* CONFIG_PCI_IOV */
2375 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); 2375 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
2376 /* i350 cannot do RSS and SR-IOV at the same time */
2377 if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
2378 adapter->rss_queues = 1;
2376 2379
2377 /* 2380 /*
2378 * if rss_queues > 4 or vfs are going to be allocated with rss_queues 2381 * if rss_queues > 4 or vfs are going to be allocated with rss_queues
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index e9656616f2a2..a5d9fbf9d816 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -1406,6 +1406,7 @@ qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry,
1406 1406
1407 for (loop = 0; loop < que->no_ops; loop++) { 1407 for (loop = 0; loop < que->no_ops; loop++) {
1408 QLCNIC_WR_DUMP_REG(que->sel_addr, base, que_id); 1408 QLCNIC_WR_DUMP_REG(que->sel_addr, base, que_id);
1409 addr = que->read_addr;
1409 for (i = 0; i < cnt; i++) { 1410 for (i = 0; i < cnt; i++) {
1410 QLCNIC_RD_DUMP_REG(addr, base, &data); 1411 QLCNIC_RD_DUMP_REG(addr, base, &data);
1411 *buffer++ = cpu_to_le32(data); 1412 *buffer++ = cpu_to_le32(data);
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 3ab7d2c7baf2..0f6af5c61a7c 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -2159,6 +2159,7 @@ qlcnic_unmap_buffers(struct pci_dev *pdev, struct sk_buff *skb,
2159 2159
2160 nf = &pbuf->frag_array[0]; 2160 nf = &pbuf->frag_array[0];
2161 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); 2161 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE);
2162 pbuf->skb = NULL;
2162} 2163}
2163 2164
2164static inline void 2165static inline void
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index dc4805f473e3..f6285748bd3c 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2400,8 +2400,10 @@ static const struct of_device_id smc91x_match[] = {
2400 { .compatible = "smsc,lan91c94", }, 2400 { .compatible = "smsc,lan91c94", },
2401 { .compatible = "smsc,lan91c111", }, 2401 { .compatible = "smsc,lan91c111", },
2402 {}, 2402 {},
2403} 2403};
2404MODULE_DEVICE_TABLE(of, smc91x_match); 2404MODULE_DEVICE_TABLE(of, smc91x_match);
2405#else
2406#define smc91x_match NULL
2405#endif 2407#endif
2406 2408
2407static struct dev_pm_ops smc_drv_pm_ops = { 2409static struct dev_pm_ops smc_drv_pm_ops = {
@@ -2416,9 +2418,7 @@ static struct platform_driver smc_driver = {
2416 .name = CARDNAME, 2418 .name = CARDNAME,
2417 .owner = THIS_MODULE, 2419 .owner = THIS_MODULE,
2418 .pm = &smc_drv_pm_ops, 2420 .pm = &smc_drv_pm_ops,
2419#ifdef CONFIG_OF
2420 .of_match_table = smc91x_match, 2421 .of_match_table = smc91x_match,
2421#endif
2422 }, 2422 },
2423}; 2423};
2424 2424
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 22047628ccfa..b6c5d3715b96 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -72,6 +72,11 @@ static int modparam_all_channels;
72module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO); 72module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO);
73MODULE_PARM_DESC(all_channels, "Expose all channels the device can use."); 73MODULE_PARM_DESC(all_channels, "Expose all channels the device can use.");
74 74
75static int modparam_fastchanswitch;
76module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO);
77MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios.");
78
79
75/* Module info */ 80/* Module info */
76MODULE_AUTHOR("Jiri Slaby"); 81MODULE_AUTHOR("Jiri Slaby");
77MODULE_AUTHOR("Nick Kossifidis"); 82MODULE_AUTHOR("Nick Kossifidis");
@@ -2686,6 +2691,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
2686 struct ath5k_hw *ah = sc->ah; 2691 struct ath5k_hw *ah = sc->ah;
2687 struct ath_common *common = ath5k_hw_common(ah); 2692 struct ath_common *common = ath5k_hw_common(ah);
2688 int ret, ani_mode; 2693 int ret, ani_mode;
2694 bool fast;
2689 2695
2690 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); 2696 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
2691 2697
@@ -2705,7 +2711,10 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
2705 ath5k_drain_tx_buffs(sc); 2711 ath5k_drain_tx_buffs(sc);
2706 if (chan) 2712 if (chan)
2707 sc->curchan = chan; 2713 sc->curchan = chan;
2708 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL, 2714
2715 fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
2716
2717 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, fast,
2709 skip_pcu); 2718 skip_pcu);
2710 if (ret) { 2719 if (ret) {
2711 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); 2720 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index 3510de2cf622..126a4eab35f3 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -1124,8 +1124,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1124 /* Non fatal, can happen eg. 1124 /* Non fatal, can happen eg.
1125 * on mode change */ 1125 * on mode change */
1126 ret = 0; 1126 ret = 0;
1127 } else 1127 } else {
1128 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
1129 "fast chan change successful\n");
1128 return 0; 1130 return 0;
1131 }
1129 } 1132 }
1130 1133
1131 /* 1134 /*
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index f9db25bb35c3..facc94e74b07 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1218,10 +1218,10 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1218 * receive commit_rxon request 1218 * receive commit_rxon request
1219 * abort any previous channel switch if still in process 1219 * abort any previous channel switch if still in process
1220 */ 1220 */
1221 if (priv->switch_rxon.switch_in_progress && 1221 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
1222 (priv->switch_rxon.channel != ctx->staging.channel)) { 1222 (priv->switch_channel != ctx->staging.channel)) {
1223 IWL_DEBUG_11H(priv, "abort channel switch on %d\n", 1223 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
1224 le16_to_cpu(priv->switch_rxon.channel)); 1224 le16_to_cpu(priv->switch_channel));
1225 iwl_legacy_chswitch_done(priv, false); 1225 iwl_legacy_chswitch_done(priv, false);
1226 } 1226 }
1227 1227
@@ -1237,7 +1237,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1237 1237
1238 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1238 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon));
1239 iwl_legacy_print_rx_config_cmd(priv, ctx); 1239 iwl_legacy_print_rx_config_cmd(priv, ctx);
1240 return 0; 1240 goto set_tx_power;
1241 } 1241 }
1242 1242
1243 /* If we are currently associated and the new config requires 1243 /* If we are currently associated and the new config requires
@@ -1317,6 +1317,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1317 1317
1318 iwl4965_init_sensitivity(priv); 1318 iwl4965_init_sensitivity(priv);
1319 1319
1320set_tx_power:
1320 /* If we issue a new RXON command which required a tune then we must 1321 /* If we issue a new RXON command which required a tune then we must
1321 * send a new TXPOWER command or we won't be able to Tx any frames */ 1322 * send a new TXPOWER command or we won't be able to Tx any frames */
1322 ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); 1323 ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true);
@@ -1403,9 +1404,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1403 return rc; 1404 return rc;
1404 } 1405 }
1405 1406
1406 priv->switch_rxon.channel = cmd.channel;
1407 priv->switch_rxon.switch_in_progress = true;
1408
1409 return iwl_legacy_send_cmd_pdu(priv, 1407 return iwl_legacy_send_cmd_pdu(priv,
1410 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 1408 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
1411} 1409}
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 42df8321dae8..3be76bd5499a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -859,12 +859,8 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success)
859 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 859 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
860 return; 860 return;
861 861
862 if (priv->switch_rxon.switch_in_progress) { 862 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
863 ieee80211_chswitch_done(ctx->vif, is_success); 863 ieee80211_chswitch_done(ctx->vif, is_success);
864 mutex_lock(&priv->mutex);
865 priv->switch_rxon.switch_in_progress = false;
866 mutex_unlock(&priv->mutex);
867 }
868} 864}
869EXPORT_SYMBOL(iwl_legacy_chswitch_done); 865EXPORT_SYMBOL(iwl_legacy_chswitch_done);
870 866
@@ -876,19 +872,19 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
876 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 872 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
877 struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; 873 struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active;
878 874
879 if (priv->switch_rxon.switch_in_progress) { 875 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
880 if (!le32_to_cpu(csa->status) && 876 return;
881 (csa->channel == priv->switch_rxon.channel)) { 877
882 rxon->channel = csa->channel; 878 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
883 ctx->staging.channel = csa->channel; 879 rxon->channel = csa->channel;
884 IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", 880 ctx->staging.channel = csa->channel;
885 le16_to_cpu(csa->channel)); 881 IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
886 iwl_legacy_chswitch_done(priv, true);
887 } else {
888 IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
889 le16_to_cpu(csa->channel)); 882 le16_to_cpu(csa->channel));
890 iwl_legacy_chswitch_done(priv, false); 883 iwl_legacy_chswitch_done(priv, true);
891 } 884 } else {
885 IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
886 le16_to_cpu(csa->channel));
887 iwl_legacy_chswitch_done(priv, false);
892 } 888 }
893} 889}
894EXPORT_SYMBOL(iwl_legacy_rx_csa); 890EXPORT_SYMBOL(iwl_legacy_rx_csa);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
index bc66c604106c..c5fbda0760de 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.h
+++ b/drivers/net/wireless/iwlegacy/iwl-core.h
@@ -560,7 +560,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv);
560#define STATUS_SCAN_HW 15 560#define STATUS_SCAN_HW 15
561#define STATUS_POWER_PMI 16 561#define STATUS_POWER_PMI 16
562#define STATUS_FW_ERROR 17 562#define STATUS_FW_ERROR 17
563 563#define STATUS_CHANNEL_SWITCH_PENDING 18
564 564
565static inline int iwl_legacy_is_ready(struct iwl_priv *priv) 565static inline int iwl_legacy_is_ready(struct iwl_priv *priv)
566{ 566{
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index be0106c6a2da..ea30122669ee 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -855,17 +855,6 @@ struct traffic_stats {
855}; 855};
856 856
857/* 857/*
858 * iwl_switch_rxon: "channel switch" structure
859 *
860 * @ switch_in_progress: channel switch in progress
861 * @ channel: new channel
862 */
863struct iwl_switch_rxon {
864 bool switch_in_progress;
865 __le16 channel;
866};
867
868/*
869 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds 858 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
870 * to perform continuous uCode event logging operation if enabled 859 * to perform continuous uCode event logging operation if enabled
871 */ 860 */
@@ -1115,7 +1104,7 @@ struct iwl_priv {
1115 1104
1116 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; 1105 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
1117 1106
1118 struct iwl_switch_rxon switch_rxon; 1107 __le16 switch_channel;
1119 1108
1120 /* 1st responses from initialize and runtime uCode images. 1109 /* 1st responses from initialize and runtime uCode images.
1121 * _4965's initialize alive response contains some calibration data. */ 1110 * _4965's initialize alive response contains some calibration data. */
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index af2ae22fcfd3..7157ba529680 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -2861,16 +2861,13 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2861 goto out; 2861 goto out;
2862 2862
2863 if (test_bit(STATUS_EXIT_PENDING, &priv->status) || 2863 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
2864 test_bit(STATUS_SCANNING, &priv->status)) 2864 test_bit(STATUS_SCANNING, &priv->status) ||
2865 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
2865 goto out; 2866 goto out;
2866 2867
2867 if (!iwl_legacy_is_associated_ctx(ctx)) 2868 if (!iwl_legacy_is_associated_ctx(ctx))
2868 goto out; 2869 goto out;
2869 2870
2870 /* channel switch in progress */
2871 if (priv->switch_rxon.switch_in_progress == true)
2872 goto out;
2873
2874 if (priv->cfg->ops->lib->set_channel_switch) { 2871 if (priv->cfg->ops->lib->set_channel_switch) {
2875 2872
2876 ch = channel->hw_value; 2873 ch = channel->hw_value;
@@ -2919,15 +2916,18 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
2919 * at this point, staging_rxon has the 2916 * at this point, staging_rxon has the
2920 * configuration for channel switch 2917 * configuration for channel switch
2921 */ 2918 */
2922 if (priv->cfg->ops->lib->set_channel_switch(priv, 2919 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
2923 ch_switch)) 2920 priv->switch_channel = cpu_to_le16(ch);
2924 priv->switch_rxon.switch_in_progress = false; 2921 if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
2922 clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
2923 &priv->status);
2924 priv->switch_channel = 0;
2925 ieee80211_chswitch_done(ctx->vif, false);
2926 }
2925 } 2927 }
2926 } 2928 }
2927out: 2929out:
2928 mutex_unlock(&priv->mutex); 2930 mutex_unlock(&priv->mutex);
2929 if (!priv->switch_rxon.switch_in_progress)
2930 ieee80211_chswitch_done(ctx->vif, false);
2931 IWL_DEBUG_MAC80211(priv, "leave\n"); 2931 IWL_DEBUG_MAC80211(priv, "leave\n");
2932} 2932}
2933 2933
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 86feec86d130..2282279cffc4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -177,79 +177,6 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
177 return 0; 177 return 0;
178} 178}
179 179
180static int iwl2030_hw_channel_switch(struct iwl_priv *priv,
181 struct ieee80211_channel_switch *ch_switch)
182{
183 /*
184 * MULTI-FIXME
185 * See iwl_mac_channel_switch.
186 */
187 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
188 struct iwl6000_channel_switch_cmd cmd;
189 const struct iwl_channel_info *ch_info;
190 u32 switch_time_in_usec, ucode_switch_time;
191 u16 ch;
192 u32 tsf_low;
193 u8 switch_count;
194 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
195 struct ieee80211_vif *vif = ctx->vif;
196 struct iwl_host_cmd hcmd = {
197 .id = REPLY_CHANNEL_SWITCH,
198 .len = { sizeof(cmd), },
199 .flags = CMD_SYNC,
200 .data = { &cmd, },
201 };
202
203 cmd.band = priv->band == IEEE80211_BAND_2GHZ;
204 ch = ch_switch->channel->hw_value;
205 IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
206 ctx->active.channel, ch);
207 cmd.channel = cpu_to_le16(ch);
208 cmd.rxon_flags = ctx->staging.flags;
209 cmd.rxon_filter_flags = ctx->staging.filter_flags;
210 switch_count = ch_switch->count;
211 tsf_low = ch_switch->timestamp & 0x0ffffffff;
212 /*
213 * calculate the ucode channel switch time
214 * adding TSF as one of the factor for when to switch
215 */
216 if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
217 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
218 beacon_interval)) {
219 switch_count -= (priv->ucode_beacon_time -
220 tsf_low) / beacon_interval;
221 } else
222 switch_count = 0;
223 }
224 if (switch_count <= 1)
225 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
226 else {
227 switch_time_in_usec =
228 vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
229 ucode_switch_time = iwl_usecs_to_beacons(priv,
230 switch_time_in_usec,
231 beacon_interval);
232 cmd.switch_time = iwl_add_beacon_time(priv,
233 priv->ucode_beacon_time,
234 ucode_switch_time,
235 beacon_interval);
236 }
237 IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
238 cmd.switch_time);
239 ch_info = iwl_get_channel_info(priv, priv->band, ch);
240 if (ch_info)
241 cmd.expect_beacon = is_channel_radar(ch_info);
242 else {
243 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
244 ctx->active.channel, ch);
245 return -EFAULT;
246 }
247 priv->switch_rxon.channel = cmd.channel;
248 priv->switch_rxon.switch_in_progress = true;
249
250 return iwl_send_cmd_sync(priv, &hcmd);
251}
252
253static struct iwl_lib_ops iwl2000_lib = { 180static struct iwl_lib_ops iwl2000_lib = {
254 .set_hw_params = iwl2000_hw_set_hw_params, 181 .set_hw_params = iwl2000_hw_set_hw_params,
255 .rx_handler_setup = iwlagn_rx_handler_setup, 182 .rx_handler_setup = iwlagn_rx_handler_setup,
@@ -258,7 +185,6 @@ static struct iwl_lib_ops iwl2000_lib = {
258 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, 185 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
259 .send_tx_power = iwlagn_send_tx_power, 186 .send_tx_power = iwlagn_send_tx_power,
260 .update_chain_flags = iwl_update_chain_flags, 187 .update_chain_flags = iwl_update_chain_flags,
261 .set_channel_switch = iwl2030_hw_channel_switch,
262 .apm_ops = { 188 .apm_ops = {
263 .init = iwl_apm_init, 189 .init = iwl_apm_init,
264 .config = iwl2000_nic_config, 190 .config = iwl2000_nic_config,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index a70b8cfafda1..f99f9c193352 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -331,8 +331,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
331 ctx->active.channel, ch); 331 ctx->active.channel, ch);
332 return -EFAULT; 332 return -EFAULT;
333 } 333 }
334 priv->switch_rxon.channel = cmd.channel;
335 priv->switch_rxon.switch_in_progress = true;
336 334
337 return iwl_send_cmd_sync(priv, &hcmd); 335 return iwl_send_cmd_sync(priv, &hcmd);
338} 336}
@@ -425,7 +423,6 @@ static struct iwl_base_params iwl5000_base_params = {
425}; 423};
426static struct iwl_ht_params iwl5000_ht_params = { 424static struct iwl_ht_params iwl5000_ht_params = {
427 .ht_greenfield_support = true, 425 .ht_greenfield_support = true,
428 .use_rts_for_aggregation = true, /* use rts/cts protection */
429}; 426};
430 427
431#define IWL_DEVICE_5000 \ 428#define IWL_DEVICE_5000 \
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index fda6fe08cf91..fbe565c816e3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -270,8 +270,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
270 ctx->active.channel, ch); 270 ctx->active.channel, ch);
271 return -EFAULT; 271 return -EFAULT;
272 } 272 }
273 priv->switch_rxon.channel = cmd.channel;
274 priv->switch_rxon.switch_in_progress = true;
275 273
276 return iwl_send_cmd_sync(priv, &hcmd); 274 return iwl_send_cmd_sync(priv, &hcmd);
277} 275}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index b12c72d63ccb..23fa93deae96 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
163 __le16 fc, __le32 *tx_flags) 163 __le16 fc, __le32 *tx_flags)
164{ 164{
165 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS || 165 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
166 info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { 166 info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
167 info->flags & IEEE80211_TX_CTL_AMPDU)
167 *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; 168 *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
168 return;
169 }
170
171 if (priv->cfg->ht_params &&
172 priv->cfg->ht_params->use_rts_for_aggregation &&
173 info->flags & IEEE80211_TX_CTL_AMPDU) {
174 *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
175 return;
176 }
177} 169}
178 170
179/* Calc max signal level (dBm) among 3 possible receivers */ 171/* Calc max signal level (dBm) among 3 possible receivers */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index a95ad84c5377..09f679d6046f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -325,6 +325,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
325 return 0; 325 return 0;
326 } 326 }
327 327
328 /*
329 * force CTS-to-self frames protection if RTS-CTS is not preferred
330 * one aggregation protection method
331 */
332 if (!(priv->cfg->ht_params &&
333 priv->cfg->ht_params->use_rts_for_aggregation))
334 ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
335
328 if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || 336 if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
329 !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) 337 !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
330 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 338 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
@@ -342,10 +350,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
342 * receive commit_rxon request 350 * receive commit_rxon request
343 * abort any previous channel switch if still in process 351 * abort any previous channel switch if still in process
344 */ 352 */
345 if (priv->switch_rxon.switch_in_progress && 353 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
346 (priv->switch_rxon.channel != ctx->staging.channel)) { 354 (priv->switch_channel != ctx->staging.channel)) {
347 IWL_DEBUG_11H(priv, "abort channel switch on %d\n", 355 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
348 le16_to_cpu(priv->switch_rxon.channel)); 356 le16_to_cpu(priv->switch_channel));
349 iwl_chswitch_done(priv, false); 357 iwl_chswitch_done(priv, false);
350 } 358 }
351 359
@@ -362,6 +370,11 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
362 } 370 }
363 371
364 memcpy(active, &ctx->staging, sizeof(*active)); 372 memcpy(active, &ctx->staging, sizeof(*active));
373 /*
374 * We do not commit tx power settings while channel changing,
375 * do it now if after settings changed.
376 */
377 iwl_set_tx_power(priv, priv->tx_power_next, false);
365 return 0; 378 return 0;
366 } 379 }
367 380
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a662adcb2adb..8e1942ebd9a0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2843,16 +2843,13 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
2843 goto out; 2843 goto out;
2844 2844
2845 if (test_bit(STATUS_EXIT_PENDING, &priv->status) || 2845 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
2846 test_bit(STATUS_SCANNING, &priv->status)) 2846 test_bit(STATUS_SCANNING, &priv->status) ||
2847 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
2847 goto out; 2848 goto out;
2848 2849
2849 if (!iwl_is_associated_ctx(ctx)) 2850 if (!iwl_is_associated_ctx(ctx))
2850 goto out; 2851 goto out;
2851 2852
2852 /* channel switch in progress */
2853 if (priv->switch_rxon.switch_in_progress == true)
2854 goto out;
2855
2856 if (priv->cfg->ops->lib->set_channel_switch) { 2853 if (priv->cfg->ops->lib->set_channel_switch) {
2857 2854
2858 ch = channel->hw_value; 2855 ch = channel->hw_value;
@@ -2901,15 +2898,19 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
2901 * at this point, staging_rxon has the 2898 * at this point, staging_rxon has the
2902 * configuration for channel switch 2899 * configuration for channel switch
2903 */ 2900 */
2901 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
2902 priv->switch_channel = cpu_to_le16(ch);
2904 if (priv->cfg->ops->lib->set_channel_switch(priv, 2903 if (priv->cfg->ops->lib->set_channel_switch(priv,
2905 ch_switch)) 2904 ch_switch)) {
2906 priv->switch_rxon.switch_in_progress = false; 2905 clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
2906 &priv->status);
2907 priv->switch_channel = 0;
2908 ieee80211_chswitch_done(ctx->vif, false);
2909 }
2907 } 2910 }
2908 } 2911 }
2909out: 2912out:
2910 mutex_unlock(&priv->mutex); 2913 mutex_unlock(&priv->mutex);
2911 if (!priv->switch_rxon.switch_in_progress)
2912 ieee80211_chswitch_done(ctx->vif, false);
2913 IWL_DEBUG_MAC80211(priv, "leave\n"); 2914 IWL_DEBUG_MAC80211(priv, "leave\n");
2914} 2915}
2915 2916
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 4653deada05b..213c80c6a668 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -843,12 +843,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
843 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 843 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
844 return; 844 return;
845 845
846 if (priv->switch_rxon.switch_in_progress) { 846 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
847 ieee80211_chswitch_done(ctx->vif, is_success); 847 ieee80211_chswitch_done(ctx->vif, is_success);
848 mutex_lock(&priv->mutex);
849 priv->switch_rxon.switch_in_progress = false;
850 mutex_unlock(&priv->mutex);
851 }
852} 848}
853 849
854#ifdef CONFIG_IWLWIFI_DEBUG 850#ifdef CONFIG_IWLWIFI_DEBUG
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 3bb76f6ea410..a54d416ec345 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -560,6 +560,7 @@ void iwlcore_free_geos(struct iwl_priv *priv);
560#define STATUS_POWER_PMI 16 560#define STATUS_POWER_PMI 16
561#define STATUS_FW_ERROR 17 561#define STATUS_FW_ERROR 17
562#define STATUS_DEVICE_ENABLED 18 562#define STATUS_DEVICE_ENABLED 18
563#define STATUS_CHANNEL_SWITCH_PENDING 19
563 564
564 565
565static inline int iwl_is_ready(struct iwl_priv *priv) 566static inline int iwl_is_ready(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 22a6e3ec7094..c8de236c141b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -982,17 +982,6 @@ struct traffic_stats {
982}; 982};
983 983
984/* 984/*
985 * iwl_switch_rxon: "channel switch" structure
986 *
987 * @ switch_in_progress: channel switch in progress
988 * @ channel: new channel
989 */
990struct iwl_switch_rxon {
991 bool switch_in_progress;
992 __le16 channel;
993};
994
995/*
996 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds 985 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
997 * to perform continuous uCode event logging operation if enabled 986 * to perform continuous uCode event logging operation if enabled
998 */ 987 */
@@ -1287,7 +1276,7 @@ struct iwl_priv {
1287 1276
1288 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; 1277 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
1289 1278
1290 struct iwl_switch_rxon switch_rxon; 1279 __le16 switch_channel;
1291 1280
1292 struct { 1281 struct {
1293 u32 error_event_table; 1282 u32 error_event_table;
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 0053e9ea9021..b774517aa9fa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -250,19 +250,19 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
250 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 250 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
251 struct iwl_rxon_cmd *rxon = (void *)&ctx->active; 251 struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
252 252
253 if (priv->switch_rxon.switch_in_progress) { 253 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
254 if (!le32_to_cpu(csa->status) && 254 return;
255 (csa->channel == priv->switch_rxon.channel)) { 255
256 rxon->channel = csa->channel; 256 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
257 ctx->staging.channel = csa->channel; 257 rxon->channel = csa->channel;
258 IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", 258 ctx->staging.channel = csa->channel;
259 le16_to_cpu(csa->channel)); 259 IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
260 iwl_chswitch_done(priv, true);
261 } else {
262 IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
263 le16_to_cpu(csa->channel)); 260 le16_to_cpu(csa->channel));
264 iwl_chswitch_done(priv, false); 261 iwl_chswitch_done(priv, true);
265 } 262 } else {
263 IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
264 le16_to_cpu(csa->channel));
265 iwl_chswitch_done(priv, false);
266 } 266 }
267} 267}
268 268
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index a7b5cb0c2753..224e9853c480 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -907,7 +907,7 @@ static void if_sdio_interrupt(struct sdio_func *func)
907 card = sdio_get_drvdata(func); 907 card = sdio_get_drvdata(func);
908 908
909 cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); 909 cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret);
910 if (ret) 910 if (ret || !cause)
911 goto out; 911 goto out;
912 912
913 lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); 913 lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause);
@@ -1008,10 +1008,6 @@ static int if_sdio_probe(struct sdio_func *func,
1008 if (ret) 1008 if (ret)
1009 goto release; 1009 goto release;
1010 1010
1011 ret = sdio_claim_irq(func, if_sdio_interrupt);
1012 if (ret)
1013 goto disable;
1014
1015 /* For 1-bit transfers to the 8686 model, we need to enable the 1011 /* For 1-bit transfers to the 8686 model, we need to enable the
1016 * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0 1012 * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0
1017 * bit to allow access to non-vendor registers. */ 1013 * bit to allow access to non-vendor registers. */
@@ -1083,6 +1079,21 @@ static int if_sdio_probe(struct sdio_func *func,
1083 card->rx_unit = 0; 1079 card->rx_unit = 0;
1084 1080
1085 /* 1081 /*
1082 * Set up the interrupt handler late.
1083 *
1084 * If we set it up earlier, the (buggy) hardware generates a spurious
1085 * interrupt, even before the interrupt has been enabled, with
1086 * CCCR_INTx = 0.
1087 *
1088 * We register the interrupt handler late so that we can handle any
1089 * spurious interrupts, and also to avoid generation of that known
1090 * spurious interrupt in the first place.
1091 */
1092 ret = sdio_claim_irq(func, if_sdio_interrupt);
1093 if (ret)
1094 goto disable;
1095
1096 /*
1086 * Enable interrupts now that everything is set up 1097 * Enable interrupts now that everything is set up
1087 */ 1098 */
1088 sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret); 1099 sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret);
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 555180d8f4aa..b704e5b183d0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -250,7 +250,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
250 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) 250 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL)
251 rt2x00link_reset_tuner(rt2x00dev, false); 251 rt2x00link_reset_tuner(rt2x00dev, false);
252 252
253 if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && 253 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
254 test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) &&
254 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) && 255 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) &&
255 (conf->flags & IEEE80211_CONF_PS)) { 256 (conf->flags & IEEE80211_CONF_PS)) {
256 beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon; 257 beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index c018d67aab8e..939821b4af2f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -146,6 +146,9 @@ static void rt2x00lib_autowakeup(struct work_struct *work)
146 struct rt2x00_dev *rt2x00dev = 146 struct rt2x00_dev *rt2x00dev =
147 container_of(work, struct rt2x00_dev, autowakeup_work.work); 147 container_of(work, struct rt2x00_dev, autowakeup_work.work);
148 148
149 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
150 return;
151
149 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) 152 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE))
150 ERROR(rt2x00dev, "Device failed to wakeup.\n"); 153 ERROR(rt2x00dev, "Device failed to wakeup.\n");
151 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); 154 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
@@ -1160,6 +1163,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1160 * Stop all work. 1163 * Stop all work.
1161 */ 1164 */
1162 cancel_work_sync(&rt2x00dev->intf_work); 1165 cancel_work_sync(&rt2x00dev->intf_work);
1166 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
1163 if (rt2x00_is_usb(rt2x00dev)) { 1167 if (rt2x00_is_usb(rt2x00dev)) {
1164 del_timer_sync(&rt2x00dev->txstatus_timer); 1168 del_timer_sync(&rt2x00dev->txstatus_timer);
1165 cancel_work_sync(&rt2x00dev->rxdone_work); 1169 cancel_work_sync(&rt2x00dev->rxdone_work);
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 89100e7c553b..9f8ccae93317 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -669,6 +669,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
669 &rx_status, 669 &rx_status,
670 (u8 *) pdesc, skb); 670 (u8 *) pdesc, skb);
671 671
672 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
673 if (unlikely(!new_skb)) {
674 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
675 DBG_DMESG,
676 ("can't alloc skb for rx\n"));
677 goto done;
678 }
679
680 pci_unmap_single(rtlpci->pdev,
681 *((dma_addr_t *) skb->cb),
682 rtlpci->rxbuffersize,
683 PCI_DMA_FROMDEVICE);
684
672 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 685 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
673 false, 686 false,
674 HW_DESC_RXPKT_LEN)); 687 HW_DESC_RXPKT_LEN));
@@ -685,22 +698,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
685 hdr = rtl_get_hdr(skb); 698 hdr = rtl_get_hdr(skb);
686 fc = rtl_get_fc(skb); 699 fc = rtl_get_fc(skb);
687 700
688 /* try for new buffer - if allocation fails, drop 701 if (!stats.crc && !stats.hwerror) {
689 * frame and reuse old buffer
690 */
691 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
692 if (unlikely(!new_skb)) {
693 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
694 DBG_DMESG,
695 ("can't alloc skb for rx\n"));
696 goto done;
697 }
698 pci_unmap_single(rtlpci->pdev,
699 *((dma_addr_t *) skb->cb),
700 rtlpci->rxbuffersize,
701 PCI_DMA_FROMDEVICE);
702
703 if (!stats.crc || !stats.hwerror) {
704 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, 702 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
705 sizeof(rx_status)); 703 sizeof(rx_status));
706 704
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 82feb348c8bb..2a20dabec76d 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -539,10 +539,12 @@ void ssb_pcicore_init(struct ssb_pcicore *pc)
539 if (!pc->hostmode) 539 if (!pc->hostmode)
540 ssb_pcicore_init_clientmode(pc); 540 ssb_pcicore_init_clientmode(pc);
541 541
542 /* Additional always once-executed workarounds */ 542 /* Additional PCIe always once-executed workarounds */
543 ssb_pcicore_serdes_workaround(pc); 543 if (dev->id.coreid == SSB_DEV_PCIE) {
544 /* TODO: ASPM */ 544 ssb_pcicore_serdes_workaround(pc);
545 /* TODO: Clock Request Update */ 545 /* TODO: ASPM */
546 /* TODO: Clock Request Update */
547 }
546} 548}
547 549
548static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address) 550static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address)