aboutsummaryrefslogtreecommitdiffstats
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
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 ...
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/sparc/kernel/sys_sunos.c2
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c2
-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
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/proc/base.c2
-rw-r--r--include/linux/in.h2
-rw-r--r--include/linux/pkt_cls.h8
-rw-r--r--include/net/sctp/sctp.h12
-rw-r--r--include/net/xfrm.h2
-rw-r--r--kernel/audit.c11
-rw-r--r--net/8021q/vlan_dev.c2
-rw-r--r--net/bridge/br_fdb.c2
-rw-r--r--net/core/netpoll.c6
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/esp4.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipconfig.c9
-rw-r--r--net/ipv4/netfilter/ipt_recent.c2
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/ipv6/Kconfig5
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c2
-rw-r--r--net/sched/cls_u32.c8
-rw-r--r--net/sched/em_u32.c2
-rw-r--r--net/sctp/input.c2
-rw-r--r--net/sctp/ipv6.c32
-rw-r--r--net/sctp/protocol.c139
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c2
-rw-r--r--net/sunrpc/svc_xprt.c2
57 files changed, 651 insertions, 391 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index d8ec68df64eb..03e4602e1b9c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -880,7 +880,7 @@ P: Marcel Holtmann
880M: marcel@holtmann.org 880M: marcel@holtmann.org
881P: Maxim Krasnyansky 881P: Maxim Krasnyansky
882M: maxk@qualcomm.com 882M: maxk@qualcomm.com
883L: bluez-devel@lists.sf.net 883L: linux-bluetooth@vger.kernel.org
884W: http://bluez.sf.net 884W: http://bluez.sf.net
885W: http://www.bluez.org 885W: http://www.bluez.org
886W: http://www.holtmann.org/linux/bluetooth/ 886W: http://www.holtmann.org/linux/bluetooth/
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index 28c187c5d9fd..f5b608bbe8af 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -659,7 +659,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
659 659
660 socket = SOCKET_I(inode); 660 socket = SOCKET_I(inode);
661 local.sin_family = AF_INET; 661 local.sin_family = AF_INET;
662 local.sin_addr.s_addr = INADDR_ANY; 662 local.sin_addr.s_addr = htonl(INADDR_ANY);
663 663
664 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ 664 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
665 try_port = 1024; 665 try_port = 1024;
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index cfc22d3fe54c..e91194fe39d7 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -618,7 +618,7 @@ sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
618 618
619 socket = SOCKET_I(inode); 619 socket = SOCKET_I(inode);
620 local.sin_family = AF_INET; 620 local.sin_family = AF_INET;
621 local.sin_addr.s_addr = INADDR_ANY; 621 local.sin_addr.s_addr = htonl(INADDR_ANY);
622 622
623 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */ 623 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
624 try_port = 1024; 624 try_port = 1024;
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;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fcf4b982c885..dd4dfcd632ec 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr)
632 switch (addr->sa_family) { 632 switch (addr->sa_family) {
633 case AF_INET: { 633 case AF_INET: {
634 struct sockaddr_in *sa = (struct sockaddr_in *)addr; 634 struct sockaddr_in *sa = (struct sockaddr_in *)addr;
635 return sa->sin_addr.s_addr != INADDR_ANY; 635 return sa->sin_addr.s_addr != htonl(INADDR_ANY);
636 } 636 }
637 case AF_INET6: { 637 case AF_INET6: {
638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; 638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8a10f6fe24a1..81d7d145292a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2290,7 +2290,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2290 DIR("fd", S_IRUSR|S_IXUSR, fd), 2290 DIR("fd", S_IRUSR|S_IXUSR, fd),
2291 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2291 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo),
2292#ifdef CONFIG_NET 2292#ifdef CONFIG_NET
2293 DIR("net", S_IRUGO|S_IXUSR, net), 2293 DIR("net", S_IRUGO|S_IXUGO, net),
2294#endif 2294#endif
2295 REG("environ", S_IRUSR, environ), 2295 REG("environ", S_IRUSR, environ),
2296 INF("auxv", S_IRUSR, pid_auxv), 2296 INF("auxv", S_IRUSR, pid_auxv),
diff --git a/include/linux/in.h b/include/linux/in.h
index 70c6df882694..4065313cd7ee 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -265,7 +265,7 @@ static inline bool ipv4_is_local_multicast(__be32 addr)
265static inline bool ipv4_is_lbcast(__be32 addr) 265static inline bool ipv4_is_lbcast(__be32 addr)
266{ 266{
267 /* limited broadcast */ 267 /* limited broadcast */
268 return addr == INADDR_BROADCAST; 268 return addr == htonl(INADDR_BROADCAST);
269} 269}
270 270
271static inline bool ipv4_is_zeronet(__be32 addr) 271static inline bool ipv4_is_zeronet(__be32 addr)
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 28dfc61cf79e..99efbed81fa2 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -201,8 +201,8 @@ enum
201 201
202struct tc_u32_key 202struct tc_u32_key
203{ 203{
204 __u32 mask; 204 __be32 mask;
205 __u32 val; 205 __be32 val;
206 int off; 206 int off;
207 int offmask; 207 int offmask;
208}; 208};
@@ -213,12 +213,12 @@ struct tc_u32_sel
213 unsigned char offshift; 213 unsigned char offshift;
214 unsigned char nkeys; 214 unsigned char nkeys;
215 215
216 __u16 offmask; 216 __be16 offmask;
217 __u16 off; 217 __u16 off;
218 short offoff; 218 short offoff;
219 219
220 short hoff; 220 short hoff;
221 __u32 hmask; 221 __be32 hmask;
222 struct tc_u32_key keys[0]; 222 struct tc_u32_key keys[0];
223}; 223};
224 224
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 57df27f19588..57ed3e323d97 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -380,15 +380,19 @@ static inline int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int
380 380
381#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 381#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
382 382
383int sctp_v6_init(void); 383void sctp_v6_pf_init(void);
384void sctp_v6_exit(void); 384void sctp_v6_pf_exit(void);
385int sctp_v6_protosw_init(void);
386void sctp_v6_protosw_exit(void);
385int sctp_v6_add_protocol(void); 387int sctp_v6_add_protocol(void);
386void sctp_v6_del_protocol(void); 388void sctp_v6_del_protocol(void);
387 389
388#else /* #ifdef defined(CONFIG_IPV6) */ 390#else /* #ifdef defined(CONFIG_IPV6) */
389 391
390static inline int sctp_v6_init(void) { return 0; } 392static inline void sctp_v6_pf_init(void) { return 0; }
391static inline void sctp_v6_exit(void) { return; } 393static inline void sctp_v6_pf_exit(void) { return; }
394static inline int sctp_v6_protosw_init(void) { return 0; }
395static inline void sctp_v6_protosw_exit(void) { return; }
392static inline int sctp_v6_add_protocol(void) { return 0; } 396static inline int sctp_v6_add_protocol(void) { return 0; }
393static inline void sctp_v6_del_protocol(void) { return; } 397static inline void sctp_v6_del_protocol(void) { return; }
394 398
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index eea7785cc757..619c53bc3cd2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -277,7 +277,7 @@ extern int __xfrm_state_delete(struct xfrm_state *x);
277struct xfrm_state_afinfo { 277struct xfrm_state_afinfo {
278 unsigned int family; 278 unsigned int family;
279 unsigned int proto; 279 unsigned int proto;
280 unsigned int eth_proto; 280 __be16 eth_proto;
281 struct module *owner; 281 struct module *owner;
282 const struct xfrm_type *type_map[IPPROTO_MAX]; 282 const struct xfrm_type *type_map[IPPROTO_MAX];
283 struct xfrm_mode *mode_map[XFRM_MODE_MAX]; 283 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
diff --git a/kernel/audit.c b/kernel/audit.c
index 10c4930c2bbf..be55cb503633 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -78,9 +78,13 @@ static int audit_default;
78/* If auditing cannot proceed, audit_failure selects what happens. */ 78/* If auditing cannot proceed, audit_failure selects what happens. */
79static int audit_failure = AUDIT_FAIL_PRINTK; 79static int audit_failure = AUDIT_FAIL_PRINTK;
80 80
81/* If audit records are to be written to the netlink socket, audit_pid 81/*
82 * contains the (non-zero) pid. */ 82 * If audit records are to be written to the netlink socket, audit_pid
83 * contains the pid of the auditd process and audit_nlk_pid contains
84 * the pid to use to send netlink messages to that process.
85 */
83int audit_pid; 86int audit_pid;
87static int audit_nlk_pid;
84 88
85/* If audit_rate_limit is non-zero, limit the rate of sending audit records 89/* If audit_rate_limit is non-zero, limit the rate of sending audit records
86 * to that number per second. This prevents DoS attacks, but results in 90 * to that number per second. This prevents DoS attacks, but results in
@@ -350,7 +354,7 @@ static int kauditd_thread(void *dummy)
350 wake_up(&audit_backlog_wait); 354 wake_up(&audit_backlog_wait);
351 if (skb) { 355 if (skb) {
352 if (audit_pid) { 356 if (audit_pid) {
353 int err = netlink_unicast(audit_sock, skb, audit_pid, 0); 357 int err = netlink_unicast(audit_sock, skb, audit_nlk_pid, 0);
354 if (err < 0) { 358 if (err < 0) {
355 BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */ 359 BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */
356 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); 360 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
@@ -626,6 +630,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
626 sid, 1); 630 sid, 1);
627 631
628 audit_pid = new_pid; 632 audit_pid = new_pid;
633 audit_nlk_pid = NETLINK_CB(skb).pid;
629 } 634 }
630 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) 635 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
631 err = audit_set_rate_limit(status_get->rate_limit, 636 err = audit_set_rate_limit(status_get->rate_limit,
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 77f04e49a1a0..8fbcefe10c9f 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -382,7 +382,7 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
382 vlan_dev_info(dev)->cnt_encap_on_xmit++; 382 vlan_dev_info(dev)->cnt_encap_on_xmit++;
383 383
384 pr_debug("%s: proto to encap: 0x%hx\n", 384 pr_debug("%s: proto to encap: 0x%hx\n",
385 __FUNCTION__, htons(veth->h_vlan_proto)); 385 __FUNCTION__, ntohs(veth->h_vlan_proto));
386 /* Construct the second two bytes. This field looks something 386 /* Construct the second two bytes. This field looks something
387 * like: 387 * like:
388 * usr_priority: 3 bits (high bits) 388 * usr_priority: 3 bits (high bits)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index bc40377136a2..9326c377822e 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -136,7 +136,7 @@ void br_fdb_cleanup(unsigned long _data)
136 this_timer = f->ageing_timer + delay; 136 this_timer = f->ageing_timer + delay;
137 if (time_before_eq(this_timer, jiffies)) 137 if (time_before_eq(this_timer, jiffies))
138 fdb_delete(f); 138 fdb_delete(f);
139 else if (this_timer < next_timer) 139 else if (time_before(this_timer, next_timer))
140 next_timer = this_timer; 140 next_timer = this_timer;
141 } 141 }
142 } 142 }
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 4b7e756181c9..c635de52526c 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -215,10 +215,12 @@ static void zap_completion_queue(void)
215 while (clist != NULL) { 215 while (clist != NULL) {
216 struct sk_buff *skb = clist; 216 struct sk_buff *skb = clist;
217 clist = clist->next; 217 clist = clist->next;
218 if (skb->destructor) 218 if (skb->destructor) {
219 atomic_inc(&skb->users);
219 dev_kfree_skb_any(skb); /* put this one back */ 220 dev_kfree_skb_any(skb); /* put this one back */
220 else 221 } else {
221 __kfree_skb(skb); 222 __kfree_skb(skb);
223 }
222 } 224 }
223 } 225 }
224 226
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 09ca5293d08f..0d109504ed86 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -458,7 +458,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
458 err = -EADDRNOTAVAIL; 458 err = -EADDRNOTAVAIL;
459 if (!sysctl_ip_nonlocal_bind && 459 if (!sysctl_ip_nonlocal_bind &&
460 !inet->freebind && 460 !inet->freebind &&
461 addr->sin_addr.s_addr != INADDR_ANY && 461 addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
462 chk_addr_ret != RTN_LOCAL && 462 chk_addr_ret != RTN_LOCAL &&
463 chk_addr_ret != RTN_MULTICAST && 463 chk_addr_ret != RTN_MULTICAST &&
464 chk_addr_ret != RTN_BROADCAST) 464 chk_addr_ret != RTN_BROADCAST)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 091e6709f831..f3ceca31aa45 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -168,7 +168,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
168 struct xfrm_encap_tmpl *encap = x->encap; 168 struct xfrm_encap_tmpl *encap = x->encap;
169 struct udphdr *uh; 169 struct udphdr *uh;
170 __be32 *udpdata32; 170 __be32 *udpdata32;
171 unsigned int sport, dport; 171 __be16 sport, dport;
172 int encap_type; 172 int encap_type;
173 173
174 spin_lock_bh(&x->lock); 174 spin_lock_bh(&x->lock);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index de0572c88859..f72457b4b0a7 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -583,7 +583,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
583 } 583 }
584 584
585 if (!mreq.imr_ifindex) { 585 if (!mreq.imr_ifindex) {
586 if (mreq.imr_address.s_addr == INADDR_ANY) { 586 if (mreq.imr_address.s_addr == htonl(INADDR_ANY)) {
587 inet->mc_index = 0; 587 inet->mc_index = 0;
588 inet->mc_addr = 0; 588 inet->mc_addr = 0;
589 err = 0; 589 err = 0;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 5dd938579eeb..7c992fbbc2c3 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -103,6 +103,7 @@
103 - '3' from resolv.h */ 103 - '3' from resolv.h */
104 104
105#define NONE __constant_htonl(INADDR_NONE) 105#define NONE __constant_htonl(INADDR_NONE)
106#define ANY __constant_htonl(INADDR_ANY)
106 107
107/* 108/*
108 * Public IP configuration 109 * Public IP configuration
@@ -1479,19 +1480,19 @@ static int __init ip_auto_config_setup(char *addrs)
1479 DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip)); 1480 DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip));
1480 switch (num) { 1481 switch (num) {
1481 case 0: 1482 case 0:
1482 if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) 1483 if ((ic_myaddr = in_aton(ip)) == ANY)
1483 ic_myaddr = NONE; 1484 ic_myaddr = NONE;
1484 break; 1485 break;
1485 case 1: 1486 case 1:
1486 if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) 1487 if ((ic_servaddr = in_aton(ip)) == ANY)
1487 ic_servaddr = NONE; 1488 ic_servaddr = NONE;
1488 break; 1489 break;
1489 case 2: 1490 case 2:
1490 if ((ic_gateway = in_aton(ip)) == INADDR_ANY) 1491 if ((ic_gateway = in_aton(ip)) == ANY)
1491 ic_gateway = NONE; 1492 ic_gateway = NONE;
1492 break; 1493 break;
1493 case 3: 1494 case 3:
1494 if ((ic_netmask = in_aton(ip)) == INADDR_ANY) 1495 if ((ic_netmask = in_aton(ip)) == ANY)
1495 ic_netmask = NONE; 1496 ic_netmask = NONE;
1496 break; 1497 break;
1497 case 4: 1498 case 4:
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 68cbe3ca01ce..8e8f0425a8ed 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -252,6 +252,8 @@ recent_mt_check(const char *tablename, const void *ip,
252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) && 252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) &&
253 (info->seconds || info->hit_count)) 253 (info->seconds || info->hit_count))
254 return false; 254 return false;
255 if (info->hit_count > ip_pkt_list_tot)
256 return false;
255 if (info->name[0] == '\0' || 257 if (info->name[0] == '\0' ||
256 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN) 258 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN)
257 return false; 259 return false;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 01578f544ad6..72b9350006fe 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -255,7 +255,7 @@ static u16 tcp_select_window(struct sock *sk)
255 * 255 *
256 * Relax Will Robinson. 256 * Relax Will Robinson.
257 */ 257 */
258 new_win = cur_win; 258 new_win = ALIGN(cur_win, 1 << tp->rx_opt.rcv_wscale);
259 } 259 }
260 tp->rcv_wnd = new_win; 260 tp->rcv_wnd = new_win;
261 tp->rcv_wup = tp->rcv_nxt; 261 tp->rcv_wup = tp->rcv_nxt;
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 58219dfffef8..47263e45bacb 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -179,11 +179,12 @@ config IPV6_SIT
179 Saying M here will produce a module called sit.ko. If unsure, say Y. 179 Saying M here will produce a module called sit.ko. If unsure, say Y.
180 180
181config IPV6_TUNNEL 181config IPV6_TUNNEL
182 tristate "IPv6: IPv6-in-IPv6 tunnel" 182 tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)"
183 select INET6_TUNNEL 183 select INET6_TUNNEL
184 depends on IPV6 184 depends on IPV6
185 ---help--- 185 ---help---
186 Support for IPv6-in-IPv6 tunnels described in RFC 2473. 186 Support for IPv6-in-IPv6 and IPv4-in-IPv6 tunnels described in
187 RFC 2473.
187 188
188 If unsure, say N. 189 If unsure, say N.
189 190
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index 62137879e6aa..898f1922b5b8 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -842,7 +842,7 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
842 842
843 set_h225_addr = rcu_dereference(set_h225_addr_hook); 843 set_h225_addr = rcu_dereference(set_h225_addr_hook);
844 if ((setup->options & eSetup_UUIE_destCallSignalAddress) && 844 if ((setup->options & eSetup_UUIE_destCallSignalAddress) &&
845 (set_h225_addr) && ct->status && IPS_NAT_MASK && 845 (set_h225_addr) && ct->status & IPS_NAT_MASK &&
846 get_h225_addr(ct, *data, &setup->destCallSignalAddress, 846 get_h225_addr(ct, *data, &setup->destCallSignalAddress,
847 &addr, &port) && 847 &addr, &port) &&
848 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) { 848 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) {
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index b18fa95ef248..c5c16b4b6e98 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -89,7 +89,7 @@ static const struct tcf_ext_map u32_ext_map = {
89 89
90static struct tc_u_common *u32_list; 90static struct tc_u_common *u32_list;
91 91
92static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift) 92static __inline__ unsigned u32_hash_fold(__be32 key, struct tc_u32_sel *sel, u8 fshift)
93{ 93{
94 unsigned h = ntohl(key & sel->hmask)>>fshift; 94 unsigned h = ntohl(key & sel->hmask)>>fshift;
95 95
@@ -137,7 +137,7 @@ next_knode:
137 137
138 for (i = n->sel.nkeys; i>0; i--, key++) { 138 for (i = n->sel.nkeys; i>0; i--, key++) {
139 139
140 if ((*(u32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) { 140 if ((*(__be32*)(ptr+key->off+(off2&key->offmask))^key->val)&key->mask) {
141 n = n->next; 141 n = n->next;
142 goto next_knode; 142 goto next_knode;
143 } 143 }
@@ -182,7 +182,7 @@ check_terminal:
182 ht = n->ht_down; 182 ht = n->ht_down;
183 sel = 0; 183 sel = 0;
184 if (ht->divisor) 184 if (ht->divisor)
185 sel = ht->divisor&u32_hash_fold(*(u32*)(ptr+n->sel.hoff), &n->sel,n->fshift); 185 sel = ht->divisor&u32_hash_fold(*(__be32*)(ptr+n->sel.hoff), &n->sel,n->fshift);
186 186
187 if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) 187 if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT)))
188 goto next_ht; 188 goto next_ht;
@@ -190,7 +190,7 @@ check_terminal:
190 if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) { 190 if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) {
191 off2 = n->sel.off + 3; 191 off2 = n->sel.off + 3;
192 if (n->sel.flags&TC_U32_VAROFFSET) 192 if (n->sel.flags&TC_U32_VAROFFSET)
193 off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift; 193 off2 += ntohs(n->sel.offmask & *(__be16*)(ptr+n->sel.offoff)) >>n->sel.offshift;
194 off2 &= ~3; 194 off2 &= ~3;
195 } 195 }
196 if (n->sel.flags&TC_U32_EAT) { 196 if (n->sel.flags&TC_U32_EAT) {
diff --git a/net/sched/em_u32.c b/net/sched/em_u32.c
index 112796e4a7c4..953f1479f7da 100644
--- a/net/sched/em_u32.c
+++ b/net/sched/em_u32.c
@@ -35,7 +35,7 @@ static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em,
35 if (!tcf_valid_offset(skb, ptr, sizeof(u32))) 35 if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
36 return 0; 36 return 0;
37 37
38 return !(((*(u32*) ptr) ^ key->val) & key->mask); 38 return !(((*(__be32*) ptr) ^ key->val) & key->mask);
39} 39}
40 40
41static struct tcf_ematch_ops em_u32_ops = { 41static struct tcf_ematch_ops em_u32_ops = {
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 57fe2f81eca8..812ff1756c3e 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -944,7 +944,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
944static struct sctp_association *__sctp_rcv_asconf_lookup( 944static struct sctp_association *__sctp_rcv_asconf_lookup(
945 sctp_chunkhdr_t *ch, 945 sctp_chunkhdr_t *ch,
946 const union sctp_addr *laddr, 946 const union sctp_addr *laddr,
947 __be32 peer_port, 947 __be16 peer_port,
948 struct sctp_transport **transportp) 948 struct sctp_transport **transportp)
949{ 949{
950 sctp_addip_chunk_t *asconf = (struct sctp_addip_chunk *)ch; 950 sctp_addip_chunk_t *asconf = (struct sctp_addip_chunk *)ch;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 9aa0733aee87..b1e05d719f9b 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -1014,15 +1014,24 @@ static struct sctp_pf sctp_pf_inet6 = {
1014}; 1014};
1015 1015
1016/* Initialize IPv6 support and register with socket layer. */ 1016/* Initialize IPv6 support and register with socket layer. */
1017int sctp_v6_init(void) 1017void sctp_v6_pf_init(void)
1018{ 1018{
1019 int rc;
1020
1021 /* Register the SCTP specific PF_INET6 functions. */ 1019 /* Register the SCTP specific PF_INET6 functions. */
1022 sctp_register_pf(&sctp_pf_inet6, PF_INET6); 1020 sctp_register_pf(&sctp_pf_inet6, PF_INET6);
1023 1021
1024 /* Register the SCTP specific AF_INET6 functions. */ 1022 /* Register the SCTP specific AF_INET6 functions. */
1025 sctp_register_af(&sctp_af_inet6); 1023 sctp_register_af(&sctp_af_inet6);
1024}
1025
1026void sctp_v6_pf_exit(void)
1027{
1028 list_del(&sctp_af_inet6.list);
1029}
1030
1031/* Initialize IPv6 support and register with socket layer. */
1032int sctp_v6_protosw_init(void)
1033{
1034 int rc;
1026 1035
1027 rc = proto_register(&sctpv6_prot, 1); 1036 rc = proto_register(&sctpv6_prot, 1);
1028 if (rc) 1037 if (rc)
@@ -1035,6 +1044,14 @@ int sctp_v6_init(void)
1035 return 0; 1044 return 0;
1036} 1045}
1037 1046
1047void sctp_v6_protosw_exit(void)
1048{
1049 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1050 inet6_unregister_protosw(&sctpv6_stream_protosw);
1051 proto_unregister(&sctpv6_prot);
1052}
1053
1054
1038/* Register with inet6 layer. */ 1055/* Register with inet6 layer. */
1039int sctp_v6_add_protocol(void) 1056int sctp_v6_add_protocol(void)
1040{ 1057{
@@ -1047,15 +1064,6 @@ int sctp_v6_add_protocol(void)
1047 return 0; 1064 return 0;
1048} 1065}
1049 1066
1050/* IPv6 specific exit support. */
1051void sctp_v6_exit(void)
1052{
1053 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1054 inet6_unregister_protosw(&sctpv6_stream_protosw);
1055 proto_unregister(&sctpv6_prot);
1056 list_del(&sctp_af_inet6.list);
1057}
1058
1059/* Unregister with inet6 layer. */ 1067/* Unregister with inet6 layer. */
1060void sctp_v6_del_protocol(void) 1068void sctp_v6_del_protocol(void)
1061{ 1069{
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index ad0a4069b95b..f90091a1b9ce 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -337,14 +337,14 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1,
337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) 337static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port)
338{ 338{
339 addr->v4.sin_family = AF_INET; 339 addr->v4.sin_family = AF_INET;
340 addr->v4.sin_addr.s_addr = INADDR_ANY; 340 addr->v4.sin_addr.s_addr = htonl(INADDR_ANY);
341 addr->v4.sin_port = port; 341 addr->v4.sin_port = port;
342} 342}
343 343
344/* Is this a wildcard address? */ 344/* Is this a wildcard address? */
345static int sctp_v4_is_any(const union sctp_addr *addr) 345static int sctp_v4_is_any(const union sctp_addr *addr)
346{ 346{
347 return INADDR_ANY == addr->v4.sin_addr.s_addr; 347 return htonl(INADDR_ANY) == addr->v4.sin_addr.s_addr;
348} 348}
349 349
350/* This function checks if the address is a valid address to be used for 350/* This function checks if the address is a valid address to be used for
@@ -375,7 +375,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr); 375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr);
376 376
377 377
378 if (addr->v4.sin_addr.s_addr != INADDR_ANY && 378 if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
379 ret != RTN_LOCAL && 379 ret != RTN_LOCAL &&
380 !sp->inet.freebind && 380 !sp->inet.freebind &&
381 !sysctl_ip_nonlocal_bind) 381 !sysctl_ip_nonlocal_bind)
@@ -785,8 +785,8 @@ static int sctp_inet_cmp_addr(const union sctp_addr *addr1,
785 /* PF_INET only supports AF_INET addresses. */ 785 /* PF_INET only supports AF_INET addresses. */
786 if (addr1->sa.sa_family != addr2->sa.sa_family) 786 if (addr1->sa.sa_family != addr2->sa.sa_family)
787 return 0; 787 return 0;
788 if (INADDR_ANY == addr1->v4.sin_addr.s_addr || 788 if (htonl(INADDR_ANY) == addr1->v4.sin_addr.s_addr ||
789 INADDR_ANY == addr2->v4.sin_addr.s_addr) 789 htonl(INADDR_ANY) == addr2->v4.sin_addr.s_addr)
790 return 1; 790 return 1;
791 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr) 791 if (addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr)
792 return 1; 792 return 1;
@@ -992,6 +992,58 @@ static void cleanup_sctp_mibs(void)
992 free_percpu(sctp_statistics[1]); 992 free_percpu(sctp_statistics[1]);
993} 993}
994 994
995static void sctp_v4_pf_init(void)
996{
997 /* Initialize the SCTP specific PF functions. */
998 sctp_register_pf(&sctp_pf_inet, PF_INET);
999 sctp_register_af(&sctp_af_inet);
1000}
1001
1002static void sctp_v4_pf_exit(void)
1003{
1004 list_del(&sctp_af_inet.list);
1005}
1006
1007static int sctp_v4_protosw_init(void)
1008{
1009 int rc;
1010
1011 rc = proto_register(&sctp_prot, 1);
1012 if (rc)
1013 return rc;
1014
1015 /* Register SCTP(UDP and TCP style) with socket layer. */
1016 inet_register_protosw(&sctp_seqpacket_protosw);
1017 inet_register_protosw(&sctp_stream_protosw);
1018
1019 return 0;
1020}
1021
1022static void sctp_v4_protosw_exit(void)
1023{
1024 inet_unregister_protosw(&sctp_stream_protosw);
1025 inet_unregister_protosw(&sctp_seqpacket_protosw);
1026 proto_unregister(&sctp_prot);
1027}
1028
1029static int sctp_v4_add_protocol(void)
1030{
1031 /* Register notifier for inet address additions/deletions. */
1032 register_inetaddr_notifier(&sctp_inetaddr_notifier);
1033
1034 /* Register SCTP with inet layer. */
1035 if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0)
1036 return -EAGAIN;
1037
1038 return 0;
1039}
1040
1041static void sctp_v4_del_protocol(void)
1042{
1043 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP);
1044 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1045}
1046
995/* Initialize the universe into something sensible. */ 1047/* Initialize the universe into something sensible. */
996SCTP_STATIC __init int sctp_init(void) 1048SCTP_STATIC __init int sctp_init(void)
997{ 1049{
@@ -1035,8 +1087,6 @@ SCTP_STATIC __init int sctp_init(void)
1035 /* Initialize object count debugging. */ 1087 /* Initialize object count debugging. */
1036 sctp_dbg_objcnt_init(); 1088 sctp_dbg_objcnt_init();
1037 1089
1038 /* Initialize the SCTP specific PF functions. */
1039 sctp_register_pf(&sctp_pf_inet, PF_INET);
1040 /* 1090 /*
1041 * 14. Suggested SCTP Protocol Parameter Values 1091 * 14. Suggested SCTP Protocol Parameter Values
1042 */ 1092 */
@@ -1194,19 +1244,22 @@ SCTP_STATIC __init int sctp_init(void)
1194 sctp_sysctl_register(); 1244 sctp_sysctl_register();
1195 1245
1196 INIT_LIST_HEAD(&sctp_address_families); 1246 INIT_LIST_HEAD(&sctp_address_families);
1197 sctp_register_af(&sctp_af_inet); 1247 sctp_v4_pf_init();
1248 sctp_v6_pf_init();
1198 1249
1199 status = proto_register(&sctp_prot, 1); 1250 /* Initialize the local address list. */
1200 if (status) 1251 INIT_LIST_HEAD(&sctp_local_addr_list);
1201 goto err_proto_register; 1252 spin_lock_init(&sctp_local_addr_lock);
1253 sctp_get_local_addr_list();
1202 1254
1203 /* Register SCTP(UDP and TCP style) with socket layer. */ 1255 status = sctp_v4_protosw_init();
1204 inet_register_protosw(&sctp_seqpacket_protosw);
1205 inet_register_protosw(&sctp_stream_protosw);
1206 1256
1207 status = sctp_v6_init();
1208 if (status) 1257 if (status)
1209 goto err_v6_init; 1258 goto err_protosw_init;
1259
1260 status = sctp_v6_protosw_init();
1261 if (status)
1262 goto err_v6_protosw_init;
1210 1263
1211 /* Initialize the control inode/socket for handling OOTB packets. */ 1264 /* Initialize the control inode/socket for handling OOTB packets. */
1212 if ((status = sctp_ctl_sock_init())) { 1265 if ((status = sctp_ctl_sock_init())) {
@@ -1215,19 +1268,9 @@ SCTP_STATIC __init int sctp_init(void)
1215 goto err_ctl_sock_init; 1268 goto err_ctl_sock_init;
1216 } 1269 }
1217 1270
1218 /* Initialize the local address list. */ 1271 status = sctp_v4_add_protocol();
1219 INIT_LIST_HEAD(&sctp_local_addr_list); 1272 if (status)
1220 spin_lock_init(&sctp_local_addr_lock);
1221 sctp_get_local_addr_list();
1222
1223 /* Register notifier for inet address additions/deletions. */
1224 register_inetaddr_notifier(&sctp_inetaddr_notifier);
1225
1226 /* Register SCTP with inet layer. */
1227 if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) {
1228 status = -EAGAIN;
1229 goto err_add_protocol; 1273 goto err_add_protocol;
1230 }
1231 1274
1232 /* Register SCTP with inet6 layer. */ 1275 /* Register SCTP with inet6 layer. */
1233 status = sctp_v6_add_protocol(); 1276 status = sctp_v6_add_protocol();
@@ -1238,18 +1281,18 @@ SCTP_STATIC __init int sctp_init(void)
1238out: 1281out:
1239 return status; 1282 return status;
1240err_v6_add_protocol: 1283err_v6_add_protocol:
1241 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); 1284 sctp_v6_del_protocol();
1242 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1243err_add_protocol: 1285err_add_protocol:
1244 sctp_free_local_addr_list(); 1286 sctp_v4_del_protocol();
1245 sock_release(sctp_ctl_socket); 1287 sock_release(sctp_ctl_socket);
1246err_ctl_sock_init: 1288err_ctl_sock_init:
1247 sctp_v6_exit(); 1289 sctp_v6_protosw_exit();
1248err_v6_init: 1290err_v6_protosw_init:
1249 inet_unregister_protosw(&sctp_stream_protosw); 1291 sctp_v4_protosw_exit();
1250 inet_unregister_protosw(&sctp_seqpacket_protosw); 1292err_protosw_init:
1251 proto_unregister(&sctp_prot); 1293 sctp_free_local_addr_list();
1252err_proto_register: 1294 sctp_v4_pf_exit();
1295 sctp_v6_pf_exit();
1253 sctp_sysctl_unregister(); 1296 sctp_sysctl_unregister();
1254 list_del(&sctp_af_inet.list); 1297 list_del(&sctp_af_inet.list);
1255 free_pages((unsigned long)sctp_port_hashtable, 1298 free_pages((unsigned long)sctp_port_hashtable,
@@ -1282,23 +1325,21 @@ SCTP_STATIC __exit void sctp_exit(void)
1282 1325
1283 /* Unregister with inet6/inet layers. */ 1326 /* Unregister with inet6/inet layers. */
1284 sctp_v6_del_protocol(); 1327 sctp_v6_del_protocol();
1285 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); 1328 sctp_v4_del_protocol();
1286
1287 /* Unregister notifier for inet address additions/deletions. */
1288 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1289
1290 /* Free the local address list. */
1291 sctp_free_local_addr_list();
1292 1329
1293 /* Free the control endpoint. */ 1330 /* Free the control endpoint. */
1294 sock_release(sctp_ctl_socket); 1331 sock_release(sctp_ctl_socket);
1295 1332
1296 /* Cleanup v6 initializations. */ 1333 /* Free protosw registrations */
1297 sctp_v6_exit(); 1334 sctp_v6_protosw_exit();
1335 sctp_v4_protosw_exit();
1336
1337 /* Free the local address list. */
1338 sctp_free_local_addr_list();
1298 1339
1299 /* Unregister with socket layer. */ 1340 /* Unregister with socket layer. */
1300 inet_unregister_protosw(&sctp_stream_protosw); 1341 sctp_v6_pf_exit();
1301 inet_unregister_protosw(&sctp_seqpacket_protosw); 1342 sctp_v4_pf_exit();
1302 1343
1303 sctp_sysctl_unregister(); 1344 sctp_sysctl_unregister();
1304 list_del(&sctp_af_inet.list); 1345 list_del(&sctp_af_inet.list);
@@ -1317,8 +1358,6 @@ SCTP_STATIC __exit void sctp_exit(void)
1317 1358
1318 kmem_cache_destroy(sctp_chunk_cachep); 1359 kmem_cache_destroy(sctp_chunk_cachep);
1319 kmem_cache_destroy(sctp_bucket_cachep); 1360 kmem_cache_destroy(sctp_bucket_cachep);
1320
1321 proto_unregister(&sctp_prot);
1322} 1361}
1323 1362
1324module_init(sctp_init); 1363module_init(sctp_init);
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index 61801a069ff0..bce9d527af08 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -317,7 +317,7 @@ gss_delete_sec_context(struct gss_ctx **context_handle)
317 317
318 if (!*context_handle) 318 if (!*context_handle)
319 return(GSS_S_NO_CONTEXT); 319 return(GSS_S_NO_CONTEXT);
320 if ((*context_handle)->internal_ctx_id != 0) 320 if ((*context_handle)->internal_ctx_id)
321 (*context_handle)->mech_type->gm_ops 321 (*context_handle)->mech_type->gm_ops
322 ->gss_delete_sec_context((*context_handle) 322 ->gss_delete_sec_context((*context_handle)
323 ->internal_ctx_id); 323 ->internal_ctx_id);
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index ea377e06afae..332eb47539e1 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -185,7 +185,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
185 struct svc_xprt_class *xcl; 185 struct svc_xprt_class *xcl;
186 struct sockaddr_in sin = { 186 struct sockaddr_in sin = {
187 .sin_family = AF_INET, 187 .sin_family = AF_INET,
188 .sin_addr.s_addr = INADDR_ANY, 188 .sin_addr.s_addr = htonl(INADDR_ANY),
189 .sin_port = htons(port), 189 .sin_port = htons(port),
190 }; 190 };
191 dprintk("svc: creating transport %s[%d]\n", xprt_name, port); 191 dprintk("svc: creating transport %s[%d]\n", xprt_name, port);