aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-06-21 01:29:08 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-21 01:29:08 -0400
commit9f6ec8d697c08963d83880ccd35c13c5ace716ea (patch)
treead8d93cf6fcdd09b86ade09f5fcbbc66cdb1cca2 /drivers/net
parent4aa3a715551c93eda32d79bd52042ce500bd5383 (diff)
parent56299378726d5f2ba8d3c8cbbd13cb280ba45e4f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/iwlwifi/iwl-agn-rxon.c drivers/net/wireless/rtlwifi/pci.c net/netfilter/ipvs/ip_vs_core.c
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c503.c3
-rw-r--r--drivers/net/arm/am79c961a.c126
-rw-r--r--drivers/net/arm/ep93xx_eth.c82
-rw-r--r--drivers/net/bfin_mac.c20
-rw-r--r--drivers/net/bonding/bond_main.c12
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/fs_enet/mac-fcc.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/hp100.c4
-rw-r--r--drivers/net/hplance.c2
-rw-r--r--drivers/net/igb/igb_main.c3
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/phy/Kconfig1
-rw-r--r--drivers/net/phy/dp83640.c24
-rw-r--r--drivers/net/ppp_async.c4
-rw-r--r--drivers/net/pxa168_eth.c2
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c1
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c1
-rw-r--r--drivers/net/r8169.c10
-rw-r--r--drivers/net/smc91x.c6
-rw-r--r--drivers/net/tun.c24
-rw-r--r--drivers/net/usb/Kconfig10
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/kalmia.c384
-rw-r--r--drivers/net/wan/farsync.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c9
-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/mwifiex/cfg80211.c2
-rw-r--r--drivers/net/wireless/mwl8k.c4
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c28
35 files changed, 690 insertions, 251 deletions
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index 554a26c55188..84e68f1b9adf 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -413,7 +413,7 @@ el2_open(struct net_device *dev)
413 outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR); 413 outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR);
414 outb_p(0x00, E33G_IDCFR); 414 outb_p(0x00, E33G_IDCFR);
415 msleep(1); 415 msleep(1);
416 free_irq(*irqp, el2_probe_interrupt); 416 free_irq(*irqp, &seen);
417 if (!seen) 417 if (!seen)
418 continue; 418 continue;
419 419
@@ -423,6 +423,7 @@ el2_open(struct net_device *dev)
423 continue; 423 continue;
424 if (retval < 0) 424 if (retval < 0)
425 goto err_disable; 425 goto err_disable;
426 break;
426 } while (*++irqp); 427 } while (*++irqp);
427 428
428 if (*irqp == 0) { 429 if (*irqp == 0) {
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 a167addd5382..4317af8d2f0a 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -284,10 +284,14 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
284 284
285 skb = dev_alloc_skb(length + 2); 285 skb = dev_alloc_skb(length + 2);
286 if (likely(skb != NULL)) { 286 if (likely(skb != NULL)) {
287 struct ep93xx_rdesc *rxd = &ep->descs->rdesc[entry];
287 skb_reserve(skb, 2); 288 skb_reserve(skb, 2);
288 dma_sync_single_for_cpu(NULL, ep->descs->rdesc[entry].buf_addr, 289 dma_sync_single_for_cpu(dev->dev.parent, rxd->buf_addr,
289 length, DMA_FROM_DEVICE); 290 length, DMA_FROM_DEVICE);
290 skb_copy_to_linear_data(skb, ep->rx_buf[entry], length); 291 skb_copy_to_linear_data(skb, ep->rx_buf[entry], length);
292 dma_sync_single_for_device(dev->dev.parent,
293 rxd->buf_addr, length,
294 DMA_FROM_DEVICE);
291 skb_put(skb, length); 295 skb_put(skb, length);
292 skb->protocol = eth_type_trans(skb, dev); 296 skb->protocol = eth_type_trans(skb, dev);
293 297
@@ -349,6 +353,7 @@ poll_some_more:
349static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) 353static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
350{ 354{
351 struct ep93xx_priv *ep = netdev_priv(dev); 355 struct ep93xx_priv *ep = netdev_priv(dev);
356 struct ep93xx_tdesc *txd;
352 int entry; 357 int entry;
353 358
354 if (unlikely(skb->len > MAX_PKT_SIZE)) { 359 if (unlikely(skb->len > MAX_PKT_SIZE)) {
@@ -360,11 +365,14 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
360 entry = ep->tx_pointer; 365 entry = ep->tx_pointer;
361 ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1); 366 ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1);
362 367
363 ep->descs->tdesc[entry].tdesc1 = 368 txd = &ep->descs->tdesc[entry];
364 TDESC1_EOF | (entry << 16) | (skb->len & 0xfff); 369
370 txd->tdesc1 = TDESC1_EOF | (entry << 16) | (skb->len & 0xfff);
371 dma_sync_single_for_cpu(dev->dev.parent, txd->buf_addr, skb->len,
372 DMA_TO_DEVICE);
365 skb_copy_and_csum_dev(skb, ep->tx_buf[entry]); 373 skb_copy_and_csum_dev(skb, ep->tx_buf[entry]);
366 dma_sync_single_for_cpu(NULL, ep->descs->tdesc[entry].buf_addr, 374 dma_sync_single_for_device(dev->dev.parent, txd->buf_addr, skb->len,
367 skb->len, DMA_TO_DEVICE); 375 DMA_TO_DEVICE);
368 dev_kfree_skb(skb); 376 dev_kfree_skb(skb);
369 377
370 spin_lock_irq(&ep->tx_pending_lock); 378 spin_lock_irq(&ep->tx_pending_lock);
@@ -458,89 +466,80 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id)
458 466
459static void ep93xx_free_buffers(struct ep93xx_priv *ep) 467static void ep93xx_free_buffers(struct ep93xx_priv *ep)
460{ 468{
469 struct device *dev = ep->dev->dev.parent;
461 int i; 470 int i;
462 471
463 for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { 472 for (i = 0; i < RX_QUEUE_ENTRIES; i++) {
464 dma_addr_t d; 473 dma_addr_t d;
465 474
466 d = ep->descs->rdesc[i].buf_addr; 475 d = ep->descs->rdesc[i].buf_addr;
467 if (d) 476 if (d)
468 dma_unmap_single(NULL, d, PAGE_SIZE, DMA_FROM_DEVICE); 477 dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_FROM_DEVICE);
469 478
470 if (ep->rx_buf[i] != NULL) 479 if (ep->rx_buf[i] != NULL)
471 free_page((unsigned long)ep->rx_buf[i]); 480 kfree(ep->rx_buf[i]);
472 } 481 }
473 482
474 for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { 483 for (i = 0; i < TX_QUEUE_ENTRIES; i++) {
475 dma_addr_t d; 484 dma_addr_t d;
476 485
477 d = ep->descs->tdesc[i].buf_addr; 486 d = ep->descs->tdesc[i].buf_addr;
478 if (d) 487 if (d)
479 dma_unmap_single(NULL, d, PAGE_SIZE, DMA_TO_DEVICE); 488 dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_TO_DEVICE);
480 489
481 if (ep->tx_buf[i] != NULL) 490 if (ep->tx_buf[i] != NULL)
482 free_page((unsigned long)ep->tx_buf[i]); 491 kfree(ep->tx_buf[i]);
483 } 492 }
484 493
485 dma_free_coherent(NULL, sizeof(struct ep93xx_descs), ep->descs, 494 dma_free_coherent(dev, sizeof(struct ep93xx_descs), ep->descs,
486 ep->descs_dma_addr); 495 ep->descs_dma_addr);
487} 496}
488 497
489/*
490 * The hardware enforces a sub-2K maximum packet size, so we put
491 * two buffers on every hardware page.
492 */
493static int ep93xx_alloc_buffers(struct ep93xx_priv *ep) 498static int ep93xx_alloc_buffers(struct ep93xx_priv *ep)
494{ 499{
500 struct device *dev = ep->dev->dev.parent;
495 int i; 501 int i;
496 502
497 ep->descs = dma_alloc_coherent(NULL, sizeof(struct ep93xx_descs), 503 ep->descs = dma_alloc_coherent(dev, sizeof(struct ep93xx_descs),
498 &ep->descs_dma_addr, GFP_KERNEL | GFP_DMA); 504 &ep->descs_dma_addr, GFP_KERNEL);
499 if (ep->descs == NULL) 505 if (ep->descs == NULL)
500 return 1; 506 return 1;
501 507
502 for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { 508 for (i = 0; i < RX_QUEUE_ENTRIES; i++) {
503 void *page; 509 void *buf;
504 dma_addr_t d; 510 dma_addr_t d;
505 511
506 page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); 512 buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL);
507 if (page == NULL) 513 if (buf == NULL)
508 goto err; 514 goto err;
509 515
510 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_FROM_DEVICE); 516 d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_FROM_DEVICE);
511 if (dma_mapping_error(NULL, d)) { 517 if (dma_mapping_error(dev, d)) {
512 free_page((unsigned long)page); 518 kfree(buf);
513 goto err; 519 goto err;
514 } 520 }
515 521
516 ep->rx_buf[i] = page; 522 ep->rx_buf[i] = buf;
517 ep->descs->rdesc[i].buf_addr = d; 523 ep->descs->rdesc[i].buf_addr = d;
518 ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE; 524 ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE;
519
520 ep->rx_buf[i + 1] = page + PKT_BUF_SIZE;
521 ep->descs->rdesc[i + 1].buf_addr = d + PKT_BUF_SIZE;
522 ep->descs->rdesc[i + 1].rdesc1 = ((i + 1) << 16) | PKT_BUF_SIZE;
523 } 525 }
524 526
525 for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { 527 for (i = 0; i < TX_QUEUE_ENTRIES; i++) {
526 void *page; 528 void *buf;
527 dma_addr_t d; 529 dma_addr_t d;
528 530
529 page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); 531 buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL);
530 if (page == NULL) 532 if (buf == NULL)
531 goto err; 533 goto err;
532 534
533 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_TO_DEVICE); 535 d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_TO_DEVICE);
534 if (dma_mapping_error(NULL, d)) { 536 if (dma_mapping_error(dev, d)) {
535 free_page((unsigned long)page); 537 kfree(buf);
536 goto err; 538 goto err;
537 } 539 }
538 540
539 ep->tx_buf[i] = page; 541 ep->tx_buf[i] = buf;
540 ep->descs->tdesc[i].buf_addr = d; 542 ep->descs->tdesc[i].buf_addr = d;
541
542 ep->tx_buf[i + 1] = page + PKT_BUF_SIZE;
543 ep->descs->tdesc[i + 1].buf_addr = d + PKT_BUF_SIZE;
544 } 543 }
545 544
546 return 0; 545 return 0;
@@ -830,6 +829,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev)
830 } 829 }
831 ep = netdev_priv(dev); 830 ep = netdev_priv(dev);
832 ep->dev = dev; 831 ep->dev = dev;
832 SET_NETDEV_DEV(dev, &pdev->dev);
833 netif_napi_add(dev, &ep->napi, ep93xx_poll, 64); 833 netif_napi_add(dev, &ep->napi, ep93xx_poll, 64);
834 834
835 platform_set_drvdata(pdev, dev); 835 platform_set_drvdata(pdev, dev);
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 68d45ba2d9b9..6c019e148546 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -52,13 +52,13 @@ MODULE_DESCRIPTION(DRV_DESC);
52MODULE_ALIAS("platform:bfin_mac"); 52MODULE_ALIAS("platform:bfin_mac");
53 53
54#if defined(CONFIG_BFIN_MAC_USE_L1) 54#if defined(CONFIG_BFIN_MAC_USE_L1)
55# define bfin_mac_alloc(dma_handle, size) l1_data_sram_zalloc(size) 55# define bfin_mac_alloc(dma_handle, size, num) l1_data_sram_zalloc(size*num)
56# define bfin_mac_free(dma_handle, ptr) l1_data_sram_free(ptr) 56# define bfin_mac_free(dma_handle, ptr, num) l1_data_sram_free(ptr)
57#else 57#else
58# define bfin_mac_alloc(dma_handle, size) \ 58# define bfin_mac_alloc(dma_handle, size, num) \
59 dma_alloc_coherent(NULL, size, dma_handle, GFP_KERNEL) 59 dma_alloc_coherent(NULL, size*num, dma_handle, GFP_KERNEL)
60# define bfin_mac_free(dma_handle, ptr) \ 60# define bfin_mac_free(dma_handle, ptr, num) \
61 dma_free_coherent(NULL, sizeof(*ptr), ptr, dma_handle) 61 dma_free_coherent(NULL, sizeof(*ptr)*num, ptr, dma_handle)
62#endif 62#endif
63 63
64#define PKT_BUF_SZ 1580 64#define PKT_BUF_SZ 1580
@@ -95,7 +95,7 @@ static void desc_list_free(void)
95 t = t->next; 95 t = t->next;
96 } 96 }
97 } 97 }
98 bfin_mac_free(dma_handle, tx_desc); 98 bfin_mac_free(dma_handle, tx_desc, CONFIG_BFIN_TX_DESC_NUM);
99 } 99 }
100 100
101 if (rx_desc) { 101 if (rx_desc) {
@@ -109,7 +109,7 @@ static void desc_list_free(void)
109 r = r->next; 109 r = r->next;
110 } 110 }
111 } 111 }
112 bfin_mac_free(dma_handle, rx_desc); 112 bfin_mac_free(dma_handle, rx_desc, CONFIG_BFIN_RX_DESC_NUM);
113 } 113 }
114} 114}
115 115
@@ -126,13 +126,13 @@ static int desc_list_init(void)
126#endif 126#endif
127 127
128 tx_desc = bfin_mac_alloc(&dma_handle, 128 tx_desc = bfin_mac_alloc(&dma_handle,
129 sizeof(struct net_dma_desc_tx) * 129 sizeof(struct net_dma_desc_tx),
130 CONFIG_BFIN_TX_DESC_NUM); 130 CONFIG_BFIN_TX_DESC_NUM);
131 if (tx_desc == NULL) 131 if (tx_desc == NULL)
132 goto init_error; 132 goto init_error;
133 133
134 rx_desc = bfin_mac_alloc(&dma_handle, 134 rx_desc = bfin_mac_alloc(&dma_handle,
135 sizeof(struct net_dma_desc_rx) * 135 sizeof(struct net_dma_desc_rx),
136 CONFIG_BFIN_RX_DESC_NUM); 136 CONFIG_BFIN_RX_DESC_NUM);
137 if (rx_desc == NULL) 137 if (rx_desc == NULL)
138 goto init_error; 138 goto init_error;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07e866d5a87c..d117280b9cd8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -378,6 +378,8 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)
378 return next; 378 return next;
379} 379}
380 380
381#define bond_queue_mapping(skb) (*(u16 *)((skb)->cb))
382
381/** 383/**
382 * bond_dev_queue_xmit - Prepare skb for xmit. 384 * bond_dev_queue_xmit - Prepare skb for xmit.
383 * 385 *
@@ -390,6 +392,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
390{ 392{
391 skb->dev = slave_dev; 393 skb->dev = slave_dev;
392 skb->priority = 1; 394 skb->priority = 1;
395
396 skb->queue_mapping = bond_queue_mapping(skb);
397
393 if (unlikely(netpoll_tx_running(slave_dev))) 398 if (unlikely(netpoll_tx_running(slave_dev)))
394 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); 399 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
395 else 400 else
@@ -1275,6 +1280,7 @@ static inline int slave_enable_netpoll(struct slave *slave)
1275 goto out; 1280 goto out;
1276 1281
1277 np->dev = slave->dev; 1282 np->dev = slave->dev;
1283 strlcpy(np->dev_name, slave->dev->name, IFNAMSIZ);
1278 err = __netpoll_setup(np); 1284 err = __netpoll_setup(np);
1279 if (err) { 1285 if (err) {
1280 kfree(np); 1286 kfree(np);
@@ -4188,6 +4194,7 @@ static inline int bond_slave_override(struct bonding *bond,
4188 return res; 4194 return res;
4189} 4195}
4190 4196
4197
4191static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) 4198static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
4192{ 4199{
4193 /* 4200 /*
@@ -4198,6 +4205,11 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
4198 */ 4205 */
4199 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0; 4206 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
4200 4207
4208 /*
4209 * Save the original txq to restore before passing to the driver
4210 */
4211 bond_queue_mapping(skb) = skb->queue_mapping;
4212
4201 if (unlikely(txq >= dev->real_num_tx_queues)) { 4213 if (unlikely(txq >= dev->real_num_tx_queues)) {
4202 do { 4214 do {
4203 txq -= dev->real_num_tx_queues; 4215 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/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 7a84e45487e8..7583a9572bcc 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -105,7 +105,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
105 goto out_ep; 105 goto out_ep;
106 106
107 fep->fcc.mem = (void __iomem *)cpm2_immr; 107 fep->fcc.mem = (void __iomem *)cpm2_immr;
108 fpi->dpram_offset = cpm_dpalloc(128, 8); 108 fpi->dpram_offset = cpm_dpalloc(128, 32);
109 if (IS_ERR_VALUE(fpi->dpram_offset)) { 109 if (IS_ERR_VALUE(fpi->dpram_offset)) {
110 ret = fpi->dpram_offset; 110 ret = fpi->dpram_offset;
111 goto out_fcccp; 111 goto out_fcccp;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index def7f7efc803..dc0a7aa42b2e 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
@@ -475,9 +475,6 @@ static const struct net_device_ops gfar_netdev_ops = {
475#endif 475#endif
476}; 476};
477 477
478unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
479unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
480
481void lock_rx_qs(struct gfar_private *priv) 478void lock_rx_qs(struct gfar_private *priv)
482{ 479{
483 int i = 0x0; 480 int i = 0x0;
@@ -872,28 +869,28 @@ static u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar,
872 869
873 rqfar--; 870 rqfar--;
874 rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT; 871 rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT;
875 ftp_rqfpr[rqfar] = rqfpr; 872 priv->ftp_rqfpr[rqfar] = rqfpr;
876 ftp_rqfcr[rqfar] = rqfcr; 873 priv->ftp_rqfcr[rqfar] = rqfcr;
877 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 874 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
878 875
879 rqfar--; 876 rqfar--;
880 rqfcr = RQFCR_CMP_NOMATCH; 877 rqfcr = RQFCR_CMP_NOMATCH;
881 ftp_rqfpr[rqfar] = rqfpr; 878 priv->ftp_rqfpr[rqfar] = rqfpr;
882 ftp_rqfcr[rqfar] = rqfcr; 879 priv->ftp_rqfcr[rqfar] = rqfcr;
883 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 880 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
884 881
885 rqfar--; 882 rqfar--;
886 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND; 883 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND;
887 rqfpr = class; 884 rqfpr = class;
888 ftp_rqfcr[rqfar] = rqfcr; 885 priv->ftp_rqfcr[rqfar] = rqfcr;
889 ftp_rqfpr[rqfar] = rqfpr; 886 priv->ftp_rqfpr[rqfar] = rqfpr;
890 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 887 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
891 888
892 rqfar--; 889 rqfar--;
893 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND; 890 rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND;
894 rqfpr = class; 891 rqfpr = class;
895 ftp_rqfcr[rqfar] = rqfcr; 892 priv->ftp_rqfcr[rqfar] = rqfcr;
896 ftp_rqfpr[rqfar] = rqfpr; 893 priv->ftp_rqfpr[rqfar] = rqfpr;
897 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 894 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
898 895
899 return rqfar; 896 return rqfar;
@@ -908,8 +905,8 @@ static void gfar_init_filer_table(struct gfar_private *priv)
908 905
909 /* Default rule */ 906 /* Default rule */
910 rqfcr = RQFCR_CMP_MATCH; 907 rqfcr = RQFCR_CMP_MATCH;
911 ftp_rqfcr[rqfar] = rqfcr; 908 priv->ftp_rqfcr[rqfar] = rqfcr;
912 ftp_rqfpr[rqfar] = rqfpr; 909 priv->ftp_rqfpr[rqfar] = rqfpr;
913 gfar_write_filer(priv, rqfar, rqfcr, rqfpr); 910 gfar_write_filer(priv, rqfar, rqfcr, rqfpr);
914 911
915 rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6); 912 rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6);
@@ -925,8 +922,8 @@ static void gfar_init_filer_table(struct gfar_private *priv)
925 /* Rest are masked rules */ 922 /* Rest are masked rules */
926 rqfcr = RQFCR_CMP_NOMATCH; 923 rqfcr = RQFCR_CMP_NOMATCH;
927 for (i = 0; i < rqfar; i++) { 924 for (i = 0; i < rqfar; i++) {
928 ftp_rqfcr[i] = rqfcr; 925 priv->ftp_rqfcr[i] = rqfcr;
929 ftp_rqfpr[i] = rqfpr; 926 priv->ftp_rqfpr[i] = rqfpr;
930 gfar_write_filer(priv, i, rqfcr, rqfpr); 927 gfar_write_filer(priv, i, rqfcr, rqfpr);
931 } 928 }
932} 929}
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index a4e690a9aeb9..76f14d044470 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
@@ -1122,10 +1122,12 @@ struct gfar_private {
1122 /* HW time stamping enabled flag */ 1122 /* HW time stamping enabled flag */
1123 int hwts_rx_en; 1123 int hwts_rx_en;
1124 int hwts_tx_en; 1124 int hwts_tx_en;
1125
1126 /*Filer table*/
1127 unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
1128 unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
1125}; 1129};
1126 1130
1127extern unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
1128extern unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];
1129 1131
1130static inline int gfar_has_errata(struct gfar_private *priv, 1132static inline int gfar_has_errata(struct gfar_private *priv,
1131 enum gfar_errata err) 1133 enum gfar_errata err)
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 05103362bebe..2ecdc9a785fa 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
@@ -610,15 +610,15 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
610 if (ethflow & RXH_L2DA) { 610 if (ethflow & RXH_L2DA) {
611 fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH | 611 fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH |
612 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; 612 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0;
613 ftp_rqfpr[priv->cur_filer_idx] = fpr; 613 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
614 ftp_rqfcr[priv->cur_filer_idx] = fcr; 614 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
615 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 615 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
616 priv->cur_filer_idx = priv->cur_filer_idx - 1; 616 priv->cur_filer_idx = priv->cur_filer_idx - 1;
617 617
618 fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH | 618 fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH |
619 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; 619 RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0;
620 ftp_rqfpr[priv->cur_filer_idx] = fpr; 620 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
621 ftp_rqfcr[priv->cur_filer_idx] = fcr; 621 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
622 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 622 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
623 priv->cur_filer_idx = priv->cur_filer_idx - 1; 623 priv->cur_filer_idx = priv->cur_filer_idx - 1;
624 } 624 }
@@ -627,16 +627,16 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
627 fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH | 627 fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH |
628 RQFCR_AND | RQFCR_HASHTBL_0; 628 RQFCR_AND | RQFCR_HASHTBL_0;
629 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 629 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
630 ftp_rqfpr[priv->cur_filer_idx] = fpr; 630 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
631 ftp_rqfcr[priv->cur_filer_idx] = fcr; 631 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
632 priv->cur_filer_idx = priv->cur_filer_idx - 1; 632 priv->cur_filer_idx = priv->cur_filer_idx - 1;
633 } 633 }
634 634
635 if (ethflow & RXH_IP_SRC) { 635 if (ethflow & RXH_IP_SRC) {
636 fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | 636 fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH |
637 RQFCR_AND | RQFCR_HASHTBL_0; 637 RQFCR_AND | RQFCR_HASHTBL_0;
638 ftp_rqfpr[priv->cur_filer_idx] = fpr; 638 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
639 ftp_rqfcr[priv->cur_filer_idx] = fcr; 639 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
640 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 640 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
641 priv->cur_filer_idx = priv->cur_filer_idx - 1; 641 priv->cur_filer_idx = priv->cur_filer_idx - 1;
642 } 642 }
@@ -644,8 +644,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
644 if (ethflow & (RXH_IP_DST)) { 644 if (ethflow & (RXH_IP_DST)) {
645 fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | 645 fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH |
646 RQFCR_AND | RQFCR_HASHTBL_0; 646 RQFCR_AND | RQFCR_HASHTBL_0;
647 ftp_rqfpr[priv->cur_filer_idx] = fpr; 647 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
648 ftp_rqfcr[priv->cur_filer_idx] = fcr; 648 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
649 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 649 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
650 priv->cur_filer_idx = priv->cur_filer_idx - 1; 650 priv->cur_filer_idx = priv->cur_filer_idx - 1;
651 } 651 }
@@ -653,8 +653,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
653 if (ethflow & RXH_L3_PROTO) { 653 if (ethflow & RXH_L3_PROTO) {
654 fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH | 654 fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH |
655 RQFCR_AND | RQFCR_HASHTBL_0; 655 RQFCR_AND | RQFCR_HASHTBL_0;
656 ftp_rqfpr[priv->cur_filer_idx] = fpr; 656 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
657 ftp_rqfcr[priv->cur_filer_idx] = fcr; 657 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
658 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 658 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
659 priv->cur_filer_idx = priv->cur_filer_idx - 1; 659 priv->cur_filer_idx = priv->cur_filer_idx - 1;
660 } 660 }
@@ -662,8 +662,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
662 if (ethflow & RXH_L4_B_0_1) { 662 if (ethflow & RXH_L4_B_0_1) {
663 fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | 663 fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH |
664 RQFCR_AND | RQFCR_HASHTBL_0; 664 RQFCR_AND | RQFCR_HASHTBL_0;
665 ftp_rqfpr[priv->cur_filer_idx] = fpr; 665 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
666 ftp_rqfcr[priv->cur_filer_idx] = fcr; 666 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
667 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 667 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
668 priv->cur_filer_idx = priv->cur_filer_idx - 1; 668 priv->cur_filer_idx = priv->cur_filer_idx - 1;
669 } 669 }
@@ -671,8 +671,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
671 if (ethflow & RXH_L4_B_2_3) { 671 if (ethflow & RXH_L4_B_2_3) {
672 fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | 672 fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH |
673 RQFCR_AND | RQFCR_HASHTBL_0; 673 RQFCR_AND | RQFCR_HASHTBL_0;
674 ftp_rqfpr[priv->cur_filer_idx] = fpr; 674 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr;
675 ftp_rqfcr[priv->cur_filer_idx] = fcr; 675 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr;
676 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); 676 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr);
677 priv->cur_filer_idx = priv->cur_filer_idx - 1; 677 priv->cur_filer_idx = priv->cur_filer_idx - 1;
678 } 678 }
@@ -706,12 +706,12 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
706 } 706 }
707 707
708 for (i = 0; i < MAX_FILER_IDX + 1; i++) { 708 for (i = 0; i < MAX_FILER_IDX + 1; i++) {
709 local_rqfpr[j] = ftp_rqfpr[i]; 709 local_rqfpr[j] = priv->ftp_rqfpr[i];
710 local_rqfcr[j] = ftp_rqfcr[i]; 710 local_rqfcr[j] = priv->ftp_rqfcr[i];
711 j--; 711 j--;
712 if ((ftp_rqfcr[i] == (RQFCR_PID_PARSE | 712 if ((priv->ftp_rqfcr[i] == (RQFCR_PID_PARSE |
713 RQFCR_CLE |RQFCR_AND)) && 713 RQFCR_CLE |RQFCR_AND)) &&
714 (ftp_rqfpr[i] == cmp_rqfpr)) 714 (priv->ftp_rqfpr[i] == cmp_rqfpr))
715 break; 715 break;
716 } 716 }
717 717
@@ -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/hp100.c b/drivers/net/hp100.c
index 8e10d2f6a5ad..c3ecb118c1df 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1580,12 +1580,12 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
1580 hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */ 1580 hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */
1581 1581
1582 lp->txrcommit++; 1582 lp->txrcommit++;
1583 spin_unlock_irqrestore(&lp->lock, flags);
1584 1583
1585 /* Update statistics */
1586 dev->stats.tx_packets++; 1584 dev->stats.tx_packets++;
1587 dev->stats.tx_bytes += skb->len; 1585 dev->stats.tx_bytes += skb->len;
1588 1586
1587 spin_unlock_irqrestore(&lp->lock, flags);
1588
1589 return NETDEV_TX_OK; 1589 return NETDEV_TX_OK;
1590 1590
1591drop: 1591drop:
diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c
index b6060f7538df..a900d5bf2948 100644
--- a/drivers/net/hplance.c
+++ b/drivers/net/hplance.c
@@ -135,7 +135,7 @@ static void __devexit hplance_remove_one(struct dio_dev *d)
135} 135}
136 136
137/* Initialise a single lance board at the given DIO device */ 137/* Initialise a single lance board at the given DIO device */
138static void __init hplance_init(struct net_device *dev, struct dio_dev *d) 138static void __devinit hplance_init(struct net_device *dev, struct dio_dev *d)
139{ 139{
140 unsigned long va = (d->resource.start + DIO_VIRADDRBASE); 140 unsigned long va = (d->resource.start + DIO_VIRADDRBASE);
141 struct hplance_private *lp; 141 struct hplance_private *lp;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index c2e9670d154d..fd64c56a433d 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2372,6 +2372,9 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
2372 } 2372 }
2373#endif /* CONFIG_PCI_IOV */ 2373#endif /* CONFIG_PCI_IOV */
2374 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); 2374 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
2375 /* i350 cannot do RSS and SR-IOV at the same time */
2376 if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
2377 adapter->rss_queues = 1;
2375 2378
2376 /* 2379 /*
2377 * if rss_queues > 4 or vfs are going to be allocated with rss_queues 2380 * if rss_queues > 4 or vfs are going to be allocated with rss_queues
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 684cacec10f8..30f41e62049a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1966,11 +1966,11 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1966 1966
1967 netxen_tso_check(netdev, tx_ring, first_desc, skb); 1967 netxen_tso_check(netdev, tx_ring, first_desc, skb);
1968 1968
1969 netxen_nic_update_cmd_producer(adapter, tx_ring);
1970
1971 adapter->stats.txbytes += skb->len; 1969 adapter->stats.txbytes += skb->len;
1972 adapter->stats.xmitcalled++; 1970 adapter->stats.xmitcalled++;
1973 1971
1972 netxen_nic_update_cmd_producer(adapter, tx_ring);
1973
1974 return NETDEV_TX_OK; 1974 return NETDEV_TX_OK;
1975 1975
1976drop_packet: 1976drop_packet:
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 392a6c4b72e5..a70244306c94 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -58,6 +58,7 @@ config BROADCOM_PHY
58 58
59config BCM63XX_PHY 59config BCM63XX_PHY
60 tristate "Drivers for Broadcom 63xx SOCs internal PHY" 60 tristate "Drivers for Broadcom 63xx SOCs internal PHY"
61 depends on BCM63XX
61 ---help--- 62 ---help---
62 Currently supports the 6348 and 6358 PHYs. 63 Currently supports the 6348 and 6358 PHYs.
63 64
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index b0c9522bb535..2cd8dc5847b4 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -543,11 +543,20 @@ static void recalibrate(struct dp83640_clock *clock)
543 543
544/* time stamping methods */ 544/* time stamping methods */
545 545
546static void decode_evnt(struct dp83640_private *dp83640, 546static int decode_evnt(struct dp83640_private *dp83640,
547 struct phy_txts *phy_txts, u16 ests) 547 void *data, u16 ests)
548{ 548{
549 struct phy_txts *phy_txts;
549 struct ptp_clock_event event; 550 struct ptp_clock_event event;
550 int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK; 551 int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK;
552 u16 ext_status = 0;
553
554 if (ests & MULT_EVNT) {
555 ext_status = *(u16 *) data;
556 data += sizeof(ext_status);
557 }
558
559 phy_txts = data;
551 560
552 switch (words) { /* fall through in every case */ 561 switch (words) { /* fall through in every case */
553 case 3: 562 case 3:
@@ -565,6 +574,9 @@ static void decode_evnt(struct dp83640_private *dp83640,
565 event.timestamp = phy2txts(&dp83640->edata); 574 event.timestamp = phy2txts(&dp83640->edata);
566 575
567 ptp_clock_event(dp83640->clock->ptp_clock, &event); 576 ptp_clock_event(dp83640->clock->ptp_clock, &event);
577
578 words = ext_status ? words + 2 : words + 1;
579 return words * sizeof(u16);
568} 580}
569 581
570static void decode_rxts(struct dp83640_private *dp83640, 582static void decode_rxts(struct dp83640_private *dp83640,
@@ -643,9 +655,7 @@ static void decode_status_frame(struct dp83640_private *dp83640,
643 655
644 } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) { 656 } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) {
645 657
646 phy_txts = (struct phy_txts *) ptr; 658 size = decode_evnt(dp83640, ptr, ests);
647 decode_evnt(dp83640, phy_txts, ests);
648 size = sizeof(*phy_txts);
649 659
650 } else { 660 } else {
651 size = 0; 661 size = 0;
@@ -1034,8 +1044,8 @@ static bool dp83640_rxtstamp(struct phy_device *phydev,
1034 1044
1035 if (is_status_frame(skb, type)) { 1045 if (is_status_frame(skb, type)) {
1036 decode_status_frame(dp83640, skb); 1046 decode_status_frame(dp83640, skb);
1037 /* Let the stack drop this frame. */ 1047 kfree_skb(skb);
1038 return false; 1048 return true;
1039 } 1049 }
1040 1050
1041 SKB_PTP_TYPE(skb) = type; 1051 SKB_PTP_TYPE(skb) = type;
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 6436ba916fe4..c6ba64380829 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -524,7 +524,7 @@ static void ppp_async_process(unsigned long arg)
524#define PUT_BYTE(ap, buf, c, islcp) do { \ 524#define PUT_BYTE(ap, buf, c, islcp) do { \
525 if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\ 525 if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\
526 *buf++ = PPP_ESCAPE; \ 526 *buf++ = PPP_ESCAPE; \
527 *buf++ = c ^ 0x20; \ 527 *buf++ = c ^ PPP_TRANS; \
528 } else \ 528 } else \
529 *buf++ = c; \ 529 *buf++ = c; \
530} while (0) 530} while (0)
@@ -897,7 +897,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
897 sp = skb_put(skb, n); 897 sp = skb_put(skb, n);
898 memcpy(sp, buf, n); 898 memcpy(sp, buf, n);
899 if (ap->state & SC_ESCAPE) { 899 if (ap->state & SC_ESCAPE) {
900 sp[0] ^= 0x20; 900 sp[0] ^= PPP_TRANS;
901 ap->state &= ~SC_ESCAPE; 901 ap->state &= ~SC_ESCAPE;
902 } 902 }
903 } 903 }
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
index e224740c6e2a..1f97db1fc4b1 100644
--- a/drivers/net/pxa168_eth.c
+++ b/drivers/net/pxa168_eth.c
@@ -1276,7 +1276,7 @@ static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1276 wmb(); 1276 wmb();
1277 wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD); 1277 wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD);
1278 1278
1279 stats->tx_bytes += skb->len; 1279 stats->tx_bytes += length;
1280 stats->tx_packets++; 1280 stats->tx_packets++;
1281 dev->trans_start = jiffies; 1281 dev->trans_start = jiffies;
1282 if (pep->tx_ring_size - pep->tx_desc_count <= 1) { 1282 if (pep->tx_ring_size - pep->tx_desc_count <= 1) {
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/r8169.c b/drivers/net/r8169.c
index bc5bb378d008..f8c4435afe51 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1635,7 +1635,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1635 * 1635 *
1636 * (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec 1636 * (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec
1637 */ 1637 */
1638 static const struct { 1638 static const struct rtl_mac_info {
1639 u32 mask; 1639 u32 mask;
1640 u32 val; 1640 u32 val;
1641 int mac_version; 1641 int mac_version;
@@ -1703,7 +1703,8 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1703 1703
1704 /* Catch-all */ 1704 /* Catch-all */
1705 { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE } 1705 { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE }
1706 }, *p = mac_info; 1706 };
1707 const struct rtl_mac_info *p = mac_info;
1707 u32 reg; 1708 u32 reg;
1708 1709
1709 reg = RTL_R32(TxConfig); 1710 reg = RTL_R32(TxConfig);
@@ -3799,7 +3800,7 @@ static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz)
3799 3800
3800static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) 3801static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
3801{ 3802{
3802 static const struct { 3803 static const struct rtl_cfg2_info {
3803 u32 mac_version; 3804 u32 mac_version;
3804 u32 clk; 3805 u32 clk;
3805 u32 val; 3806 u32 val;
@@ -3808,7 +3809,8 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
3808 { RTL_GIGA_MAC_VER_05, PCI_Clock_66MHz, 0x000fffff }, 3809 { RTL_GIGA_MAC_VER_05, PCI_Clock_66MHz, 0x000fffff },
3809 { RTL_GIGA_MAC_VER_06, PCI_Clock_33MHz, 0x00ffff00 }, // 8110SCe 3810 { RTL_GIGA_MAC_VER_06, PCI_Clock_33MHz, 0x00ffff00 }, // 8110SCe
3810 { RTL_GIGA_MAC_VER_06, PCI_Clock_66MHz, 0x00ffffff } 3811 { RTL_GIGA_MAC_VER_06, PCI_Clock_66MHz, 0x00ffffff }
3811 }, *p = cfg2_info; 3812 };
3813 const struct rtl_cfg2_info *p = cfg2_info;
3812 unsigned int i; 3814 unsigned int i;
3813 u32 clk; 3815 u32 clk;
3814 3816
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/tun.c b/drivers/net/tun.c
index 4dab85eecb60..9a6b3824da14 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -460,7 +460,23 @@ static u32 tun_net_fix_features(struct net_device *dev, u32 features)
460 460
461 return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); 461 return (features & tun->set_features) | (features & ~TUN_USER_FEATURES);
462} 462}
463 463#ifdef CONFIG_NET_POLL_CONTROLLER
464static void tun_poll_controller(struct net_device *dev)
465{
466 /*
467 * Tun only receives frames when:
468 * 1) the char device endpoint gets data from user space
469 * 2) the tun socket gets a sendmsg call from user space
470 * Since both of those are syncronous operations, we are guaranteed
471 * never to have pending data when we poll for it
472 * so theres nothing to do here but return.
473 * We need this though so netpoll recognizes us as an interface that
474 * supports polling, which enables bridge devices in virt setups to
475 * still use netconsole
476 */
477 return;
478}
479#endif
464static const struct net_device_ops tun_netdev_ops = { 480static const struct net_device_ops tun_netdev_ops = {
465 .ndo_uninit = tun_net_uninit, 481 .ndo_uninit = tun_net_uninit,
466 .ndo_open = tun_net_open, 482 .ndo_open = tun_net_open,
@@ -468,6 +484,9 @@ static const struct net_device_ops tun_netdev_ops = {
468 .ndo_start_xmit = tun_net_xmit, 484 .ndo_start_xmit = tun_net_xmit,
469 .ndo_change_mtu = tun_net_change_mtu, 485 .ndo_change_mtu = tun_net_change_mtu,
470 .ndo_fix_features = tun_net_fix_features, 486 .ndo_fix_features = tun_net_fix_features,
487#ifdef CONFIG_NET_POLL_CONTROLLER
488 .ndo_poll_controller = tun_poll_controller,
489#endif
471}; 490};
472 491
473static const struct net_device_ops tap_netdev_ops = { 492static const struct net_device_ops tap_netdev_ops = {
@@ -480,6 +499,9 @@ static const struct net_device_ops tap_netdev_ops = {
480 .ndo_set_multicast_list = tun_net_mclist, 499 .ndo_set_multicast_list = tun_net_mclist,
481 .ndo_set_mac_address = eth_mac_addr, 500 .ndo_set_mac_address = eth_mac_addr,
482 .ndo_validate_addr = eth_validate_addr, 501 .ndo_validate_addr = eth_validate_addr,
502#ifdef CONFIG_NET_POLL_CONTROLLER
503 .ndo_poll_controller = tun_poll_controller,
504#endif
483}; 505};
484 506
485/* Initialize net device. */ 507/* Initialize net device. */
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 9d4f9117260f..84d4608153c9 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -385,6 +385,16 @@ config USB_NET_CX82310_ETH
385 router with USB ethernet port. This driver is for routers only, 385 router with USB ethernet port. This driver is for routers only,
386 it will not work with ADSL modems (use cxacru driver instead). 386 it will not work with ADSL modems (use cxacru driver instead).
387 387
388config USB_NET_KALMIA
389 tristate "Samsung Kalmia based LTE USB modem"
390 depends on USB_USBNET
391 help
392 Choose this option if you have a Samsung Kalmia based USB modem
393 as Samsung GT-B3730.
394
395 To compile this driver as a module, choose M here: the
396 module will be called kalmia.
397
388config USB_HSO 398config USB_HSO
389 tristate "Option USB High Speed Mobile Devices" 399 tristate "Option USB High Speed Mobile Devices"
390 depends on USB && RFKILL 400 depends on USB && RFKILL
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index c7ec8a5f0a90..c203fa21f6b1 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
23obj-$(CONFIG_USB_USBNET) += usbnet.o 23obj-$(CONFIG_USB_USBNET) += usbnet.o
24obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o 24obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
25obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o 25obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o
26obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o
26obj-$(CONFIG_USB_IPHETH) += ipheth.o 27obj-$(CONFIG_USB_IPHETH) += ipheth.o
27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o 28obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o 29obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
new file mode 100644
index 000000000000..d965fb1e013e
--- /dev/null
+++ b/drivers/net/usb/kalmia.c
@@ -0,0 +1,384 @@
1/*
2 * USB network interface driver for Samsung Kalmia based LTE USB modem like the
3 * Samsung GT-B3730 and GT-B3710.
4 *
5 * Copyright (C) 2011 Marius Bjoernstad Kotsbak <marius@kotsbak.com>
6 *
7 * Sponsored by Quicklink Video Distribution Services Ltd.
8 *
9 * Based on the cdc_eem module.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/netdevice.h>
20#include <linux/etherdevice.h>
21#include <linux/ctype.h>
22#include <linux/ethtool.h>
23#include <linux/workqueue.h>
24#include <linux/mii.h>
25#include <linux/usb.h>
26#include <linux/crc32.h>
27#include <linux/usb/cdc.h>
28#include <linux/usb/usbnet.h>
29#include <linux/gfp.h>
30
31/*
32 * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control
33 * handled by the "option" module and an ethernet data port handled by this
34 * module.
35 *
36 * The stick must first be switched into modem mode by usb_modeswitch
37 * or similar tool. Then the modem gets sent two initialization packets by
38 * this module, which gives the MAC address of the device. User space can then
39 * connect the modem using AT commands through the ACM port and then use
40 * DHCP on the network interface exposed by this module. Network packets are
41 * sent to and from the modem in a proprietary format discovered after watching
42 * the behavior of the windows driver for the modem.
43 *
44 * More information about the use of the modem is available in usb_modeswitch
45 * forum and the project page:
46 *
47 * http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=465
48 * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver
49 */
50
51/* #define DEBUG */
52/* #define VERBOSE */
53
54#define KALMIA_HEADER_LENGTH 6
55#define KALMIA_ALIGN_SIZE 4
56#define KALMIA_USB_TIMEOUT 10000
57
58/*-------------------------------------------------------------------------*/
59
60static int
61kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len,
62 u8 *buffer, u8 expected_len)
63{
64 int act_len;
65 int status;
66
67 netdev_dbg(dev->net, "Sending init packet");
68
69 status = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 0x02),
70 init_msg, init_msg_len, &act_len, KALMIA_USB_TIMEOUT);
71 if (status != 0) {
72 netdev_err(dev->net,
73 "Error sending init packet. Status %i, length %i\n",
74 status, act_len);
75 return status;
76 }
77 else if (act_len != init_msg_len) {
78 netdev_err(dev->net,
79 "Did not send all of init packet. Bytes sent: %i",
80 act_len);
81 }
82 else {
83 netdev_dbg(dev->net, "Successfully sent init packet.");
84 }
85
86 status = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, 0x81),
87 buffer, expected_len, &act_len, KALMIA_USB_TIMEOUT);
88
89 if (status != 0)
90 netdev_err(dev->net,
91 "Error receiving init result. Status %i, length %i\n",
92 status, act_len);
93 else if (act_len != expected_len)
94 netdev_err(dev->net, "Unexpected init result length: %i\n",
95 act_len);
96
97 return status;
98}
99
100static int
101kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr)
102{
103 char init_msg_1[] =
104 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
105 0x00, 0x00 };
106 char init_msg_2[] =
107 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4,
108 0x00, 0x00 };
109 char receive_buf[28];
110 int status;
111
112 status = kalmia_send_init_packet(dev, init_msg_1, sizeof(init_msg_1)
113 / sizeof(init_msg_1[0]), receive_buf, 24);
114 if (status != 0)
115 return status;
116
117 status = kalmia_send_init_packet(dev, init_msg_2, sizeof(init_msg_2)
118 / sizeof(init_msg_2[0]), receive_buf, 28);
119 if (status != 0)
120 return status;
121
122 memcpy(ethernet_addr, receive_buf + 10, ETH_ALEN);
123
124 return status;
125}
126
127static int
128kalmia_bind(struct usbnet *dev, struct usb_interface *intf)
129{
130 u8 status;
131 u8 ethernet_addr[ETH_ALEN];
132
133 /* Don't bind to AT command interface */
134 if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
135 return -EINVAL;
136
137 dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK);
138 dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK);
139 dev->status = NULL;
140
141 dev->net->hard_header_len += KALMIA_HEADER_LENGTH;
142 dev->hard_mtu = 1400;
143 dev->rx_urb_size = dev->hard_mtu * 10; // Found as optimal after testing
144
145 status = kalmia_init_and_get_ethernet_addr(dev, ethernet_addr);
146
147 if (status < 0) {
148 usb_set_intfdata(intf, NULL);
149 usb_driver_release_interface(driver_of(intf), intf);
150 return status;
151 }
152
153 memcpy(dev->net->dev_addr, ethernet_addr, ETH_ALEN);
154 memcpy(dev->net->perm_addr, ethernet_addr, ETH_ALEN);
155
156 return status;
157}
158
159static struct sk_buff *
160kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
161{
162 struct sk_buff *skb2 = NULL;
163 u16 content_len;
164 unsigned char *header_start;
165 unsigned char ether_type_1, ether_type_2;
166 u8 remainder, padlen = 0;
167
168 if (!skb_cloned(skb)) {
169 int headroom = skb_headroom(skb);
170 int tailroom = skb_tailroom(skb);
171
172 if ((tailroom >= KALMIA_ALIGN_SIZE) && (headroom
173 >= KALMIA_HEADER_LENGTH))
174 goto done;
175
176 if ((headroom + tailroom) > (KALMIA_HEADER_LENGTH
177 + KALMIA_ALIGN_SIZE)) {
178 skb->data = memmove(skb->head + KALMIA_HEADER_LENGTH,
179 skb->data, skb->len);
180 skb_set_tail_pointer(skb, skb->len);
181 goto done;
182 }
183 }
184
185 skb2 = skb_copy_expand(skb, KALMIA_HEADER_LENGTH,
186 KALMIA_ALIGN_SIZE, flags);
187 if (!skb2)
188 return NULL;
189
190 dev_kfree_skb_any(skb);
191 skb = skb2;
192
193 done: header_start = skb_push(skb, KALMIA_HEADER_LENGTH);
194 ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12];
195 ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13];
196
197 netdev_dbg(dev->net, "Sending etherType: %02x%02x", ether_type_1,
198 ether_type_2);
199
200 /* According to empiric data for data packages */
201 header_start[0] = 0x57;
202 header_start[1] = 0x44;
203 content_len = skb->len - KALMIA_HEADER_LENGTH;
204 header_start[2] = (content_len & 0xff); /* low byte */
205 header_start[3] = (content_len >> 8); /* high byte */
206
207 header_start[4] = ether_type_1;
208 header_start[5] = ether_type_2;
209
210 /* Align to 4 bytes by padding with zeros */
211 remainder = skb->len % KALMIA_ALIGN_SIZE;
212 if (remainder > 0) {
213 padlen = KALMIA_ALIGN_SIZE - remainder;
214 memset(skb_put(skb, padlen), 0, padlen);
215 }
216
217 netdev_dbg(
218 dev->net,
219 "Sending package with length %i and padding %i. Header: %02x:%02x:%02x:%02x:%02x:%02x.",
220 content_len, padlen, header_start[0], header_start[1],
221 header_start[2], header_start[3], header_start[4],
222 header_start[5]);
223
224 return skb;
225}
226
227static int
228kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
229{
230 /*
231 * Our task here is to strip off framing, leaving skb with one
232 * data frame for the usbnet framework code to process.
233 */
234 const u8 HEADER_END_OF_USB_PACKET[] =
235 { 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 };
236 const u8 EXPECTED_UNKNOWN_HEADER_1[] =
237 { 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 };
238 const u8 EXPECTED_UNKNOWN_HEADER_2[] =
239 { 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 };
240 u8 i = 0;
241
242 /* incomplete header? */
243 if (skb->len < KALMIA_HEADER_LENGTH)
244 return 0;
245
246 do {
247 struct sk_buff *skb2 = NULL;
248 u8 *header_start;
249 u16 usb_packet_length, ether_packet_length;
250 int is_last;
251
252 header_start = skb->data;
253
254 if (unlikely(header_start[0] != 0x57 || header_start[1] != 0x44)) {
255 if (!memcmp(header_start, EXPECTED_UNKNOWN_HEADER_1,
256 sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp(
257 header_start, EXPECTED_UNKNOWN_HEADER_2,
258 sizeof(EXPECTED_UNKNOWN_HEADER_2))) {
259 netdev_dbg(
260 dev->net,
261 "Received expected unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
262 header_start[0], header_start[1],
263 header_start[2], header_start[3],
264 header_start[4], header_start[5],
265 skb->len - KALMIA_HEADER_LENGTH);
266 }
267 else {
268 netdev_err(
269 dev->net,
270 "Received unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
271 header_start[0], header_start[1],
272 header_start[2], header_start[3],
273 header_start[4], header_start[5],
274 skb->len - KALMIA_HEADER_LENGTH);
275 return 0;
276 }
277 }
278 else
279 netdev_dbg(
280 dev->net,
281 "Received header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
282 header_start[0], header_start[1], header_start[2],
283 header_start[3], header_start[4], header_start[5],
284 skb->len - KALMIA_HEADER_LENGTH);
285
286 /* subtract start header and end header */
287 usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH);
288 ether_packet_length = header_start[2] + (header_start[3] << 8);
289 skb_pull(skb, KALMIA_HEADER_LENGTH);
290
291 /* Some small packets misses end marker */
292 if (usb_packet_length < ether_packet_length) {
293 ether_packet_length = usb_packet_length
294 + KALMIA_HEADER_LENGTH;
295 is_last = true;
296 }
297 else {
298 netdev_dbg(dev->net, "Correct package length #%i", i
299 + 1);
300
301 is_last = (memcmp(skb->data + ether_packet_length,
302 HEADER_END_OF_USB_PACKET,
303 sizeof(HEADER_END_OF_USB_PACKET)) == 0);
304 if (!is_last) {
305 header_start = skb->data + ether_packet_length;
306 netdev_dbg(
307 dev->net,
308 "End header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
309 header_start[0], header_start[1],
310 header_start[2], header_start[3],
311 header_start[4], header_start[5],
312 skb->len - KALMIA_HEADER_LENGTH);
313 }
314 }
315
316 if (is_last) {
317 skb2 = skb;
318 }
319 else {
320 skb2 = skb_clone(skb, GFP_ATOMIC);
321 if (unlikely(!skb2))
322 return 0;
323 }
324
325 skb_trim(skb2, ether_packet_length);
326
327 if (is_last) {
328 return 1;
329 }
330 else {
331 usbnet_skb_return(dev, skb2);
332 skb_pull(skb, ether_packet_length);
333 }
334
335 i++;
336 }
337 while (skb->len);
338
339 return 1;
340}
341
342static const struct driver_info kalmia_info = {
343 .description = "Samsung Kalmia LTE USB dongle",
344 .flags = FLAG_WWAN,
345 .bind = kalmia_bind,
346 .rx_fixup = kalmia_rx_fixup,
347 .tx_fixup = kalmia_tx_fixup
348};
349
350/*-------------------------------------------------------------------------*/
351
352static const struct usb_device_id products[] = {
353 /* The unswitched USB ID, to get the module auto loaded: */
354 { USB_DEVICE(0x04e8, 0x689a) },
355 /* The stick swithed into modem (by e.g. usb_modeswitch): */
356 { USB_DEVICE(0x04e8, 0x6889),
357 .driver_info = (unsigned long) &kalmia_info, },
358 { /* EMPTY == end of list */} };
359MODULE_DEVICE_TABLE( usb, products);
360
361static struct usb_driver kalmia_driver = {
362 .name = "kalmia",
363 .id_table = products,
364 .probe = usbnet_probe,
365 .disconnect = usbnet_disconnect,
366 .suspend = usbnet_suspend,
367 .resume = usbnet_resume
368};
369
370static int __init kalmia_init(void)
371{
372 return usb_register(&kalmia_driver);
373}
374module_init( kalmia_init);
375
376static void __exit kalmia_exit(void)
377{
378 usb_deregister(&kalmia_driver);
379}
380module_exit( kalmia_exit);
381
382MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>");
383MODULE_DESCRIPTION("Samsung Kalmia USB network driver");
384MODULE_LICENSE("GPL");
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 1eba06f6fa4c..0f27f4c5bb73 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2204,8 +2204,10 @@ fst_open(struct net_device *dev)
2204 2204
2205 if (port->mode != FST_RAW) { 2205 if (port->mode != FST_RAW) {
2206 err = hdlc_open(dev); 2206 err = hdlc_open(dev);
2207 if (err) 2207 if (err) {
2208 module_put(THIS_MODULE);
2208 return err; 2209 return err;
2210 }
2209 } 2211 }
2210 2212
2211 fst_openport(port); 2213 fst_openport(port);
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 3a022bcf615c..9cf96cb51712 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1216,10 +1216,10 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
1216 * receive commit_rxon request 1216 * receive commit_rxon request
1217 * abort any previous channel switch if still in process 1217 * abort any previous channel switch if still in process
1218 */ 1218 */
1219 if (priv->switch_rxon.switch_in_progress && 1219 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
1220 (priv->switch_rxon.channel != ctx->staging.channel)) { 1220 (priv->switch_channel != ctx->staging.channel)) {
1221 IWL_DEBUG_11H(priv, "abort channel switch on %d\n", 1221 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
1222 le16_to_cpu(priv->switch_rxon.channel)); 1222 le16_to_cpu(priv->switch_channel));
1223 iwl_legacy_chswitch_done(priv, false); 1223 iwl_legacy_chswitch_done(priv, false);
1224 } 1224 }
1225 1225
@@ -1402,9 +1402,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1402 return rc; 1402 return rc;
1403 } 1403 }
1404 1404
1405 priv->switch_rxon.channel = cmd.channel;
1406 priv->switch_rxon.switch_in_progress = true;
1407
1408 return iwl_legacy_send_cmd_pdu(priv, 1405 return iwl_legacy_send_cmd_pdu(priv,
1409 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 1406 REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
1410} 1407}
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 416448acd971..0a8d07fdc0e7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -856,17 +856,6 @@ struct traffic_stats {
856}; 856};
857 857
858/* 858/*
859 * iwl_switch_rxon: "channel switch" structure
860 *
861 * @ switch_in_progress: channel switch in progress
862 * @ channel: new channel
863 */
864struct iwl_switch_rxon {
865 bool switch_in_progress;
866 __le16 channel;
867};
868
869/*
870 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds 859 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
871 * to perform continuous uCode event logging operation if enabled 860 * to perform continuous uCode event logging operation if enabled
872 */ 861 */
@@ -1116,7 +1105,7 @@ struct iwl_priv {
1116 1105
1117 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; 1106 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
1118 1107
1119 struct iwl_switch_rxon switch_rxon; 1108 __le16 switch_channel;
1120 1109
1121 /* 1st responses from initialize and runtime uCode images. 1110 /* 1st responses from initialize and runtime uCode images.
1122 * _4965's initialize alive response contains some calibration data. */ 1111 * _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/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 660831ce293c..687c1f223497 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1288,6 +1288,8 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac,
1288 1288
1289 *(unsigned long *) wdev_priv = (unsigned long) priv; 1289 *(unsigned long *) wdev_priv = (unsigned long) priv;
1290 1290
1291 set_wiphy_dev(wdev->wiphy, (struct device *) priv->adapter->dev);
1292
1291 ret = wiphy_register(wdev->wiphy); 1293 ret = wiphy_register(wdev->wiphy);
1292 if (ret < 0) { 1294 if (ret < 0) {
1293 dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", 1295 dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n",
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 8ff43c281411..d633edbd9796 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -2475,6 +2475,7 @@ struct mwl8k_cmd_set_hw_spec {
2475 * faster client. 2475 * faster client.
2476 */ 2476 */
2477#define MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY 0x00000400 2477#define MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY 0x00000400
2478#define MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR 0x00000200
2478#define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT 0x00000080 2479#define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT 0x00000080
2479#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP 0x00000020 2480#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP 0x00000020
2480#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON 0x00000010 2481#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON 0x00000010
@@ -2511,7 +2512,8 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw)
2511 cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT | 2512 cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT |
2512 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP | 2513 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP |
2513 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON | 2514 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON |
2514 MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY); 2515 MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY |
2516 MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR);
2515 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); 2517 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS);
2516 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); 2518 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS);
2517 2519
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index fc44005b0d53..e502db0532e5 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -670,6 +670,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
670 &rx_status, 670 &rx_status,
671 (u8 *) pdesc, skb); 671 (u8 *) pdesc, skb);
672 672
673 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
674 if (unlikely(!new_skb)) {
675 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
676 DBG_DMESG,
677 ("can't alloc skb for rx\n"));
678 goto done;
679 }
680
681 pci_unmap_single(rtlpci->pdev,
682 *((dma_addr_t *) skb->cb),
683 rtlpci->rxbuffersize,
684 PCI_DMA_FROMDEVICE);
685
673 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, 686 skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
674 false, 687 false,
675 HW_DESC_RXPKT_LEN)); 688 HW_DESC_RXPKT_LEN));
@@ -686,21 +699,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
686 hdr = rtl_get_hdr(skb); 699 hdr = rtl_get_hdr(skb);
687 fc = rtl_get_fc(skb); 700 fc = rtl_get_fc(skb);
688 701
689 /* try for new buffer - if allocation fails, drop
690 * frame and reuse old buffer
691 */
692 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
693 if (unlikely(!new_skb)) {
694 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
695 DBG_DMESG,
696 ("can't alloc skb for rx\n"));
697 goto done;
698 }
699 pci_unmap_single(rtlpci->pdev,
700 *((dma_addr_t *) skb->cb),
701 rtlpci->rxbuffersize,
702 PCI_DMA_FROMDEVICE);
703
704 if (!stats.crc && !stats.hwerror) { 702 if (!stats.crc && !stats.hwerror) {
705 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, 703 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
706 sizeof(rx_status)); 704 sizeof(rx_status));