aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-03-21 10:57:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-21 10:57:45 -0400
commit7d3628b230ecbdc29566c18bc7800ff8ed66a71f (patch)
treeeac1bff40bdb655fdfdeaf1e22ce12a81296f1fb /drivers
parent2c7871982cf27caaddbaeb7e2121ce1374b520ff (diff)
parent94833dfb8c98ed4ca1944dd2c1339d88a2d1c758 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (46 commits) [NET] ifb: set separate lockdep classes for queue locks [IPV6] KCONFIG: Fix description about IPV6_TUNNEL. [TCP]: Fix shrinking windows with window scaling netpoll: zap_completion_queue: adjust skb->users counter bridge: use time_before() in br_fdb_cleanup() [TG3]: Fix build warning on sparc32. MAINTAINERS: bluez-devel is subscribers-only audit: netlink socket can be auto-bound to pid other than current->pid (v2) [NET]: Fix permissions of /proc/net [SCTP]: Fix a race between module load and protosw access [NETFILTER]: ipt_recent: sanity check hit count [NETFILTER]: nf_conntrack_h323: logical-bitwise & confusion in process_setup() [RT2X00] drivers/net/wireless/rt2x00/rt2x00dev.c: remove dead code, fix warning [IPV4]: esp_output() misannotations [8021Q]: vlan_dev misannotations xfrm: ->eth_proto is __be16 [IPV4]: ipv4_is_lbcast() misannotations [SUNRPC]: net/* NULL noise [SCTP]: fix misannotated __sctp_rcv_asconf_lookup() [PKT_SCHED]: annotate cls_u32 ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/fore200e.c110
-rw-r--r--drivers/atm/fore200e.h106
-rw-r--r--drivers/net/3c501.c16
-rw-r--r--drivers/net/atl1/atl1_main.c3
-rw-r--r--drivers/net/cxgb3/sge.c12
-rw-r--r--drivers/net/epic100.c47
-rw-r--r--drivers/net/forcedeth.c118
-rw-r--r--drivers/net/ibm_newemac/core.c7
-rw-r--r--drivers/net/ibm_newemac/tah.c4
-rw-r--r--drivers/net/ifb.c15
-rw-r--r--drivers/net/igb/igb_main.c21
-rw-r--r--drivers/net/ioc3-eth.c3
-rw-r--r--drivers/net/ipg.c10
-rw-r--r--drivers/net/ne2k-pci.c8
-rw-r--r--drivers/net/ps3_gelic_wireless.c29
-rw-r--r--drivers/net/r6040.c10
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/net/tulip/de2104x.c10
-rw-r--r--drivers/net/ucc_geth.c6
-rw-r--r--drivers/net/usb/rndis_host.c12
-rw-r--r--drivers/net/wan/farsync.c17
-rw-r--r--drivers/net/wireless/ath5k/hw.c2
-rw-r--r--drivers/net/wireless/b43/phy.c2
-rw-r--r--drivers/net/wireless/p54usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c38
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00rfkill.c116
-rw-r--r--drivers/sn/ioc3.c22
29 files changed, 486 insertions, 288 deletions
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 9427a61f62b0..432181ed7bb5 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -1988,19 +1988,19 @@ fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg)
1988 if (fore200e_getstats(fore200e) < 0) 1988 if (fore200e_getstats(fore200e) < 0)
1989 return -EIO; 1989 return -EIO;
1990 1990
1991 tmp.section_bip = cpu_to_be32(fore200e->stats->oc3.section_bip8_errors); 1991 tmp.section_bip = be32_to_cpu(fore200e->stats->oc3.section_bip8_errors);
1992 tmp.line_bip = cpu_to_be32(fore200e->stats->oc3.line_bip24_errors); 1992 tmp.line_bip = be32_to_cpu(fore200e->stats->oc3.line_bip24_errors);
1993 tmp.path_bip = cpu_to_be32(fore200e->stats->oc3.path_bip8_errors); 1993 tmp.path_bip = be32_to_cpu(fore200e->stats->oc3.path_bip8_errors);
1994 tmp.line_febe = cpu_to_be32(fore200e->stats->oc3.line_febe_errors); 1994 tmp.line_febe = be32_to_cpu(fore200e->stats->oc3.line_febe_errors);
1995 tmp.path_febe = cpu_to_be32(fore200e->stats->oc3.path_febe_errors); 1995 tmp.path_febe = be32_to_cpu(fore200e->stats->oc3.path_febe_errors);
1996 tmp.corr_hcs = cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors); 1996 tmp.corr_hcs = be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors);
1997 tmp.uncorr_hcs = cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors); 1997 tmp.uncorr_hcs = be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors);
1998 tmp.tx_cells = cpu_to_be32(fore200e->stats->aal0.cells_transmitted) + 1998 tmp.tx_cells = be32_to_cpu(fore200e->stats->aal0.cells_transmitted) +
1999 cpu_to_be32(fore200e->stats->aal34.cells_transmitted) + 1999 be32_to_cpu(fore200e->stats->aal34.cells_transmitted) +
2000 cpu_to_be32(fore200e->stats->aal5.cells_transmitted); 2000 be32_to_cpu(fore200e->stats->aal5.cells_transmitted);
2001 tmp.rx_cells = cpu_to_be32(fore200e->stats->aal0.cells_received) + 2001 tmp.rx_cells = be32_to_cpu(fore200e->stats->aal0.cells_received) +
2002 cpu_to_be32(fore200e->stats->aal34.cells_received) + 2002 be32_to_cpu(fore200e->stats->aal34.cells_received) +
2003 cpu_to_be32(fore200e->stats->aal5.cells_received); 2003 be32_to_cpu(fore200e->stats->aal5.cells_received);
2004 2004
2005 if (arg) 2005 if (arg)
2006 return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; 2006 return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0;
@@ -2587,7 +2587,7 @@ fore200e_start_fw(struct fore200e* fore200e)
2587static int __devinit 2587static int __devinit
2588fore200e_load_fw(struct fore200e* fore200e) 2588fore200e_load_fw(struct fore200e* fore200e)
2589{ 2589{
2590 u32* fw_data = (u32*) fore200e->bus->fw_data; 2590 __le32* fw_data = (__le32*) fore200e->bus->fw_data;
2591 u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32); 2591 u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32);
2592 2592
2593 struct fw_header* fw_header = (struct fw_header*) fw_data; 2593 struct fw_header* fw_header = (struct fw_header*) fw_data;
@@ -2965,8 +2965,8 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
2965 " 4b5b:\n" 2965 " 4b5b:\n"
2966 " crc_header_errors:\t\t%10u\n" 2966 " crc_header_errors:\t\t%10u\n"
2967 " framing_errors:\t\t%10u\n", 2967 " framing_errors:\t\t%10u\n",
2968 cpu_to_be32(fore200e->stats->phy.crc_header_errors), 2968 be32_to_cpu(fore200e->stats->phy.crc_header_errors),
2969 cpu_to_be32(fore200e->stats->phy.framing_errors)); 2969 be32_to_cpu(fore200e->stats->phy.framing_errors));
2970 2970
2971 if (!left--) 2971 if (!left--)
2972 return sprintf(page, "\n" 2972 return sprintf(page, "\n"
@@ -2978,13 +2978,13 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
2978 " path_febe_errors:\t\t%10u\n" 2978 " path_febe_errors:\t\t%10u\n"
2979 " corr_hcs_errors:\t\t%10u\n" 2979 " corr_hcs_errors:\t\t%10u\n"
2980 " ucorr_hcs_errors:\t\t%10u\n", 2980 " ucorr_hcs_errors:\t\t%10u\n",
2981 cpu_to_be32(fore200e->stats->oc3.section_bip8_errors), 2981 be32_to_cpu(fore200e->stats->oc3.section_bip8_errors),
2982 cpu_to_be32(fore200e->stats->oc3.path_bip8_errors), 2982 be32_to_cpu(fore200e->stats->oc3.path_bip8_errors),
2983 cpu_to_be32(fore200e->stats->oc3.line_bip24_errors), 2983 be32_to_cpu(fore200e->stats->oc3.line_bip24_errors),
2984 cpu_to_be32(fore200e->stats->oc3.line_febe_errors), 2984 be32_to_cpu(fore200e->stats->oc3.line_febe_errors),
2985 cpu_to_be32(fore200e->stats->oc3.path_febe_errors), 2985 be32_to_cpu(fore200e->stats->oc3.path_febe_errors),
2986 cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors), 2986 be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors),
2987 cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors)); 2987 be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors));
2988 2988
2989 if (!left--) 2989 if (!left--)
2990 return sprintf(page,"\n" 2990 return sprintf(page,"\n"
@@ -2995,12 +2995,12 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
2995 " vpi no conn:\t\t%10u\n" 2995 " vpi no conn:\t\t%10u\n"
2996 " vci out of range:\t\t%10u\n" 2996 " vci out of range:\t\t%10u\n"
2997 " vci no conn:\t\t%10u\n", 2997 " vci no conn:\t\t%10u\n",
2998 cpu_to_be32(fore200e->stats->atm.cells_transmitted), 2998 be32_to_cpu(fore200e->stats->atm.cells_transmitted),
2999 cpu_to_be32(fore200e->stats->atm.cells_received), 2999 be32_to_cpu(fore200e->stats->atm.cells_received),
3000 cpu_to_be32(fore200e->stats->atm.vpi_bad_range), 3000 be32_to_cpu(fore200e->stats->atm.vpi_bad_range),
3001 cpu_to_be32(fore200e->stats->atm.vpi_no_conn), 3001 be32_to_cpu(fore200e->stats->atm.vpi_no_conn),
3002 cpu_to_be32(fore200e->stats->atm.vci_bad_range), 3002 be32_to_cpu(fore200e->stats->atm.vci_bad_range),
3003 cpu_to_be32(fore200e->stats->atm.vci_no_conn)); 3003 be32_to_cpu(fore200e->stats->atm.vci_no_conn));
3004 3004
3005 if (!left--) 3005 if (!left--)
3006 return sprintf(page,"\n" 3006 return sprintf(page,"\n"
@@ -3008,9 +3008,9 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
3008 " TX:\t\t\t%10u\n" 3008 " TX:\t\t\t%10u\n"
3009 " RX:\t\t\t%10u\n" 3009 " RX:\t\t\t%10u\n"
3010 " dropped:\t\t\t%10u\n", 3010 " dropped:\t\t\t%10u\n",
3011 cpu_to_be32(fore200e->stats->aal0.cells_transmitted), 3011 be32_to_cpu(fore200e->stats->aal0.cells_transmitted),
3012 cpu_to_be32(fore200e->stats->aal0.cells_received), 3012 be32_to_cpu(fore200e->stats->aal0.cells_received),
3013 cpu_to_be32(fore200e->stats->aal0.cells_dropped)); 3013 be32_to_cpu(fore200e->stats->aal0.cells_dropped));
3014 3014
3015 if (!left--) 3015 if (!left--)
3016 return sprintf(page,"\n" 3016 return sprintf(page,"\n"
@@ -3026,15 +3026,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
3026 " RX:\t\t\t%10u\n" 3026 " RX:\t\t\t%10u\n"
3027 " dropped:\t\t\t%10u\n" 3027 " dropped:\t\t\t%10u\n"
3028 " protocol errors:\t\t%10u\n", 3028 " protocol errors:\t\t%10u\n",
3029 cpu_to_be32(fore200e->stats->aal34.cells_transmitted), 3029 be32_to_cpu(fore200e->stats->aal34.cells_transmitted),
3030 cpu_to_be32(fore200e->stats->aal34.cells_received), 3030 be32_to_cpu(fore200e->stats->aal34.cells_received),
3031 cpu_to_be32(fore200e->stats->aal34.cells_dropped), 3031 be32_to_cpu(fore200e->stats->aal34.cells_dropped),
3032 cpu_to_be32(fore200e->stats->aal34.cells_crc_errors), 3032 be32_to_cpu(fore200e->stats->aal34.cells_crc_errors),
3033 cpu_to_be32(fore200e->stats->aal34.cells_protocol_errors), 3033 be32_to_cpu(fore200e->stats->aal34.cells_protocol_errors),
3034 cpu_to_be32(fore200e->stats->aal34.cspdus_transmitted), 3034 be32_to_cpu(fore200e->stats->aal34.cspdus_transmitted),
3035 cpu_to_be32(fore200e->stats->aal34.cspdus_received), 3035 be32_to_cpu(fore200e->stats->aal34.cspdus_received),
3036 cpu_to_be32(fore200e->stats->aal34.cspdus_dropped), 3036 be32_to_cpu(fore200e->stats->aal34.cspdus_dropped),
3037 cpu_to_be32(fore200e->stats->aal34.cspdus_protocol_errors)); 3037 be32_to_cpu(fore200e->stats->aal34.cspdus_protocol_errors));
3038 3038
3039 if (!left--) 3039 if (!left--)
3040 return sprintf(page,"\n" 3040 return sprintf(page,"\n"
@@ -3050,15 +3050,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
3050 " dropped:\t\t\t%10u\n" 3050 " dropped:\t\t\t%10u\n"
3051 " CRC errors:\t\t%10u\n" 3051 " CRC errors:\t\t%10u\n"
3052 " protocol errors:\t\t%10u\n", 3052 " protocol errors:\t\t%10u\n",
3053 cpu_to_be32(fore200e->stats->aal5.cells_transmitted), 3053 be32_to_cpu(fore200e->stats->aal5.cells_transmitted),
3054 cpu_to_be32(fore200e->stats->aal5.cells_received), 3054 be32_to_cpu(fore200e->stats->aal5.cells_received),
3055 cpu_to_be32(fore200e->stats->aal5.cells_dropped), 3055 be32_to_cpu(fore200e->stats->aal5.cells_dropped),
3056 cpu_to_be32(fore200e->stats->aal5.congestion_experienced), 3056 be32_to_cpu(fore200e->stats->aal5.congestion_experienced),
3057 cpu_to_be32(fore200e->stats->aal5.cspdus_transmitted), 3057 be32_to_cpu(fore200e->stats->aal5.cspdus_transmitted),
3058 cpu_to_be32(fore200e->stats->aal5.cspdus_received), 3058 be32_to_cpu(fore200e->stats->aal5.cspdus_received),
3059 cpu_to_be32(fore200e->stats->aal5.cspdus_dropped), 3059 be32_to_cpu(fore200e->stats->aal5.cspdus_dropped),
3060 cpu_to_be32(fore200e->stats->aal5.cspdus_crc_errors), 3060 be32_to_cpu(fore200e->stats->aal5.cspdus_crc_errors),
3061 cpu_to_be32(fore200e->stats->aal5.cspdus_protocol_errors)); 3061 be32_to_cpu(fore200e->stats->aal5.cspdus_protocol_errors));
3062 3062
3063 if (!left--) 3063 if (!left--)
3064 return sprintf(page,"\n" 3064 return sprintf(page,"\n"
@@ -3069,11 +3069,11 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page)
3069 " large b2:\t\t\t%10u\n" 3069 " large b2:\t\t\t%10u\n"
3070 " RX PDUs:\t\t\t%10u\n" 3070 " RX PDUs:\t\t\t%10u\n"
3071 " TX PDUs:\t\t\t%10lu\n", 3071 " TX PDUs:\t\t\t%10lu\n",
3072 cpu_to_be32(fore200e->stats->aux.small_b1_failed), 3072 be32_to_cpu(fore200e->stats->aux.small_b1_failed),
3073 cpu_to_be32(fore200e->stats->aux.large_b1_failed), 3073 be32_to_cpu(fore200e->stats->aux.large_b1_failed),
3074 cpu_to_be32(fore200e->stats->aux.small_b2_failed), 3074 be32_to_cpu(fore200e->stats->aux.small_b2_failed),
3075 cpu_to_be32(fore200e->stats->aux.large_b2_failed), 3075 be32_to_cpu(fore200e->stats->aux.large_b2_failed),
3076 cpu_to_be32(fore200e->stats->aux.rpd_alloc_failed), 3076 be32_to_cpu(fore200e->stats->aux.rpd_alloc_failed),
3077 fore200e->tx_sat); 3077 fore200e->tx_sat);
3078 3078
3079 if (!left--) 3079 if (!left--)
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h
index b85a54613dea..183841cc8fdf 100644
--- a/drivers/atm/fore200e.h
+++ b/drivers/atm/fore200e.h
@@ -349,90 +349,90 @@ typedef struct oc3_block {
349/* physical encoding statistics */ 349/* physical encoding statistics */
350 350
351typedef struct stats_phy { 351typedef struct stats_phy {
352 u32 crc_header_errors; /* cells received with bad header CRC */ 352 __be32 crc_header_errors; /* cells received with bad header CRC */
353 u32 framing_errors; /* cells received with bad framing */ 353 __be32 framing_errors; /* cells received with bad framing */
354 u32 pad[ 2 ]; /* i960 padding */ 354 __be32 pad[ 2 ]; /* i960 padding */
355} stats_phy_t; 355} stats_phy_t;
356 356
357 357
358/* OC-3 statistics */ 358/* OC-3 statistics */
359 359
360typedef struct stats_oc3 { 360typedef struct stats_oc3 {
361 u32 section_bip8_errors; /* section 8 bit interleaved parity */ 361 __be32 section_bip8_errors; /* section 8 bit interleaved parity */
362 u32 path_bip8_errors; /* path 8 bit interleaved parity */ 362 __be32 path_bip8_errors; /* path 8 bit interleaved parity */
363 u32 line_bip24_errors; /* line 24 bit interleaved parity */ 363 __be32 line_bip24_errors; /* line 24 bit interleaved parity */
364 u32 line_febe_errors; /* line far end block errors */ 364 __be32 line_febe_errors; /* line far end block errors */
365 u32 path_febe_errors; /* path far end block errors */ 365 __be32 path_febe_errors; /* path far end block errors */
366 u32 corr_hcs_errors; /* correctable header check sequence */ 366 __be32 corr_hcs_errors; /* correctable header check sequence */
367 u32 ucorr_hcs_errors; /* uncorrectable header check sequence */ 367 __be32 ucorr_hcs_errors; /* uncorrectable header check sequence */
368 u32 pad[ 1 ]; /* i960 padding */ 368 __be32 pad[ 1 ]; /* i960 padding */
369} stats_oc3_t; 369} stats_oc3_t;
370 370
371 371
372/* ATM statistics */ 372/* ATM statistics */
373 373
374typedef struct stats_atm { 374typedef struct stats_atm {
375 u32 cells_transmitted; /* cells transmitted */ 375 __be32 cells_transmitted; /* cells transmitted */
376 u32 cells_received; /* cells received */ 376 __be32 cells_received; /* cells received */
377 u32 vpi_bad_range; /* cell drops: VPI out of range */ 377 __be32 vpi_bad_range; /* cell drops: VPI out of range */
378 u32 vpi_no_conn; /* cell drops: no connection for VPI */ 378 __be32 vpi_no_conn; /* cell drops: no connection for VPI */
379 u32 vci_bad_range; /* cell drops: VCI out of range */ 379 __be32 vci_bad_range; /* cell drops: VCI out of range */
380 u32 vci_no_conn; /* cell drops: no connection for VCI */ 380 __be32 vci_no_conn; /* cell drops: no connection for VCI */
381 u32 pad[ 2 ]; /* i960 padding */ 381 __be32 pad[ 2 ]; /* i960 padding */
382} stats_atm_t; 382} stats_atm_t;
383 383
384/* AAL0 statistics */ 384/* AAL0 statistics */
385 385
386typedef struct stats_aal0 { 386typedef struct stats_aal0 {
387 u32 cells_transmitted; /* cells transmitted */ 387 __be32 cells_transmitted; /* cells transmitted */
388 u32 cells_received; /* cells received */ 388 __be32 cells_received; /* cells received */
389 u32 cells_dropped; /* cells dropped */ 389 __be32 cells_dropped; /* cells dropped */
390 u32 pad[ 1 ]; /* i960 padding */ 390 __be32 pad[ 1 ]; /* i960 padding */
391} stats_aal0_t; 391} stats_aal0_t;
392 392
393 393
394/* AAL3/4 statistics */ 394/* AAL3/4 statistics */
395 395
396typedef struct stats_aal34 { 396typedef struct stats_aal34 {
397 u32 cells_transmitted; /* cells transmitted from segmented PDUs */ 397 __be32 cells_transmitted; /* cells transmitted from segmented PDUs */
398 u32 cells_received; /* cells reassembled into PDUs */ 398 __be32 cells_received; /* cells reassembled into PDUs */
399 u32 cells_crc_errors; /* payload CRC error count */ 399 __be32 cells_crc_errors; /* payload CRC error count */
400 u32 cells_protocol_errors; /* SAR or CS layer protocol errors */ 400 __be32 cells_protocol_errors; /* SAR or CS layer protocol errors */
401 u32 cells_dropped; /* cells dropped: partial reassembly */ 401 __be32 cells_dropped; /* cells dropped: partial reassembly */
402 u32 cspdus_transmitted; /* CS PDUs transmitted */ 402 __be32 cspdus_transmitted; /* CS PDUs transmitted */
403 u32 cspdus_received; /* CS PDUs received */ 403 __be32 cspdus_received; /* CS PDUs received */
404 u32 cspdus_protocol_errors; /* CS layer protocol errors */ 404 __be32 cspdus_protocol_errors; /* CS layer protocol errors */
405 u32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ 405 __be32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */
406 u32 pad[ 3 ]; /* i960 padding */ 406 __be32 pad[ 3 ]; /* i960 padding */
407} stats_aal34_t; 407} stats_aal34_t;
408 408
409 409
410/* AAL5 statistics */ 410/* AAL5 statistics */
411 411
412typedef struct stats_aal5 { 412typedef struct stats_aal5 {
413 u32 cells_transmitted; /* cells transmitted from segmented SDUs */ 413 __be32 cells_transmitted; /* cells transmitted from segmented SDUs */
414 u32 cells_received; /* cells reassembled into SDUs */ 414 __be32 cells_received; /* cells reassembled into SDUs */
415 u32 cells_dropped; /* reassembled PDUs dropped (in cells) */ 415 __be32 cells_dropped; /* reassembled PDUs dropped (in cells) */
416 u32 congestion_experienced; /* CRC error and length wrong */ 416 __be32 congestion_experienced; /* CRC error and length wrong */
417 u32 cspdus_transmitted; /* CS PDUs transmitted */ 417 __be32 cspdus_transmitted; /* CS PDUs transmitted */
418 u32 cspdus_received; /* CS PDUs received */ 418 __be32 cspdus_received; /* CS PDUs received */
419 u32 cspdus_crc_errors; /* CS PDUs CRC errors */ 419 __be32 cspdus_crc_errors; /* CS PDUs CRC errors */
420 u32 cspdus_protocol_errors; /* CS layer protocol errors */ 420 __be32 cspdus_protocol_errors; /* CS layer protocol errors */
421 u32 cspdus_dropped; /* reassembled PDUs dropped */ 421 __be32 cspdus_dropped; /* reassembled PDUs dropped */
422 u32 pad[ 3 ]; /* i960 padding */ 422 __be32 pad[ 3 ]; /* i960 padding */
423} stats_aal5_t; 423} stats_aal5_t;
424 424
425 425
426/* auxiliary statistics */ 426/* auxiliary statistics */
427 427
428typedef struct stats_aux { 428typedef struct stats_aux {
429 u32 small_b1_failed; /* receive BD allocation failures */ 429 __be32 small_b1_failed; /* receive BD allocation failures */
430 u32 large_b1_failed; /* receive BD allocation failures */ 430 __be32 large_b1_failed; /* receive BD allocation failures */
431 u32 small_b2_failed; /* receive BD allocation failures */ 431 __be32 small_b2_failed; /* receive BD allocation failures */
432 u32 large_b2_failed; /* receive BD allocation failures */ 432 __be32 large_b2_failed; /* receive BD allocation failures */
433 u32 rpd_alloc_failed; /* receive PDU allocation failures */ 433 __be32 rpd_alloc_failed; /* receive PDU allocation failures */
434 u32 receive_carrier; /* no carrier = 0, carrier = 1 */ 434 __be32 receive_carrier; /* no carrier = 0, carrier = 1 */
435 u32 pad[ 2 ]; /* i960 padding */ 435 __be32 pad[ 2 ]; /* i960 padding */
436} stats_aux_t; 436} stats_aux_t;
437 437
438 438
@@ -643,10 +643,10 @@ typedef struct host_bsq {
643/* header of the firmware image */ 643/* header of the firmware image */
644 644
645typedef struct fw_header { 645typedef struct fw_header {
646 u32 magic; /* magic number */ 646 __le32 magic; /* magic number */
647 u32 version; /* firmware version id */ 647 __le32 version; /* firmware version id */
648 u32 load_offset; /* fw load offset in board memory */ 648 __le32 load_offset; /* fw load offset in board memory */
649 u32 start_offset; /* fw execution start address in board memory */ 649 __le32 start_offset; /* fw execution start address in board memory */
650} fw_header_t; 650} fw_header_t;
651 651
652#define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ 652#define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index 7d253686ed0d..5ba4bab6d43e 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -485,9 +485,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
485 printk(KERN_DEBUG "%s: burped during tx load.\n", 485 printk(KERN_DEBUG "%s: burped during tx load.\n",
486 dev->name); 486 dev->name);
487 spin_lock_irqsave(&lp->lock, flags); 487 spin_lock_irqsave(&lp->lock, flags);
488 } 488 } while (1);
489 while (1);
490
491} 489}
492 490
493/** 491/**
@@ -612,7 +610,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
612 dev->stats.tx_packets++; 610 dev->stats.tx_packets++;
613 if (el_debug > 6) 611 if (el_debug > 6)
614 printk(KERN_DEBUG " Tx succeeded %s\n", 612 printk(KERN_DEBUG " Tx succeeded %s\n",
615 (txsr & TX_RDY) ? "." : "but tx is busy!"); 613 (txsr & TX_RDY) ? "." :
614 "but tx is busy!");
616 /* 615 /*
617 * This is safe the interrupt is atomic WRT itself. 616 * This is safe the interrupt is atomic WRT itself.
618 */ 617 */
@@ -693,7 +692,8 @@ static void el_receive(struct net_device *dev)
693 692
694 if (pkt_len < 60 || pkt_len > 1536) { 693 if (pkt_len < 60 || pkt_len > 1536) {
695 if (el_debug) 694 if (el_debug)
696 printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); 695 printk(KERN_DEBUG "%s: bogus packet, length=%d\n",
696 dev->name, pkt_len);
697 dev->stats.rx_over_errors++; 697 dev->stats.rx_over_errors++;
698 return; 698 return;
699 } 699 }
@@ -711,7 +711,8 @@ static void el_receive(struct net_device *dev)
711 711
712 outw(0x00, GP_LOW); 712 outw(0x00, GP_LOW);
713 if (skb == NULL) { 713 if (skb == NULL) {
714 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); 714 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n",
715 dev->name);
715 dev->stats.rx_dropped++; 716 dev->stats.rx_dropped++;
716 return; 717 return;
717 } else { 718 } else {
@@ -748,7 +749,8 @@ static void el_reset(struct net_device *dev)
748 if (el_debug > 2) 749 if (el_debug > 2)
749 printk(KERN_INFO "3c501 reset..."); 750 printk(KERN_INFO "3c501 reset...");
750 outb(AX_RESET, AX_CMD); /* Reset the chip */ 751 outb(AX_RESET, AX_CMD); /* Reset the chip */
751 outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ 752 /* Aux control, irq and loopback enabled */
753 outb(AX_LOOP, AX_CMD);
752 { 754 {
753 int i; 755 int i;
754 for (i = 0; i < 6; i++) /* Set the station address. */ 756 for (i = 0; i < 6; i++) /* Set the station address. */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 9200ee59d854..129b8b3aa773 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1765,15 +1765,12 @@ static irqreturn_t atl1_intr(int irq, void *data)
1765{ 1765{
1766 struct atl1_adapter *adapter = netdev_priv(data); 1766 struct atl1_adapter *adapter = netdev_priv(data);
1767 u32 status; 1767 u32 status;
1768 u8 update_rx;
1769 int max_ints = 10; 1768 int max_ints = 10;
1770 1769
1771 status = adapter->cmb.cmb->int_stats; 1770 status = adapter->cmb.cmb->int_stats;
1772 if (!status) 1771 if (!status)
1773 return IRQ_NONE; 1772 return IRQ_NONE;
1774 1773
1775 update_rx = 0;
1776
1777 do { 1774 do {
1778 /* clear CMB interrupt status at once */ 1775 /* clear CMB interrupt status at once */
1779 adapter->cmb.cmb->int_stats = 0; 1776 adapter->cmb.cmb->int_stats = 0;
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 979f3fc5e765..db586870c5f4 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1107,9 +1107,15 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1107 } 1107 }
1108 1108
1109 q->in_use += ndesc; 1109 q->in_use += ndesc;
1110 if (unlikely(credits - ndesc < q->stop_thres)) 1110 if (unlikely(credits - ndesc < q->stop_thres)) {
1111 if (USE_GTS || !should_restart_tx(q)) 1111 t3_stop_queue(dev, qs, q);
1112 t3_stop_queue(dev, qs, q); 1112
1113 if (should_restart_tx(q) &&
1114 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
1115 q->restarts++;
1116 netif_wake_queue(dev);
1117 }
1118 }
1113 1119
1114 gen = q->gen; 1120 gen = q->gen;
1115 q->unacked += ndesc; 1121 q->unacked += ndesc;
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 0b365b8d947b..76118ddd1042 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -131,8 +131,8 @@ IIIa. Ring buffers
131 131
132IVb. References 132IVb. References
133 133
134http://www.smsc.com/main/datasheets/83c171.pdf 134http://www.smsc.com/main/tools/discontinued/83c171.pdf
135http://www.smsc.com/main/datasheets/83c175.pdf 135http://www.smsc.com/main/tools/discontinued/83c175.pdf
136http://scyld.com/expert/NWay.html 136http://scyld.com/expert/NWay.html
137http://www.national.com/pf/DP/DP83840A.html 137http://www.national.com/pf/DP/DP83840A.html
138 138
@@ -227,7 +227,12 @@ static const u16 media2miictl[16] = {
227 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, 227 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0 }; 228 0, 0, 0, 0, 0, 0, 0, 0 };
229 229
230/* The EPIC100 Rx and Tx buffer descriptors. */ 230/*
231 * The EPIC100 Rx and Tx buffer descriptors. Note that these
232 * really ARE host-endian; it's not a misannotation. We tell
233 * the card to byteswap them internally on big-endian hosts -
234 * look for #ifdef CONFIG_BIG_ENDIAN in epic_open().
235 */
231 236
232struct epic_tx_desc { 237struct epic_tx_desc {
233 u32 txstatus; 238 u32 txstatus;
@@ -418,7 +423,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
418 423
419 /* Note: the '175 does not have a serial EEPROM. */ 424 /* Note: the '175 does not have a serial EEPROM. */
420 for (i = 0; i < 3; i++) 425 for (i = 0; i < 3; i++)
421 ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4)); 426 ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(inw(ioaddr + LAN0 + i*4));
422 427
423 if (debug > 2) { 428 if (debug > 2) {
424 dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); 429 dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n");
@@ -682,7 +687,8 @@ static int epic_open(struct net_device *dev)
682 if (ep->chip_flags & MII_PWRDWN) 687 if (ep->chip_flags & MII_PWRDWN)
683 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); 688 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
684 689
685#if defined(__powerpc__) || defined(__sparc__) /* Big endian */ 690 /* Tell the chip to byteswap descriptors on big-endian hosts */
691#ifdef CONFIG_BIG_ENDIAN
686 outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 692 outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
687 inl(ioaddr + GENCTL); 693 inl(ioaddr + GENCTL);
688 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 694 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
@@ -695,7 +701,7 @@ static int epic_open(struct net_device *dev)
695 udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ 701 udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */
696 702
697 for (i = 0; i < 3; i++) 703 for (i = 0; i < 3; i++)
698 outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); 704 outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4);
699 705
700 ep->tx_threshold = TX_FIFO_THRESH; 706 ep->tx_threshold = TX_FIFO_THRESH;
701 outl(ep->tx_threshold, ioaddr + TxThresh); 707 outl(ep->tx_threshold, ioaddr + TxThresh);
@@ -798,7 +804,7 @@ static void epic_restart(struct net_device *dev)
798 for (i = 16; i > 0; i--) 804 for (i = 16; i > 0; i--)
799 outl(0x0008, ioaddr + TEST1); 805 outl(0x0008, ioaddr + TEST1);
800 806
801#if defined(__powerpc__) || defined(__sparc__) /* Big endian */ 807#ifdef CONFIG_BIG_ENDIAN
802 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 808 outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
803#else 809#else
804 outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); 810 outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
@@ -808,7 +814,7 @@ static void epic_restart(struct net_device *dev)
808 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); 814 outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
809 815
810 for (i = 0; i < 3; i++) 816 for (i = 0; i < 3; i++)
811 outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); 817 outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4);
812 818
813 ep->tx_threshold = TX_FIFO_THRESH; 819 ep->tx_threshold = TX_FIFO_THRESH;
814 outl(ep->tx_threshold, ioaddr + TxThresh); 820 outl(ep->tx_threshold, ioaddr + TxThresh);
@@ -919,7 +925,7 @@ static void epic_init_ring(struct net_device *dev)
919 /* Initialize all Rx descriptors. */ 925 /* Initialize all Rx descriptors. */
920 for (i = 0; i < RX_RING_SIZE; i++) { 926 for (i = 0; i < RX_RING_SIZE; i++) {
921 ep->rx_ring[i].rxstatus = 0; 927 ep->rx_ring[i].rxstatus = 0;
922 ep->rx_ring[i].buflength = cpu_to_le32(ep->rx_buf_sz); 928 ep->rx_ring[i].buflength = ep->rx_buf_sz;
923 ep->rx_ring[i].next = ep->rx_ring_dma + 929 ep->rx_ring[i].next = ep->rx_ring_dma +
924 (i+1)*sizeof(struct epic_rx_desc); 930 (i+1)*sizeof(struct epic_rx_desc);
925 ep->rx_skbuff[i] = NULL; 931 ep->rx_skbuff[i] = NULL;
@@ -936,7 +942,7 @@ static void epic_init_ring(struct net_device *dev)
936 skb_reserve(skb, 2); /* 16 byte align the IP header. */ 942 skb_reserve(skb, 2); /* 16 byte align the IP header. */
937 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, 943 ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev,
938 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 944 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
939 ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); 945 ep->rx_ring[i].rxstatus = DescOwn;
940 } 946 }
941 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 947 ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
942 948
@@ -974,20 +980,20 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
974 ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, 980 ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data,
975 skb->len, PCI_DMA_TODEVICE); 981 skb->len, PCI_DMA_TODEVICE);
976 if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ 982 if (free_count < TX_QUEUE_LEN/2) {/* Typical path */
977 ctrl_word = cpu_to_le32(0x100000); /* No interrupt */ 983 ctrl_word = 0x100000; /* No interrupt */
978 } else if (free_count == TX_QUEUE_LEN/2) { 984 } else if (free_count == TX_QUEUE_LEN/2) {
979 ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ 985 ctrl_word = 0x140000; /* Tx-done intr. */
980 } else if (free_count < TX_QUEUE_LEN - 1) { 986 } else if (free_count < TX_QUEUE_LEN - 1) {
981 ctrl_word = cpu_to_le32(0x100000); /* No Tx-done intr. */ 987 ctrl_word = 0x100000; /* No Tx-done intr. */
982 } else { 988 } else {
983 /* Leave room for an additional entry. */ 989 /* Leave room for an additional entry. */
984 ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ 990 ctrl_word = 0x140000; /* Tx-done intr. */
985 ep->tx_full = 1; 991 ep->tx_full = 1;
986 } 992 }
987 ep->tx_ring[entry].buflength = ctrl_word | cpu_to_le32(skb->len); 993 ep->tx_ring[entry].buflength = ctrl_word | skb->len;
988 ep->tx_ring[entry].txstatus = 994 ep->tx_ring[entry].txstatus =
989 ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) 995 ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16)
990 | cpu_to_le32(DescOwn); 996 | DescOwn;
991 997
992 ep->cur_tx++; 998 ep->cur_tx++;
993 if (ep->tx_full) 999 if (ep->tx_full)
@@ -1041,7 +1047,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep)
1041 for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { 1047 for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) {
1042 struct sk_buff *skb; 1048 struct sk_buff *skb;
1043 int entry = dirty_tx % TX_RING_SIZE; 1049 int entry = dirty_tx % TX_RING_SIZE;
1044 int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); 1050 int txstatus = ep->tx_ring[entry].txstatus;
1045 1051
1046 if (txstatus & DescOwn) 1052 if (txstatus & DescOwn)
1047 break; /* It still hasn't been Txed */ 1053 break; /* It still hasn't been Txed */
@@ -1163,8 +1169,8 @@ static int epic_rx(struct net_device *dev, int budget)
1163 rx_work_limit = budget; 1169 rx_work_limit = budget;
1164 1170
1165 /* If we own the next entry, it's a new packet. Send it up. */ 1171 /* If we own the next entry, it's a new packet. Send it up. */
1166 while ((ep->rx_ring[entry].rxstatus & cpu_to_le32(DescOwn)) == 0) { 1172 while ((ep->rx_ring[entry].rxstatus & DescOwn) == 0) {
1167 int status = le32_to_cpu(ep->rx_ring[entry].rxstatus); 1173 int status = ep->rx_ring[entry].rxstatus;
1168 1174
1169 if (debug > 4) 1175 if (debug > 4)
1170 printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); 1176 printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status);
@@ -1238,7 +1244,8 @@ static int epic_rx(struct net_device *dev, int budget)
1238 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); 1244 skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE);
1239 work_done++; 1245 work_done++;
1240 } 1246 }
1241 ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); 1247 /* AV: shouldn't we add a barrier here? */
1248 ep->rx_ring[entry].rxstatus = DescOwn;
1242 } 1249 }
1243 return work_done; 1250 return work_done;
1244} 1251}
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 801b4d9cd972..6f7e3fde9e7c 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -184,6 +184,7 @@
184#define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ 184#define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */
185#define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ 185#define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */
186#define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ 186#define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */
187#define DEV_NEED_TX_LIMIT 0x40000 /* device needs to limit tx */
187 188
188enum { 189enum {
189 NvRegIrqStatus = 0x000, 190 NvRegIrqStatus = 0x000,
@@ -635,6 +636,8 @@ union ring_type {
635#define NV_RESTART_TX 0x1 636#define NV_RESTART_TX 0x1
636#define NV_RESTART_RX 0x2 637#define NV_RESTART_RX 0x2
637 638
639#define NV_TX_LIMIT_COUNT 16
640
638/* statistics */ 641/* statistics */
639struct nv_ethtool_str { 642struct nv_ethtool_str {
640 char name[ETH_GSTRING_LEN]; 643 char name[ETH_GSTRING_LEN];
@@ -743,6 +746,8 @@ struct nv_skb_map {
743 struct sk_buff *skb; 746 struct sk_buff *skb;
744 dma_addr_t dma; 747 dma_addr_t dma;
745 unsigned int dma_len; 748 unsigned int dma_len;
749 struct ring_desc_ex *first_tx_desc;
750 struct nv_skb_map *next_tx_ctx;
746}; 751};
747 752
748/* 753/*
@@ -827,6 +832,10 @@ struct fe_priv {
827 union ring_type tx_ring; 832 union ring_type tx_ring;
828 u32 tx_flags; 833 u32 tx_flags;
829 int tx_ring_size; 834 int tx_ring_size;
835 int tx_limit;
836 u32 tx_pkts_in_progress;
837 struct nv_skb_map *tx_change_owner;
838 struct nv_skb_map *tx_end_flip;
830 int tx_stop; 839 int tx_stop;
831 840
832 /* vlan fields */ 841 /* vlan fields */
@@ -1707,6 +1716,9 @@ static void nv_init_tx(struct net_device *dev)
1707 np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; 1716 np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1];
1708 np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; 1717 np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb;
1709 np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; 1718 np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1];
1719 np->tx_pkts_in_progress = 0;
1720 np->tx_change_owner = NULL;
1721 np->tx_end_flip = NULL;
1710 1722
1711 for (i = 0; i < np->tx_ring_size; i++) { 1723 for (i = 0; i < np->tx_ring_size; i++) {
1712 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 1724 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
@@ -1720,6 +1732,9 @@ static void nv_init_tx(struct net_device *dev)
1720 } 1732 }
1721 np->tx_skb[i].skb = NULL; 1733 np->tx_skb[i].skb = NULL;
1722 np->tx_skb[i].dma = 0; 1734 np->tx_skb[i].dma = 0;
1735 np->tx_skb[i].dma_len = 0;
1736 np->tx_skb[i].first_tx_desc = NULL;
1737 np->tx_skb[i].next_tx_ctx = NULL;
1723 } 1738 }
1724} 1739}
1725 1740
@@ -1771,7 +1786,14 @@ static void nv_drain_tx(struct net_device *dev)
1771 } 1786 }
1772 if (nv_release_txskb(dev, &np->tx_skb[i])) 1787 if (nv_release_txskb(dev, &np->tx_skb[i]))
1773 dev->stats.tx_dropped++; 1788 dev->stats.tx_dropped++;
1789 np->tx_skb[i].dma = 0;
1790 np->tx_skb[i].dma_len = 0;
1791 np->tx_skb[i].first_tx_desc = NULL;
1792 np->tx_skb[i].next_tx_ctx = NULL;
1774 } 1793 }
1794 np->tx_pkts_in_progress = 0;
1795 np->tx_change_owner = NULL;
1796 np->tx_end_flip = NULL;
1775} 1797}
1776 1798
1777static void nv_drain_rx(struct net_device *dev) 1799static void nv_drain_rx(struct net_device *dev)
@@ -1948,6 +1970,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1948 struct ring_desc_ex* start_tx; 1970 struct ring_desc_ex* start_tx;
1949 struct ring_desc_ex* prev_tx; 1971 struct ring_desc_ex* prev_tx;
1950 struct nv_skb_map* prev_tx_ctx; 1972 struct nv_skb_map* prev_tx_ctx;
1973 struct nv_skb_map* start_tx_ctx;
1951 1974
1952 /* add fragments to entries count */ 1975 /* add fragments to entries count */
1953 for (i = 0; i < fragments; i++) { 1976 for (i = 0; i < fragments; i++) {
@@ -1965,6 +1988,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1965 } 1988 }
1966 1989
1967 start_tx = put_tx = np->put_tx.ex; 1990 start_tx = put_tx = np->put_tx.ex;
1991 start_tx_ctx = np->put_tx_ctx;
1968 1992
1969 /* setup the header buffer */ 1993 /* setup the header buffer */
1970 do { 1994 do {
@@ -2037,6 +2061,26 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2037 2061
2038 spin_lock_irq(&np->lock); 2062 spin_lock_irq(&np->lock);
2039 2063
2064 if (np->tx_limit) {
2065 /* Limit the number of outstanding tx. Setup all fragments, but
2066 * do not set the VALID bit on the first descriptor. Save a pointer
2067 * to that descriptor and also for next skb_map element.
2068 */
2069
2070 if (np->tx_pkts_in_progress == NV_TX_LIMIT_COUNT) {
2071 if (!np->tx_change_owner)
2072 np->tx_change_owner = start_tx_ctx;
2073
2074 /* remove VALID bit */
2075 tx_flags &= ~NV_TX2_VALID;
2076 start_tx_ctx->first_tx_desc = start_tx;
2077 start_tx_ctx->next_tx_ctx = np->put_tx_ctx;
2078 np->tx_end_flip = np->put_tx_ctx;
2079 } else {
2080 np->tx_pkts_in_progress++;
2081 }
2082 }
2083
2040 /* set tx flags */ 2084 /* set tx flags */
2041 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); 2085 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
2042 np->put_tx.ex = put_tx; 2086 np->put_tx.ex = put_tx;
@@ -2060,6 +2104,25 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2060 return NETDEV_TX_OK; 2104 return NETDEV_TX_OK;
2061} 2105}
2062 2106
2107static inline void nv_tx_flip_ownership(struct net_device *dev)
2108{
2109 struct fe_priv *np = netdev_priv(dev);
2110
2111 np->tx_pkts_in_progress--;
2112 if (np->tx_change_owner) {
2113 __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen);
2114 flaglen |= NV_TX2_VALID;
2115 np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen);
2116 np->tx_pkts_in_progress++;
2117
2118 np->tx_change_owner = np->tx_change_owner->next_tx_ctx;
2119 if (np->tx_change_owner == np->tx_end_flip)
2120 np->tx_change_owner = NULL;
2121
2122 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
2123 }
2124}
2125
2063/* 2126/*
2064 * nv_tx_done: check for completed packets, release the skbs. 2127 * nv_tx_done: check for completed packets, release the skbs.
2065 * 2128 *
@@ -2147,6 +2210,10 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit)
2147 dev->stats.tx_packets++; 2210 dev->stats.tx_packets++;
2148 dev_kfree_skb_any(np->get_tx_ctx->skb); 2211 dev_kfree_skb_any(np->get_tx_ctx->skb);
2149 np->get_tx_ctx->skb = NULL; 2212 np->get_tx_ctx->skb = NULL;
2213
2214 if (np->tx_limit) {
2215 nv_tx_flip_ownership(dev);
2216 }
2150 } 2217 }
2151 if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) 2218 if (unlikely(np->get_tx.ex++ == np->last_tx.ex))
2152 np->get_tx.ex = np->first_tx.ex; 2219 np->get_tx.ex = np->first_tx.ex;
@@ -5333,6 +5400,21 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5333 np->need_linktimer = 0; 5400 np->need_linktimer = 0;
5334 } 5401 }
5335 5402
5403 /* Limit the number of tx's outstanding for hw bug */
5404 if (id->driver_data & DEV_NEED_TX_LIMIT) {
5405 np->tx_limit = 1;
5406 if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_32 ||
5407 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_33 ||
5408 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_34 ||
5409 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_35 ||
5410 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_36 ||
5411 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_37 ||
5412 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_38 ||
5413 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_39) &&
5414 pci_dev->revision >= 0xA2)
5415 np->tx_limit = 0;
5416 }
5417
5336 /* clear phy state and temporarily halt phy interrupts */ 5418 /* clear phy state and temporarily halt phy interrupts */
5337 writel(0, base + NvRegMIIMask); 5419 writel(0, base + NvRegMIIMask);
5338 phystate = readl(base + NvRegAdapterControl); 5420 phystate = readl(base + NvRegAdapterControl);
@@ -5563,19 +5645,19 @@ static struct pci_device_id pci_tbl[] = {
5563 }, 5645 },
5564 { /* CK804 Ethernet Controller */ 5646 { /* CK804 Ethernet Controller */
5565 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), 5647 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8),
5566 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5648 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5567 }, 5649 },
5568 { /* CK804 Ethernet Controller */ 5650 { /* CK804 Ethernet Controller */
5569 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), 5651 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9),
5570 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5652 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5571 }, 5653 },
5572 { /* MCP04 Ethernet Controller */ 5654 { /* MCP04 Ethernet Controller */
5573 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), 5655 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10),
5574 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5656 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5575 }, 5657 },
5576 { /* MCP04 Ethernet Controller */ 5658 { /* MCP04 Ethernet Controller */
5577 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), 5659 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11),
5578 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, 5660 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
5579 }, 5661 },
5580 { /* MCP51 Ethernet Controller */ 5662 { /* MCP51 Ethernet Controller */
5581 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), 5663 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12),
@@ -5587,11 +5669,11 @@ static struct pci_device_id pci_tbl[] = {
5587 }, 5669 },
5588 { /* MCP55 Ethernet Controller */ 5670 { /* MCP55 Ethernet Controller */
5589 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), 5671 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14),
5590 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5672 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
5591 }, 5673 },
5592 { /* MCP55 Ethernet Controller */ 5674 { /* MCP55 Ethernet Controller */
5593 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), 5675 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15),
5594 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, 5676 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
5595 }, 5677 },
5596 { /* MCP61 Ethernet Controller */ 5678 { /* MCP61 Ethernet Controller */
5597 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), 5679 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16),
@@ -5611,19 +5693,19 @@ static struct pci_device_id pci_tbl[] = {
5611 }, 5693 },
5612 { /* MCP65 Ethernet Controller */ 5694 { /* MCP65 Ethernet Controller */
5613 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), 5695 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20),
5614 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5696 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT|DEV_NEED_TX_LIMIT,
5615 }, 5697 },
5616 { /* MCP65 Ethernet Controller */ 5698 { /* MCP65 Ethernet Controller */
5617 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), 5699 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21),
5618 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5700 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5619 }, 5701 },
5620 { /* MCP65 Ethernet Controller */ 5702 { /* MCP65 Ethernet Controller */
5621 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), 5703 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22),
5622 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5704 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5623 }, 5705 },
5624 { /* MCP65 Ethernet Controller */ 5706 { /* MCP65 Ethernet Controller */
5625 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), 5707 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23),
5626 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, 5708 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT,
5627 }, 5709 },
5628 { /* MCP67 Ethernet Controller */ 5710 { /* MCP67 Ethernet Controller */
5629 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), 5711 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24),
@@ -5659,35 +5741,35 @@ static struct pci_device_id pci_tbl[] = {
5659 }, 5741 },
5660 { /* MCP77 Ethernet Controller */ 5742 { /* MCP77 Ethernet Controller */
5661 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), 5743 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32),
5662 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5744 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5663 }, 5745 },
5664 { /* MCP77 Ethernet Controller */ 5746 { /* MCP77 Ethernet Controller */
5665 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), 5747 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33),
5666 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5748 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5667 }, 5749 },
5668 { /* MCP77 Ethernet Controller */ 5750 { /* MCP77 Ethernet Controller */
5669 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), 5751 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34),
5670 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5752 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5671 }, 5753 },
5672 { /* MCP77 Ethernet Controller */ 5754 { /* MCP77 Ethernet Controller */
5673 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), 5755 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35),
5674 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5756 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5675 }, 5757 },
5676 { /* MCP79 Ethernet Controller */ 5758 { /* MCP79 Ethernet Controller */
5677 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), 5759 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36),
5678 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5760 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5679 }, 5761 },
5680 { /* MCP79 Ethernet Controller */ 5762 { /* MCP79 Ethernet Controller */
5681 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), 5763 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37),
5682 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5764 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5683 }, 5765 },
5684 { /* MCP79 Ethernet Controller */ 5766 { /* MCP79 Ethernet Controller */
5685 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), 5767 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38),
5686 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5768 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5687 }, 5769 },
5688 { /* MCP79 Ethernet Controller */ 5770 { /* MCP79 Ethernet Controller */
5689 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), 5771 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39),
5690 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, 5772 .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT,
5691 }, 5773 },
5692 {0,}, 5774 {0,},
5693}; 5775};
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index e6c69f77259b..0789802d59ed 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -143,6 +143,10 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
143#define STOP_TIMEOUT_1000 13 143#define STOP_TIMEOUT_1000 13
144#define STOP_TIMEOUT_1000_JUMBO 73 144#define STOP_TIMEOUT_1000_JUMBO 73
145 145
146static unsigned char default_mcast_addr[] = {
147 0x01, 0x80, 0xC2, 0x00, 0x00, 0x01
148};
149
146/* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ 150/* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */
147static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { 151static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = {
148 "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", 152 "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum",
@@ -618,6 +622,9 @@ static int emac_configure(struct emac_instance *dev)
618 if (emac_phy_gpcs(dev->phy.mode)) 622 if (emac_phy_gpcs(dev->phy.mode))
619 emac_mii_reset_phy(&dev->phy); 623 emac_mii_reset_phy(&dev->phy);
620 624
625 /* Required for Pause packet support in EMAC */
626 dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
627
621 return 0; 628 return 0;
622} 629}
623 630
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 96417adec326..b023d10d7e1c 100644
--- a/drivers/net/ibm_newemac/tah.c
+++ b/drivers/net/ibm_newemac/tah.c
@@ -155,6 +155,10 @@ static int __devexit tah_remove(struct of_device *ofdev)
155static struct of_device_id tah_match[] = 155static struct of_device_id tah_match[] =
156{ 156{
157 { 157 {
158 .compatible = "ibm,tah",
159 },
160 /* For backward compat with old DT */
161 {
158 .type = "tah", 162 .type = "tah",
159 }, 163 },
160 {}, 164 {},
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 15949d3df17e..af233b591534 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -35,6 +35,7 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <net/pkt_sched.h> 36#include <net/pkt_sched.h>
37#include <net/net_namespace.h> 37#include <net/net_namespace.h>
38#include <linux/lockdep.h>
38 39
39#define TX_TIMEOUT (2*HZ) 40#define TX_TIMEOUT (2*HZ)
40 41
@@ -227,6 +228,16 @@ static struct rtnl_link_ops ifb_link_ops __read_mostly = {
227module_param(numifbs, int, 0); 228module_param(numifbs, int, 0);
228MODULE_PARM_DESC(numifbs, "Number of ifb devices"); 229MODULE_PARM_DESC(numifbs, "Number of ifb devices");
229 230
231/*
232 * dev_ifb->queue_lock is usually taken after dev->ingress_lock,
233 * reversely to e.g. qdisc_lock_tree(). It should be safe until
234 * ifb doesn't take dev->queue_lock with dev_ifb->ingress_lock.
235 * But lockdep should know that ifb has different locks from dev.
236 */
237static struct lock_class_key ifb_queue_lock_key;
238static struct lock_class_key ifb_ingress_lock_key;
239
240
230static int __init ifb_init_one(int index) 241static int __init ifb_init_one(int index)
231{ 242{
232 struct net_device *dev_ifb; 243 struct net_device *dev_ifb;
@@ -246,6 +257,10 @@ static int __init ifb_init_one(int index)
246 err = register_netdevice(dev_ifb); 257 err = register_netdevice(dev_ifb);
247 if (err < 0) 258 if (err < 0)
248 goto err; 259 goto err;
260
261 lockdep_set_class(&dev_ifb->queue_lock, &ifb_queue_lock_key);
262 lockdep_set_class(&dev_ifb->ingress_lock, &ifb_ingress_lock_key);
263
249 return 0; 264 return 0;
250 265
251err: 266err:
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 6a1f23092099..928ce8287e69 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -31,7 +31,6 @@
31#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/netdevice.h> 33#include <linux/netdevice.h>
34#include <linux/tcp.h>
35#include <linux/ipv6.h> 34#include <linux/ipv6.h>
36#include <net/checksum.h> 35#include <net/checksum.h>
37#include <net/ip6_checksum.h> 36#include <net/ip6_checksum.h>
@@ -2484,10 +2483,24 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
2484 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); 2483 tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
2485 2484
2486 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2485 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2487 if (skb->protocol == htons(ETH_P_IP)) 2486 switch (skb->protocol) {
2487 case __constant_htons(ETH_P_IP):
2488 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; 2488 tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
2489 if (skb->sk && (skb->sk->sk_protocol == IPPROTO_TCP)) 2489 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2490 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; 2490 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
2491 break;
2492 case __constant_htons(ETH_P_IPV6):
2493 /* XXX what about other V6 headers?? */
2494 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2495 tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
2496 break;
2497 default:
2498 if (unlikely(net_ratelimit()))
2499 dev_warn(&adapter->pdev->dev,
2500 "partial checksum but proto=%x!\n",
2501 skb->protocol);
2502 break;
2503 }
2491 } 2504 }
2492 2505
2493 context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); 2506 context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 373f72cdbe8e..1f25263dc7eb 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1221,7 +1221,8 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
1221} 1221}
1222#endif 1222#endif
1223 1223
1224static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1224static int __devinit ioc3_probe(struct pci_dev *pdev,
1225 const struct pci_device_id *ent)
1225{ 1226{
1226 unsigned int sw_physid1, sw_physid2; 1227 unsigned int sw_physid1, sw_physid2;
1227 struct net_device *dev = NULL; 1228 struct net_device *dev = NULL;
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 5e5d9b527ed1..9b358f61ed7f 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -472,7 +472,6 @@ static int ipg_config_autoneg(struct net_device *dev)
472 unsigned int txflowcontrol; 472 unsigned int txflowcontrol;
473 unsigned int rxflowcontrol; 473 unsigned int rxflowcontrol;
474 unsigned int fullduplex; 474 unsigned int fullduplex;
475 unsigned int gig;
476 u32 mac_ctrl_val; 475 u32 mac_ctrl_val;
477 u32 asicctrl; 476 u32 asicctrl;
478 u8 phyctrl; 477 u8 phyctrl;
@@ -489,7 +488,6 @@ static int ipg_config_autoneg(struct net_device *dev)
489 fullduplex = 0; 488 fullduplex = 0;
490 txflowcontrol = 0; 489 txflowcontrol = 0;
491 rxflowcontrol = 0; 490 rxflowcontrol = 0;
492 gig = 0;
493 491
494 /* To accomodate a problem in 10Mbps operation, 492 /* To accomodate a problem in 10Mbps operation,
495 * set a global flag if PHY running in 10Mbps mode. 493 * set a global flag if PHY running in 10Mbps mode.
@@ -511,7 +509,6 @@ static int ipg_config_autoneg(struct net_device *dev)
511 break; 509 break;
512 case IPG_PC_LINK_SPEED_1000MBPS: 510 case IPG_PC_LINK_SPEED_1000MBPS:
513 printk("1000Mbps.\n"); 511 printk("1000Mbps.\n");
514 gig = 1;
515 break; 512 break;
516 default: 513 default:
517 printk("undefined!\n"); 514 printk("undefined!\n");
@@ -1900,8 +1897,13 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1900 1897
1901 /* Specify the TFC field within the TFD. */ 1898 /* Specify the TFC field within the TFD. */
1902 txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | 1899 txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED |
1903 (IPG_TFC_FRAMEID & cpu_to_le64(sp->tx_current)) | 1900 (IPG_TFC_FRAMEID & sp->tx_current) |
1904 (IPG_TFC_FRAGCOUNT & (1 << 24))); 1901 (IPG_TFC_FRAGCOUNT & (1 << 24)));
1902 /*
1903 * 16--17 (WordAlign) <- 3 (disable),
1904 * 0--15 (FrameId) <- sp->tx_current,
1905 * 24--27 (FragCount) <- 1
1906 */
1905 1907
1906 /* Request TxComplete interrupts at an interval defined 1908 /* Request TxComplete interrupts at an interval defined
1907 * by the constant IPG_FRAMESBETWEENTXCOMPLETES. 1909 * by the constant IPG_FRAMESBETWEENTXCOMPLETES.
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index b569c90da4ba..de0de744a8fa 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -535,9 +535,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count,
535 if (count & 3) { 535 if (count & 3) {
536 buf += count & ~3; 536 buf += count & ~3;
537 if (count & 2) { 537 if (count & 2) {
538 u16 *b = (u16 *)buf; 538 __le16 *b = (__le16 *)buf;
539 539
540 *b++ = le16_to_cpu(inw(NE_BASE + NE_DATAPORT)); 540 *b++ = cpu_to_le16(inw(NE_BASE + NE_DATAPORT));
541 buf = (char *)b; 541 buf = (char *)b;
542 } 542 }
543 if (count & 1) 543 if (count & 1)
@@ -600,9 +600,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
600 if (count & 3) { 600 if (count & 3) {
601 buf += count & ~3; 601 buf += count & ~3;
602 if (count & 2) { 602 if (count & 2) {
603 u16 *b = (u16 *)buf; 603 __le16 *b = (__le16 *)buf;
604 604
605 outw(cpu_to_le16(*b++), NE_BASE + NE_DATAPORT); 605 outw(le16_to_cpu(*b++), NE_BASE + NE_DATAPORT);
606 buf = (char *)b; 606 buf = (char *)b;
607 } 607 }
608 } 608 }
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index daf5abab9534..ddbc6e475e28 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -1644,13 +1644,24 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1644 } 1644 }
1645 1645
1646 /* put them in the newtork_list */ 1646 /* put them in the newtork_list */
1647 scan_info = wl->buf; 1647 for (i = 0, scan_info_size = 0, scan_info = wl->buf;
1648 scan_info_size = 0; 1648 scan_info_size < data_len;
1649 i = 0; 1649 i++, scan_info_size += be16_to_cpu(scan_info->size),
1650 while (scan_info_size < data_len) { 1650 scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) {
1651 pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, 1651 pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__,
1652 be16_to_cpu(scan_info->size), 1652 be16_to_cpu(scan_info->size),
1653 print_mac(mac, &scan_info->bssid[2]), scan_info); 1653 print_mac(mac, &scan_info->bssid[2]), scan_info);
1654
1655 /*
1656 * The wireless firmware may return invalid channel 0 and/or
1657 * invalid rate if the AP emits zero length SSID ie. As this
1658 * scan information is useless, ignore it
1659 */
1660 if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) {
1661 pr_debug("%s: invalid scan info\n", __func__);
1662 continue;
1663 }
1664
1654 found = 0; 1665 found = 0;
1655 oldest = NULL; 1666 oldest = NULL;
1656 list_for_each_entry(target, &wl->network_list, list) { 1667 list_for_each_entry(target, &wl->network_list, list) {
@@ -1687,10 +1698,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1687 GFP_KERNEL); 1698 GFP_KERNEL);
1688 if (!target->hwinfo) { 1699 if (!target->hwinfo) {
1689 pr_info("%s: kzalloc failed\n", __func__); 1700 pr_info("%s: kzalloc failed\n", __func__);
1690 i++;
1691 scan_info_size += be16_to_cpu(scan_info->size);
1692 scan_info = (void *)scan_info +
1693 be16_to_cpu(scan_info->size);
1694 continue; 1701 continue;
1695 } 1702 }
1696 /* copy hw scan info */ 1703 /* copy hw scan info */
@@ -1709,10 +1716,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1709 if (scan_info->ext_rate[r]) 1716 if (scan_info->ext_rate[r])
1710 target->rate_ext_len++; 1717 target->rate_ext_len++;
1711 list_move_tail(&target->list, &wl->network_list); 1718 list_move_tail(&target->list, &wl->network_list);
1712 /* bump pointer */
1713 i++;
1714 scan_info_size += be16_to_cpu(scan_info->size);
1715 scan_info = (void *)scan_info + be16_to_cpu(scan_info->size);
1716 } 1719 }
1717 memset(&data, 0, sizeof(data)); 1720 memset(&data, 0, sizeof(data));
1718 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, 1721 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data,
@@ -2389,6 +2392,8 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card)
2389 if (!netdev) 2392 if (!netdev)
2390 return NULL; 2393 return NULL;
2391 2394
2395 strcpy(netdev->name, "wlan%d");
2396
2392 port = netdev_priv(netdev); 2397 port = netdev_priv(netdev);
2393 port->netdev = netdev; 2398 port->netdev = netdev;
2394 port->card = card; 2399 port->card = card;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 19184e486ae9..169edc154928 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -239,7 +239,8 @@ static void r6040_free_txbufs(struct net_device *dev)
239 239
240 for (i = 0; i < TX_DCNT; i++) { 240 for (i = 0; i < TX_DCNT; i++) {
241 if (lp->tx_insert_ptr->skb_ptr) { 241 if (lp->tx_insert_ptr->skb_ptr) {
242 pci_unmap_single(lp->pdev, lp->tx_insert_ptr->buf, 242 pci_unmap_single(lp->pdev,
243 le32_to_cpu(lp->tx_insert_ptr->buf),
243 MAX_BUF_SIZE, PCI_DMA_TODEVICE); 244 MAX_BUF_SIZE, PCI_DMA_TODEVICE);
244 dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); 245 dev_kfree_skb(lp->tx_insert_ptr->skb_ptr);
245 lp->rx_insert_ptr->skb_ptr = NULL; 246 lp->rx_insert_ptr->skb_ptr = NULL;
@@ -255,7 +256,8 @@ static void r6040_free_rxbufs(struct net_device *dev)
255 256
256 for (i = 0; i < RX_DCNT; i++) { 257 for (i = 0; i < RX_DCNT; i++) {
257 if (lp->rx_insert_ptr->skb_ptr) { 258 if (lp->rx_insert_ptr->skb_ptr) {
258 pci_unmap_single(lp->pdev, lp->rx_insert_ptr->buf, 259 pci_unmap_single(lp->pdev,
260 le32_to_cpu(lp->rx_insert_ptr->buf),
259 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); 261 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
260 dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); 262 dev_kfree_skb(lp->rx_insert_ptr->skb_ptr);
261 lp->rx_insert_ptr->skb_ptr = NULL; 263 lp->rx_insert_ptr->skb_ptr = NULL;
@@ -542,7 +544,7 @@ static int r6040_rx(struct net_device *dev, int limit)
542 skb_ptr->dev = priv->dev; 544 skb_ptr->dev = priv->dev;
543 /* Do not count the CRC */ 545 /* Do not count the CRC */
544 skb_put(skb_ptr, descptr->len - 4); 546 skb_put(skb_ptr, descptr->len - 4);
545 pci_unmap_single(priv->pdev, descptr->buf, 547 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
546 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); 548 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
547 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); 549 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
548 /* Send to upper layer */ 550 /* Send to upper layer */
@@ -585,7 +587,7 @@ static void r6040_tx(struct net_device *dev)
585 if (descptr->status & 0x8000) 587 if (descptr->status & 0x8000)
586 break; /* Not complete */ 588 break; /* Not complete */
587 skb_ptr = descptr->skb_ptr; 589 skb_ptr = descptr->skb_ptr;
588 pci_unmap_single(priv->pdev, descptr->buf, 590 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
589 skb_ptr->len, PCI_DMA_TODEVICE); 591 skb_ptr->len, PCI_DMA_TODEVICE);
590 /* Free buffer */ 592 /* Free buffer */
591 dev_kfree_skb_irq(skb_ptr); 593 dev_kfree_skb_irq(skb_ptr);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 26ffb67f1da2..f9ef8bd8b11e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.87" 67#define DRV_MODULE_VERSION "3.88"
68#define DRV_MODULE_RELDATE "December 20, 2007" 68#define DRV_MODULE_RELDATE "March 20, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -11841,7 +11841,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
11841 } 11841 }
11842 11842
11843 if (!is_valid_ether_addr(&dev->dev_addr[0])) { 11843 if (!is_valid_ether_addr(&dev->dev_addr[0])) {
11844#ifdef CONFIG_SPARC64 11844#ifdef CONFIG_SPARC
11845 if (!tg3_get_default_macaddr_sparc(tp)) 11845 if (!tg3_get_default_macaddr_sparc(tp))
11846 return 0; 11846 return 0;
11847#endif 11847#endif
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 567c62757e9d..1b5edd646a8c 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -842,7 +842,7 @@ static inline int de_is_running (struct de_private *de)
842static void de_stop_rxtx (struct de_private *de) 842static void de_stop_rxtx (struct de_private *de)
843{ 843{
844 u32 macmode; 844 u32 macmode;
845 unsigned int work = 1000; 845 unsigned int i = 1300/100;
846 846
847 macmode = dr32(MacMode); 847 macmode = dr32(MacMode);
848 if (macmode & RxTx) { 848 if (macmode & RxTx) {
@@ -850,10 +850,14 @@ static void de_stop_rxtx (struct de_private *de)
850 dr32(MacMode); 850 dr32(MacMode);
851 } 851 }
852 852
853 while (--work > 0) { 853 /* wait until in-flight frame completes.
854 * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin)
855 * Typically expect this loop to end in < 50 us on 100BT.
856 */
857 while (--i) {
854 if (!de_is_running(de)) 858 if (!de_is_running(de))
855 return; 859 return;
856 cpu_relax(); 860 udelay(100);
857 } 861 }
858 862
859 printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); 863 printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index fba0811d2608..8cc316653a39 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -154,8 +154,8 @@ static struct ucc_geth_info ugeth_primary_info = {
154 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, 154 .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
155 .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, 155 .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE,
156 .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, 156 .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC,
157 .numThreadsTx = UCC_GETH_NUM_OF_THREADS_4, 157 .numThreadsTx = UCC_GETH_NUM_OF_THREADS_1,
158 .numThreadsRx = UCC_GETH_NUM_OF_THREADS_4, 158 .numThreadsRx = UCC_GETH_NUM_OF_THREADS_1,
159 .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, 159 .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
160 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, 160 .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2,
161}; 161};
@@ -3975,6 +3975,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3975 ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; 3975 ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT;
3976 ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; 3976 ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT;
3977 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; 3977 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT;
3978 ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4;
3979 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3978 } 3980 }
3979 3981
3980 /* Set the bus id */ 3982 /* Set the bus id */
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index a61324757b17..727547a28992 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -16,10 +16,6 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19
20// #define DEBUG // error path messages, extra info
21// #define VERBOSE // more; success messages
22
23#include <linux/module.h> 19#include <linux/module.h>
24#include <linux/init.h> 20#include <linux/init.h>
25#include <linux/netdevice.h> 21#include <linux/netdevice.h>
@@ -318,6 +314,14 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
318 net->hard_header_len += sizeof (struct rndis_data_hdr); 314 net->hard_header_len += sizeof (struct rndis_data_hdr);
319 dev->hard_mtu = net->mtu + net->hard_header_len; 315 dev->hard_mtu = net->mtu + net->hard_header_len;
320 316
317 dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1);
318 if (dev->maxpacket == 0) {
319 if (netif_msg_probe(dev))
320 dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n");
321 retval = -EINVAL;
322 goto fail_and_release;
323 }
324
321 dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); 325 dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1);
322 dev->rx_urb_size &= ~(dev->maxpacket - 1); 326 dev->rx_urb_size &= ~(dev->maxpacket - 1);
323 u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); 327 u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index cf27bf40d36e..547368e9633d 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2024,6 +2024,7 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2024 struct fstioc_write wrthdr; 2024 struct fstioc_write wrthdr;
2025 struct fstioc_info info; 2025 struct fstioc_info info;
2026 unsigned long flags; 2026 unsigned long flags;
2027 void *buf;
2027 2028
2028 dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); 2029 dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data);
2029 2030
@@ -2065,16 +2066,22 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2065 return -ENXIO; 2066 return -ENXIO;
2066 } 2067 }
2067 2068
2068 /* Now copy the data to the card. 2069 /* Now copy the data to the card. */
2069 * This will probably break on some architectures. 2070
2070 * I'll fix it when I have something to test on. 2071 buf = kmalloc(wrthdr.size, GFP_KERNEL);
2071 */ 2072 if (!buf)
2072 if (copy_from_user(card->mem + wrthdr.offset, 2073 return -ENOMEM;
2074
2075 if (copy_from_user(buf,
2073 ifr->ifr_data + sizeof (struct fstioc_write), 2076 ifr->ifr_data + sizeof (struct fstioc_write),
2074 wrthdr.size)) { 2077 wrthdr.size)) {
2078 kfree(buf);
2075 return -EFAULT; 2079 return -EFAULT;
2076 } 2080 }
2077 2081
2082 memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
2083 kfree(buf);
2084
2078 /* Writes to the memory of a card in the reset state constitute 2085 /* Writes to the memory of a card in the reset state constitute
2079 * a download 2086 * a download
2080 */ 2087 */
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index c2de2d958e8e..01757436353d 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -427,6 +427,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
427{ 427{
428 ATH5K_TRACE(ah->ah_sc); 428 ATH5K_TRACE(ah->ah_sc);
429 429
430 __set_bit(ATH_STAT_INVALID, ah->ah_sc->status);
431
430 if (ah->ah_rf_banks != NULL) 432 if (ah->ah_rf_banks != NULL)
431 kfree(ah->ah_rf_banks); 433 kfree(ah->ah_rf_banks);
432 434
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c
index 71507b260b6d..575c5436ebdf 100644
--- a/drivers/net/wireless/b43/phy.c
+++ b/drivers/net/wireless/b43/phy.c
@@ -860,7 +860,7 @@ static void b43_phy_ww(struct b43_wldev *dev)
860 b43_phy_write(dev, B43_PHY_OFDM(0xBB), 860 b43_phy_write(dev, B43_PHY_OFDM(0xBB),
861 (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); 861 (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053);
862 b43_phy_write(dev, B43_PHY_OFDM61, 862 b43_phy_write(dev, B43_PHY_OFDM61,
863 (b43_phy_read(dev, B43_PHY_OFDM61 & 0xFE1F)) | 0x0120); 863 (b43_phy_read(dev, B43_PHY_OFDM61) & 0xFE1F) | 0x0120);
864 b43_phy_write(dev, B43_PHY_OFDM(0x13), 864 b43_phy_write(dev, B43_PHY_OFDM(0x13),
865 (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); 865 (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000);
866 b43_phy_write(dev, B43_PHY_OFDM(0x14), 866 b43_phy_write(dev, B43_PHY_OFDM(0x14),
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index e7d4aee8799e..98ddbb3b3273 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -63,6 +63,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
63 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ 63 {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */
64 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ 64 {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */
65 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 65 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
66 {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */
66 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ 67 {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */
67 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 68 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
68 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 69 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 05927b908f80..6c725422af5a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -620,6 +620,9 @@ struct rt2x00_dev {
620 * This will only be compiled in when required. 620 * This will only be compiled in when required.
621 */ 621 */
622#ifdef CONFIG_RT2X00_LIB_RFKILL 622#ifdef CONFIG_RT2X00_LIB_RFKILL
623unsigned long rfkill_state;
624#define RFKILL_STATE_ALLOCATED 1
625#define RFKILL_STATE_REGISTERED 2
623 struct rfkill *rfkill; 626 struct rfkill *rfkill;
624 struct input_polled_dev *poll_dev; 627 struct input_polled_dev *poll_dev;
625#endif /* CONFIG_RT2X00_LIB_RFKILL */ 628#endif /* CONFIG_RT2X00_LIB_RFKILL */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 0d51f478bcdf..bd305f7f3efd 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1098,7 +1098,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
1098 return; 1098 return;
1099 1099
1100 /* 1100 /*
1101 * Unregister rfkill. 1101 * Unregister extra components.
1102 */ 1102 */
1103 rt2x00rfkill_unregister(rt2x00dev); 1103 rt2x00rfkill_unregister(rt2x00dev);
1104 1104
@@ -1139,17 +1139,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1139 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); 1139 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
1140 1140
1141 /* 1141 /*
1142 * Register the rfkill handler. 1142 * Register the extra components.
1143 */ 1143 */
1144 status = rt2x00rfkill_register(rt2x00dev); 1144 rt2x00rfkill_register(rt2x00dev);
1145 if (status)
1146 goto exit_unitialize;
1147 1145
1148 return 0; 1146 return 0;
1149 1147
1150exit_unitialize:
1151 rt2x00lib_uninitialize(rt2x00dev);
1152
1153exit: 1148exit:
1154 rt2x00lib_free_ring_entries(rt2x00dev); 1149 rt2x00lib_free_ring_entries(rt2x00dev);
1155 1150
@@ -1313,15 +1308,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1313 } 1308 }
1314 1309
1315 /* 1310 /*
1316 * Allocatie rfkill. 1311 * Register extra components.
1317 */
1318 retval = rt2x00rfkill_allocate(rt2x00dev);
1319 if (retval)
1320 goto exit;
1321
1322 /*
1323 * Open the debugfs entry.
1324 */ 1312 */
1313 rt2x00rfkill_allocate(rt2x00dev);
1325 rt2x00debug_register(rt2x00dev); 1314 rt2x00debug_register(rt2x00dev);
1326 1315
1327 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); 1316 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
@@ -1350,13 +1339,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1350 rt2x00lib_uninitialize(rt2x00dev); 1339 rt2x00lib_uninitialize(rt2x00dev);
1351 1340
1352 /* 1341 /*
1353 * Close debugfs entry. 1342 * Free extra components
1354 */ 1343 */
1355 rt2x00debug_deregister(rt2x00dev); 1344 rt2x00debug_deregister(rt2x00dev);
1356
1357 /*
1358 * Free rfkill
1359 */
1360 rt2x00rfkill_free(rt2x00dev); 1345 rt2x00rfkill_free(rt2x00dev);
1361 1346
1362 /* 1347 /*
@@ -1395,11 +1380,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
1395 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); 1380 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
1396 1381
1397 /* 1382 /*
1398 * Disable radio and unitialize all items 1383 * Disable radio.
1399 * that must be recreated on resume.
1400 */ 1384 */
1401 rt2x00lib_stop(rt2x00dev); 1385 rt2x00lib_stop(rt2x00dev);
1402 rt2x00lib_uninitialize(rt2x00dev); 1386 rt2x00lib_uninitialize(rt2x00dev);
1387
1388 /*
1389 * Suspend/disable extra components.
1390 */
1391 rt2x00rfkill_suspend(rt2x00dev);
1403 rt2x00debug_deregister(rt2x00dev); 1392 rt2x00debug_deregister(rt2x00dev);
1404 1393
1405exit: 1394exit:
@@ -1422,9 +1411,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
1422 NOTICE(rt2x00dev, "Waking up.\n"); 1411 NOTICE(rt2x00dev, "Waking up.\n");
1423 1412
1424 /* 1413 /*
1425 * Open the debugfs entry. 1414 * Restore/enable extra components.
1426 */ 1415 */
1427 rt2x00debug_register(rt2x00dev); 1416 rt2x00debug_register(rt2x00dev);
1417 rt2x00rfkill_resume(rt2x00dev);
1428 1418
1429 /* 1419 /*
1430 * Only continue if mac80211 had open interfaces. 1420 * Only continue if mac80211 had open interfaces.
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 1adbd28e0973..ce58c654ade1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -100,28 +100,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
100 * RFkill handlers. 100 * RFkill handlers.
101 */ 101 */
102#ifdef CONFIG_RT2X00_LIB_RFKILL 102#ifdef CONFIG_RT2X00_LIB_RFKILL
103int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); 103void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev);
104void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); 104void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev);
105int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); 105void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev);
106void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); 106void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev);
107void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev);
108void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev);
107#else 109#else
108static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 110static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
109{ 111{
110 return 0;
111} 112}
112 113
113static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 114static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
114{ 115{
115} 116}
116 117
117static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 118static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
118{ 119{
119 return 0;
120} 120}
121 121
122static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 122static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
123{ 123{
124} 124}
125
126static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
127{
128}
129
130static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
131{
132}
125#endif /* CONFIG_RT2X00_LIB_RFKILL */ 133#endif /* CONFIG_RT2X00_LIB_RFKILL */
126 134
127#endif /* RT2X00LIB_H */ 135#endif /* RT2X00LIB_H */
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index 34a96d44e306..f95577596206 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -69,56 +69,81 @@ static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev)
69 } 69 }
70} 70}
71 71
72int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 72void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
73{ 73{
74 int retval; 74 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
75 75 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
76 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 76 return;
77 return 0;
78 77
79 retval = rfkill_register(rt2x00dev->rfkill); 78 if (rfkill_register(rt2x00dev->rfkill)) {
80 if (retval) {
81 ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); 79 ERROR(rt2x00dev, "Failed to register rfkill handler.\n");
82 return retval; 80 return;
83 } 81 }
84 82
85 retval = input_register_polled_device(rt2x00dev->poll_dev); 83 if (input_register_polled_device(rt2x00dev->poll_dev)) {
86 if (retval) {
87 ERROR(rt2x00dev, "Failed to register polled device.\n"); 84 ERROR(rt2x00dev, "Failed to register polled device.\n");
88 rfkill_unregister(rt2x00dev->rfkill); 85 rfkill_unregister(rt2x00dev->rfkill);
89 return retval; 86 return;
90 } 87 }
91 88
89 __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
90
92 /* 91 /*
93 * Force initial poll which will detect the initial device state, 92 * Force initial poll which will detect the initial device state,
94 * and correctly sends the signal to the rfkill layer about this 93 * and correctly sends the signal to the rfkill layer about this
95 * state. 94 * state.
96 */ 95 */
97 rt2x00rfkill_poll(rt2x00dev->poll_dev); 96 rt2x00rfkill_poll(rt2x00dev->poll_dev);
98
99 return 0;
100} 97}
101 98
102void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 99void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
103{ 100{
104 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 101 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
102 !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
105 return; 103 return;
106 104
107 input_unregister_polled_device(rt2x00dev->poll_dev); 105 input_unregister_polled_device(rt2x00dev->poll_dev);
108 rfkill_unregister(rt2x00dev->rfkill); 106 rfkill_unregister(rt2x00dev->rfkill);
107
108 __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
109} 109}
110 110
111int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 111static struct input_polled_dev *
112rt2x00rfkill_allocate_polldev(struct rt2x00_dev *rt2x00dev)
112{ 113{
113 struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); 114 struct input_polled_dev *poll_dev;
115
116 poll_dev = input_allocate_polled_device();
117 if (!poll_dev)
118 return NULL;
119
120 poll_dev->private = rt2x00dev;
121 poll_dev->poll = rt2x00rfkill_poll;
122 poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
123
124 poll_dev->input->name = rt2x00dev->ops->name;
125 poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy);
126 poll_dev->input->id.bustype = BUS_HOST;
127 poll_dev->input->id.vendor = 0x1814;
128 poll_dev->input->id.product = rt2x00dev->chip.rt;
129 poll_dev->input->id.version = rt2x00dev->chip.rev;
130 poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy);
131 poll_dev->input->evbit[0] = BIT(EV_KEY);
132 set_bit(KEY_WLAN, poll_dev->input->keybit);
133
134 return poll_dev;
135}
114 136
137void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
138{
115 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 139 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
116 return 0; 140 return;
117 141
118 rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); 142 rt2x00dev->rfkill =
143 rfkill_allocate(wiphy_dev(rt2x00dev->hw->wiphy), RFKILL_TYPE_WLAN);
119 if (!rt2x00dev->rfkill) { 144 if (!rt2x00dev->rfkill) {
120 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); 145 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n");
121 goto exit; 146 return;
122 } 147 }
123 148
124 rt2x00dev->rfkill->name = rt2x00dev->ops->name; 149 rt2x00dev->rfkill->name = rt2x00dev->ops->name;
@@ -126,40 +151,49 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
126 rt2x00dev->rfkill->state = -1; 151 rt2x00dev->rfkill->state = -1;
127 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; 152 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
128 153
129 rt2x00dev->poll_dev = input_allocate_polled_device(); 154 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
130 if (!rt2x00dev->poll_dev) { 155 if (!rt2x00dev->poll_dev) {
131 ERROR(rt2x00dev, "Failed to allocate polled device.\n"); 156 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
132 goto exit_free_rfkill; 157 rfkill_free(rt2x00dev->rfkill);
158 rt2x00dev->rfkill = NULL;
159 return;
133 } 160 }
134 161
135 rt2x00dev->poll_dev->private = rt2x00dev; 162 return;
136 rt2x00dev->poll_dev->poll = rt2x00rfkill_poll; 163}
137 rt2x00dev->poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
138 164
139 rt2x00dev->poll_dev->input->name = rt2x00dev->ops->name; 165void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
140 rt2x00dev->poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); 166{
141 rt2x00dev->poll_dev->input->id.bustype = BUS_HOST; 167 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
142 rt2x00dev->poll_dev->input->id.vendor = 0x1814; 168 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
143 rt2x00dev->poll_dev->input->id.product = rt2x00dev->chip.rt; 169 return;
144 rt2x00dev->poll_dev->input->id.version = rt2x00dev->chip.rev;
145 rt2x00dev->poll_dev->input->dev.parent = device;
146 rt2x00dev->poll_dev->input->evbit[0] = BIT(EV_KEY);
147 set_bit(KEY_WLAN, rt2x00dev->poll_dev->input->keybit);
148 170
149 return 0; 171 input_free_polled_device(rt2x00dev->poll_dev);
172 rt2x00dev->poll_dev = NULL;
150 173
151exit_free_rfkill:
152 rfkill_free(rt2x00dev->rfkill); 174 rfkill_free(rt2x00dev->rfkill);
153 175 rt2x00dev->rfkill = NULL;
154exit:
155 return -ENOMEM;
156} 176}
157 177
158void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 178void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
159{ 179{
160 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 180 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
181 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
161 return; 182 return;
162 183
163 input_free_polled_device(rt2x00dev->poll_dev); 184 input_free_polled_device(rt2x00dev->poll_dev);
164 rfkill_free(rt2x00dev->rfkill); 185 rt2x00dev->poll_dev = NULL;
186}
187
188void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
189{
190 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
191 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
192 return;
193
194 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
195 if (!rt2x00dev->poll_dev) {
196 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
197 return;
198 }
165} 199}
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index 29fcd6d0301d..a0aa33dde0a4 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -561,7 +561,7 @@ void ioc3_unregister_submodule(struct ioc3_submodule *is)
561 printk(KERN_WARNING 561 printk(KERN_WARNING
562 "%s: IOC3 submodule %s remove failed " 562 "%s: IOC3 submodule %s remove failed "
563 "for pci_dev %s.\n", 563 "for pci_dev %s.\n",
564 __FUNCTION__, module_name(is->owner), 564 __func__, module_name(is->owner),
565 pci_name(idd->pdev)); 565 pci_name(idd->pdev));
566 idd->active[is->id] = 0; 566 idd->active[is->id] = 0;
567 if(is->irq_mask) 567 if(is->irq_mask)
@@ -611,7 +611,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
611 if ((ret = pci_enable_device(pdev))) { 611 if ((ret = pci_enable_device(pdev))) {
612 printk(KERN_WARNING 612 printk(KERN_WARNING
613 "%s: Failed to enable IOC3 device for pci_dev %s.\n", 613 "%s: Failed to enable IOC3 device for pci_dev %s.\n",
614 __FUNCTION__, pci_name(pdev)); 614 __func__, pci_name(pdev));
615 goto out; 615 goto out;
616 } 616 }
617 pci_set_master(pdev); 617 pci_set_master(pdev);
@@ -623,7 +623,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
623 if (ret < 0) { 623 if (ret < 0) {
624 printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " 624 printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA "
625 "for consistent allocations\n", 625 "for consistent allocations\n",
626 __FUNCTION__); 626 __func__);
627 } 627 }
628 } 628 }
629#endif 629#endif
@@ -633,7 +633,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
633 if (!idd) { 633 if (!idd) {
634 printk(KERN_WARNING 634 printk(KERN_WARNING
635 "%s: Failed to allocate IOC3 data for pci_dev %s.\n", 635 "%s: Failed to allocate IOC3 data for pci_dev %s.\n",
636 __FUNCTION__, pci_name(pdev)); 636 __func__, pci_name(pdev));
637 ret = -ENODEV; 637 ret = -ENODEV;
638 goto out_idd; 638 goto out_idd;
639 } 639 }
@@ -649,7 +649,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
649 printk(KERN_WARNING 649 printk(KERN_WARNING
650 "%s: Unable to find IOC3 resource " 650 "%s: Unable to find IOC3 resource "
651 "for pci_dev %s.\n", 651 "for pci_dev %s.\n",
652 __FUNCTION__, pci_name(pdev)); 652 __func__, pci_name(pdev));
653 ret = -ENODEV; 653 ret = -ENODEV;
654 goto out_pci; 654 goto out_pci;
655 } 655 }
@@ -657,7 +657,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
657 printk(KERN_WARNING 657 printk(KERN_WARNING
658 "%s: Unable to request IOC3 region " 658 "%s: Unable to request IOC3 region "
659 "for pci_dev %s.\n", 659 "for pci_dev %s.\n",
660 __FUNCTION__, pci_name(pdev)); 660 __func__, pci_name(pdev));
661 ret = -ENODEV; 661 ret = -ENODEV;
662 goto out_pci; 662 goto out_pci;
663 } 663 }
@@ -666,7 +666,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
666 printk(KERN_WARNING 666 printk(KERN_WARNING
667 "%s: Unable to remap IOC3 region " 667 "%s: Unable to remap IOC3 region "
668 "for pci_dev %s.\n", 668 "for pci_dev %s.\n",
669 __FUNCTION__, pci_name(pdev)); 669 __func__, pci_name(pdev));
670 ret = -ENODEV; 670 ret = -ENODEV;
671 goto out_misc_region; 671 goto out_misc_region;
672 } 672 }
@@ -709,7 +709,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
709 } else { 709 } else {
710 printk(KERN_WARNING 710 printk(KERN_WARNING
711 "%s : request_irq fails for IRQ 0x%x\n ", 711 "%s : request_irq fails for IRQ 0x%x\n ",
712 __FUNCTION__, pdev->irq); 712 __func__, pdev->irq);
713 } 713 }
714 if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, 714 if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED,
715 "ioc3-io", (void *)idd)) { 715 "ioc3-io", (void *)idd)) {
@@ -717,7 +717,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
717 } else { 717 } else {
718 printk(KERN_WARNING 718 printk(KERN_WARNING
719 "%s : request_irq fails for IRQ 0x%x\n ", 719 "%s : request_irq fails for IRQ 0x%x\n ",
720 __FUNCTION__, pdev->irq+2); 720 __func__, pdev->irq+2);
721 } 721 }
722 } else { 722 } else {
723 if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, 723 if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED,
@@ -726,7 +726,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
726 } else { 726 } else {
727 printk(KERN_WARNING 727 printk(KERN_WARNING
728 "%s : request_irq fails for IRQ 0x%x\n ", 728 "%s : request_irq fails for IRQ 0x%x\n ",
729 __FUNCTION__, pdev->irq); 729 __func__, pdev->irq);
730 } 730 }
731 } 731 }
732 732
@@ -769,7 +769,7 @@ static void ioc3_remove(struct pci_dev *pdev)
769 printk(KERN_WARNING 769 printk(KERN_WARNING
770 "%s: IOC3 submodule 0x%s remove failed " 770 "%s: IOC3 submodule 0x%s remove failed "
771 "for pci_dev %s.\n", 771 "for pci_dev %s.\n",
772 __FUNCTION__, 772 __func__,
773 module_name(ioc3_submodules[id]->owner), 773 module_name(ioc3_submodules[id]->owner),
774 pci_name(pdev)); 774 pci_name(pdev));
775 idd->active[id] = 0; 775 idd->active[id] = 0;