aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/3c505.txt3
-rw-r--r--drivers/block/nbd.c3
-rw-r--r--drivers/net/Kconfig199
-rw-r--r--drivers/net/arcnet/Kconfig15
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/myri_sbus.c2
-rw-r--r--drivers/net/ppp_async.c34
-rw-r--r--drivers/net/ppp_generic.c126
-rw-r--r--drivers/net/ppp_synctty.c27
-rw-r--r--drivers/net/sungem.c11
-rw-r--r--drivers/net/tehuti.c8
-rw-r--r--drivers/net/tg3.c186
-rw-r--r--drivers/net/tg3.h44
-rw-r--r--drivers/net/tulip/Kconfig21
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/ocfs2/cluster/tcp.c4
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/net/inet_common.h4
-rw-r--r--include/net/inetpeer.h2
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/constants.h3
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/structs.h22
-rw-r--r--net/bridge/br_netfilter.c3
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/dev_mcast.c2
-rw-r--r--net/core/net_namespace.c18
-rw-r--r--net/core/sock.c4
-rw-r--r--net/ipv4/inetpeer.c42
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c1
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c2
-rw-r--r--net/ipv6/ndisc.c1
-rw-r--r--net/netfilter/nf_sockopt.c106
-rw-r--r--net/netfilter/xt_time.c2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/packet/af_packet.c16
-rw-r--r--net/rxrpc/ar-local.c4
-rw-r--r--net/sctp/associola.c10
-rw-r--r--net/sctp/bind_addr.c13
-rw-r--r--net/sctp/endpointola.c35
-rw-r--r--net/sctp/input.c43
-rw-r--r--net/sctp/inqueue.c4
-rw-r--r--net/sctp/outqueue.c41
-rw-r--r--net/sctp/proc.c6
-rw-r--r--net/sctp/protocol.c7
-rw-r--r--net/sctp/sm_make_chunk.c170
-rw-r--r--net/sctp/sm_sideeffect.c10
-rw-r--r--net/sctp/sm_statefuns.c12
-rw-r--r--net/sctp/socket.c16
-rw-r--r--net/sctp/sysctl.c9
-rw-r--r--net/sctp/transport.c5
-rw-r--r--net/sctp/ulpqueue.c2
-rw-r--r--net/socket.c6
57 files changed, 713 insertions, 624 deletions
diff --git a/Documentation/networking/3c505.txt b/Documentation/networking/3c505.txt
index b9d5b7230118..72f38b13101d 100644
--- a/Documentation/networking/3c505.txt
+++ b/Documentation/networking/3c505.txt
@@ -14,8 +14,7 @@ If no base address is given at boot time, the driver will autoprobe
14ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver 14ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver
15will try to probe for it. 15will try to probe for it.
16 16
17The driver can be used as a loadable module. See net-modules.txt for details 17The driver can be used as a loadable module.
18of the parameters it can take.
19 18
20Theoretically, one instance of the driver can now run multiple cards, 19Theoretically, one instance of the driver can now run multiple cards,
21in the standard way (when loading a module, say "modprobe 3c505 20in the standard way (when loading a module, say "modprobe 3c505
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6332acad078c..b4c0888aedc3 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -28,6 +28,7 @@
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <net/sock.h> 30#include <net/sock.h>
31#include <linux/net.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
126 if (lo->sock) { 127 if (lo->sock) {
127 printk(KERN_WARNING "%s: shutting down socket\n", 128 printk(KERN_WARNING "%s: shutting down socket\n",
128 lo->disk->disk_name); 129 lo->disk->disk_name);
129 lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); 130 kernel_sock_shutdown(lo->sock, SHUT_RDWR);
130 lo->sock = NULL; 131 lo->sock = NULL;
131 } 132 }
132 if (lock) 133 if (lock)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bf8890ebbc4c..e8d69b0adf90 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -366,8 +366,7 @@ config MAC89x0
366 read the Ethernet-HOWTO, available from 366 read the Ethernet-HOWTO, available from
367 <http://www.tldp.org/docs.html#howto>. 367 <http://www.tldp.org/docs.html#howto>.
368 368
369 To compile this driver as a module, choose M here and read 369 To compile this driver as a module, choose M here. This module will
370 <file:Documentation/networking/net-modules.txt>. This module will
371 be called mac89x0. 370 be called mac89x0.
372 371
373config MACSONIC 372config MACSONIC
@@ -380,8 +379,7 @@ config MACSONIC
380 one of these say Y and read the Ethernet-HOWTO, available from 379 one of these say Y and read the Ethernet-HOWTO, available from
381 <http://www.tldp.org/docs.html#howto>. 380 <http://www.tldp.org/docs.html#howto>.
382 381
383 To compile this driver as a module, choose M here and read 382 To compile this driver as a module, choose M here. This module will
384 <file:Documentation/networking/net-modules.txt>. This module will
385 be called macsonic. 383 be called macsonic.
386 384
387config MACMACE 385config MACMACE
@@ -619,8 +617,7 @@ config EL1
619 have problems. Some people suggest to ping ("man ping") a nearby 617 have problems. Some people suggest to ping ("man ping") a nearby
620 machine every minute ("man cron") when using this card. 618 machine every minute ("man cron") when using this card.
621 619
622 To compile this driver as a module, choose M here and read 620 To compile this driver as a module, choose M here. The module
623 <file:Documentation/networking/net-modules.txt>. The module
624 will be called 3c501. 621 will be called 3c501.
625 622
626config EL2 623config EL2
@@ -632,8 +629,7 @@ config EL2
632 the Ethernet-HOWTO, available from 629 the Ethernet-HOWTO, available from
633 <http://www.tldp.org/docs.html#howto>. 630 <http://www.tldp.org/docs.html#howto>.
634 631
635 To compile this driver as a module, choose M here and read 632 To compile this driver as a module, choose M here. The module
636 <file:Documentation/networking/net-modules.txt>. The module
637 will be called 3c503. 633 will be called 3c503.
638 634
639config ELPLUS 635config ELPLUS
@@ -645,8 +641,7 @@ config ELPLUS
645 this type, say Y and read the Ethernet-HOWTO, available from 641 this type, say Y and read the Ethernet-HOWTO, available from
646 <http://www.tldp.org/docs.html#howto>. 642 <http://www.tldp.org/docs.html#howto>.
647 643
648 To compile this driver as a module, choose M here and read 644 To compile this driver as a module, choose M here. The module
649 <file:Documentation/networking/net-modules.txt>. The module
650 will be called 3c505. 645 will be called 3c505.
651 646
652config EL16 647config EL16
@@ -657,8 +652,7 @@ config EL16
657 the Ethernet-HOWTO, available from 652 the Ethernet-HOWTO, available from
658 <http://www.tldp.org/docs.html#howto>. 653 <http://www.tldp.org/docs.html#howto>.
659 654
660 To compile this driver as a module, choose M here and read 655 To compile this driver as a module, choose M here. The module
661 <file:Documentation/networking/net-modules.txt>. The module
662 will be called 3c507. 656 will be called 3c507.
663 657
664config EL3 658config EL3
@@ -673,8 +667,7 @@ config EL3
673 setup disk to disable Plug & Play mode, and to select the default 667 setup disk to disable Plug & Play mode, and to select the default
674 media type. 668 media type.
675 669
676 To compile this driver as a module, choose M here and read 670 To compile this driver as a module, choose M here. The module
677 <file:Documentation/networking/net-modules.txt>. The module
678 will be called 3c509. 671 will be called 3c509.
679 672
680config 3C515 673config 3C515
@@ -685,8 +678,7 @@ config 3C515
685 network card, say Y and read the Ethernet-HOWTO, available from 678 network card, say Y and read the Ethernet-HOWTO, available from
686 <http://www.tldp.org/docs.html#howto>. 679 <http://www.tldp.org/docs.html#howto>.
687 680
688 To compile this driver as a module, choose M here and read 681 To compile this driver as a module, choose M here. The module
689 <file:Documentation/networking/net-modules.txt>. The module
690 will be called 3c515. 682 will be called 3c515.
691 683
692config ELMC 684config ELMC
@@ -697,8 +689,7 @@ config ELMC
697 the Ethernet-HOWTO, available from 689 the Ethernet-HOWTO, available from
698 <http://www.tldp.org/docs.html#howto>. 690 <http://www.tldp.org/docs.html#howto>.
699 691
700 To compile this driver as a module, choose M here and read 692 To compile this driver as a module, choose M here. The module
701 <file:Documentation/networking/net-modules.txt>. The module
702 will be called 3c523. 693 will be called 3c523.
703 694
704config ELMC_II 695config ELMC_II
@@ -709,8 +700,7 @@ config ELMC_II
709 the Ethernet-HOWTO, available from 700 the Ethernet-HOWTO, available from
710 <http://www.tldp.org/docs.html#howto>. 701 <http://www.tldp.org/docs.html#howto>.
711 702
712 To compile this driver as a module, choose M here and read 703 To compile this driver as a module, choose M here. The module
713 <file:Documentation/networking/net-modules.txt>. The module
714 will be called 3c527. 704 will be called 3c527.
715 705
716config VORTEX 706config VORTEX
@@ -733,8 +723,7 @@ config VORTEX
733 <file:Documentation/networking/vortex.txt> and in the comments at 723 <file:Documentation/networking/vortex.txt> and in the comments at
734 the beginning of <file:drivers/net/3c59x.c>. 724 the beginning of <file:drivers/net/3c59x.c>.
735 725
736 To compile this support as a module, choose M here and read 726 To compile this support as a module, choose M here.
737 <file:Documentation/networking/net-modules.txt>.
738 727
739config TYPHOON 728config TYPHOON
740 tristate "3cr990 series \"Typhoon\" support" 729 tristate "3cr990 series \"Typhoon\" support"
@@ -751,8 +740,7 @@ config TYPHOON
751 the Ethernet-HOWTO, available from 740 the Ethernet-HOWTO, available from
752 <http://www.tldp.org/docs.html#howto>. 741 <http://www.tldp.org/docs.html#howto>.
753 742
754 To compile this driver as a module, choose M here and read 743 To compile this driver as a module, choose M here. The module
755 <file:Documentation/networking/net-modules.txt>. The module
756 will be called typhoon. 744 will be called typhoon.
757 745
758config LANCE 746config LANCE
@@ -789,8 +777,7 @@ config WD80x3
789 the Ethernet-HOWTO, available from 777 the Ethernet-HOWTO, available from
790 <http://www.tldp.org/docs.html#howto>. 778 <http://www.tldp.org/docs.html#howto>.
791 779
792 To compile this driver as a module, choose M here and read 780 To compile this driver as a module, choose M here. The module
793 <file:Documentation/networking/net-modules.txt>. The module
794 will be called wd. 781 will be called wd.
795 782
796config ULTRAMCA 783config ULTRAMCA
@@ -802,8 +789,7 @@ config ULTRAMCA
802 an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, 789 an MCA based system (PS/2), say Y and read the Ethernet-HOWTO,
803 available from <http://www.tldp.org/docs.html#howto>. 790 available from <http://www.tldp.org/docs.html#howto>.
804 791
805 To compile this driver as a module, choose M here and read 792 To compile this driver as a module, choose M here. The module
806 <file:Documentation/networking/net-modules.txt>. The module
807 will be called smc-mca. 793 will be called smc-mca.
808 794
809config ULTRA 795config ULTRA
@@ -822,8 +808,7 @@ config ULTRA
822 this but keep it in mind if you have such a SCSI card and have 808 this but keep it in mind if you have such a SCSI card and have
823 problems. 809 problems.
824 810
825 To compile this driver as a module, choose M here and read 811 To compile this driver as a module, choose M here. The module
826 <file:Documentation/networking/net-modules.txt>. The module
827 will be called smc-ultra. 812 will be called smc-ultra.
828 813
829config ULTRA32 814config ULTRA32
@@ -835,8 +820,7 @@ config ULTRA32
835 the Ethernet-HOWTO, available from 820 the Ethernet-HOWTO, available from
836 <http://www.tldp.org/docs.html#howto>. 821 <http://www.tldp.org/docs.html#howto>.
837 822
838 To compile this driver as a module, choose M here and read 823 To compile this driver as a module, choose M here. The module
839 <file:Documentation/networking/net-modules.txt>. The module
840 will be called smc-ultra32. 824 will be called smc-ultra32.
841 825
842config BFIN_MAC 826config BFIN_MAC
@@ -897,8 +881,7 @@ config SMC9194
897 <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, 881 <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO,
898 available from <http://www.tldp.org/docs.html#howto>. 882 available from <http://www.tldp.org/docs.html#howto>.
899 883
900 To compile this driver as a module, choose M here and read 884 To compile this driver as a module, choose M here. The module
901 <file:Documentation/networking/net-modules.txt>. The module
902 will be called smc9194. 885 will be called smc9194.
903 886
904config SMC91X 887config SMC91X
@@ -916,8 +899,7 @@ config SMC91X
916 This driver is also available as a module ( = code which can be 899 This driver is also available as a module ( = code which can be
917 inserted in and removed from the running kernel whenever you want). 900 inserted in and removed from the running kernel whenever you want).
918 The module will be called smc91x. If you want to compile it as a 901 The module will be called smc91x. If you want to compile it as a
919 module, say M here and read <file:Documentation/kbuild/modules.txt> 902 module, say M here and read <file:Documentation/kbuild/modules.txt>.
920 as well as <file:Documentation/networking/net-modules.txt>.
921 903
922config NET_NETX 904config NET_NETX
923 tristate "NetX Ethernet support" 905 tristate "NetX Ethernet support"
@@ -926,8 +908,7 @@ config NET_NETX
926 help 908 help
927 This is support for the Hilscher netX builtin Ethernet ports 909 This is support for the Hilscher netX builtin Ethernet ports
928 910
929 To compile this driver as a module, choose M here and read 911 To compile this driver as a module, choose M here. The module
930 <file:Documentation/networking/net-modules.txt>. The module
931 will be called netx-eth. 912 will be called netx-eth.
932 913
933config DM9000 914config DM9000
@@ -938,9 +919,8 @@ config DM9000
938 ---help--- 919 ---help---
939 Support for DM9000 chipset. 920 Support for DM9000 chipset.
940 921
941 To compile this driver as a module, choose M here and read 922 To compile this driver as a module, choose M here. The module
942 <file:Documentation/networking/net-modules.txt>. The module will be 923 will be called dm9000.
943 called dm9000.
944 924
945config SMC911X 925config SMC911X
946 tristate "SMSC LAN911[5678] support" 926 tristate "SMSC LAN911[5678] support"
@@ -980,8 +960,7 @@ config NI5010
980 <http://www.tldp.org/docs.html#howto>. Note that this is still 960 <http://www.tldp.org/docs.html#howto>. Note that this is still
981 experimental code. 961 experimental code.
982 962
983 To compile this driver as a module, choose M here and read 963 To compile this driver as a module, choose M here. The module
984 <file:Documentation/networking/net-modules.txt>. The module
985 will be called ni5010. 964 will be called ni5010.
986 965
987config NI52 966config NI52
@@ -992,8 +971,7 @@ config NI52
992 the Ethernet-HOWTO, available from 971 the Ethernet-HOWTO, available from
993 <http://www.tldp.org/docs.html#howto>. 972 <http://www.tldp.org/docs.html#howto>.
994 973
995 To compile this driver as a module, choose M here and read 974 To compile this driver as a module, choose M here. The module
996 <file:Documentation/networking/net-modules.txt>. The module
997 will be called ni52. 975 will be called ni52.
998 976
999config NI65 977config NI65
@@ -1004,8 +982,7 @@ config NI65
1004 the Ethernet-HOWTO, available from 982 the Ethernet-HOWTO, available from
1005 <http://www.tldp.org/docs.html#howto>. 983 <http://www.tldp.org/docs.html#howto>.
1006 984
1007 To compile this driver as a module, choose M here and read 985 To compile this driver as a module, choose M here. The module
1008 <file:Documentation/networking/net-modules.txt>. The module
1009 will be called ni65. 986 will be called ni65.
1010 987
1011source "drivers/net/tulip/Kconfig" 988source "drivers/net/tulip/Kconfig"
@@ -1019,8 +996,7 @@ config AT1700
1019 the Ethernet-HOWTO, available from 996 the Ethernet-HOWTO, available from
1020 <http://www.tldp.org/docs.html#howto>. 997 <http://www.tldp.org/docs.html#howto>.
1021 998
1022 To compile this driver as a module, choose M here and read 999 To compile this driver as a module, choose M here. The module
1023 <file:Documentation/networking/net-modules.txt>. The module
1024 will be called at1700. 1000 will be called at1700.
1025 1001
1026config DEPCA 1002config DEPCA
@@ -1033,8 +1009,7 @@ config DEPCA
1033 <http://www.tldp.org/docs.html#howto> as well as 1009 <http://www.tldp.org/docs.html#howto> as well as
1034 <file:drivers/net/depca.c>. 1010 <file:drivers/net/depca.c>.
1035 1011
1036 To compile this driver as a module, choose M here and read 1012 To compile this driver as a module, choose M here. The module
1037 <file:Documentation/networking/net-modules.txt>. The module
1038 will be called depca. 1013 will be called depca.
1039 1014
1040config HP100 1015config HP100
@@ -1045,8 +1020,7 @@ config HP100
1045 the Ethernet-HOWTO, available from 1020 the Ethernet-HOWTO, available from
1046 <http://www.tldp.org/docs.html#howto>. 1021 <http://www.tldp.org/docs.html#howto>.
1047 1022
1048 To compile this driver as a module, choose M here and read 1023 To compile this driver as a module, choose M here. The module
1049 <file:Documentation/networking/net-modules.txt>. The module
1050 will be called hp100. 1024 will be called hp100.
1051 1025
1052config NET_ISA 1026config NET_ISA
@@ -1075,8 +1049,7 @@ config E2100
1075 the Ethernet-HOWTO, available from 1049 the Ethernet-HOWTO, available from
1076 <http://www.tldp.org/docs.html#howto>. 1050 <http://www.tldp.org/docs.html#howto>.
1077 1051
1078 To compile this driver as a module, choose M here and read 1052 To compile this driver as a module, choose M here. The module
1079 <file:Documentation/networking/net-modules.txt>. The module
1080 will be called e2100. 1053 will be called e2100.
1081 1054
1082config EWRK3 1055config EWRK3
@@ -1090,8 +1063,7 @@ config EWRK3
1090 well as the Ethernet-HOWTO, available from 1063 well as the Ethernet-HOWTO, available from
1091 <http://www.tldp.org/docs.html#howto>. 1064 <http://www.tldp.org/docs.html#howto>.
1092 1065
1093 To compile this driver as a module, choose M here and read 1066 To compile this driver as a module, choose M here. The module
1094 <file:Documentation/networking/net-modules.txt>. The module
1095 will be called ewrk3. 1067 will be called ewrk3.
1096 1068
1097config EEXPRESS 1069config EEXPRESS
@@ -1105,8 +1077,7 @@ config EEXPRESS
1105 because the driver was very unreliable. We now have a new driver 1077 because the driver was very unreliable. We now have a new driver
1106 that should do better. 1078 that should do better.
1107 1079
1108 To compile this driver as a module, choose M here and read 1080 To compile this driver as a module, choose M here. The module
1109 <file:Documentation/networking/net-modules.txt>. The module
1110 will be called eexpress. 1081 will be called eexpress.
1111 1082
1112config EEXPRESS_PRO 1083config EEXPRESS_PRO
@@ -1119,8 +1090,7 @@ config EEXPRESS_PRO
1119 driver. Please read the Ethernet-HOWTO, available from 1090 driver. Please read the Ethernet-HOWTO, available from
1120 <http://www.tldp.org/docs.html#howto>. 1091 <http://www.tldp.org/docs.html#howto>.
1121 1092
1122 To compile this driver as a module, choose M here and read 1093 To compile this driver as a module, choose M here. The module
1123 <file:Documentation/networking/net-modules.txt>. The module
1124 will be called eepro. 1094 will be called eepro.
1125 1095
1126config HPLAN_PLUS 1096config HPLAN_PLUS
@@ -1132,8 +1102,7 @@ config HPLAN_PLUS
1132 the Ethernet-HOWTO, available from 1102 the Ethernet-HOWTO, available from
1133 <http://www.tldp.org/docs.html#howto>. 1103 <http://www.tldp.org/docs.html#howto>.
1134 1104
1135 To compile this driver as a module, choose M here and read 1105 To compile this driver as a module, choose M here. The module
1136 <file:Documentation/networking/net-modules.txt>. The module
1137 will be called hp-plus. 1106 will be called hp-plus.
1138 1107
1139config HPLAN 1108config HPLAN
@@ -1145,8 +1114,7 @@ config HPLAN
1145 the Ethernet-HOWTO, available from 1114 the Ethernet-HOWTO, available from
1146 <http://www.tldp.org/docs.html#howto>. 1115 <http://www.tldp.org/docs.html#howto>.
1147 1116
1148 To compile this driver as a module, choose M here and read 1117 To compile this driver as a module, choose M here. The module
1149 <file:Documentation/networking/net-modules.txt>. The module
1150 will be called hp. 1118 will be called hp.
1151 1119
1152config LP486E 1120config LP486E
@@ -1165,8 +1133,7 @@ config ETH16I
1165 the Ethernet-HOWTO, available from 1133 the Ethernet-HOWTO, available from
1166 <http://www.tldp.org/docs.html#howto>. 1134 <http://www.tldp.org/docs.html#howto>.
1167 1135
1168 To compile this driver as a module, choose M here and read 1136 To compile this driver as a module, choose M here. The module
1169 <file:Documentation/networking/net-modules.txt>. The module
1170 will be called eth16i. 1137 will be called eth16i.
1171 1138
1172config NE2000 1139config NE2000
@@ -1186,8 +1153,7 @@ config NE2000
1186 laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", 1153 laptops), say N here and Y to "NE/2 (ne2000 MCA version) support",
1187 below. 1154 below.
1188 1155
1189 To compile this driver as a module, choose M here and read 1156 To compile this driver as a module, choose M here. The module
1190 <file:Documentation/networking/net-modules.txt>. The module
1191 will be called ne. 1157 will be called ne.
1192 1158
1193config ZNET 1159config ZNET
@@ -1208,8 +1174,7 @@ config SEEQ8005
1208 is for you, read the Ethernet-HOWTO, available from 1174 is for you, read the Ethernet-HOWTO, available from
1209 <http://www.tldp.org/docs.html#howto>. 1175 <http://www.tldp.org/docs.html#howto>.
1210 1176
1211 To compile this driver as a module, choose M here and read 1177 To compile this driver as a module, choose M here. The module
1212 <file:Documentation/networking/net-modules.txt>. The module
1213 will be called seeq8005. 1178 will be called seeq8005.
1214 1179
1215config NE2_MCA 1180config NE2_MCA
@@ -1221,8 +1186,7 @@ config NE2_MCA
1221 the Ethernet-HOWTO, available from 1186 the Ethernet-HOWTO, available from
1222 <http://www.tldp.org/docs.html#howto>. 1187 <http://www.tldp.org/docs.html#howto>.
1223 1188
1224 To compile this driver as a module, choose M here and read 1189 To compile this driver as a module, choose M here. The module
1225 <file:Documentation/networking/net-modules.txt>. The module
1226 will be called ne2. 1190 will be called ne2.
1227 1191
1228config IBMLANA 1192config IBMLANA
@@ -1233,8 +1197,7 @@ config IBMLANA
1233 CONFIG_MCA to use this driver. It is both available as an in-kernel 1197 CONFIG_MCA to use this driver. It is both available as an in-kernel
1234 driver and as a module. 1198 driver and as a module.
1235 1199
1236 To compile this driver as a module, choose M here and read 1200 To compile this driver as a module, choose M here. The only
1237 <file:Documentation/networking/net-modules.txt>. The only
1238 currently supported card is the IBM LAN Adapter/A for Ethernet. It 1201 currently supported card is the IBM LAN Adapter/A for Ethernet. It
1239 will both support 16K and 32K memory windows, however a 32K window 1202 will both support 16K and 32K memory windows, however a 32K window
1240 gives a better security against packet losses. Usage of multiple 1203 gives a better security against packet losses. Usage of multiple
@@ -1248,8 +1211,7 @@ config IBMVETH
1248 This driver supports virtual ethernet adapters on newer IBM iSeries 1211 This driver supports virtual ethernet adapters on newer IBM iSeries
1249 and pSeries systems. 1212 and pSeries systems.
1250 1213
1251 To compile this driver as a module, choose M here and read 1214 To compile this driver as a module, choose M here. The module will
1252 <file:Documentation/networking/net-modules.txt>. The module will
1253 be called ibmveth. 1215 be called ibmveth.
1254 1216
1255source "drivers/net/ibm_emac/Kconfig" 1217source "drivers/net/ibm_emac/Kconfig"
@@ -1279,8 +1241,7 @@ config PCNET32
1279 answer Y here and read the Ethernet-HOWTO, available from 1241 answer Y here and read the Ethernet-HOWTO, available from
1280 <http://www.tldp.org/docs.html#howto>. 1242 <http://www.tldp.org/docs.html#howto>.
1281 1243
1282 To compile this driver as a module, choose M here and read 1244 To compile this driver as a module, choose M here. The module
1283 <file:Documentation/networking/net-modules.txt>. The module
1284 will be called pcnet32. 1245 will be called pcnet32.
1285 1246
1286config PCNET32_NAPI 1247config PCNET32_NAPI
@@ -1307,8 +1268,7 @@ config AMD8111_ETH
1307 answer Y here and read the Ethernet-HOWTO, available from 1268 answer Y here and read the Ethernet-HOWTO, available from
1308 <http://www.tldp.org/docs.html#howto>. 1269 <http://www.tldp.org/docs.html#howto>.
1309 1270
1310 To compile this driver as a module, choose M here and read 1271 To compile this driver as a module, choose M here. The module
1311 <file:Documentation/networking/net-modules.txt>. The module
1312 will be called amd8111e. 1272 will be called amd8111e.
1313 1273
1314config AMD8111E_NAPI 1274config AMD8111E_NAPI
@@ -1362,8 +1322,7 @@ config AC3200
1362 the Ethernet-HOWTO, available from 1322 the Ethernet-HOWTO, available from
1363 <http://www.tldp.org/docs.html#howto>. 1323 <http://www.tldp.org/docs.html#howto>.
1364 1324
1365 To compile this driver as a module, choose M here and read 1325 To compile this driver as a module, choose M here. The module
1366 <file:Documentation/networking/net-modules.txt>. The module
1367 will be called ac3200. 1326 will be called ac3200.
1368 1327
1369config APRICOT 1328config APRICOT
@@ -1374,9 +1333,8 @@ config APRICOT
1374 read the Ethernet-HOWTO, available from 1333 read the Ethernet-HOWTO, available from
1375 <http://www.tldp.org/docs.html#howto>. 1334 <http://www.tldp.org/docs.html#howto>.
1376 1335
1377 To compile this driver as a module, choose M here and read 1336 To compile this driver as a module, choose M here. The module
1378 <file:Documentation/networking/net-modules.txt>. The module will be 1337 will be called apricot.
1379 called apricot.
1380 1338
1381config B44 1339config B44
1382 tristate "Broadcom 440x/47xx ethernet support" 1340 tristate "Broadcom 440x/47xx ethernet support"
@@ -1388,9 +1346,8 @@ config B44
1388 or M and read the Ethernet-HOWTO, available from 1346 or M and read the Ethernet-HOWTO, available from
1389 <http://www.tldp.org/docs.html#howto>. 1347 <http://www.tldp.org/docs.html#howto>.
1390 1348
1391 To compile this driver as a module, choose M here and read 1349 To compile this driver as a module, choose M here. The module
1392 <file:Documentation/networking/net-modules.txt>. The module will be 1350 will be called b44.
1393 called b44.
1394 1351
1395# Auto-select SSB PCI-HOST support, if possible 1352# Auto-select SSB PCI-HOST support, if possible
1396config B44_PCI_AUTOSELECT 1353config B44_PCI_AUTOSELECT
@@ -1419,9 +1376,8 @@ config FORCEDETH
1419 read the Ethernet-HOWTO, available from 1376 read the Ethernet-HOWTO, available from
1420 <http://www.tldp.org/docs.html#howto>. 1377 <http://www.tldp.org/docs.html#howto>.
1421 1378
1422 To compile this driver as a module, choose M here and read 1379 To compile this driver as a module, choose M here. The module
1423 <file:Documentation/networking/net-modules.txt>. The module will be 1380 will be called forcedeth.
1424 called forcedeth.
1425 1381
1426config FORCEDETH_NAPI 1382config FORCEDETH_NAPI
1427 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" 1383 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
@@ -1447,9 +1403,8 @@ config CS89x0
1447 <http://www.tldp.org/docs.html#howto> as well as 1403 <http://www.tldp.org/docs.html#howto> as well as
1448 <file:Documentation/networking/cs89x0.txt>. 1404 <file:Documentation/networking/cs89x0.txt>.
1449 1405
1450 To compile this driver as a module, choose M here and read 1406 To compile this driver as a module, choose M here. The module
1451 <file:Documentation/networking/net-modules.txt>. The module will be 1407 will be called cs89x0.
1452 called cs89x0.
1453 1408
1454config TC35815 1409config TC35815
1455 tristate "TOSHIBA TC35815 Ethernet support" 1410 tristate "TOSHIBA TC35815 Ethernet support"
@@ -1465,8 +1420,7 @@ config EEPRO100
1465 card, say Y and read the Ethernet-HOWTO, available from 1420 card, say Y and read the Ethernet-HOWTO, available from
1466 <http://www.tldp.org/docs.html#howto>. 1421 <http://www.tldp.org/docs.html#howto>.
1467 1422
1468 To compile this driver as a module, choose M here and read 1423 To compile this driver as a module, choose M here. The module
1469 <file:Documentation/networking/net-modules.txt>. The module
1470 will be called eepro100. 1424 will be called eepro100.
1471 1425
1472 1426
@@ -1493,8 +1447,7 @@ config E100
1493 More specific information on configuring the driver is in 1447 More specific information on configuring the driver is in
1494 <file:Documentation/networking/e100.txt>. 1448 <file:Documentation/networking/e100.txt>.
1495 1449
1496 To compile this driver as a module, choose M here and read 1450 To compile this driver as a module, choose M here. The module
1497 <file:Documentation/networking/net-modules.txt>. The module
1498 will be called e100. 1451 will be called e100.
1499 1452
1500config LNE390 1453config LNE390
@@ -1506,8 +1459,7 @@ config LNE390
1506 the Ethernet-HOWTO, available from 1459 the Ethernet-HOWTO, available from
1507 <http://www.tldp.org/docs.html#howto>. 1460 <http://www.tldp.org/docs.html#howto>.
1508 1461
1509 To compile this driver as a module, choose M here and read 1462 To compile this driver as a module, choose M here. The module
1510 <file:Documentation/networking/net-modules.txt>. The module
1511 will be called lne390. 1463 will be called lne390.
1512 1464
1513config FEALNX 1465config FEALNX
@@ -1547,8 +1499,7 @@ config NE2K_PCI
1547 NetVin NV5000SC Via 86C926 SureCom NE34 Winbond 1499 NetVin NV5000SC Via 86C926 SureCom NE34 Winbond
1548 Holtek HT80232 Holtek HT80229 1500 Holtek HT80232 Holtek HT80229
1549 1501
1550 To compile this driver as a module, choose M here and read 1502 To compile this driver as a module, choose M here. The module
1551 <file:Documentation/networking/net-modules.txt>. The module
1552 will be called ne2k-pci. 1503 will be called ne2k-pci.
1553 1504
1554config NE3210 1505config NE3210
@@ -1561,8 +1512,7 @@ config NE3210
1561 <http://www.tldp.org/docs.html#howto>. Note that this driver 1512 <http://www.tldp.org/docs.html#howto>. Note that this driver
1562 will NOT WORK for NE3200 cards as they are completely different. 1513 will NOT WORK for NE3200 cards as they are completely different.
1563 1514
1564 To compile this driver as a module, choose M here and read 1515 To compile this driver as a module, choose M here. The module
1565 <file:Documentation/networking/net-modules.txt>. The module
1566 will be called ne3210. 1516 will be called ne3210.
1567 1517
1568config ES3210 1518config ES3210
@@ -1574,8 +1524,7 @@ config ES3210
1574 the Ethernet-HOWTO, available from 1524 the Ethernet-HOWTO, available from
1575 <http://www.tldp.org/docs.html#howto>. 1525 <http://www.tldp.org/docs.html#howto>.
1576 1526
1577 To compile this driver as a module, choose M here and read 1527 To compile this driver as a module, choose M here. The module
1578 <file:Documentation/networking/net-modules.txt>. The module
1579 will be called es3210. 1528 will be called es3210.
1580 1529
1581config 8139CP 1530config 8139CP
@@ -1705,8 +1654,7 @@ config TLAN
1705 Compaq NetFlex and Olicom cards. Please read the file 1654 Compaq NetFlex and Olicom cards. Please read the file
1706 <file:Documentation/networking/tlan.txt> for more details. 1655 <file:Documentation/networking/tlan.txt> for more details.
1707 1656
1708 To compile this driver as a module, choose M here and read 1657 To compile this driver as a module, choose M here. The module
1709 <file:Documentation/networking/net-modules.txt>. The module
1710 will be called tlan. 1658 will be called tlan.
1711 1659
1712 Please email feedback to <torben.mathiasen@compaq.com>. 1660 Please email feedback to <torben.mathiasen@compaq.com>.
@@ -1996,8 +1944,7 @@ config E1000
1996 More specific information on configuring the driver is in 1944 More specific information on configuring the driver is in
1997 <file:Documentation/networking/e1000.txt>. 1945 <file:Documentation/networking/e1000.txt>.
1998 1946
1999 To compile this driver as a module, choose M here and read 1947 To compile this driver as a module, choose M here. The module
2000 <file:Documentation/networking/net-modules.txt>. The module
2001 will be called e1000. 1948 will be called e1000.
2002 1949
2003config E1000_NAPI 1950config E1000_NAPI
@@ -2042,8 +1989,7 @@ config E1000E
2042 More specific information on configuring the driver is in 1989 More specific information on configuring the driver is in
2043 <file:Documentation/networking/e1000e.txt>. 1990 <file:Documentation/networking/e1000e.txt>.
2044 1991
2045 To compile this driver as a module, choose M here and read 1992 To compile this driver as a module, choose M here. The module
2046 <file:Documentation/networking/net-modules.txt>. The module
2047 will be called e1000e. 1993 will be called e1000e.
2048 1994
2049source "drivers/net/ixp2000/Kconfig" 1995source "drivers/net/ixp2000/Kconfig"
@@ -2076,8 +2022,7 @@ config HAMACHI
2076 the Ethernet-HOWTO, available from 2022 the Ethernet-HOWTO, available from
2077 <http://www.tldp.org/docs.html#howto>. 2023 <http://www.tldp.org/docs.html#howto>.
2078 2024
2079 To compile this driver as a module, choose M here and read 2025 To compile this driver as a module, choose M here. The module will be
2080 <file:Documentation/networking/net-modules.txt>. The module will be
2081 called hamachi. 2026 called hamachi.
2082 2027
2083config YELLOWFIN 2028config YELLOWFIN
@@ -2526,8 +2471,7 @@ config IXGBE
2526 More specific information on configuring the driver is in 2471 More specific information on configuring the driver is in
2527 <file:Documentation/networking/ixgbe.txt>. 2472 <file:Documentation/networking/ixgbe.txt>.
2528 2473
2529 To compile this driver as a module, choose M here and read 2474 To compile this driver as a module, choose M here. The module
2530 <file:Documentation/networking/net-modules.txt>. The module
2531 will be called ixgbe. 2475 will be called ixgbe.
2532 2476
2533config IXGB 2477config IXGB
@@ -2549,8 +2493,7 @@ config IXGB
2549 More specific information on configuring the driver is in 2493 More specific information on configuring the driver is in
2550 <file:Documentation/networking/ixgb.txt>. 2494 <file:Documentation/networking/ixgb.txt>.
2551 2495
2552 To compile this driver as a module, choose M here and read 2496 To compile this driver as a module, choose M here. The module
2553 <file:Documentation/networking/net-modules.txt>. The module
2554 will be called ixgb. 2497 will be called ixgb.
2555 2498
2556config IXGB_NAPI 2499config IXGB_NAPI
@@ -2603,8 +2546,7 @@ config MYRI10GE
2603 2546
2604 <http://www.myri.com/scs/download-Myri10GE.html> 2547 <http://www.myri.com/scs/download-Myri10GE.html>
2605 2548
2606 To compile this driver as a module, choose M here and read 2549 To compile this driver as a module, choose M here. The module
2607 <file:Documentation/networking/net-modules.txt>. The module
2608 will be called myri10ge. 2550 will be called myri10ge.
2609 2551
2610config NETXEN_NIC 2552config NETXEN_NIC
@@ -2828,10 +2770,9 @@ config PLIP
2828 with the PLIP support in Linux versions 1.0.x. This option enlarges 2770 with the PLIP support in Linux versions 1.0.x. This option enlarges
2829 your kernel by about 8 KB. 2771 your kernel by about 8 KB.
2830 2772
2831 To compile this driver as a module, choose M here and read 2773 To compile this driver as a module, choose M here. The module
2832 <file:Documentation/networking/net-modules.txt>. The module will be 2774 will be called plip. If unsure, say Y or M, in case you buy
2833 called plip. If unsure, say Y or M, in case you buy a laptop 2775 a laptop later.
2834 later.
2835 2776
2836config PPP 2777config PPP
2837 tristate "PPP (point-to-point protocol) support" 2778 tristate "PPP (point-to-point protocol) support"
@@ -2861,8 +2802,7 @@ config PPP
2861 If you said Y to "Version information on all symbols" above, then 2802 If you said Y to "Version information on all symbols" above, then
2862 you cannot compile the PPP driver into the kernel; you can then only 2803 you cannot compile the PPP driver into the kernel; you can then only
2863 compile it as a module. To compile this driver as a module, choose M 2804 compile it as a module. To compile this driver as a module, choose M
2864 here and read <file:Documentation/networking/net-modules.txt>. 2805 here. The module will be called ppp_generic.
2865 The module will be called ppp_generic.
2866 2806
2867config PPP_MULTILINK 2807config PPP_MULTILINK
2868 bool "PPP multilink support (EXPERIMENTAL)" 2808 bool "PPP multilink support (EXPERIMENTAL)"
@@ -3023,9 +2963,8 @@ config SLIP
3023 <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP 2963 <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP
3024 support will enlarge your kernel by about 4 KB. If unsure, say N. 2964 support will enlarge your kernel by about 4 KB. If unsure, say N.
3025 2965
3026 To compile this driver as a module, choose M here and read 2966 To compile this driver as a module, choose M here. The module
3027 <file:Documentation/networking/net-modules.txt>. The module will be 2967 will be called slip.
3028 called slip.
3029 2968
3030config SLIP_COMPRESSED 2969config SLIP_COMPRESSED
3031 bool "CSLIP compressed headers" 2970 bool "CSLIP compressed headers"
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index 4030274fe788..3b2f7f115464 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -19,8 +19,7 @@ menuconfig ARCNET
19 from <http://www.tldp.org/docs.html#howto>(even though ARCnet 19 from <http://www.tldp.org/docs.html#howto>(even though ARCnet
20 is not really Ethernet). 20 is not really Ethernet).
21 21
22 To compile this driver as a module, choose M here and read 22 To compile this driver as a module, choose M here. The module will
23 <file:Documentation/networking/net-modules.txt>. The module will
24 be called arcnet. 23 be called arcnet.
25 24
26if ARCNET 25if ARCNET
@@ -81,8 +80,7 @@ config ARCNET_COM90xx
81 have always used the old ARCnet driver without knowing what type of 80 have always used the old ARCnet driver without knowing what type of
82 card you had, this is probably the one for you. 81 card you had, this is probably the one for you.
83 82
84 To compile this driver as a module, choose M here and read 83 To compile this driver as a module, choose M here. The module will
85 <file:Documentation/networking/net-modules.txt>. The module will
86 be called com90xx. 84 be called com90xx.
87 85
88config ARCNET_COM90xxIO 86config ARCNET_COM90xxIO
@@ -93,8 +91,7 @@ config ARCNET_COM90xxIO
93 the normal driver. Only use it if your card doesn't support shared 91 the normal driver. Only use it if your card doesn't support shared
94 memory. 92 memory.
95 93
96 To compile this driver as a module, choose M here and read 94 To compile this driver as a module, choose M here. The module will
97 <file:Documentation/networking/net-modules.txt>. The module will
98 be called com90io. 95 be called com90io.
99 96
100config ARCNET_RIM_I 97config ARCNET_RIM_I
@@ -105,8 +102,7 @@ config ARCNET_RIM_I
105 driver is completely untested, so if you have one of these cards, 102 driver is completely untested, so if you have one of these cards,
106 please mail <dwmw2@infradead.org>, especially if it works! 103 please mail <dwmw2@infradead.org>, especially if it works!
107 104
108 To compile this driver as a module, choose M here and read 105 To compile this driver as a module, choose M here. The module will
109 <file:Documentation/networking/net-modules.txt>. The module will
110 be called arc-rimi. 106 be called arc-rimi.
111 107
112config ARCNET_COM20020 108config ARCNET_COM20020
@@ -116,8 +112,7 @@ config ARCNET_COM20020
116 things as promiscuous mode, so packet sniffing is possible, and 112 things as promiscuous mode, so packet sniffing is possible, and
117 extra diagnostic information. 113 extra diagnostic information.
118 114
119 To compile this driver as a module, choose M here and read 115 To compile this driver as a module, choose M here. The module will
120 <file:Documentation/networking/net-modules.txt>. The module will
121 be called com20020. 116 be called com20020.
122 117
123config ARCNET_COM20020_ISA 118config ARCNET_COM20020_ISA
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 45f30a2974b8..662b8d16803c 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net)
284 unregister_netdev(dev); 284 unregister_netdev(dev);
285} 285}
286 286
287static struct pernet_operations loopback_net_ops = { 287static struct pernet_operations __net_initdata loopback_net_ops = {
288 .init = loopback_net_init, 288 .init = loopback_net_init,
289 .exit = loopback_net_exit, 289 .exit = loopback_net_exit,
290}; 290};
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 8d29319cc5cb..656a260fc956 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -134,7 +134,7 @@ static int myri_do_handshake(struct myri_eth *mp)
134 134
135 myri_disable_irq(mp->lregs, cregs); 135 myri_disable_irq(mp->lregs, cregs);
136 136
137 while (tick++ <= 25) { 137 while (tick++ < 25) {
138 u32 softstate; 138 u32 softstate;
139 139
140 /* Wake it up. */ 140 /* Wake it up. */
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 8d278c87ba48..f023d5b67e6e 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty)
160 160
161 err = -ENOMEM; 161 err = -ENOMEM;
162 ap = kzalloc(sizeof(*ap), GFP_KERNEL); 162 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
163 if (ap == 0) 163 if (!ap)
164 goto out; 164 goto out;
165 165
166 /* initialize the asyncppp structure */ 166 /* initialize the asyncppp structure */
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty)
215 ap = tty->disc_data; 215 ap = tty->disc_data;
216 tty->disc_data = NULL; 216 tty->disc_data = NULL;
217 write_unlock_irq(&disc_data_lock); 217 write_unlock_irq(&disc_data_lock);
218 if (ap == 0) 218 if (!ap)
219 return; 219 return;
220 220
221 /* 221 /*
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty)
230 tasklet_kill(&ap->tsk); 230 tasklet_kill(&ap->tsk);
231 231
232 ppp_unregister_channel(&ap->chan); 232 ppp_unregister_channel(&ap->chan);
233 if (ap->rpkt != 0) 233 if (ap->rpkt)
234 kfree_skb(ap->rpkt); 234 kfree_skb(ap->rpkt);
235 skb_queue_purge(&ap->rqueue); 235 skb_queue_purge(&ap->rqueue);
236 if (ap->tpkt != 0) 236 if (ap->tpkt)
237 kfree_skb(ap->tpkt); 237 kfree_skb(ap->tpkt);
238 kfree(ap); 238 kfree(ap);
239} 239}
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
285 int err, val; 285 int err, val;
286 int __user *p = (int __user *)arg; 286 int __user *p = (int __user *)arg;
287 287
288 if (ap == 0) 288 if (!ap)
289 return -ENXIO; 289 return -ENXIO;
290 err = -EFAULT; 290 err = -EFAULT;
291 switch (cmd) { 291 switch (cmd) {
292 case PPPIOCGCHAN: 292 case PPPIOCGCHAN:
293 err = -ENXIO; 293 err = -ENXIO;
294 if (ap == 0) 294 if (!ap)
295 break; 295 break;
296 err = -EFAULT; 296 err = -EFAULT;
297 if (put_user(ppp_channel_index(&ap->chan), p)) 297 if (put_user(ppp_channel_index(&ap->chan), p))
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
301 301
302 case PPPIOCGUNIT: 302 case PPPIOCGUNIT:
303 err = -ENXIO; 303 err = -ENXIO;
304 if (ap == 0) 304 if (!ap)
305 break; 305 break;
306 err = -EFAULT; 306 err = -EFAULT;
307 if (put_user(ppp_unit_number(&ap->chan), p)) 307 if (put_user(ppp_unit_number(&ap->chan), p))
@@ -350,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
350 struct asyncppp *ap = ap_get(tty); 350 struct asyncppp *ap = ap_get(tty);
351 unsigned long flags; 351 unsigned long flags;
352 352
353 if (ap == 0) 353 if (!ap)
354 return; 354 return;
355 spin_lock_irqsave(&ap->recv_lock, flags); 355 spin_lock_irqsave(&ap->recv_lock, flags);
356 ppp_async_input(ap, buf, cflags, count); 356 ppp_async_input(ap, buf, cflags, count);
@@ -369,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
369 struct asyncppp *ap = ap_get(tty); 369 struct asyncppp *ap = ap_get(tty);
370 370
371 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 371 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
372 if (ap == 0) 372 if (!ap)
373 return; 373 return;
374 set_bit(XMIT_WAKEUP, &ap->xmit_flags); 374 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
375 tasklet_schedule(&ap->tsk); 375 tasklet_schedule(&ap->tsk);
@@ -684,7 +684,7 @@ ppp_async_push(struct asyncppp *ap)
684 tty_stuffed = 1; 684 tty_stuffed = 1;
685 continue; 685 continue;
686 } 686 }
687 if (ap->optr >= ap->olim && ap->tpkt != 0) { 687 if (ap->optr >= ap->olim && ap->tpkt) {
688 if (ppp_async_encode(ap)) { 688 if (ppp_async_encode(ap)) {
689 /* finished processing ap->tpkt */ 689 /* finished processing ap->tpkt */
690 clear_bit(XMIT_FULL, &ap->xmit_flags); 690 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -704,7 +704,7 @@ ppp_async_push(struct asyncppp *ap)
704 clear_bit(XMIT_BUSY, &ap->xmit_flags); 704 clear_bit(XMIT_BUSY, &ap->xmit_flags);
705 /* any more work to do? if not, exit the loop */ 705 /* any more work to do? if not, exit the loop */
706 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) 706 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
707 || (!tty_stuffed && ap->tpkt != 0))) 707 || (!tty_stuffed && ap->tpkt)))
708 break; 708 break;
709 /* more work to do, see if we can do it now */ 709 /* more work to do, see if we can do it now */
710 if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) 710 if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags))
@@ -715,7 +715,7 @@ ppp_async_push(struct asyncppp *ap)
715 715
716flush: 716flush:
717 clear_bit(XMIT_BUSY, &ap->xmit_flags); 717 clear_bit(XMIT_BUSY, &ap->xmit_flags);
718 if (ap->tpkt != 0) { 718 if (ap->tpkt) {
719 kfree_skb(ap->tpkt); 719 kfree_skb(ap->tpkt);
720 ap->tpkt = NULL; 720 ap->tpkt = NULL;
721 clear_bit(XMIT_FULL, &ap->xmit_flags); 721 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -848,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
848 s = 0; 848 s = 0;
849 for (i = 0; i < count; ++i) { 849 for (i = 0; i < count; ++i) {
850 c = buf[i]; 850 c = buf[i];
851 if (flags != 0 && flags[i] != 0) 851 if (flags && flags[i] != 0)
852 continue; 852 continue;
853 s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; 853 s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0;
854 c = ((c >> 4) ^ c) & 0xf; 854 c = ((c >> 4) ^ c) & 0xf;
@@ -865,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
865 n = scan_ordinary(ap, buf, count); 865 n = scan_ordinary(ap, buf, count);
866 866
867 f = 0; 867 f = 0;
868 if (flags != 0 && (ap->state & SC_TOSS) == 0) { 868 if (flags && (ap->state & SC_TOSS) == 0) {
869 /* check the flags to see if any char had an error */ 869 /* check the flags to see if any char had an error */
870 for (j = 0; j < n; ++j) 870 for (j = 0; j < n; ++j)
871 if ((f = flags[j]) != 0) 871 if ((f = flags[j]) != 0)
@@ -878,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
878 } else if (n > 0 && (ap->state & SC_TOSS) == 0) { 878 } else if (n > 0 && (ap->state & SC_TOSS) == 0) {
879 /* stuff the chars in the skb */ 879 /* stuff the chars in the skb */
880 skb = ap->rpkt; 880 skb = ap->rpkt;
881 if (skb == 0) { 881 if (!skb) {
882 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); 882 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
883 if (skb == 0) 883 if (!skb)
884 goto nomem; 884 goto nomem;
885 ap->rpkt = skb; 885 ap->rpkt = skb;
886 } 886 }
@@ -927,7 +927,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
927 ++n; 927 ++n;
928 928
929 buf += n; 929 buf += n;
930 if (flags != 0) 930 if (flags)
931 flags += n; 931 flags += n;
932 count -= n; 932 count -= n;
933 } 933 }
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4b49d0e8c7eb..4f690378bb77 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -367,7 +367,7 @@ static int ppp_release(struct inode *inode, struct file *file)
367 struct ppp_file *pf = file->private_data; 367 struct ppp_file *pf = file->private_data;
368 struct ppp *ppp; 368 struct ppp *ppp;
369 369
370 if (pf != 0) { 370 if (pf) {
371 file->private_data = NULL; 371 file->private_data = NULL;
372 if (pf->kind == INTERFACE) { 372 if (pf->kind == INTERFACE) {
373 ppp = PF_TO_PPP(pf); 373 ppp = PF_TO_PPP(pf);
@@ -398,7 +398,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
398 398
399 ret = count; 399 ret = count;
400 400
401 if (pf == 0) 401 if (!pf)
402 return -ENXIO; 402 return -ENXIO;
403 add_wait_queue(&pf->rwait, &wait); 403 add_wait_queue(&pf->rwait, &wait);
404 for (;;) { 404 for (;;) {
@@ -431,7 +431,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
431 set_current_state(TASK_RUNNING); 431 set_current_state(TASK_RUNNING);
432 remove_wait_queue(&pf->rwait, &wait); 432 remove_wait_queue(&pf->rwait, &wait);
433 433
434 if (skb == 0) 434 if (!skb)
435 goto out; 435 goto out;
436 436
437 ret = -EOVERFLOW; 437 ret = -EOVERFLOW;
@@ -455,11 +455,11 @@ static ssize_t ppp_write(struct file *file, const char __user *buf,
455 struct sk_buff *skb; 455 struct sk_buff *skb;
456 ssize_t ret; 456 ssize_t ret;
457 457
458 if (pf == 0) 458 if (!pf)
459 return -ENXIO; 459 return -ENXIO;
460 ret = -ENOMEM; 460 ret = -ENOMEM;
461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); 461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL);
462 if (skb == 0) 462 if (!skb)
463 goto out; 463 goto out;
464 skb_reserve(skb, pf->hdrlen); 464 skb_reserve(skb, pf->hdrlen);
465 ret = -EFAULT; 465 ret = -EFAULT;
@@ -491,11 +491,11 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait)
491 struct ppp_file *pf = file->private_data; 491 struct ppp_file *pf = file->private_data;
492 unsigned int mask; 492 unsigned int mask;
493 493
494 if (pf == 0) 494 if (!pf)
495 return 0; 495 return 0;
496 poll_wait(file, &pf->rwait, wait); 496 poll_wait(file, &pf->rwait, wait);
497 mask = POLLOUT | POLLWRNORM; 497 mask = POLLOUT | POLLWRNORM;
498 if (skb_peek(&pf->rq) != 0) 498 if (skb_peek(&pf->rq))
499 mask |= POLLIN | POLLRDNORM; 499 mask |= POLLIN | POLLRDNORM;
500 if (pf->dead) 500 if (pf->dead)
501 mask |= POLLHUP; 501 mask |= POLLHUP;
@@ -559,7 +559,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
559 void __user *argp = (void __user *)arg; 559 void __user *argp = (void __user *)arg;
560 int __user *p = argp; 560 int __user *p = argp;
561 561
562 if (pf == 0) 562 if (!pf)
563 return ppp_unattached_ioctl(pf, file, cmd, arg); 563 return ppp_unattached_ioctl(pf, file, cmd, arg);
564 564
565 if (cmd == PPPIOCDETACH) { 565 if (cmd == PPPIOCDETACH) {
@@ -689,13 +689,13 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
689 val &= 0xffff; 689 val &= 0xffff;
690 } 690 }
691 vj = slhc_init(val2+1, val+1); 691 vj = slhc_init(val2+1, val+1);
692 if (vj == 0) { 692 if (!vj) {
693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); 693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n");
694 err = -ENOMEM; 694 err = -ENOMEM;
695 break; 695 break;
696 } 696 }
697 ppp_lock(ppp); 697 ppp_lock(ppp);
698 if (ppp->vj != 0) 698 if (ppp->vj)
699 slhc_free(ppp->vj); 699 slhc_free(ppp->vj);
700 ppp->vj = vj; 700 ppp->vj = vj;
701 ppp_unlock(ppp); 701 ppp_unlock(ppp);
@@ -786,7 +786,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
786 if (get_user(unit, p)) 786 if (get_user(unit, p))
787 break; 787 break;
788 ppp = ppp_create_interface(unit, &err); 788 ppp = ppp_create_interface(unit, &err);
789 if (ppp == 0) 789 if (!ppp)
790 break; 790 break;
791 file->private_data = &ppp->file; 791 file->private_data = &ppp->file;
792 ppp->owner = file; 792 ppp->owner = file;
@@ -803,7 +803,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
803 mutex_lock(&all_ppp_mutex); 803 mutex_lock(&all_ppp_mutex);
804 err = -ENXIO; 804 err = -ENXIO;
805 ppp = ppp_find_unit(unit); 805 ppp = ppp_find_unit(unit);
806 if (ppp != 0) { 806 if (ppp) {
807 atomic_inc(&ppp->file.refcnt); 807 atomic_inc(&ppp->file.refcnt);
808 file->private_data = &ppp->file; 808 file->private_data = &ppp->file;
809 err = 0; 809 err = 0;
@@ -817,7 +817,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
817 spin_lock_bh(&all_channels_lock); 817 spin_lock_bh(&all_channels_lock);
818 err = -ENXIO; 818 err = -ENXIO;
819 chan = ppp_find_channel(unit); 819 chan = ppp_find_channel(unit);
820 if (chan != 0) { 820 if (chan) {
821 atomic_inc(&chan->file.refcnt); 821 atomic_inc(&chan->file.refcnt);
822 file->private_data = &chan->file; 822 file->private_data = &chan->file;
823 err = 0; 823 err = 0;
@@ -946,9 +946,9 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
946 946
947 case SIOCGPPPCSTATS: 947 case SIOCGPPPCSTATS:
948 memset(&cstats, 0, sizeof(cstats)); 948 memset(&cstats, 0, sizeof(cstats));
949 if (ppp->xc_state != 0) 949 if (ppp->xc_state)
950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); 950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c);
951 if (ppp->rc_state != 0) 951 if (ppp->rc_state)
952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); 952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d);
953 if (copy_to_user(addr, &cstats, sizeof(cstats))) 953 if (copy_to_user(addr, &cstats, sizeof(cstats)))
954 break; 954 break;
@@ -993,14 +993,14 @@ ppp_xmit_process(struct ppp *ppp)
993 struct sk_buff *skb; 993 struct sk_buff *skb;
994 994
995 ppp_xmit_lock(ppp); 995 ppp_xmit_lock(ppp);
996 if (ppp->dev != 0) { 996 if (ppp->dev) {
997 ppp_push(ppp); 997 ppp_push(ppp);
998 while (ppp->xmit_pending == 0 998 while (!ppp->xmit_pending
999 && (skb = skb_dequeue(&ppp->file.xq)) != 0) 999 && (skb = skb_dequeue(&ppp->file.xq)))
1000 ppp_send_frame(ppp, skb); 1000 ppp_send_frame(ppp, skb);
1001 /* If there's no work left to do, tell the core net 1001 /* If there's no work left to do, tell the core net
1002 code that we can accept some more. */ 1002 code that we can accept some more. */
1003 if (ppp->xmit_pending == 0 && skb_peek(&ppp->file.xq) == 0) 1003 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
1004 netif_wake_queue(ppp->dev); 1004 netif_wake_queue(ppp->dev);
1005 } 1005 }
1006 ppp_xmit_unlock(ppp); 1006 ppp_xmit_unlock(ppp);
@@ -1100,12 +1100,12 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1100 1100
1101 switch (proto) { 1101 switch (proto) {
1102 case PPP_IP: 1102 case PPP_IP:
1103 if (ppp->vj == 0 || (ppp->flags & SC_COMP_TCP) == 0) 1103 if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0)
1104 break; 1104 break;
1105 /* try to do VJ TCP header compression */ 1105 /* try to do VJ TCP header compression */
1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, 1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2,
1107 GFP_ATOMIC); 1107 GFP_ATOMIC);
1108 if (new_skb == 0) { 1108 if (!new_skb) {
1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); 1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n");
1110 goto drop; 1110 goto drop;
1111 } 1111 }
@@ -1140,7 +1140,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1140 } 1140 }
1141 1141
1142 /* try to do packet compression */ 1142 /* try to do packet compression */
1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state
1144 && proto != PPP_LCP && proto != PPP_CCP) { 1144 && proto != PPP_LCP && proto != PPP_CCP) {
1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { 1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) {
1146 if (net_ratelimit()) 1146 if (net_ratelimit())
@@ -1185,7 +1185,7 @@ ppp_push(struct ppp *ppp)
1185 struct channel *pch; 1185 struct channel *pch;
1186 struct sk_buff *skb = ppp->xmit_pending; 1186 struct sk_buff *skb = ppp->xmit_pending;
1187 1187
1188 if (skb == 0) 1188 if (!skb)
1189 return; 1189 return;
1190 1190
1191 list = &ppp->channels; 1191 list = &ppp->channels;
@@ -1355,7 +1355,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1355 if (flen == len && nfree == 0) 1355 if (flen == len && nfree == 0)
1356 bits |= E; 1356 bits |= E;
1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); 1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
1358 if (frag == 0) 1358 if (!frag)
1359 goto noskb; 1359 goto noskb;
1360 q = skb_put(frag, flen + hdrlen); 1360 q = skb_put(frag, flen + hdrlen);
1361 1361
@@ -1425,7 +1425,7 @@ ppp_channel_push(struct channel *pch)
1425 struct ppp *ppp; 1425 struct ppp *ppp;
1426 1426
1427 spin_lock_bh(&pch->downl); 1427 spin_lock_bh(&pch->downl);
1428 if (pch->chan != 0) { 1428 if (pch->chan) {
1429 while (!skb_queue_empty(&pch->file.xq)) { 1429 while (!skb_queue_empty(&pch->file.xq)) {
1430 skb = skb_dequeue(&pch->file.xq); 1430 skb = skb_dequeue(&pch->file.xq);
1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) { 1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
@@ -1443,7 +1443,7 @@ ppp_channel_push(struct channel *pch)
1443 if (skb_queue_empty(&pch->file.xq)) { 1443 if (skb_queue_empty(&pch->file.xq)) {
1444 read_lock_bh(&pch->upl); 1444 read_lock_bh(&pch->upl);
1445 ppp = pch->ppp; 1445 ppp = pch->ppp;
1446 if (ppp != 0) 1446 if (ppp)
1447 ppp_xmit_process(ppp); 1447 ppp_xmit_process(ppp);
1448 read_unlock_bh(&pch->upl); 1448 read_unlock_bh(&pch->upl);
1449 } 1449 }
@@ -1462,7 +1462,7 @@ ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1462{ 1462{
1463 ppp_recv_lock(ppp); 1463 ppp_recv_lock(ppp);
1464 /* ppp->dev == 0 means interface is closing down */ 1464 /* ppp->dev == 0 means interface is closing down */
1465 if (ppp->dev != 0) 1465 if (ppp->dev)
1466 ppp_receive_frame(ppp, skb, pch); 1466 ppp_receive_frame(ppp, skb, pch);
1467 else 1467 else
1468 kfree_skb(skb); 1468 kfree_skb(skb);
@@ -1475,19 +1475,19 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
1475 struct channel *pch = chan->ppp; 1475 struct channel *pch = chan->ppp;
1476 int proto; 1476 int proto;
1477 1477
1478 if (pch == 0 || skb->len == 0) { 1478 if (!pch || skb->len == 0) {
1479 kfree_skb(skb); 1479 kfree_skb(skb);
1480 return; 1480 return;
1481 } 1481 }
1482 1482
1483 proto = PPP_PROTO(skb); 1483 proto = PPP_PROTO(skb);
1484 read_lock_bh(&pch->upl); 1484 read_lock_bh(&pch->upl);
1485 if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) { 1485 if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) {
1486 /* put it on the channel queue */ 1486 /* put it on the channel queue */
1487 skb_queue_tail(&pch->file.rq, skb); 1487 skb_queue_tail(&pch->file.rq, skb);
1488 /* drop old frames if queue too long */ 1488 /* drop old frames if queue too long */
1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN 1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN
1490 && (skb = skb_dequeue(&pch->file.rq)) != 0) 1490 && (skb = skb_dequeue(&pch->file.rq)))
1491 kfree_skb(skb); 1491 kfree_skb(skb);
1492 wake_up_interruptible(&pch->file.rwait); 1492 wake_up_interruptible(&pch->file.rwait);
1493 } else { 1493 } else {
@@ -1503,13 +1503,13 @@ ppp_input_error(struct ppp_channel *chan, int code)
1503 struct channel *pch = chan->ppp; 1503 struct channel *pch = chan->ppp;
1504 struct sk_buff *skb; 1504 struct sk_buff *skb;
1505 1505
1506 if (pch == 0) 1506 if (!pch)
1507 return; 1507 return;
1508 1508
1509 read_lock_bh(&pch->upl); 1509 read_lock_bh(&pch->upl);
1510 if (pch->ppp != 0) { 1510 if (pch->ppp) {
1511 skb = alloc_skb(0, GFP_ATOMIC); 1511 skb = alloc_skb(0, GFP_ATOMIC);
1512 if (skb != 0) { 1512 if (skb) {
1513 skb->len = 0; /* probably unnecessary */ 1513 skb->len = 0; /* probably unnecessary */
1514 skb->cb[0] = code; 1514 skb->cb[0] = code;
1515 ppp_do_recv(pch->ppp, skb, pch); 1515 ppp_do_recv(pch->ppp, skb, pch);
@@ -1548,7 +1548,7 @@ static void
1548ppp_receive_error(struct ppp *ppp) 1548ppp_receive_error(struct ppp *ppp)
1549{ 1549{
1550 ++ppp->stats.rx_errors; 1550 ++ppp->stats.rx_errors;
1551 if (ppp->vj != 0) 1551 if (ppp->vj)
1552 slhc_toss(ppp->vj); 1552 slhc_toss(ppp->vj);
1553} 1553}
1554 1554
@@ -1563,7 +1563,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1563 * Note that some decompressors need to see uncompressed frames 1563 * Note that some decompressors need to see uncompressed frames
1564 * that come in as well as compressed frames. 1564 * that come in as well as compressed frames.
1565 */ 1565 */
1566 if (ppp->rc_state != 0 && (ppp->rstate & SC_DECOMP_RUN) 1566 if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN)
1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) 1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0)
1568 skb = ppp_decompress_frame(ppp, skb); 1568 skb = ppp_decompress_frame(ppp, skb);
1569 1569
@@ -1574,13 +1574,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1574 switch (proto) { 1574 switch (proto) {
1575 case PPP_VJC_COMP: 1575 case PPP_VJC_COMP:
1576 /* decompress VJ compressed packets */ 1576 /* decompress VJ compressed packets */
1577 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1577 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1578 goto err; 1578 goto err;
1579 1579
1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { 1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) {
1581 /* copy to a new sk_buff with more tailroom */ 1581 /* copy to a new sk_buff with more tailroom */
1582 ns = dev_alloc_skb(skb->len + 128); 1582 ns = dev_alloc_skb(skb->len + 128);
1583 if (ns == 0) { 1583 if (!ns) {
1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); 1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n");
1585 goto err; 1585 goto err;
1586 } 1586 }
@@ -1606,7 +1606,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1606 break; 1606 break;
1607 1607
1608 case PPP_VJC_UNCOMP: 1608 case PPP_VJC_UNCOMP:
1609 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1609 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1610 goto err; 1610 goto err;
1611 1611
1612 /* Until we fix the decompressor need to make sure 1612 /* Until we fix the decompressor need to make sure
@@ -1636,7 +1636,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1636 skb_queue_tail(&ppp->file.rq, skb); 1636 skb_queue_tail(&ppp->file.rq, skb);
1637 /* limit queue length by dropping old frames */ 1637 /* limit queue length by dropping old frames */
1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN 1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN
1639 && (skb = skb_dequeue(&ppp->file.rq)) != 0) 1639 && (skb = skb_dequeue(&ppp->file.rq)))
1640 kfree_skb(skb); 1640 kfree_skb(skb);
1641 /* wake up any process polling or blocking on read */ 1641 /* wake up any process polling or blocking on read */
1642 wake_up_interruptible(&ppp->file.rwait); 1642 wake_up_interruptible(&ppp->file.rwait);
@@ -1718,7 +1718,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
1718 } 1718 }
1719 1719
1720 ns = dev_alloc_skb(obuff_size); 1720 ns = dev_alloc_skb(obuff_size);
1721 if (ns == 0) { 1721 if (!ns) {
1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n"); 1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
1723 goto err; 1723 goto err;
1724 } 1724 }
@@ -1836,7 +1836,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1836 ppp->minseq = ppp->mrq.next->sequence; 1836 ppp->minseq = ppp->mrq.next->sequence;
1837 1837
1838 /* Pull completed packets off the queue and receive them. */ 1838 /* Pull completed packets off the queue and receive them. */
1839 while ((skb = ppp_mp_reconstruct(ppp)) != 0) 1839 while ((skb = ppp_mp_reconstruct(ppp)))
1840 ppp_receive_nonmp_frame(ppp, skb); 1840 ppp_receive_nonmp_frame(ppp, skb);
1841 1841
1842 return; 1842 return;
@@ -2002,7 +2002,7 @@ ppp_register_channel(struct ppp_channel *chan)
2002 struct channel *pch; 2002 struct channel *pch;
2003 2003
2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL); 2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
2005 if (pch == 0) 2005 if (!pch)
2006 return -ENOMEM; 2006 return -ENOMEM;
2007 pch->ppp = NULL; 2007 pch->ppp = NULL;
2008 pch->chan = chan; 2008 pch->chan = chan;
@@ -2030,7 +2030,7 @@ int ppp_channel_index(struct ppp_channel *chan)
2030{ 2030{
2031 struct channel *pch = chan->ppp; 2031 struct channel *pch = chan->ppp;
2032 2032
2033 if (pch != 0) 2033 if (pch)
2034 return pch->file.index; 2034 return pch->file.index;
2035 return -1; 2035 return -1;
2036} 2036}
@@ -2043,9 +2043,9 @@ int ppp_unit_number(struct ppp_channel *chan)
2043 struct channel *pch = chan->ppp; 2043 struct channel *pch = chan->ppp;
2044 int unit = -1; 2044 int unit = -1;
2045 2045
2046 if (pch != 0) { 2046 if (pch) {
2047 read_lock_bh(&pch->upl); 2047 read_lock_bh(&pch->upl);
2048 if (pch->ppp != 0) 2048 if (pch->ppp)
2049 unit = pch->ppp->file.index; 2049 unit = pch->ppp->file.index;
2050 read_unlock_bh(&pch->upl); 2050 read_unlock_bh(&pch->upl);
2051 } 2051 }
@@ -2061,7 +2061,7 @@ ppp_unregister_channel(struct ppp_channel *chan)
2061{ 2061{
2062 struct channel *pch = chan->ppp; 2062 struct channel *pch = chan->ppp;
2063 2063
2064 if (pch == 0) 2064 if (!pch)
2065 return; /* should never happen */ 2065 return; /* should never happen */
2066 chan->ppp = NULL; 2066 chan->ppp = NULL;
2067 2067
@@ -2093,7 +2093,7 @@ ppp_output_wakeup(struct ppp_channel *chan)
2093{ 2093{
2094 struct channel *pch = chan->ppp; 2094 struct channel *pch = chan->ppp;
2095 2095
2096 if (pch == 0) 2096 if (!pch)
2097 return; 2097 return;
2098 ppp_channel_push(pch); 2098 ppp_channel_push(pch);
2099} 2099}
@@ -2124,18 +2124,18 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2124 2124
2125 cp = find_compressor(ccp_option[0]); 2125 cp = find_compressor(ccp_option[0]);
2126#ifdef CONFIG_KMOD 2126#ifdef CONFIG_KMOD
2127 if (cp == 0) { 2127 if (!cp) {
2128 request_module("ppp-compress-%d", ccp_option[0]); 2128 request_module("ppp-compress-%d", ccp_option[0]);
2129 cp = find_compressor(ccp_option[0]); 2129 cp = find_compressor(ccp_option[0]);
2130 } 2130 }
2131#endif /* CONFIG_KMOD */ 2131#endif /* CONFIG_KMOD */
2132 if (cp == 0) 2132 if (!cp)
2133 goto out; 2133 goto out;
2134 2134
2135 err = -ENOBUFS; 2135 err = -ENOBUFS;
2136 if (data.transmit) { 2136 if (data.transmit) {
2137 state = cp->comp_alloc(ccp_option, data.length); 2137 state = cp->comp_alloc(ccp_option, data.length);
2138 if (state != 0) { 2138 if (state) {
2139 ppp_xmit_lock(ppp); 2139 ppp_xmit_lock(ppp);
2140 ppp->xstate &= ~SC_COMP_RUN; 2140 ppp->xstate &= ~SC_COMP_RUN;
2141 ocomp = ppp->xcomp; 2141 ocomp = ppp->xcomp;
@@ -2143,7 +2143,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2143 ppp->xcomp = cp; 2143 ppp->xcomp = cp;
2144 ppp->xc_state = state; 2144 ppp->xc_state = state;
2145 ppp_xmit_unlock(ppp); 2145 ppp_xmit_unlock(ppp);
2146 if (ostate != 0) { 2146 if (ostate) {
2147 ocomp->comp_free(ostate); 2147 ocomp->comp_free(ostate);
2148 module_put(ocomp->owner); 2148 module_put(ocomp->owner);
2149 } 2149 }
@@ -2153,7 +2153,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2153 2153
2154 } else { 2154 } else {
2155 state = cp->decomp_alloc(ccp_option, data.length); 2155 state = cp->decomp_alloc(ccp_option, data.length);
2156 if (state != 0) { 2156 if (state) {
2157 ppp_recv_lock(ppp); 2157 ppp_recv_lock(ppp);
2158 ppp->rstate &= ~SC_DECOMP_RUN; 2158 ppp->rstate &= ~SC_DECOMP_RUN;
2159 ocomp = ppp->rcomp; 2159 ocomp = ppp->rcomp;
@@ -2161,7 +2161,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2161 ppp->rcomp = cp; 2161 ppp->rcomp = cp;
2162 ppp->rc_state = state; 2162 ppp->rc_state = state;
2163 ppp_recv_unlock(ppp); 2163 ppp_recv_unlock(ppp);
2164 if (ostate != 0) { 2164 if (ostate) {
2165 ocomp->decomp_free(ostate); 2165 ocomp->decomp_free(ostate);
2166 module_put(ocomp->owner); 2166 module_put(ocomp->owner);
2167 } 2167 }
@@ -2228,7 +2228,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2228 break; 2228 break;
2229 if (inbound) { 2229 if (inbound) {
2230 /* we will start receiving compressed packets */ 2230 /* we will start receiving compressed packets */
2231 if (ppp->rc_state == 0) 2231 if (!ppp->rc_state)
2232 break; 2232 break;
2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, 2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len,
2234 ppp->file.index, 0, ppp->mru, ppp->debug)) { 2234 ppp->file.index, 0, ppp->mru, ppp->debug)) {
@@ -2237,7 +2237,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2237 } 2237 }
2238 } else { 2238 } else {
2239 /* we will soon start sending compressed packets */ 2239 /* we will soon start sending compressed packets */
2240 if (ppp->xc_state == 0) 2240 if (!ppp->xc_state)
2241 break; 2241 break;
2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, 2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len,
2243 ppp->file.index, 0, ppp->debug)) 2243 ppp->file.index, 0, ppp->debug))
@@ -2320,11 +2320,11 @@ ppp_register_compressor(struct compressor *cp)
2320 int ret; 2320 int ret;
2321 spin_lock(&compressor_list_lock); 2321 spin_lock(&compressor_list_lock);
2322 ret = -EEXIST; 2322 ret = -EEXIST;
2323 if (find_comp_entry(cp->compress_proto) != 0) 2323 if (find_comp_entry(cp->compress_proto))
2324 goto out; 2324 goto out;
2325 ret = -ENOMEM; 2325 ret = -ENOMEM;
2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); 2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC);
2327 if (ce == 0) 2327 if (!ce)
2328 goto out; 2328 goto out;
2329 ret = 0; 2329 ret = 0;
2330 ce->comp = cp; 2330 ce->comp = cp;
@@ -2342,7 +2342,7 @@ ppp_unregister_compressor(struct compressor *cp)
2342 2342
2343 spin_lock(&compressor_list_lock); 2343 spin_lock(&compressor_list_lock);
2344 ce = find_comp_entry(cp->compress_proto); 2344 ce = find_comp_entry(cp->compress_proto);
2345 if (ce != 0 && ce->comp == cp) { 2345 if (ce && ce->comp == cp) {
2346 list_del(&ce->list); 2346 list_del(&ce->list);
2347 kfree(ce); 2347 kfree(ce);
2348 } 2348 }
@@ -2358,7 +2358,7 @@ find_compressor(int type)
2358 2358
2359 spin_lock(&compressor_list_lock); 2359 spin_lock(&compressor_list_lock);
2360 ce = find_comp_entry(type); 2360 ce = find_comp_entry(type);
2361 if (ce != 0) { 2361 if (ce) {
2362 cp = ce->comp; 2362 cp = ce->comp;
2363 if (!try_module_get(cp->owner)) 2363 if (!try_module_get(cp->owner))
2364 cp = NULL; 2364 cp = NULL;
@@ -2383,7 +2383,7 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st)
2383 st->p.ppp_opackets = ppp->stats.tx_packets; 2383 st->p.ppp_opackets = ppp->stats.tx_packets;
2384 st->p.ppp_oerrors = ppp->stats.tx_errors; 2384 st->p.ppp_oerrors = ppp->stats.tx_errors;
2385 st->p.ppp_obytes = ppp->stats.tx_bytes; 2385 st->p.ppp_obytes = ppp->stats.tx_bytes;
2386 if (vj == 0) 2386 if (!vj)
2387 return; 2387 return;
2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; 2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed;
2389 st->vj.vjs_compressed = vj->sls_o_compressed; 2389 st->vj.vjs_compressed = vj->sls_o_compressed;
@@ -2604,11 +2604,11 @@ ppp_connect_channel(struct channel *pch, int unit)
2604 2604
2605 mutex_lock(&all_ppp_mutex); 2605 mutex_lock(&all_ppp_mutex);
2606 ppp = ppp_find_unit(unit); 2606 ppp = ppp_find_unit(unit);
2607 if (ppp == 0) 2607 if (!ppp)
2608 goto out; 2608 goto out;
2609 write_lock_bh(&pch->upl); 2609 write_lock_bh(&pch->upl);
2610 ret = -EINVAL; 2610 ret = -EINVAL;
2611 if (pch->ppp != 0) 2611 if (pch->ppp)
2612 goto outl; 2612 goto outl;
2613 2613
2614 ppp_lock(ppp); 2614 ppp_lock(ppp);
@@ -2644,7 +2644,7 @@ ppp_disconnect_channel(struct channel *pch)
2644 ppp = pch->ppp; 2644 ppp = pch->ppp;
2645 pch->ppp = NULL; 2645 pch->ppp = NULL;
2646 write_unlock_bh(&pch->upl); 2646 write_unlock_bh(&pch->upl);
2647 if (ppp != 0) { 2647 if (ppp) {
2648 /* remove it from the ppp unit's list */ 2648 /* remove it from the ppp unit's list */
2649 ppp_lock(ppp); 2649 ppp_lock(ppp);
2650 list_del(&pch->clist); 2650 list_del(&pch->clist);
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index 00e2fb48b4ae..f0c6a1926a02 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -209,7 +209,7 @@ ppp_sync_open(struct tty_struct *tty)
209 209
210 ap = kzalloc(sizeof(*ap), GFP_KERNEL); 210 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
211 err = -ENOMEM; 211 err = -ENOMEM;
212 if (ap == 0) 212 if (!ap)
213 goto out; 213 goto out;
214 214
215 /* initialize the syncppp structure */ 215 /* initialize the syncppp structure */
@@ -262,7 +262,7 @@ ppp_sync_close(struct tty_struct *tty)
262 ap = tty->disc_data; 262 ap = tty->disc_data;
263 tty->disc_data = NULL; 263 tty->disc_data = NULL;
264 write_unlock_irq(&disc_data_lock); 264 write_unlock_irq(&disc_data_lock);
265 if (ap == 0) 265 if (!ap)
266 return; 266 return;
267 267
268 /* 268 /*
@@ -278,7 +278,7 @@ ppp_sync_close(struct tty_struct *tty)
278 278
279 ppp_unregister_channel(&ap->chan); 279 ppp_unregister_channel(&ap->chan);
280 skb_queue_purge(&ap->rqueue); 280 skb_queue_purge(&ap->rqueue);
281 if (ap->tpkt != 0) 281 if (ap->tpkt)
282 kfree_skb(ap->tpkt); 282 kfree_skb(ap->tpkt);
283 kfree(ap); 283 kfree(ap);
284} 284}
@@ -325,13 +325,13 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
325 int __user *p = (int __user *)arg; 325 int __user *p = (int __user *)arg;
326 int err, val; 326 int err, val;
327 327
328 if (ap == 0) 328 if (!ap)
329 return -ENXIO; 329 return -ENXIO;
330 err = -EFAULT; 330 err = -EFAULT;
331 switch (cmd) { 331 switch (cmd) {
332 case PPPIOCGCHAN: 332 case PPPIOCGCHAN:
333 err = -ENXIO; 333 err = -ENXIO;
334 if (ap == 0) 334 if (!ap)
335 break; 335 break;
336 err = -EFAULT; 336 err = -EFAULT;
337 if (put_user(ppp_channel_index(&ap->chan), p)) 337 if (put_user(ppp_channel_index(&ap->chan), p))
@@ -341,7 +341,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
341 341
342 case PPPIOCGUNIT: 342 case PPPIOCGUNIT:
343 err = -ENXIO; 343 err = -ENXIO;
344 if (ap == 0) 344 if (!ap)
345 break; 345 break;
346 err = -EFAULT; 346 err = -EFAULT;
347 if (put_user(ppp_unit_number(&ap->chan), p)) 347 if (put_user(ppp_unit_number(&ap->chan), p))
@@ -390,7 +390,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
390 struct syncppp *ap = sp_get(tty); 390 struct syncppp *ap = sp_get(tty);
391 unsigned long flags; 391 unsigned long flags;
392 392
393 if (ap == 0) 393 if (!ap)
394 return; 394 return;
395 spin_lock_irqsave(&ap->recv_lock, flags); 395 spin_lock_irqsave(&ap->recv_lock, flags);
396 ppp_sync_input(ap, buf, cflags, count); 396 ppp_sync_input(ap, buf, cflags, count);
@@ -409,7 +409,7 @@ ppp_sync_wakeup(struct tty_struct *tty)
409 struct syncppp *ap = sp_get(tty); 409 struct syncppp *ap = sp_get(tty);
410 410
411 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 411 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
412 if (ap == 0) 412 if (!ap)
413 return; 413 return;
414 set_bit(XMIT_WAKEUP, &ap->xmit_flags); 414 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
415 tasklet_schedule(&ap->tsk); 415 tasklet_schedule(&ap->tsk);
@@ -651,7 +651,7 @@ ppp_sync_push(struct syncppp *ap)
651 for (;;) { 651 for (;;) {
652 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) 652 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags))
653 tty_stuffed = 0; 653 tty_stuffed = 0;
654 if (!tty_stuffed && ap->tpkt != 0) { 654 if (!tty_stuffed && ap->tpkt) {
655 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 655 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
656 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); 656 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len);
657 if (sent < 0) 657 if (sent < 0)
@@ -669,7 +669,7 @@ ppp_sync_push(struct syncppp *ap)
669 /* haven't made any progress */ 669 /* haven't made any progress */
670 spin_unlock_bh(&ap->xmit_lock); 670 spin_unlock_bh(&ap->xmit_lock);
671 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) 671 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
672 || (!tty_stuffed && ap->tpkt != 0))) 672 || (!tty_stuffed && ap->tpkt)))
673 break; 673 break;
674 if (!spin_trylock_bh(&ap->xmit_lock)) 674 if (!spin_trylock_bh(&ap->xmit_lock))
675 break; 675 break;
@@ -677,7 +677,7 @@ ppp_sync_push(struct syncppp *ap)
677 return done; 677 return done;
678 678
679flush: 679flush:
680 if (ap->tpkt != 0) { 680 if (ap->tpkt) {
681 kfree_skb(ap->tpkt); 681 kfree_skb(ap->tpkt);
682 ap->tpkt = NULL; 682 ap->tpkt = NULL;
683 clear_bit(XMIT_FULL, &ap->xmit_flags); 683 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -732,7 +732,8 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
732 ppp_print_buffer ("receive buffer", buf, count); 732 ppp_print_buffer ("receive buffer", buf, count);
733 733
734 /* stuff the chars in the skb */ 734 /* stuff the chars in the skb */
735 if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) { 735 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
736 if (!skb) {
736 printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); 737 printk(KERN_ERR "PPPsync: no memory (input pkt)\n");
737 goto err; 738 goto err;
738 } 739 }
@@ -740,7 +741,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
740 if (buf[0] != PPP_ALLSTATIONS) 741 if (buf[0] != PPP_ALLSTATIONS)
741 skb_reserve(skb, 2 + (buf[0] & 1)); 742 skb_reserve(skb, 2 + (buf[0] & 1));
742 743
743 if (flags != 0 && *flags) { 744 if (flags && *flags) {
744 /* error flag set, ignore frame */ 745 /* error flag set, ignore frame */
745 goto err; 746 goto err;
746 } else if (count > skb_tailroom(skb)) { 747 } else if (count > skb_tailroom(skb)) {
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 53b8344a68ef..f6fedcc32de1 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *dev)
2333{ 2333{
2334 struct gem *gp = dev->priv; 2334 struct gem *gp = dev->priv;
2335 2335
2336 napi_disable(&gp->napi);
2337
2338 mutex_lock(&gp->pm_mutex); 2336 mutex_lock(&gp->pm_mutex);
2339 2337
2338 napi_disable(&gp->napi);
2339
2340 gp->opened = 0; 2340 gp->opened = 0;
2341 if (!gp->asleep) 2341 if (!gp->asleep)
2342 gem_do_stop(dev, 0); 2342 gem_do_stop(dev, 0);
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2355 2355
2356 mutex_lock(&gp->pm_mutex); 2356 mutex_lock(&gp->pm_mutex);
2357 2357
2358 napi_disable(&gp->napi);
2359
2360 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", 2358 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n",
2361 dev->name, 2359 dev->name,
2362 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); 2360 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2370 2368
2371 /* If the driver is opened, we stop the MAC */ 2369 /* If the driver is opened, we stop the MAC */
2372 if (gp->opened) { 2370 if (gp->opened) {
2371 napi_disable(&gp->napi);
2372
2373 /* Stop traffic, mark us closed */ 2373 /* Stop traffic, mark us closed */
2374 netif_device_detach(dev); 2374 netif_device_detach(dev);
2375 2375
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pdev)
2460 /* Re-attach net device */ 2460 /* Re-attach net device */
2461 netif_device_attach(dev); 2461 netif_device_attach(dev);
2462 2462
2463 napi_enable(&gp->napi);
2463 } 2464 }
2464 2465
2465 spin_lock_irqsave(&gp->lock, flags); 2466 spin_lock_irqsave(&gp->lock, flags);
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pdev)
2479 spin_unlock(&gp->tx_lock); 2480 spin_unlock(&gp->tx_lock);
2480 spin_unlock_irqrestore(&gp->lock, flags); 2481 spin_unlock_irqrestore(&gp->lock, flags);
2481 2482
2482 napi_enable(&gp->napi);
2483
2484 mutex_unlock(&gp->pm_mutex); 2483 mutex_unlock(&gp->pm_mutex);
2485 2484
2486 return 0; 2485 return 0;
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 4e1b84e6d66a..21230c97b2a0 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -2168,10 +2168,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
2168{ 2168{
2169 struct bdx_priv *priv = netdev->priv; 2169 struct bdx_priv *priv = netdev->priv;
2170 2170
2171 strncat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); 2171 strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
2172 strncat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); 2172 strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
2173 strncat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); 2173 strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
2174 strncat(drvinfo->bus_info, pci_name(priv->pdev), 2174 strlcat(drvinfo->bus_info, pci_name(priv->pdev),
2175 sizeof(drvinfo->bus_info)); 2175 sizeof(drvinfo->bus_info));
2176 2176
2177 drvinfo->n_stats = ((priv->stats_flag) ? 2177 drvinfo->n_stats = ((priv->stats_flag) ?
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index cad519910767..4942f7d18937 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.85" 67#define DRV_MODULE_VERSION "3.86"
68#define DRV_MODULE_RELDATE "October 18, 2007" 68#define DRV_MODULE_RELDATE "November 9, 2007"
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
@@ -1106,6 +1106,24 @@ static int tg3_phy_reset(struct tg3 *tp)
1106 if (err) 1106 if (err)
1107 return err; 1107 return err;
1108 1108
1109 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1110 u32 val;
1111
1112 val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
1113 if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) ==
1114 CPMU_LSPD_1000MB_MACCLK_12_5) {
1115 val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
1116 udelay(40);
1117 tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
1118 }
1119
1120 /* Disable GPHY autopowerdown. */
1121 tg3_writephy(tp, MII_TG3_MISC_SHDW,
1122 MII_TG3_MISC_SHDW_WREN |
1123 MII_TG3_MISC_SHDW_APD_SEL |
1124 MII_TG3_MISC_SHDW_APD_WKTM_84MS);
1125 }
1126
1109out: 1127out:
1110 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1128 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
1111 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1129 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -1297,6 +1315,8 @@ static void tg3_nvram_unlock(struct tg3 *);
1297 1315
1298static void tg3_power_down_phy(struct tg3 *tp) 1316static void tg3_power_down_phy(struct tg3 *tp)
1299{ 1317{
1318 u32 val;
1319
1300 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 1320 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
1301 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 1321 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
1302 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); 1322 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL);
@@ -1311,8 +1331,6 @@ static void tg3_power_down_phy(struct tg3 *tp)
1311 } 1331 }
1312 1332
1313 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 1333 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
1314 u32 val;
1315
1316 tg3_bmcr_reset(tp); 1334 tg3_bmcr_reset(tp);
1317 val = tr32(GRC_MISC_CFG); 1335 val = tr32(GRC_MISC_CFG);
1318 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); 1336 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ);
@@ -1332,6 +1350,14 @@ static void tg3_power_down_phy(struct tg3 *tp)
1332 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && 1350 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
1333 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) 1351 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
1334 return; 1352 return;
1353
1354 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1355 val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
1356 val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
1357 val |= CPMU_LSPD_1000MB_MACCLK_12_5;
1358 tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
1359 }
1360
1335 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); 1361 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
1336} 1362}
1337 1363
@@ -3126,6 +3152,23 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
3126 err = tg3_setup_copper_phy(tp, force_reset); 3152 err = tg3_setup_copper_phy(tp, force_reset);
3127 } 3153 }
3128 3154
3155 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
3156 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
3157 u32 val, scale;
3158
3159 val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK;
3160 if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5)
3161 scale = 65;
3162 else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25)
3163 scale = 6;
3164 else
3165 scale = 12;
3166
3167 val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK;
3168 val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT);
3169 tw32(GRC_MISC_CFG, val);
3170 }
3171
3129 if (tp->link_config.active_speed == SPEED_1000 && 3172 if (tp->link_config.active_speed == SPEED_1000 &&
3130 tp->link_config.active_duplex == DUPLEX_HALF) 3173 tp->link_config.active_duplex == DUPLEX_HALF)
3131 tw32(MAC_TX_LENGTHS, 3174 tw32(MAC_TX_LENGTHS,
@@ -5054,12 +5097,15 @@ static void tg3_restore_pci_state(struct tg3 *tp)
5054 5097
5055 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); 5098 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd);
5056 5099
5057 if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { 5100 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)
5101 pcie_set_readrq(tp->pdev, 4096);
5102 else {
5058 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, 5103 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
5059 tp->pci_cacheline_sz); 5104 tp->pci_cacheline_sz);
5060 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 5105 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
5061 tp->pci_lat_timer); 5106 tp->pci_lat_timer);
5062 } 5107 }
5108
5063 /* Make sure PCI-X relaxed ordering bit is clear. */ 5109 /* Make sure PCI-X relaxed ordering bit is clear. */
5064 if (tp->pcix_cap) { 5110 if (tp->pcix_cap) {
5065 u16 pcix_cmd; 5111 u16 pcix_cmd;
@@ -6343,10 +6389,26 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6343 6389
6344 tg3_write_sig_legacy(tp, RESET_KIND_INIT); 6390 tg3_write_sig_legacy(tp, RESET_KIND_INIT);
6345 6391
6346 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) { 6392 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
6393 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
6347 val = tr32(TG3_CPMU_CTRL); 6394 val = tr32(TG3_CPMU_CTRL);
6348 val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); 6395 val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE);
6349 tw32(TG3_CPMU_CTRL, val); 6396 tw32(TG3_CPMU_CTRL, val);
6397
6398 val = tr32(TG3_CPMU_LSPD_10MB_CLK);
6399 val &= ~CPMU_LSPD_10MB_MACCLK_MASK;
6400 val |= CPMU_LSPD_10MB_MACCLK_6_25;
6401 tw32(TG3_CPMU_LSPD_10MB_CLK, val);
6402
6403 val = tr32(TG3_CPMU_LNK_AWARE_PWRMD);
6404 val &= ~CPMU_LNK_AWARE_MACCLK_MASK;
6405 val |= CPMU_LNK_AWARE_MACCLK_6_25;
6406 tw32(TG3_CPMU_LNK_AWARE_PWRMD, val);
6407
6408 val = tr32(TG3_CPMU_HST_ACC);
6409 val &= ~CPMU_HST_ACC_MACCLK_MASK;
6410 val |= CPMU_HST_ACC_MACCLK_6_25;
6411 tw32(TG3_CPMU_HST_ACC, val);
6350 } 6412 }
6351 6413
6352 /* This works around an issue with Athlon chipsets on 6414 /* This works around an issue with Athlon chipsets on
@@ -8267,7 +8329,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
8267 SUPPORTED_100baseT_Full | 8329 SUPPORTED_100baseT_Full |
8268 SUPPORTED_10baseT_Half | 8330 SUPPORTED_10baseT_Half |
8269 SUPPORTED_10baseT_Full | 8331 SUPPORTED_10baseT_Full |
8270 SUPPORTED_MII); 8332 SUPPORTED_TP);
8271 cmd->port = PORT_TP; 8333 cmd->port = PORT_TP;
8272 } else { 8334 } else {
8273 cmd->supported |= SUPPORTED_FIBRE; 8335 cmd->supported |= SUPPORTED_FIBRE;
@@ -8664,7 +8726,9 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
8664} 8726}
8665 8727
8666#define NVRAM_TEST_SIZE 0x100 8728#define NVRAM_TEST_SIZE 0x100
8667#define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 8729#define NVRAM_SELFBOOT_FORMAT1_0_SIZE 0x14
8730#define NVRAM_SELFBOOT_FORMAT1_2_SIZE 0x18
8731#define NVRAM_SELFBOOT_FORMAT1_3_SIZE 0x1c
8668#define NVRAM_SELFBOOT_HW_SIZE 0x20 8732#define NVRAM_SELFBOOT_HW_SIZE 0x20
8669#define NVRAM_SELFBOOT_DATA_SIZE 0x1c 8733#define NVRAM_SELFBOOT_DATA_SIZE 0x1c
8670 8734
@@ -8679,9 +8743,22 @@ static int tg3_test_nvram(struct tg3 *tp)
8679 if (magic == TG3_EEPROM_MAGIC) 8743 if (magic == TG3_EEPROM_MAGIC)
8680 size = NVRAM_TEST_SIZE; 8744 size = NVRAM_TEST_SIZE;
8681 else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { 8745 else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) {
8682 if ((magic & 0xe00000) == 0x200000) 8746 if ((magic & TG3_EEPROM_SB_FORMAT_MASK) ==
8683 size = NVRAM_SELFBOOT_FORMAT1_SIZE; 8747 TG3_EEPROM_SB_FORMAT_1) {
8684 else 8748 switch (magic & TG3_EEPROM_SB_REVISION_MASK) {
8749 case TG3_EEPROM_SB_REVISION_0:
8750 size = NVRAM_SELFBOOT_FORMAT1_0_SIZE;
8751 break;
8752 case TG3_EEPROM_SB_REVISION_2:
8753 size = NVRAM_SELFBOOT_FORMAT1_2_SIZE;
8754 break;
8755 case TG3_EEPROM_SB_REVISION_3:
8756 size = NVRAM_SELFBOOT_FORMAT1_3_SIZE;
8757 break;
8758 default:
8759 return 0;
8760 }
8761 } else
8685 return 0; 8762 return 0;
8686 } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) 8763 } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
8687 size = NVRAM_SELFBOOT_HW_SIZE; 8764 size = NVRAM_SELFBOOT_HW_SIZE;
@@ -8708,8 +8785,17 @@ static int tg3_test_nvram(struct tg3 *tp)
8708 TG3_EEPROM_MAGIC_FW) { 8785 TG3_EEPROM_MAGIC_FW) {
8709 u8 *buf8 = (u8 *) buf, csum8 = 0; 8786 u8 *buf8 = (u8 *) buf, csum8 = 0;
8710 8787
8711 for (i = 0; i < size; i++) 8788 if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) ==
8712 csum8 += buf8[i]; 8789 TG3_EEPROM_SB_REVISION_2) {
8790 /* For rev 2, the csum doesn't include the MBA. */
8791 for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
8792 csum8 += buf8[i];
8793 for (i = TG3_EEPROM_SB_F1R2_MBA_OFF + 4; i < size; i++)
8794 csum8 += buf8[i];
8795 } else {
8796 for (i = 0; i < size; i++)
8797 csum8 += buf8[i];
8798 }
8713 8799
8714 if (csum8 == 0) { 8800 if (csum8 == 0) {
8715 err = 0; 8801 err = 0;
@@ -9293,7 +9379,7 @@ static int tg3_test_loopback(struct tg3 *tp)
9293 if (err) 9379 if (err)
9294 return TG3_LOOPBACK_FAILED; 9380 return TG3_LOOPBACK_FAILED;
9295 9381
9296 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { 9382 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
9297 int i; 9383 int i;
9298 u32 status; 9384 u32 status;
9299 9385
@@ -9310,17 +9396,17 @@ static int tg3_test_loopback(struct tg3 *tp)
9310 if (status != CPMU_MUTEX_GNT_DRIVER) 9396 if (status != CPMU_MUTEX_GNT_DRIVER)
9311 return TG3_LOOPBACK_FAILED; 9397 return TG3_LOOPBACK_FAILED;
9312 9398
9313 cpmuctrl = tr32(TG3_CPMU_CTRL);
9314
9315 /* Turn off power management based on link speed. */ 9399 /* Turn off power management based on link speed. */
9400 cpmuctrl = tr32(TG3_CPMU_CTRL);
9316 tw32(TG3_CPMU_CTRL, 9401 tw32(TG3_CPMU_CTRL,
9317 cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE); 9402 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE |
9403 CPMU_CTRL_LINK_AWARE_MODE));
9318 } 9404 }
9319 9405
9320 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) 9406 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
9321 err |= TG3_MAC_LOOPBACK_FAILED; 9407 err |= TG3_MAC_LOOPBACK_FAILED;
9322 9408
9323 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { 9409 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
9324 tw32(TG3_CPMU_CTRL, cpmuctrl); 9410 tw32(TG3_CPMU_CTRL, cpmuctrl);
9325 9411
9326 /* Release the mutex */ 9412 /* Release the mutex */
@@ -10541,6 +10627,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10541 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 10627 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
10542 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 10628 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
10543 10629
10630 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
10631 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1)
10632 tp->led_ctrl = LED_CTRL_MODE_MAC;
10633
10544 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { 10634 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
10545 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 10635 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
10546 if ((tp->pdev->subsystem_vendor == 10636 if ((tp->pdev->subsystem_vendor ==
@@ -10859,7 +10949,7 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
10859 } 10949 }
10860 10950
10861 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || 10951 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
10862 (tp->tg3_flags & TG3_FLG3_ENABLE_APE)) 10952 (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
10863 return; 10953 return;
10864 10954
10865 for (offset = TG3_NVM_DIR_START; 10955 for (offset = TG3_NVM_DIR_START;
@@ -11127,6 +11217,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11127 pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); 11217 pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP);
11128 if (pcie_cap != 0) { 11218 if (pcie_cap != 0) {
11129 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; 11219 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
11220
11221 pcie_set_readrq(tp->pdev, 4096);
11222
11130 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 11223 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
11131 u16 lnkctl; 11224 u16 lnkctl;
11132 11225
@@ -11307,9 +11400,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11307 } 11400 }
11308 11401
11309 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 11402 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
11310 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) 11403 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
11311 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; 11404 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
11312 11405
11406 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
11407 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1 ||
11408 tp->pci_chip_rev_id == CHIPREV_ID_5761_A0 ||
11409 tp->pci_chip_rev_id == CHIPREV_ID_5761_A1)
11410 tp->tg3_flags3 |= TG3_FLG3_5761_5784_AX_FIXES;
11411 }
11412
11313 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). 11413 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state().
11314 * GPIO1 driven high will bring 5700's external PHY out of reset. 11414 * GPIO1 driven high will bring 5700's external PHY out of reset.
11315 * It is also used as eeprom write protect on LOMs. 11415 * It is also used as eeprom write protect on LOMs.
@@ -12464,6 +12564,28 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12464 goto err_out_iounmap; 12564 goto err_out_iounmap;
12465 } 12565 }
12466 12566
12567 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
12568 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
12569 printk(KERN_ERR PFX "Cannot find proper PCI device "
12570 "base address for APE, aborting.\n");
12571 err = -ENODEV;
12572 goto err_out_iounmap;
12573 }
12574
12575 tg3reg_base = pci_resource_start(pdev, 2);
12576 tg3reg_len = pci_resource_len(pdev, 2);
12577
12578 tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
12579 if (tp->aperegs == 0UL) {
12580 printk(KERN_ERR PFX "Cannot map APE registers, "
12581 "aborting.\n");
12582 err = -ENOMEM;
12583 goto err_out_iounmap;
12584 }
12585
12586 tg3_ape_lock_init(tp);
12587 }
12588
12467 /* 12589 /*
12468 * Reset chip in case UNDI or EFI driver did not shutdown 12590 * Reset chip in case UNDI or EFI driver did not shutdown
12469 * DMA self test will enable WDMAC and we'll see (spurious) 12591 * DMA self test will enable WDMAC and we'll see (spurious)
@@ -12478,7 +12600,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12478 err = tg3_test_dma(tp); 12600 err = tg3_test_dma(tp);
12479 if (err) { 12601 if (err) {
12480 printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); 12602 printk(KERN_ERR PFX "DMA engine test failed, aborting.\n");
12481 goto err_out_iounmap; 12603 goto err_out_apeunmap;
12482 } 12604 }
12483 12605
12484 /* Tigon3 can do ipv4 only... and some chips have buggy 12606 /* Tigon3 can do ipv4 only... and some chips have buggy
@@ -12501,28 +12623,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12501 12623
12502 tg3_init_coal(tp); 12624 tg3_init_coal(tp);
12503 12625
12504 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
12505 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
12506 printk(KERN_ERR PFX "Cannot find proper PCI device "
12507 "base address for APE, aborting.\n");
12508 err = -ENODEV;
12509 goto err_out_iounmap;
12510 }
12511
12512 tg3reg_base = pci_resource_start(pdev, 2);
12513 tg3reg_len = pci_resource_len(pdev, 2);
12514
12515 tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
12516 if (tp->aperegs == 0UL) {
12517 printk(KERN_ERR PFX "Cannot map APE registers, "
12518 "aborting.\n");
12519 err = -ENOMEM;
12520 goto err_out_iounmap;
12521 }
12522
12523 tg3_ape_lock_init(tp);
12524 }
12525
12526 pci_set_drvdata(pdev, dev); 12626 pci_set_drvdata(pdev, dev);
12527 12627
12528 err = register_netdev(dev); 12628 err = register_netdev(dev);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 1d5b2a3dd29d..da18fb220712 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -109,6 +109,9 @@
109#define CHIPREV_ID_5714_A2 0x9002 109#define CHIPREV_ID_5714_A2 0x9002
110#define CHIPREV_ID_5906_A1 0xc001 110#define CHIPREV_ID_5906_A1 0xc001
111#define CHIPREV_ID_5784_A0 0x5784000 111#define CHIPREV_ID_5784_A0 0x5784000
112#define CHIPREV_ID_5784_A1 0x5784001
113#define CHIPREV_ID_5761_A0 0x5761000
114#define CHIPREV_ID_5761_A1 0x5761001
112#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) 115#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
113#define ASIC_REV_5700 0x07 116#define ASIC_REV_5700 0x07
114#define ASIC_REV_5701 0x00 117#define ASIC_REV_5701 0x00
@@ -856,7 +859,31 @@
856#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 859#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200
857#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 860#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400
858#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 861#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000
859/* 0x3604 --> 0x365c unused */ 862#define TG3_CPMU_LSPD_10MB_CLK 0x00003604
863#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000
864#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000
865/* 0x3608 --> 0x360c unused */
866
867#define TG3_CPMU_LSPD_1000MB_CLK 0x0000360c
868#define CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000
869#define CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000
870#define CPMU_LSPD_1000MB_MACCLK_MASK 0x001f0000
871#define TG3_CPMU_LNK_AWARE_PWRMD 0x00003610
872#define CPMU_LNK_AWARE_MACCLK_MASK 0x001f0000
873#define CPMU_LNK_AWARE_MACCLK_6_25 0x00130000
874/* 0x3614 --> 0x361c unused */
875
876#define TG3_CPMU_HST_ACC 0x0000361c
877#define CPMU_HST_ACC_MACCLK_MASK 0x001f0000
878#define CPMU_HST_ACC_MACCLK_6_25 0x00130000
879/* 0x3620 --> 0x3630 unused */
880
881#define TG3_CPMU_CLCK_STAT 0x00003630
882#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000
883#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
884#define CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000
885#define CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000
886/* 0x3634 --> 0x365c unused */
860 887
861#define TG3_CPMU_MUTEX_REQ 0x0000365c 888#define TG3_CPMU_MUTEX_REQ 0x0000365c
862#define CPMU_MUTEX_REQ_DRIVER 0x00001000 889#define CPMU_MUTEX_REQ_DRIVER 0x00001000
@@ -1537,6 +1564,12 @@
1537#define TG3_EEPROM_MAGIC 0x669955aa 1564#define TG3_EEPROM_MAGIC 0x669955aa
1538#define TG3_EEPROM_MAGIC_FW 0xa5000000 1565#define TG3_EEPROM_MAGIC_FW 0xa5000000
1539#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 1566#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000
1567#define TG3_EEPROM_SB_FORMAT_MASK 0x00e00000
1568#define TG3_EEPROM_SB_FORMAT_1 0x00200000
1569#define TG3_EEPROM_SB_REVISION_MASK 0x001f0000
1570#define TG3_EEPROM_SB_REVISION_0 0x00000000
1571#define TG3_EEPROM_SB_REVISION_2 0x00020000
1572#define TG3_EEPROM_SB_REVISION_3 0x00030000
1540#define TG3_EEPROM_MAGIC_HW 0xabcd 1573#define TG3_EEPROM_MAGIC_HW 0xabcd
1541#define TG3_EEPROM_MAGIC_HW_MSK 0xffff 1574#define TG3_EEPROM_MAGIC_HW_MSK 0xffff
1542 1575
@@ -1691,6 +1724,12 @@
1691#define MII_TG3_ISTAT 0x1a /* IRQ status register */ 1724#define MII_TG3_ISTAT 0x1a /* IRQ status register */
1692#define MII_TG3_IMASK 0x1b /* IRQ mask register */ 1725#define MII_TG3_IMASK 0x1b /* IRQ mask register */
1693 1726
1727#define MII_TG3_MISC_SHDW 0x1c
1728#define MII_TG3_MISC_SHDW_WREN 0x8000
1729#define MII_TG3_MISC_SHDW_APD_SEL 0x2800
1730
1731#define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001
1732
1694/* ISTAT/IMASK event bits */ 1733/* ISTAT/IMASK event bits */
1695#define MII_TG3_INT_LINKCHG 0x0002 1734#define MII_TG3_INT_LINKCHG 0x0002
1696#define MII_TG3_INT_SPEEDCHG 0x0004 1735#define MII_TG3_INT_SPEEDCHG 0x0004
@@ -1747,6 +1786,8 @@
1747/* APE convenience enumerations. */ 1786/* APE convenience enumerations. */
1748#define TG3_APE_LOCK_MEM 4 1787#define TG3_APE_LOCK_MEM 4
1749 1788
1789#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10
1790
1750 1791
1751/* There are two ways to manage the TX descriptors on the tigon3. 1792/* There are two ways to manage the TX descriptors on the tigon3.
1752 * Either the descriptors are in host DMA'able memory, or they 1793 * Either the descriptors are in host DMA'able memory, or they
@@ -2352,6 +2393,7 @@ struct tg3 {
2352 u32 tg3_flags3; 2393 u32 tg3_flags3;
2353#define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 2394#define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001
2354#define TG3_FLG3_ENABLE_APE 0x00000002 2395#define TG3_FLG3_ENABLE_APE 0x00000002
2396#define TG3_FLG3_5761_5784_AX_FIXES 0x00000004
2355 2397
2356 struct timer_list timer; 2398 struct timer_list timer;
2357 u16 timer_counter; 2399 u16 timer_counter;
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 49d7a290dbbc..20ac1503021e 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -24,8 +24,7 @@ config DE2104X
24 will say Y here.) Do read the Ethernet-HOWTO, available from 24 will say Y here.) Do read the Ethernet-HOWTO, available from
25 <http://www.tldp.org/docs.html#howto>. 25 <http://www.tldp.org/docs.html#howto>.
26 26
27 To compile this driver as a module, choose M here and read 27 To compile this driver as a module, choose M here. The module will
28 <file:Documentation/networking/net-modules.txt>. The module will
29 be called de2104x. 28 be called de2104x.
30 29
31config TULIP 30config TULIP
@@ -42,8 +41,7 @@ config TULIP
42 will say Y here.) Do read the Ethernet-HOWTO, available from 41 will say Y here.) Do read the Ethernet-HOWTO, available from
43 <http://www.tldp.org/docs.html#howto>. 42 <http://www.tldp.org/docs.html#howto>.
44 43
45 To compile this driver as a module, choose M here and read 44 To compile this driver as a module, choose M here. The module will
46 <file:Documentation/networking/net-modules.txt>. The module will
47 be called tulip. 45 be called tulip.
48 46
49config TULIP_MWI 47config TULIP_MWI
@@ -104,8 +102,7 @@ config DE4X5
104 information is contained in 102 information is contained in
105 <file:Documentation/networking/de4x5.txt>. 103 <file:Documentation/networking/de4x5.txt>.
106 104
107 To compile this driver as a module, choose M here and read 105 To compile this driver as a module, choose M here. The module will
108 <file:Documentation/networking/net-modules.txt>. The module will
109 be called de4x5. 106 be called de4x5.
110 107
111config WINBOND_840 108config WINBOND_840
@@ -129,8 +126,7 @@ config DM9102
129 (Ethernet) card, say Y. Some information is contained in the file 126 (Ethernet) card, say Y. Some information is contained in the file
130 <file:Documentation/networking/dmfe.txt>. 127 <file:Documentation/networking/dmfe.txt>.
131 128
132 To compile this driver as a module, choose M here and read 129 To compile this driver as a module, choose M here. The module will
133 <file:Documentation/networking/net-modules.txt>. The module will
134 be called dmfe. 130 be called dmfe.
135 131
136config ULI526X 132config ULI526X
@@ -141,8 +137,7 @@ config ULI526X
141 This driver is for ULi M5261/M5263 10/100M Ethernet Controller 137 This driver is for ULi M5261/M5263 10/100M Ethernet Controller
142 (<http://www.uli.com.tw/>). 138 (<http://www.uli.com.tw/>).
143 139
144 To compile this driver as a module, choose M here and read 140 To compile this driver as a module, choose M here. The module will
145 <file:Documentation/networking/net-modules.txt>. The module will
146 be called uli526x. 141 be called uli526x.
147 142
148config PCMCIA_XIRCOM 143config PCMCIA_XIRCOM
@@ -154,8 +149,7 @@ config PCMCIA_XIRCOM
154 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and 149 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and
155 ASIX. 150 ASIX.
156 151
157 To compile this driver as a module, choose M here and read 152 To compile this driver as a module, choose M here. The module will
158 <file:Documentation/networking/net-modules.txt>. The module will
159 be called xircom_cb. If unsure, say N. 153 be called xircom_cb. If unsure, say N.
160 154
161config PCMCIA_XIRTULIP 155config PCMCIA_XIRTULIP
@@ -168,8 +162,7 @@ config PCMCIA_XIRTULIP
168 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and 162 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and
169 ASIX. 163 ASIX.
170 164
171 To compile this driver as a module, choose M here and read 165 To compile this driver as a module, choose M here. The module will
172 <file:Documentation/networking/net-modules.txt>. The module will
173 be called xircom_tulip_cb. If unsure, say N. 166 be called xircom_tulip_cb. If unsure, say N.
174 167
175endif # NET_TULIP 168endif # NET_TULIP
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 1102160f6661..c52a76ff4bb9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
160 if (server->ssocket) { 160 if (server->ssocket) {
161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state, 161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
162 server->ssocket->flags)); 162 server->ssocket->flags));
163 server->ssocket->ops->shutdown(server->ssocket, SEND_SHUTDOWN); 163 kernel_sock_shutdown(server->ssocket, SHUT_WR);
164 cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx", 164 cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx",
165 server->ssocket->state, 165 server->ssocket->state,
166 server->ssocket->flags)); 166 server->ssocket->flags));
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 685c18065c82..d84bd155997b 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -58,6 +58,7 @@
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/idr.h> 59#include <linux/idr.h>
60#include <linux/kref.h> 60#include <linux/kref.h>
61#include <linux/net.h>
61#include <net/tcp.h> 62#include <net/tcp.h>
62 63
63#include <asm/uaccess.h> 64#include <asm/uaccess.h>
@@ -616,8 +617,7 @@ static void o2net_shutdown_sc(struct work_struct *work)
616 del_timer_sync(&sc->sc_idle_timeout); 617 del_timer_sync(&sc->sc_idle_timeout);
617 o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); 618 o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work);
618 sc_put(sc); 619 sc_put(sc);
619 sc->sc_sock->ops->shutdown(sc->sc_sock, 620 kernel_sock_shutdown(sc->sc_sock, SHUT_RDWR);
620 RCV_SHUTDOWN|SEND_SHUTDOWN);
621 } 621 }
622 622
623 /* not fatal so failed connects before the other guy has our 623 /* not fatal so failed connects before the other guy has our
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 153554cf5575..131f9c68be5f 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -178,7 +178,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
178 kfree(net->proc_net_root); 178 kfree(net->proc_net_root);
179} 179}
180 180
181static struct pernet_operations proc_net_ns_ops = { 181static struct pernet_operations __net_initdata proc_net_ns_ops = {
182 .init = proc_net_ns_init, 182 .init = proc_net_ns_init,
183 .exit = proc_net_ns_exit, 183 .exit = proc_net_ns_exit,
184}; 184};
diff --git a/include/linux/net.h b/include/linux/net.h
index dd79cdb8c4cf..596131ea46f4 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -95,6 +95,12 @@ enum sock_type {
95 95
96#endif /* ARCH_HAS_SOCKET_TYPES */ 96#endif /* ARCH_HAS_SOCKET_TYPES */
97 97
98enum sock_shutdown_cmd {
99 SHUT_RD = 0,
100 SHUT_WR = 1,
101 SHUT_RDWR = 2,
102};
103
98/** 104/**
99 * struct socket - general BSD socket 105 * struct socket - general BSD socket
100 * @state: socket state (%SS_CONNECTED, etc) 106 * @state: socket state (%SS_CONNECTED, etc)
@@ -223,6 +229,8 @@ extern int kernel_setsockopt(struct socket *sock, int level, int optname,
223extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 229extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
224 size_t size, int flags); 230 size_t size, int flags);
225extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 231extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
232extern int kernel_sock_shutdown(struct socket *sock,
233 enum sock_shutdown_cmd how);
226 234
227#ifndef CONFIG_SMP 235#ifndef CONFIG_SMP
228#define SOCKOPS_WRAPPED(name) name 236#define SOCKOPS_WRAPPED(name) name
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5bf618241ab9..4e81836191df 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -491,9 +491,11 @@ struct nduseroptmsg
491 unsigned char nduseropt_family; 491 unsigned char nduseropt_family;
492 unsigned char nduseropt_pad1; 492 unsigned char nduseropt_pad1;
493 unsigned short nduseropt_opts_len; /* Total length of options */ 493 unsigned short nduseropt_opts_len; /* Total length of options */
494 int nduseropt_ifindex;
494 __u8 nduseropt_icmp_type; 495 __u8 nduseropt_icmp_type;
495 __u8 nduseropt_icmp_code; 496 __u8 nduseropt_icmp_code;
496 unsigned short nduseropt_pad2; 497 unsigned short nduseropt_pad2;
498 unsigned int nduseropt_pad3;
497 /* Followed by one or more ND options */ 499 /* Followed by one or more ND options */
498}; 500};
499 501
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 227adcbdfec8..38d5a1e9980d 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -13,9 +13,6 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern void inet_remove_sock(struct sock *sk1);
17extern void inet_put_sock(unsigned short num,
18 struct sock *sk);
19extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
20extern int inet_stream_connect(struct socket *sock, 17extern int inet_stream_connect(struct socket *sock,
21 struct sockaddr * uaddr, 18 struct sockaddr * uaddr,
@@ -30,7 +27,6 @@ extern int inet_sendmsg(struct kiocb *iocb,
30 struct msghdr *msg, 27 struct msghdr *msg,
31 size_t size); 28 size_t size);
32extern int inet_shutdown(struct socket *sock, int how); 29extern int inet_shutdown(struct socket *sock, int how);
33extern unsigned int inet_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
34extern int inet_listen(struct socket *sock, int backlog); 30extern int inet_listen(struct socket *sock, int backlog);
35 31
36extern void inet_sock_destruct(struct sock *sk); 32extern void inet_sock_destruct(struct sock *sk);
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index aa10a8178e70..ad8404b56113 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,7 +22,7 @@ struct inet_peer
22 __be32 v4daddr; /* peer's address */ 22 __be32 v4daddr; /* peer's address */
23 __u16 avl_height; 23 __u16 avl_height;
24 __u16 ip_id_count; /* IP ID for the next packet */ 24 __u16 ip_id_count; /* IP ID for the next packet */
25 struct inet_peer *unused_next, **unused_prevp; 25 struct list_head unused;
26 __u32 dtime; /* the time of last use of not 26 __u32 dtime; /* the time of last use of not
27 * referenced entries */ 27 * referenced entries */
28 atomic_t refcnt; 28 atomic_t refcnt;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 1fd449a6530b..5dd6d90b37eb 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -119,9 +119,11 @@ static inline struct net *maybe_get_net(struct net *net)
119#ifdef CONFIG_NET_NS 119#ifdef CONFIG_NET_NS
120#define __net_init 120#define __net_init
121#define __net_exit 121#define __net_exit
122#define __net_initdata
122#else 123#else
123#define __net_init __init 124#define __net_init __init
124#define __net_exit __exit_refok 125#define __net_exit __exit_refok
126#define __net_initdata __initdata
125#endif 127#endif
126 128
127struct pernet_operations { 129struct pernet_operations {
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index b8733364557f..c1f797673571 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -103,6 +103,7 @@ typedef enum {
103 SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ 103 SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */
104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ 104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
106 SCTP_CMD_LAST 107 SCTP_CMD_LAST
107} sctp_verb_t; 108} sctp_verb_t;
108 109
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index da8354e8e33c..f30b537d6952 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -186,6 +186,8 @@ typedef enum {
186 SCTP_IERROR_AUTH_BAD_HMAC, 186 SCTP_IERROR_AUTH_BAD_HMAC,
187 SCTP_IERROR_AUTH_BAD_KEYID, 187 SCTP_IERROR_AUTH_BAD_KEYID,
188 SCTP_IERROR_PROTO_VIOLATION, 188 SCTP_IERROR_PROTO_VIOLATION,
189 SCTP_IERROR_ERROR,
190 SCTP_IERROR_ABORT,
189} sctp_ierror_t; 191} sctp_ierror_t;
190 192
191 193
@@ -407,6 +409,7 @@ typedef enum {
407 SCTP_RTXR_T3_RTX, 409 SCTP_RTXR_T3_RTX,
408 SCTP_RTXR_FAST_RTX, 410 SCTP_RTXR_FAST_RTX,
409 SCTP_RTXR_PMTUD, 411 SCTP_RTXR_PMTUD,
412 SCTP_RTXR_T1_RTX,
410} sctp_retransmit_reason_t; 413} sctp_retransmit_reason_t;
411 414
412/* Reasons to lower cwnd. */ 415/* Reasons to lower cwnd. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 93eb708609e7..34318a33a94c 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -65,7 +65,6 @@
65 65
66 66
67#ifdef TEST_FRAME 67#ifdef TEST_FRAME
68#undef CONFIG_PROC_FS
69#undef CONFIG_SCTP_DBG_OBJCNT 68#undef CONFIG_SCTP_DBG_OBJCNT
70#undef CONFIG_SYSCTL 69#undef CONFIG_SYSCTL
71#endif /* TEST_FRAME */ 70#endif /* TEST_FRAME */
@@ -267,6 +266,7 @@ enum
267 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, 266 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
268 SCTP_MIB_DELAY_SACK_EXPIREDS, 267 SCTP_MIB_DELAY_SACK_EXPIREDS,
269 SCTP_MIB_AUTOCLOSE_EXPIREDS, 268 SCTP_MIB_AUTOCLOSE_EXPIREDS,
269 SCTP_MIB_T1_RETRANSMITS,
270 SCTP_MIB_T3_RETRANSMITS, 270 SCTP_MIB_T3_RETRANSMITS,
271 SCTP_MIB_PMTUD_RETRANSMITS, 271 SCTP_MIB_PMTUD_RETRANSMITS,
272 SCTP_MIB_FAST_RETRANSMITS, 272 SCTP_MIB_FAST_RETRANSMITS,
@@ -664,6 +664,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
664 return (h & (sctp_assoc_hashsize-1)); 664 return (h & (sctp_assoc_hashsize-1));
665} 665}
666 666
667#define sctp_for_each_hentry(epb, node, head) \
668 hlist_for_each_entry(epb, node, head, node)
669
667/* Is a socket of this style? */ 670/* Is a socket of this style? */
668#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) 671#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
669static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) 672static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ef892e00c833..eb3113c38a94 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -100,20 +100,19 @@ struct crypto_hash;
100struct sctp_bind_bucket { 100struct sctp_bind_bucket {
101 unsigned short port; 101 unsigned short port;
102 unsigned short fastreuse; 102 unsigned short fastreuse;
103 struct sctp_bind_bucket *next; 103 struct hlist_node node;
104 struct sctp_bind_bucket **pprev;
105 struct hlist_head owner; 104 struct hlist_head owner;
106}; 105};
107 106
108struct sctp_bind_hashbucket { 107struct sctp_bind_hashbucket {
109 spinlock_t lock; 108 spinlock_t lock;
110 struct sctp_bind_bucket *chain; 109 struct hlist_head chain;
111}; 110};
112 111
113/* Used for hashing all associations. */ 112/* Used for hashing all associations. */
114struct sctp_hashbucket { 113struct sctp_hashbucket {
115 rwlock_t lock; 114 rwlock_t lock;
116 struct sctp_ep_common *chain; 115 struct hlist_head chain;
117} __attribute__((__aligned__(8))); 116} __attribute__((__aligned__(8)));
118 117
119 118
@@ -212,6 +211,7 @@ extern struct sctp_globals {
212 211
213 /* Flag to indicate if addip is enabled. */ 212 /* Flag to indicate if addip is enabled. */
214 int addip_enable; 213 int addip_enable;
214 int addip_noauth_enable;
215 215
216 /* Flag to indicate if PR-SCTP is enabled. */ 216 /* Flag to indicate if PR-SCTP is enabled. */
217 int prsctp_enable; 217 int prsctp_enable;
@@ -249,6 +249,7 @@ extern struct sctp_globals {
249#define sctp_local_addr_list (sctp_globals.local_addr_list) 249#define sctp_local_addr_list (sctp_globals.local_addr_list)
250#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 250#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
251#define sctp_addip_enable (sctp_globals.addip_enable) 251#define sctp_addip_enable (sctp_globals.addip_enable)
252#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
252#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 253#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
253#define sctp_auth_enable (sctp_globals.auth_enable) 254#define sctp_auth_enable (sctp_globals.auth_enable)
254 255
@@ -873,10 +874,11 @@ struct sctp_transport {
873 * address list derived from the INIT or INIT ACK chunk, a 874 * address list derived from the INIT or INIT ACK chunk, a
874 * number of data elements needs to be maintained including: 875 * number of data elements needs to be maintained including:
875 */ 876 */
876 __u32 rtt; /* This is the most recent RTT. */
877
878 /* RTO : The current retransmission timeout value. */ 877 /* RTO : The current retransmission timeout value. */
879 unsigned long rto; 878 unsigned long rto;
879 unsigned long last_rto;
880
881 __u32 rtt; /* This is the most recent RTT. */
880 882
881 /* RTTVAR : The current RTT variation. */ 883 /* RTTVAR : The current RTT variation. */
882 __u32 rttvar; 884 __u32 rttvar;
@@ -1184,9 +1186,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
1184 int flags); 1186 int flags);
1185int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1187int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1186 __u8 use_as_src, gfp_t gfp); 1188 __u8 use_as_src, gfp_t gfp);
1187int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1189int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1188 void fastcall (*rcu_call)(struct rcu_head *,
1189 void (*func)(struct rcu_head *)));
1190int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, 1190int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1191 struct sctp_sock *); 1191 struct sctp_sock *);
1192union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, 1192union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
@@ -1229,8 +1229,7 @@ typedef enum {
1229 1229
1230struct sctp_ep_common { 1230struct sctp_ep_common {
1231 /* Fields to help us manage our entries in the hash tables. */ 1231 /* Fields to help us manage our entries in the hash tables. */
1232 struct sctp_ep_common *next; 1232 struct hlist_node node;
1233 struct sctp_ep_common **pprev;
1234 int hashent; 1233 int hashent;
1235 1234
1236 /* Runtime type information. What kind of endpoint is this? */ 1235 /* Runtime type information. What kind of endpoint is this? */
@@ -1541,7 +1540,6 @@ struct sctp_association {
1541 __u8 asconf_capable; /* Does peer support ADDIP? */ 1540 __u8 asconf_capable; /* Does peer support ADDIP? */
1542 __u8 prsctp_capable; /* Can peer do PR-SCTP? */ 1541 __u8 prsctp_capable; /* Can peer do PR-SCTP? */
1543 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ 1542 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */
1544 __u8 addip_capable; /* Can peer do ADD-IP */
1545 1543
1546 __u32 adaptation_ind; /* Adaptation Code point. */ 1544 __u32 adaptation_ind; /* Adaptation Code point. */
1547 1545
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index da22f900e89d..c1757c79dfbb 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -766,6 +766,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
766 if (!nf_bridge) 766 if (!nf_bridge)
767 return NF_ACCEPT; 767 return NF_ACCEPT;
768 768
769 if (!(nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT)))
770 return NF_ACCEPT;
771
769 if (!realoutdev) 772 if (!realoutdev)
770 return NF_DROP; 773 return NF_DROP;
771 774
diff --git a/net/core/dev.c b/net/core/dev.c
index dd7e30754cbc..dd40b35bb006 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2688,7 +2688,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
2688 proc_net_remove(net, "dev"); 2688 proc_net_remove(net, "dev");
2689} 2689}
2690 2690
2691static struct pernet_operations dev_proc_ops = { 2691static struct pernet_operations __net_initdata dev_proc_ops = {
2692 .init = dev_proc_net_init, 2692 .init = dev_proc_net_init,
2693 .exit = dev_proc_net_exit, 2693 .exit = dev_proc_net_exit,
2694}; 2694};
@@ -4353,7 +4353,7 @@ static void __net_exit netdev_exit(struct net *net)
4353 kfree(net->dev_index_head); 4353 kfree(net->dev_index_head);
4354} 4354}
4355 4355
4356static struct pernet_operations netdev_net_ops = { 4356static struct pernet_operations __net_initdata netdev_net_ops = {
4357 .init = netdev_init, 4357 .init = netdev_init,
4358 .exit = netdev_exit, 4358 .exit = netdev_exit,
4359}; 4359};
@@ -4384,7 +4384,7 @@ static void __net_exit default_device_exit(struct net *net)
4384 rtnl_unlock(); 4384 rtnl_unlock();
4385} 4385}
4386 4386
4387static struct pernet_operations default_device_ops = { 4387static struct pernet_operations __net_initdata default_device_ops = {
4388 .exit = default_device_exit, 4388 .exit = default_device_exit,
4389}; 4389};
4390 4390
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 647973daca2b..69fff16ece10 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net)
285 proc_net_remove(net, "dev_mcast"); 285 proc_net_remove(net, "dev_mcast");
286} 286}
287 287
288static struct pernet_operations dev_mc_net_ops = { 288static struct pernet_operations __net_initdata dev_mc_net_ops = {
289 .init = dev_mc_net_init, 289 .init = dev_mc_net_init,
290 .exit = dev_mc_net_exit, 290 .exit = dev_mc_net_exit,
291}; 291};
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3f6d37deac45..383252b50411 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -188,6 +188,7 @@ static int __init net_ns_init(void)
188 188
189pure_initcall(net_ns_init); 189pure_initcall(net_ns_init);
190 190
191#ifdef CONFIG_NET_NS
191static int register_pernet_operations(struct list_head *list, 192static int register_pernet_operations(struct list_head *list,
192 struct pernet_operations *ops) 193 struct pernet_operations *ops)
193{ 194{
@@ -228,6 +229,23 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
228 ops->exit(net); 229 ops->exit(net);
229} 230}
230 231
232#else
233
234static int register_pernet_operations(struct list_head *list,
235 struct pernet_operations *ops)
236{
237 if (ops->init == NULL)
238 return 0;
239 return ops->init(&init_net);
240}
241
242static void unregister_pernet_operations(struct pernet_operations *ops)
243{
244 if (ops->exit)
245 ops->exit(&init_net);
246}
247#endif
248
231/** 249/**
232 * register_pernet_subsys - register a network namespace subsystem 250 * register_pernet_subsys - register a network namespace subsystem
233 * @ops: pernet operations structure for the subsystem 251 * @ops: pernet operations structure for the subsystem
diff --git a/net/core/sock.c b/net/core/sock.c
index 8fc2f84209e4..c519b439b8b1 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2097,7 +2097,3 @@ EXPORT_SYMBOL(sock_wmalloc);
2097EXPORT_SYMBOL(sock_i_uid); 2097EXPORT_SYMBOL(sock_i_uid);
2098EXPORT_SYMBOL(sock_i_ino); 2098EXPORT_SYMBOL(sock_i_ino);
2099EXPORT_SYMBOL(sysctl_optmem_max); 2099EXPORT_SYMBOL(sysctl_optmem_max);
2100#ifdef CONFIG_SYSCTL
2101EXPORT_SYMBOL(sysctl_rmem_max);
2102EXPORT_SYMBOL(sysctl_wmem_max);
2103#endif
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 771031dfbd0f..af995198f643 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -61,7 +61,7 @@
61 * 4. Global variable peer_total is modified under the pool lock. 61 * 4. Global variable peer_total is modified under the pool lock.
62 * 5. struct inet_peer fields modification: 62 * 5. struct inet_peer fields modification:
63 * avl_left, avl_right, avl_parent, avl_height: pool lock 63 * avl_left, avl_right, avl_parent, avl_height: pool lock
64 * unused_next, unused_prevp: unused node list lock 64 * unused: unused node list lock
65 * refcnt: atomically against modifications on other CPU; 65 * refcnt: atomically against modifications on other CPU;
66 * usually under some other lock to prevent node disappearing 66 * usually under some other lock to prevent node disappearing
67 * dtime: unused node list lock 67 * dtime: unused node list lock
@@ -94,8 +94,7 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min
94int inet_peer_gc_mintime __read_mostly = 10 * HZ; 94int inet_peer_gc_mintime __read_mostly = 10 * HZ;
95int inet_peer_gc_maxtime __read_mostly = 120 * HZ; 95int inet_peer_gc_maxtime __read_mostly = 120 * HZ;
96 96
97static struct inet_peer *inet_peer_unused_head; 97static LIST_HEAD(unused_peers);
98static struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head;
99static DEFINE_SPINLOCK(inet_peer_unused_lock); 98static DEFINE_SPINLOCK(inet_peer_unused_lock);
100 99
101static void peer_check_expire(unsigned long dummy); 100static void peer_check_expire(unsigned long dummy);
@@ -138,15 +137,7 @@ void __init inet_initpeers(void)
138static void unlink_from_unused(struct inet_peer *p) 137static void unlink_from_unused(struct inet_peer *p)
139{ 138{
140 spin_lock_bh(&inet_peer_unused_lock); 139 spin_lock_bh(&inet_peer_unused_lock);
141 if (p->unused_prevp != NULL) { 140 list_del_init(&p->unused);
142 /* On unused list. */
143 *p->unused_prevp = p->unused_next;
144 if (p->unused_next != NULL)
145 p->unused_next->unused_prevp = p->unused_prevp;
146 else
147 inet_peer_unused_tailp = p->unused_prevp;
148 p->unused_prevp = NULL; /* mark it as removed */
149 }
150 spin_unlock_bh(&inet_peer_unused_lock); 141 spin_unlock_bh(&inet_peer_unused_lock);
151} 142}
152 143
@@ -337,24 +328,24 @@ static void unlink_from_pool(struct inet_peer *p)
337/* May be called with local BH enabled. */ 328/* May be called with local BH enabled. */
338static int cleanup_once(unsigned long ttl) 329static int cleanup_once(unsigned long ttl)
339{ 330{
340 struct inet_peer *p; 331 struct inet_peer *p = NULL;
341 332
342 /* Remove the first entry from the list of unused nodes. */ 333 /* Remove the first entry from the list of unused nodes. */
343 spin_lock_bh(&inet_peer_unused_lock); 334 spin_lock_bh(&inet_peer_unused_lock);
344 p = inet_peer_unused_head; 335 if (!list_empty(&unused_peers)) {
345 if (p != NULL) { 336 __u32 delta;
346 __u32 delta = (__u32)jiffies - p->dtime; 337
338 p = list_first_entry(&unused_peers, struct inet_peer, unused);
339 delta = (__u32)jiffies - p->dtime;
340
347 if (delta < ttl) { 341 if (delta < ttl) {
348 /* Do not prune fresh entries. */ 342 /* Do not prune fresh entries. */
349 spin_unlock_bh(&inet_peer_unused_lock); 343 spin_unlock_bh(&inet_peer_unused_lock);
350 return -1; 344 return -1;
351 } 345 }
352 inet_peer_unused_head = p->unused_next; 346
353 if (p->unused_next != NULL) 347 list_del_init(&p->unused);
354 p->unused_next->unused_prevp = p->unused_prevp; 348
355 else
356 inet_peer_unused_tailp = p->unused_prevp;
357 p->unused_prevp = NULL; /* mark as not on the list */
358 /* Grab an extra reference to prevent node disappearing 349 /* Grab an extra reference to prevent node disappearing
359 * before unlink_from_pool() call. */ 350 * before unlink_from_pool() call. */
360 atomic_inc(&p->refcnt); 351 atomic_inc(&p->refcnt);
@@ -412,7 +403,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
412 403
413 /* Link the node. */ 404 /* Link the node. */
414 link_to_pool(n); 405 link_to_pool(n);
415 n->unused_prevp = NULL; /* not on the list */ 406 INIT_LIST_HEAD(&n->unused);
416 peer_total++; 407 peer_total++;
417 write_unlock_bh(&peer_pool_lock); 408 write_unlock_bh(&peer_pool_lock);
418 409
@@ -467,10 +458,7 @@ void inet_putpeer(struct inet_peer *p)
467{ 458{
468 spin_lock_bh(&inet_peer_unused_lock); 459 spin_lock_bh(&inet_peer_unused_lock);
469 if (atomic_dec_and_test(&p->refcnt)) { 460 if (atomic_dec_and_test(&p->refcnt)) {
470 p->unused_prevp = inet_peer_unused_tailp; 461 list_add_tail(&p->unused, &unused_peers);
471 p->unused_next = NULL;
472 *inet_peer_unused_tailp = p;
473 inet_peer_unused_tailp = &p->unused_next;
474 p->dtime = (__u32)jiffies; 462 p->dtime = (__u32)jiffies;
475 } 463 }
476 spin_unlock_bh(&inet_peer_unused_lock); 464 spin_unlock_bh(&inet_peer_unused_lock);
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index b7eeae622d9b..0a9f3c37e18d 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -441,7 +441,6 @@ struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp)
441 } else 441 } else
442 return NULL; 442 return NULL;
443} 443}
444EXPORT_SYMBOL(ip_vs_try_bind_dest);
445 444
446 445
447/* 446/*
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 3c4d22a468ec..b64cf45a9ead 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -604,7 +604,6 @@ struct ip_vs_dest *ip_vs_find_dest(__be32 daddr, __be16 dport,
604 ip_vs_service_put(svc); 604 ip_vs_service_put(svc);
605 return dest; 605 return dest;
606} 606}
607EXPORT_SYMBOL(ip_vs_find_dest);
608 607
609/* 608/*
610 * Lookup dest by {svc,addr,port} in the destination trash. 609 * Lookup dest by {svc,addr,port} in the destination trash.
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 56e93f692e82..70e7997ea284 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -681,7 +681,7 @@ static int clean_nat(struct nf_conn *i, void *data)
681 681
682 if (!nat) 682 if (!nat)
683 return 0; 683 return 0;
684 memset(nat, 0, sizeof(nat)); 684 memset(nat, 0, sizeof(*nat));
685 i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST); 685 i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST);
686 return 0; 686 return 0;
687} 687}
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 36f7dbfb6dbb..67997a74ddce 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1037,6 +1037,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1037 1037
1038 ndmsg = nlmsg_data(nlh); 1038 ndmsg = nlmsg_data(nlh);
1039 ndmsg->nduseropt_family = AF_INET6; 1039 ndmsg->nduseropt_family = AF_INET6;
1040 ndmsg->nduseropt_ifindex = ra->dev->ifindex;
1040 ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type; 1041 ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type;
1041 ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code; 1042 ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code;
1042 ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3; 1043 ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3;
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index 2dfac3253569..87bc1443c520 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -60,46 +60,57 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg)
60} 60}
61EXPORT_SYMBOL(nf_unregister_sockopt); 61EXPORT_SYMBOL(nf_unregister_sockopt);
62 62
63/* Call get/setsockopt() */ 63static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf,
64static int nf_sockopt(struct sock *sk, int pf, int val, 64 int val, int get)
65 char __user *opt, int *len, int get)
66{ 65{
67 struct nf_sockopt_ops *ops; 66 struct nf_sockopt_ops *ops;
68 int ret;
69 67
70 if (sk->sk_net != &init_net) 68 if (sk->sk_net != &init_net)
71 return -ENOPROTOOPT; 69 return ERR_PTR(-ENOPROTOOPT);
72 70
73 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 71 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
74 return -EINTR; 72 return ERR_PTR(-EINTR);
75 73
76 list_for_each_entry(ops, &nf_sockopts, list) { 74 list_for_each_entry(ops, &nf_sockopts, list) {
77 if (ops->pf == pf) { 75 if (ops->pf == pf) {
78 if (!try_module_get(ops->owner)) 76 if (!try_module_get(ops->owner))
79 goto out_nosup; 77 goto out_nosup;
78
80 if (get) { 79 if (get) {
81 if (val >= ops->get_optmin 80 if (val >= ops->get_optmin &&
82 && val < ops->get_optmax) { 81 val < ops->get_optmax)
83 mutex_unlock(&nf_sockopt_mutex);
84 ret = ops->get(sk, val, opt, len);
85 goto out; 82 goto out;
86 }
87 } else { 83 } else {
88 if (val >= ops->set_optmin 84 if (val >= ops->set_optmin &&
89 && val < ops->set_optmax) { 85 val < ops->set_optmax)
90 mutex_unlock(&nf_sockopt_mutex);
91 ret = ops->set(sk, val, opt, *len);
92 goto out; 86 goto out;
93 }
94 } 87 }
95 module_put(ops->owner); 88 module_put(ops->owner);
96 } 89 }
97 } 90 }
98 out_nosup: 91out_nosup:
92 ops = ERR_PTR(-ENOPROTOOPT);
93out:
99 mutex_unlock(&nf_sockopt_mutex); 94 mutex_unlock(&nf_sockopt_mutex);
100 return -ENOPROTOOPT; 95 return ops;
96}
97
98/* Call get/setsockopt() */
99static int nf_sockopt(struct sock *sk, int pf, int val,
100 char __user *opt, int *len, int get)
101{
102 struct nf_sockopt_ops *ops;
103 int ret;
104
105 ops = nf_sockopt_find(sk, pf, val, get);
106 if (IS_ERR(ops))
107 return PTR_ERR(ops);
108
109 if (get)
110 ret = ops->get(sk, val, opt, len);
111 else
112 ret = ops->set(sk, val, opt, *len);
101 113
102 out:
103 module_put(ops->owner); 114 module_put(ops->owner);
104 return ret; 115 return ret;
105} 116}
@@ -124,51 +135,22 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val,
124 struct nf_sockopt_ops *ops; 135 struct nf_sockopt_ops *ops;
125 int ret; 136 int ret;
126 137
127 if (sk->sk_net != &init_net) 138 ops = nf_sockopt_find(sk, pf, val, get);
128 return -ENOPROTOOPT; 139 if (IS_ERR(ops))
129 140 return PTR_ERR(ops);
130 141
131 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 142 if (get) {
132 return -EINTR; 143 if (ops->compat_get)
133 144 ret = ops->compat_get(sk, val, opt, len);
134 list_for_each_entry(ops, &nf_sockopts, list) { 145 else
135 if (ops->pf == pf) { 146 ret = ops->get(sk, val, ops, len);
136 if (!try_module_get(ops->owner)) 147 } else {
137 goto out_nosup; 148 if (ops->compat_set)
138 149 ret = ops->compat_set(sk, val, ops, *len);
139 if (get) { 150 else
140 if (val >= ops->get_optmin 151 ret = ops->set(sk, val, ops, *len);
141 && val < ops->get_optmax) {
142 mutex_unlock(&nf_sockopt_mutex);
143 if (ops->compat_get)
144 ret = ops->compat_get(sk,
145 val, opt, len);
146 else
147 ret = ops->get(sk,
148 val, opt, len);
149 goto out;
150 }
151 } else {
152 if (val >= ops->set_optmin
153 && val < ops->set_optmax) {
154 mutex_unlock(&nf_sockopt_mutex);
155 if (ops->compat_set)
156 ret = ops->compat_set(sk,
157 val, opt, *len);
158 else
159 ret = ops->set(sk,
160 val, opt, *len);
161 goto out;
162 }
163 }
164 module_put(ops->owner);
165 }
166 } 152 }
167 out_nosup:
168 mutex_unlock(&nf_sockopt_mutex);
169 return -ENOPROTOOPT;
170 153
171 out:
172 module_put(ops->owner); 154 module_put(ops->owner);
173 return ret; 155 return ret;
174} 156}
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index ff44f86c24ce..f9c55dcd894b 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -170,7 +170,7 @@ static bool xt_time_match(const struct sk_buff *skb,
170 if (skb->tstamp.tv64 == 0) 170 if (skb->tstamp.tv64 == 0)
171 __net_timestamp((struct sk_buff *)skb); 171 __net_timestamp((struct sk_buff *)skb);
172 172
173 stamp = skb->tstamp.tv64; 173 stamp = ktime_to_ns(skb->tstamp);
174 do_div(stamp, NSEC_PER_SEC); 174 do_div(stamp, NSEC_PER_SEC);
175 175
176 if (info->flags & XT_TIME_LOCAL_TZ) 176 if (info->flags & XT_TIME_LOCAL_TZ)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 415c97236f63..de3988ba1f46 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
1888#endif 1888#endif
1889} 1889}
1890 1890
1891static struct pernet_operations netlink_net_ops = { 1891static struct pernet_operations __net_initdata netlink_net_ops = {
1892 .init = netlink_net_init, 1892 .init = netlink_net_init,
1893 .exit = netlink_net_exit, 1893 .exit = netlink_net_exit,
1894}; 1894};
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index eb6be5030c70..8a7807dbba01 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -881,20 +881,14 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
881 if (protocol == 0) 881 if (protocol == 0)
882 goto out_unlock; 882 goto out_unlock;
883 883
884 if (dev) { 884 if (!dev || (dev->flags & IFF_UP)) {
885 if (dev->flags&IFF_UP) {
886 dev_add_pack(&po->prot_hook);
887 sock_hold(sk);
888 po->running = 1;
889 } else {
890 sk->sk_err = ENETDOWN;
891 if (!sock_flag(sk, SOCK_DEAD))
892 sk->sk_error_report(sk);
893 }
894 } else {
895 dev_add_pack(&po->prot_hook); 885 dev_add_pack(&po->prot_hook);
896 sock_hold(sk); 886 sock_hold(sk);
897 po->running = 1; 887 po->running = 1;
888 } else {
889 sk->sk_err = ENETDOWN;
890 if (!sock_flag(sk, SOCK_DEAD))
891 sk->sk_error_report(sk);
898 } 892 }
899 893
900out_unlock: 894out_unlock:
diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c
index fe03f71f17da..f3a2bd747a8f 100644
--- a/net/rxrpc/ar-local.c
+++ b/net/rxrpc/ar-local.c
@@ -114,7 +114,7 @@ static int rxrpc_create_local(struct rxrpc_local *local)
114 return 0; 114 return 0;
115 115
116error: 116error:
117 local->socket->ops->shutdown(local->socket, 2); 117 kernel_sock_shutdown(local->socket, SHUT_RDWR);
118 local->socket->sk->sk_user_data = NULL; 118 local->socket->sk->sk_user_data = NULL;
119 sock_release(local->socket); 119 sock_release(local->socket);
120 local->socket = NULL; 120 local->socket = NULL;
@@ -267,7 +267,7 @@ static void rxrpc_destroy_local(struct work_struct *work)
267 /* finish cleaning up the local descriptor */ 267 /* finish cleaning up the local descriptor */
268 rxrpc_purge_queue(&local->accept_queue); 268 rxrpc_purge_queue(&local->accept_queue);
269 rxrpc_purge_queue(&local->reject_queue); 269 rxrpc_purge_queue(&local->reject_queue);
270 local->socket->ops->shutdown(local->socket, 2); 270 kernel_sock_shutdown(local->socket, SHUT_RDWR);
271 sock_release(local->socket); 271 sock_release(local->socket);
272 272
273 up_read(&rxrpc_local_sem); 273 up_read(&rxrpc_local_sem);
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 03158e3665da..013e3d3ab0f1 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -262,10 +262,14 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
262 */ 262 */
263 asoc->peer.sack_needed = 1; 263 asoc->peer.sack_needed = 1;
264 264
265 /* Assume that the peer recongizes ASCONF until reported otherwise 265 /* Assume that the peer will tell us if he recognizes ASCONF
266 * via an ERROR chunk. 266 * as part of INIT exchange.
267 * The sctp_addip_noauth option is there for backward compatibilty
268 * and will revert old behavior.
267 */ 269 */
268 asoc->peer.asconf_capable = 1; 270 asoc->peer.asconf_capable = 0;
271 if (sctp_addip_noauth)
272 asoc->peer.asconf_capable = 1;
269 273
270 /* Create an input queue. */ 274 /* Create an input queue. */
271 sctp_inq_init(&asoc->base.inqueue); 275 sctp_inq_init(&asoc->base.inqueue);
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index dfffa94fb9f6..cae95af9a8cc 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -180,9 +180,7 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
180/* Delete an address from the bind address list in the SCTP_bind_addr 180/* Delete an address from the bind address list in the SCTP_bind_addr
181 * structure. 181 * structure.
182 */ 182 */
183int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr, 183int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
184 void fastcall (*rcu_call)(struct rcu_head *head,
185 void (*func)(struct rcu_head *head)))
186{ 184{
187 struct sctp_sockaddr_entry *addr, *temp; 185 struct sctp_sockaddr_entry *addr, *temp;
188 186
@@ -198,15 +196,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr,
198 } 196 }
199 } 197 }
200 198
201 /* Call the rcu callback provided in the args. This function is
202 * called by both BH packet processing and user side socket option
203 * processing, but it works on different lists in those 2 contexts.
204 * Each context provides it's own callback, whether call_rcu_bh()
205 * or call_rcu(), to make sure that we wait for an appropriate time.
206 */
207 if (addr && !addr->valid) { 199 if (addr && !addr->valid) {
208 rcu_call(&addr->rcu, sctp_local_addr_free); 200 call_rcu(&addr->rcu, sctp_local_addr_free);
209 SCTP_DBG_OBJCNT_DEC(addr); 201 SCTP_DBG_OBJCNT_DEC(addr);
202 return 0;
210 } 203 }
211 204
212 return -EINVAL; 205 return -EINVAL;
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 2d2d81ef4a69..de6f505d6ff8 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -328,24 +328,35 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
328 const union sctp_addr *paddr, 328 const union sctp_addr *paddr,
329 struct sctp_transport **transport) 329 struct sctp_transport **transport)
330{ 330{
331 struct sctp_association *asoc = NULL;
332 struct sctp_transport *t = NULL;
333 struct sctp_hashbucket *head;
334 struct sctp_ep_common *epb;
335 struct hlist_node *node;
336 int hash;
331 int rport; 337 int rport;
332 struct sctp_association *asoc;
333 struct list_head *pos;
334 338
339 *transport = NULL;
335 rport = ntohs(paddr->v4.sin_port); 340 rport = ntohs(paddr->v4.sin_port);
336 341
337 list_for_each(pos, &ep->asocs) { 342 hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport);
338 asoc = list_entry(pos, struct sctp_association, asocs); 343 head = &sctp_assoc_hashtable[hash];
339 if (rport == asoc->peer.port) { 344 read_lock(&head->lock);
340 *transport = sctp_assoc_lookup_paddr(asoc, paddr); 345 sctp_for_each_hentry(epb, node, &head->chain) {
341 346 asoc = sctp_assoc(epb);
342 if (*transport) 347 if (asoc->ep != ep || rport != asoc->peer.port)
343 return asoc; 348 goto next;
349
350 t = sctp_assoc_lookup_paddr(asoc, paddr);
351 if (t) {
352 *transport = t;
353 break;
344 } 354 }
355next:
356 asoc = NULL;
345 } 357 }
346 358 read_unlock(&head->lock);
347 *transport = NULL; 359 return asoc;
348 return NULL;
349} 360}
350 361
351/* Lookup association on an endpoint based on a peer address. BH-safe. */ 362/* Lookup association on an endpoint based on a peer address. BH-safe. */
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 86503e7fa21e..91ae463b079b 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -656,7 +656,6 @@ discard:
656/* Insert endpoint into the hash table. */ 656/* Insert endpoint into the hash table. */
657static void __sctp_hash_endpoint(struct sctp_endpoint *ep) 657static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
658{ 658{
659 struct sctp_ep_common **epp;
660 struct sctp_ep_common *epb; 659 struct sctp_ep_common *epb;
661 struct sctp_hashbucket *head; 660 struct sctp_hashbucket *head;
662 661
@@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
666 head = &sctp_ep_hashtable[epb->hashent]; 665 head = &sctp_ep_hashtable[epb->hashent];
667 666
668 sctp_write_lock(&head->lock); 667 sctp_write_lock(&head->lock);
669 epp = &head->chain; 668 hlist_add_head(&epb->node, &head->chain);
670 epb->next = *epp;
671 if (epb->next)
672 (*epp)->pprev = &epb->next;
673 *epp = epb;
674 epb->pprev = epp;
675 sctp_write_unlock(&head->lock); 669 sctp_write_unlock(&head->lock);
676} 670}
677 671
@@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep)
691 685
692 epb = &ep->base; 686 epb = &ep->base;
693 687
688 if (hlist_unhashed(&epb->node))
689 return;
690
694 epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); 691 epb->hashent = sctp_ep_hashfn(epb->bind_addr.port);
695 692
696 head = &sctp_ep_hashtable[epb->hashent]; 693 head = &sctp_ep_hashtable[epb->hashent];
697 694
698 sctp_write_lock(&head->lock); 695 sctp_write_lock(&head->lock);
699 696 __hlist_del(&epb->node);
700 if (epb->pprev) {
701 if (epb->next)
702 epb->next->pprev = epb->pprev;
703 *epb->pprev = epb->next;
704 epb->pprev = NULL;
705 }
706
707 sctp_write_unlock(&head->lock); 697 sctp_write_unlock(&head->lock);
708} 698}
709 699
@@ -721,12 +711,13 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l
721 struct sctp_hashbucket *head; 711 struct sctp_hashbucket *head;
722 struct sctp_ep_common *epb; 712 struct sctp_ep_common *epb;
723 struct sctp_endpoint *ep; 713 struct sctp_endpoint *ep;
714 struct hlist_node *node;
724 int hash; 715 int hash;
725 716
726 hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); 717 hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port));
727 head = &sctp_ep_hashtable[hash]; 718 head = &sctp_ep_hashtable[hash];
728 read_lock(&head->lock); 719 read_lock(&head->lock);
729 for (epb = head->chain; epb; epb = epb->next) { 720 sctp_for_each_hentry(epb, node, &head->chain) {
730 ep = sctp_ep(epb); 721 ep = sctp_ep(epb);
731 if (sctp_endpoint_is_match(ep, laddr)) 722 if (sctp_endpoint_is_match(ep, laddr))
732 goto hit; 723 goto hit;
@@ -744,7 +735,6 @@ hit:
744/* Insert association into the hash table. */ 735/* Insert association into the hash table. */
745static void __sctp_hash_established(struct sctp_association *asoc) 736static void __sctp_hash_established(struct sctp_association *asoc)
746{ 737{
747 struct sctp_ep_common **epp;
748 struct sctp_ep_common *epb; 738 struct sctp_ep_common *epb;
749 struct sctp_hashbucket *head; 739 struct sctp_hashbucket *head;
750 740
@@ -756,12 +746,7 @@ static void __sctp_hash_established(struct sctp_association *asoc)
756 head = &sctp_assoc_hashtable[epb->hashent]; 746 head = &sctp_assoc_hashtable[epb->hashent];
757 747
758 sctp_write_lock(&head->lock); 748 sctp_write_lock(&head->lock);
759 epp = &head->chain; 749 hlist_add_head(&epb->node, &head->chain);
760 epb->next = *epp;
761 if (epb->next)
762 (*epp)->pprev = &epb->next;
763 *epp = epb;
764 epb->pprev = epp;
765 sctp_write_unlock(&head->lock); 750 sctp_write_unlock(&head->lock);
766} 751}
767 752
@@ -790,14 +775,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc)
790 head = &sctp_assoc_hashtable[epb->hashent]; 775 head = &sctp_assoc_hashtable[epb->hashent];
791 776
792 sctp_write_lock(&head->lock); 777 sctp_write_lock(&head->lock);
793 778 __hlist_del(&epb->node);
794 if (epb->pprev) {
795 if (epb->next)
796 epb->next->pprev = epb->pprev;
797 *epb->pprev = epb->next;
798 epb->pprev = NULL;
799 }
800
801 sctp_write_unlock(&head->lock); 779 sctp_write_unlock(&head->lock);
802} 780}
803 781
@@ -822,6 +800,7 @@ static struct sctp_association *__sctp_lookup_association(
822 struct sctp_ep_common *epb; 800 struct sctp_ep_common *epb;
823 struct sctp_association *asoc; 801 struct sctp_association *asoc;
824 struct sctp_transport *transport; 802 struct sctp_transport *transport;
803 struct hlist_node *node;
825 int hash; 804 int hash;
826 805
827 /* Optimize here for direct hit, only listening connections can 806 /* Optimize here for direct hit, only listening connections can
@@ -830,7 +809,7 @@ static struct sctp_association *__sctp_lookup_association(
830 hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); 809 hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port));
831 head = &sctp_assoc_hashtable[hash]; 810 head = &sctp_assoc_hashtable[hash];
832 read_lock(&head->lock); 811 read_lock(&head->lock);
833 for (epb = head->chain; epb; epb = epb->next) { 812 sctp_for_each_hentry(epb, node, &head->chain) {
834 asoc = sctp_assoc(epb); 813 asoc = sctp_assoc(epb);
835 transport = sctp_assoc_is_match(asoc, local, peer); 814 transport = sctp_assoc_is_match(asoc, local, peer);
836 if (transport) 815 if (transport)
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index f10fe7fbf24c..cf4b7eb023b3 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -90,6 +90,10 @@ void sctp_inq_free(struct sctp_inq *queue)
90void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) 90void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
91{ 91{
92 /* Directly call the packet handling routine. */ 92 /* Directly call the packet handling routine. */
93 if (chunk->rcvr->dead) {
94 sctp_chunk_free(chunk);
95 return;
96 }
93 97
94 /* We are now calling this either from the soft interrupt 98 /* We are now calling this either from the soft interrupt
95 * or from the backlog processing. 99 * or from the backlog processing.
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 28f4fe77ceee..fa76f235169b 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -382,7 +382,7 @@ static void sctp_insert_list(struct list_head *head, struct list_head *new)
382/* Mark all the eligible packets on a transport for retransmission. */ 382/* Mark all the eligible packets on a transport for retransmission. */
383void sctp_retransmit_mark(struct sctp_outq *q, 383void sctp_retransmit_mark(struct sctp_outq *q,
384 struct sctp_transport *transport, 384 struct sctp_transport *transport,
385 __u8 fast_retransmit) 385 __u8 reason)
386{ 386{
387 struct list_head *lchunk, *ltemp; 387 struct list_head *lchunk, *ltemp;
388 struct sctp_chunk *chunk; 388 struct sctp_chunk *chunk;
@@ -412,20 +412,20 @@ void sctp_retransmit_mark(struct sctp_outq *q,
412 continue; 412 continue;
413 } 413 }
414 414
415 /* If we are doing retransmission due to a fast retransmit, 415 /* If we are doing retransmission due to a timeout or pmtu
416 * only the chunk's that are marked for fast retransmit 416 * discovery, only the chunks that are not yet acked should
417 * should be added to the retransmit queue. If we are doing 417 * be added to the retransmit queue.
418 * retransmission due to a timeout or pmtu discovery, only the
419 * chunks that are not yet acked should be added to the
420 * retransmit queue.
421 */ 418 */
422 if ((fast_retransmit && (chunk->fast_retransmit > 0)) || 419 if ((reason == SCTP_RTXR_FAST_RTX &&
423 (!fast_retransmit && !chunk->tsn_gap_acked)) { 420 (chunk->fast_retransmit > 0)) ||
421 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
424 /* If this chunk was sent less then 1 rto ago, do not 422 /* If this chunk was sent less then 1 rto ago, do not
425 * retransmit this chunk, but give the peer time 423 * retransmit this chunk, but give the peer time
426 * to acknowlege it. 424 * to acknowlege it. Do this only when
425 * retransmitting due to T3 timeout.
427 */ 426 */
428 if ((jiffies - chunk->sent_at) < transport->rto) 427 if (reason == SCTP_RTXR_T3_RTX &&
428 (jiffies - chunk->sent_at) < transport->last_rto)
429 continue; 429 continue;
430 430
431 /* RFC 2960 6.2.1 Processing a Received SACK 431 /* RFC 2960 6.2.1 Processing a Received SACK
@@ -467,10 +467,10 @@ void sctp_retransmit_mark(struct sctp_outq *q,
467 } 467 }
468 } 468 }
469 469
470 SCTP_DEBUG_PRINTK("%s: transport: %p, fast_retransmit: %d, " 470 SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, "
471 "cwnd: %d, ssthresh: %d, flight_size: %d, " 471 "cwnd: %d, ssthresh: %d, flight_size: %d, "
472 "pba: %d\n", __FUNCTION__, 472 "pba: %d\n", __FUNCTION__,
473 transport, fast_retransmit, 473 transport, reason,
474 transport->cwnd, transport->ssthresh, 474 transport->cwnd, transport->ssthresh,
475 transport->flight_size, 475 transport->flight_size,
476 transport->partial_bytes_acked); 476 transport->partial_bytes_acked);
@@ -484,7 +484,6 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
484 sctp_retransmit_reason_t reason) 484 sctp_retransmit_reason_t reason)
485{ 485{
486 int error = 0; 486 int error = 0;
487 __u8 fast_retransmit = 0;
488 487
489 switch(reason) { 488 switch(reason) {
490 case SCTP_RTXR_T3_RTX: 489 case SCTP_RTXR_T3_RTX:
@@ -499,16 +498,18 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
499 case SCTP_RTXR_FAST_RTX: 498 case SCTP_RTXR_FAST_RTX:
500 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); 499 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS);
501 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); 500 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX);
502 fast_retransmit = 1;
503 break; 501 break;
504 case SCTP_RTXR_PMTUD: 502 case SCTP_RTXR_PMTUD:
505 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); 503 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS);
506 break; 504 break;
505 case SCTP_RTXR_T1_RTX:
506 SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS);
507 break;
507 default: 508 default:
508 BUG(); 509 BUG();
509 } 510 }
510 511
511 sctp_retransmit_mark(q, transport, fast_retransmit); 512 sctp_retransmit_mark(q, transport, reason);
512 513
513 /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination, 514 /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination,
514 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by 515 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by
@@ -641,7 +642,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
641 642
642 /* If we are here due to a retransmit timeout or a fast 643 /* If we are here due to a retransmit timeout or a fast
643 * retransmit and if there are any chunks left in the retransmit 644 * retransmit and if there are any chunks left in the retransmit
644 * queue that could not fit in the PMTU sized packet, they need * to be marked as ineligible for a subsequent fast retransmit. 645 * queue that could not fit in the PMTU sized packet, they need
646 * to be marked as ineligible for a subsequent fast retransmit.
645 */ 647 */
646 if (rtx_timeout && !lchunk) { 648 if (rtx_timeout && !lchunk) {
647 list_for_each(lchunk1, lqueue) { 649 list_for_each(lchunk1, lqueue) {
@@ -660,10 +662,9 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
660int sctp_outq_uncork(struct sctp_outq *q) 662int sctp_outq_uncork(struct sctp_outq *q)
661{ 663{
662 int error = 0; 664 int error = 0;
663 if (q->cork) { 665 if (q->cork)
664 q->cork = 0; 666 q->cork = 0;
665 error = sctp_outq_flush(q, 0); 667 error = sctp_outq_flush(q, 0);
666 }
667 return error; 668 return error;
668} 669}
669 670
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index e4cd841a22e4..249973204070 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -225,6 +225,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
225 struct sctp_ep_common *epb; 225 struct sctp_ep_common *epb;
226 struct sctp_endpoint *ep; 226 struct sctp_endpoint *ep;
227 struct sock *sk; 227 struct sock *sk;
228 struct hlist_node *node;
228 int hash = *(loff_t *)v; 229 int hash = *(loff_t *)v;
229 230
230 if (hash >= sctp_ep_hashsize) 231 if (hash >= sctp_ep_hashsize)
@@ -233,7 +234,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
233 head = &sctp_ep_hashtable[hash]; 234 head = &sctp_ep_hashtable[hash];
234 sctp_local_bh_disable(); 235 sctp_local_bh_disable();
235 read_lock(&head->lock); 236 read_lock(&head->lock);
236 for (epb = head->chain; epb; epb = epb->next) { 237 sctp_for_each_hentry(epb, node, &head->chain) {
237 ep = sctp_ep(epb); 238 ep = sctp_ep(epb);
238 sk = epb->sk; 239 sk = epb->sk;
239 seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, 240 seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk,
@@ -328,6 +329,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
328 struct sctp_ep_common *epb; 329 struct sctp_ep_common *epb;
329 struct sctp_association *assoc; 330 struct sctp_association *assoc;
330 struct sock *sk; 331 struct sock *sk;
332 struct hlist_node *node;
331 int hash = *(loff_t *)v; 333 int hash = *(loff_t *)v;
332 334
333 if (hash >= sctp_assoc_hashsize) 335 if (hash >= sctp_assoc_hashsize)
@@ -336,7 +338,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
336 head = &sctp_assoc_hashtable[hash]; 338 head = &sctp_assoc_hashtable[hash];
337 sctp_local_bh_disable(); 339 sctp_local_bh_disable();
338 read_lock(&head->lock); 340 read_lock(&head->lock);
339 for (epb = head->chain; epb; epb = epb->next) { 341 sctp_for_each_hentry(epb, node, &head->chain) {
340 assoc = sctp_assoc(epb); 342 assoc = sctp_assoc(epb);
341 sk = epb->sk; 343 sk = epb->sk;
342 seq_printf(seq, 344 seq_printf(seq,
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 40c1a47d1b8d..d50f610d1b02 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1137,7 +1137,7 @@ SCTP_STATIC __init int sctp_init(void)
1137 } 1137 }
1138 for (i = 0; i < sctp_assoc_hashsize; i++) { 1138 for (i = 0; i < sctp_assoc_hashsize; i++) {
1139 rwlock_init(&sctp_assoc_hashtable[i].lock); 1139 rwlock_init(&sctp_assoc_hashtable[i].lock);
1140 sctp_assoc_hashtable[i].chain = NULL; 1140 INIT_HLIST_HEAD(&sctp_assoc_hashtable[i].chain);
1141 } 1141 }
1142 1142
1143 /* Allocate and initialize the endpoint hash table. */ 1143 /* Allocate and initialize the endpoint hash table. */
@@ -1151,7 +1151,7 @@ SCTP_STATIC __init int sctp_init(void)
1151 } 1151 }
1152 for (i = 0; i < sctp_ep_hashsize; i++) { 1152 for (i = 0; i < sctp_ep_hashsize; i++) {
1153 rwlock_init(&sctp_ep_hashtable[i].lock); 1153 rwlock_init(&sctp_ep_hashtable[i].lock);
1154 sctp_ep_hashtable[i].chain = NULL; 1154 INIT_HLIST_HEAD(&sctp_ep_hashtable[i].chain);
1155 } 1155 }
1156 1156
1157 /* Allocate and initialize the SCTP port hash table. */ 1157 /* Allocate and initialize the SCTP port hash table. */
@@ -1170,7 +1170,7 @@ SCTP_STATIC __init int sctp_init(void)
1170 } 1170 }
1171 for (i = 0; i < sctp_port_hashsize; i++) { 1171 for (i = 0; i < sctp_port_hashsize; i++) {
1172 spin_lock_init(&sctp_port_hashtable[i].lock); 1172 spin_lock_init(&sctp_port_hashtable[i].lock);
1173 sctp_port_hashtable[i].chain = NULL; 1173 INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain);
1174 } 1174 }
1175 1175
1176 printk(KERN_INFO "SCTP: Hash tables configured " 1176 printk(KERN_INFO "SCTP: Hash tables configured "
@@ -1179,6 +1179,7 @@ SCTP_STATIC __init int sctp_init(void)
1179 1179
1180 /* Disable ADDIP by default. */ 1180 /* Disable ADDIP by default. */
1181 sctp_addip_enable = 0; 1181 sctp_addip_enable = 0;
1182 sctp_addip_noauth = 0;
1182 1183
1183 /* Enable PR-SCTP by default. */ 1184 /* Enable PR-SCTP by default. */
1184 sctp_prsctp_enable = 1; 1185 sctp_prsctp_enable = 1;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index c377e4e8f653..5a9783c38de1 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1788,9 +1788,14 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
1788 sizeof(sctp_paramhdr_t); 1788 sizeof(sctp_paramhdr_t);
1789 1789
1790 1790
1791 /* This is a fatal error. Any accumulated non-fatal errors are
1792 * not reported.
1793 */
1794 if (*errp)
1795 sctp_chunk_free(*errp);
1796
1791 /* Create an error chunk and fill it in with our payload. */ 1797 /* Create an error chunk and fill it in with our payload. */
1792 if (!*errp) 1798 *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
1793 *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
1794 1799
1795 if (*errp) { 1800 if (*errp) {
1796 sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION, 1801 sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
@@ -1813,9 +1818,15 @@ static int sctp_process_hn_param(const struct sctp_association *asoc,
1813{ 1818{
1814 __u16 len = ntohs(param.p->length); 1819 __u16 len = ntohs(param.p->length);
1815 1820
1816 /* Make an ERROR chunk. */ 1821 /* Processing of the HOST_NAME parameter will generate an
1817 if (!*errp) 1822 * ABORT. If we've accumulated any non-fatal errors, they
1818 *errp = sctp_make_op_error_space(asoc, chunk, len); 1823 * would be unrecognized parameters and we should not include
1824 * them in the ABORT.
1825 */
1826 if (*errp)
1827 sctp_chunk_free(*errp);
1828
1829 *errp = sctp_make_op_error_space(asoc, chunk, len);
1819 1830
1820 if (*errp) { 1831 if (*errp) {
1821 sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len); 1832 sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len);
@@ -1847,7 +1858,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1847 break; 1858 break;
1848 case SCTP_CID_ASCONF: 1859 case SCTP_CID_ASCONF:
1849 case SCTP_CID_ASCONF_ACK: 1860 case SCTP_CID_ASCONF_ACK:
1850 asoc->peer.addip_capable = 1; 1861 asoc->peer.asconf_capable = 1;
1851 break; 1862 break;
1852 default: 1863 default:
1853 break; 1864 break;
@@ -1862,56 +1873,40 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1862 * taken if the processing endpoint does not recognize the 1873 * taken if the processing endpoint does not recognize the
1863 * Parameter Type. 1874 * Parameter Type.
1864 * 1875 *
1865 * 00 - Stop processing this SCTP chunk and discard it, 1876 * 00 - Stop processing this parameter; do not process any further
1866 * do not process any further chunks within it. 1877 * parameters within this chunk
1867 * 1878 *
1868 * 01 - Stop processing this SCTP chunk and discard it, 1879 * 01 - Stop processing this parameter, do not process any further
1869 * do not process any further chunks within it, and report 1880 * parameters within this chunk, and report the unrecognized
1870 * the unrecognized parameter in an 'Unrecognized 1881 * parameter in an 'Unrecognized Parameter' ERROR chunk.
1871 * Parameter Type' (in either an ERROR or in the INIT ACK).
1872 * 1882 *
1873 * 10 - Skip this parameter and continue processing. 1883 * 10 - Skip this parameter and continue processing.
1874 * 1884 *
1875 * 11 - Skip this parameter and continue processing but 1885 * 11 - Skip this parameter and continue processing but
1876 * report the unrecognized parameter in an 1886 * report the unrecognized parameter in an
1877 * 'Unrecognized Parameter Type' (in either an ERROR or in 1887 * 'Unrecognized Parameter' ERROR chunk.
1878 * the INIT ACK).
1879 * 1888 *
1880 * Return value: 1889 * Return value:
1881 * 0 - discard the chunk 1890 * SCTP_IERROR_NO_ERROR - continue with the chunk
1882 * 1 - continue with the chunk 1891 * SCTP_IERROR_ERROR - stop and report an error.
1892 * SCTP_IERROR_NOMEME - out of memory.
1883 */ 1893 */
1884static int sctp_process_unk_param(const struct sctp_association *asoc, 1894static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
1885 union sctp_params param, 1895 union sctp_params param,
1886 struct sctp_chunk *chunk, 1896 struct sctp_chunk *chunk,
1887 struct sctp_chunk **errp) 1897 struct sctp_chunk **errp)
1888{ 1898{
1889 int retval = 1; 1899 int retval = SCTP_IERROR_NO_ERROR;
1890 1900
1891 switch (param.p->type & SCTP_PARAM_ACTION_MASK) { 1901 switch (param.p->type & SCTP_PARAM_ACTION_MASK) {
1892 case SCTP_PARAM_ACTION_DISCARD: 1902 case SCTP_PARAM_ACTION_DISCARD:
1893 retval = 0; 1903 retval = SCTP_IERROR_ERROR;
1894 break;
1895 case SCTP_PARAM_ACTION_DISCARD_ERR:
1896 retval = 0;
1897 /* Make an ERROR chunk, preparing enough room for
1898 * returning multiple unknown parameters.
1899 */
1900 if (NULL == *errp)
1901 *errp = sctp_make_op_error_space(asoc, chunk,
1902 ntohs(chunk->chunk_hdr->length));
1903
1904 if (*errp) {
1905 sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM,
1906 WORD_ROUND(ntohs(param.p->length)));
1907 sctp_addto_chunk(*errp,
1908 WORD_ROUND(ntohs(param.p->length)),
1909 param.v);
1910 }
1911
1912 break; 1904 break;
1913 case SCTP_PARAM_ACTION_SKIP: 1905 case SCTP_PARAM_ACTION_SKIP:
1914 break; 1906 break;
1907 case SCTP_PARAM_ACTION_DISCARD_ERR:
1908 retval = SCTP_IERROR_ERROR;
1909 /* Fall through */
1915 case SCTP_PARAM_ACTION_SKIP_ERR: 1910 case SCTP_PARAM_ACTION_SKIP_ERR:
1916 /* Make an ERROR chunk, preparing enough room for 1911 /* Make an ERROR chunk, preparing enough room for
1917 * returning multiple unknown parameters. 1912 * returning multiple unknown parameters.
@@ -1932,9 +1927,8 @@ static int sctp_process_unk_param(const struct sctp_association *asoc,
1932 * to the peer and the association won't be 1927 * to the peer and the association won't be
1933 * established. 1928 * established.
1934 */ 1929 */
1935 retval = 0; 1930 retval = SCTP_IERROR_NOMEM;
1936 } 1931 }
1937
1938 break; 1932 break;
1939 default: 1933 default:
1940 break; 1934 break;
@@ -1943,18 +1937,20 @@ static int sctp_process_unk_param(const struct sctp_association *asoc,
1943 return retval; 1937 return retval;
1944} 1938}
1945 1939
1946/* Find unrecognized parameters in the chunk. 1940/* Verify variable length parameters
1947 * Return values: 1941 * Return values:
1948 * 0 - discard the chunk 1942 * SCTP_IERROR_ABORT - trigger an ABORT
1949 * 1 - continue with the chunk 1943 * SCTP_IERROR_NOMEM - out of memory (abort)
1944 * SCTP_IERROR_ERROR - stop processing, trigger an ERROR
1945 * SCTP_IERROR_NO_ERROR - continue with the chunk
1950 */ 1946 */
1951static int sctp_verify_param(const struct sctp_association *asoc, 1947static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
1952 union sctp_params param, 1948 union sctp_params param,
1953 sctp_cid_t cid, 1949 sctp_cid_t cid,
1954 struct sctp_chunk *chunk, 1950 struct sctp_chunk *chunk,
1955 struct sctp_chunk **err_chunk) 1951 struct sctp_chunk **err_chunk)
1956{ 1952{
1957 int retval = 1; 1953 int retval = SCTP_IERROR_NO_ERROR;
1958 1954
1959 /* FIXME - This routine is not looking at each parameter per the 1955 /* FIXME - This routine is not looking at each parameter per the
1960 * chunk type, i.e., unrecognized parameters should be further 1956 * chunk type, i.e., unrecognized parameters should be further
@@ -1976,7 +1972,9 @@ static int sctp_verify_param(const struct sctp_association *asoc,
1976 1972
1977 case SCTP_PARAM_HOST_NAME_ADDRESS: 1973 case SCTP_PARAM_HOST_NAME_ADDRESS:
1978 /* Tell the peer, we won't support this param. */ 1974 /* Tell the peer, we won't support this param. */
1979 return sctp_process_hn_param(asoc, param, chunk, err_chunk); 1975 sctp_process_hn_param(asoc, param, chunk, err_chunk);
1976 retval = SCTP_IERROR_ABORT;
1977 break;
1980 1978
1981 case SCTP_PARAM_FWD_TSN_SUPPORT: 1979 case SCTP_PARAM_FWD_TSN_SUPPORT:
1982 if (sctp_prsctp_enable) 1980 if (sctp_prsctp_enable)
@@ -1993,9 +1991,11 @@ static int sctp_verify_param(const struct sctp_association *asoc,
1993 * cause 'Protocol Violation'. 1991 * cause 'Protocol Violation'.
1994 */ 1992 */
1995 if (SCTP_AUTH_RANDOM_LENGTH != 1993 if (SCTP_AUTH_RANDOM_LENGTH !=
1996 ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) 1994 ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) {
1997 return sctp_process_inv_paramlength(asoc, param.p, 1995 sctp_process_inv_paramlength(asoc, param.p,
1998 chunk, err_chunk); 1996 chunk, err_chunk);
1997 retval = SCTP_IERROR_ABORT;
1998 }
1999 break; 1999 break;
2000 2000
2001 case SCTP_PARAM_CHUNKS: 2001 case SCTP_PARAM_CHUNKS:
@@ -2007,9 +2007,11 @@ static int sctp_verify_param(const struct sctp_association *asoc,
2007 * INIT-ACK chunk if the sender wants to receive authenticated 2007 * INIT-ACK chunk if the sender wants to receive authenticated
2008 * chunks. Its maximum length is 260 bytes. 2008 * chunks. Its maximum length is 260 bytes.
2009 */ 2009 */
2010 if (260 < ntohs(param.p->length)) 2010 if (260 < ntohs(param.p->length)) {
2011 return sctp_process_inv_paramlength(asoc, param.p, 2011 sctp_process_inv_paramlength(asoc, param.p,
2012 chunk, err_chunk); 2012 chunk, err_chunk);
2013 retval = SCTP_IERROR_ABORT;
2014 }
2013 break; 2015 break;
2014 2016
2015 case SCTP_PARAM_HMAC_ALGO: 2017 case SCTP_PARAM_HMAC_ALGO:
@@ -2020,8 +2022,7 @@ fallthrough:
2020 default: 2022 default:
2021 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", 2023 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n",
2022 ntohs(param.p->type), cid); 2024 ntohs(param.p->type), cid);
2023 return sctp_process_unk_param(asoc, param, chunk, err_chunk); 2025 retval = sctp_process_unk_param(asoc, param, chunk, err_chunk);
2024
2025 break; 2026 break;
2026 } 2027 }
2027 return retval; 2028 return retval;
@@ -2036,6 +2037,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
2036{ 2037{
2037 union sctp_params param; 2038 union sctp_params param;
2038 int has_cookie = 0; 2039 int has_cookie = 0;
2040 int result;
2039 2041
2040 /* Verify stream values are non-zero. */ 2042 /* Verify stream values are non-zero. */
2041 if ((0 == peer_init->init_hdr.num_outbound_streams) || 2043 if ((0 == peer_init->init_hdr.num_outbound_streams) ||
@@ -2043,8 +2045,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
2043 (0 == peer_init->init_hdr.init_tag) || 2045 (0 == peer_init->init_hdr.init_tag) ||
2044 (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { 2046 (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) {
2045 2047
2046 sctp_process_inv_mandatory(asoc, chunk, errp); 2048 return sctp_process_inv_mandatory(asoc, chunk, errp);
2047 return 0;
2048 } 2049 }
2049 2050
2050 /* Check for missing mandatory parameters. */ 2051 /* Check for missing mandatory parameters. */
@@ -2062,29 +2063,29 @@ int sctp_verify_init(const struct sctp_association *asoc,
2062 * VIOLATION error. We build the ERROR chunk here and let the normal 2063 * VIOLATION error. We build the ERROR chunk here and let the normal
2063 * error handling code build and send the packet. 2064 * error handling code build and send the packet.
2064 */ 2065 */
2065 if (param.v != (void*)chunk->chunk_end) { 2066 if (param.v != (void*)chunk->chunk_end)
2066 sctp_process_inv_paramlength(asoc, param.p, chunk, errp); 2067 return sctp_process_inv_paramlength(asoc, param.p, chunk, errp);
2067 return 0;
2068 }
2069 2068
2070 /* The only missing mandatory param possible today is 2069 /* The only missing mandatory param possible today is
2071 * the state cookie for an INIT-ACK chunk. 2070 * the state cookie for an INIT-ACK chunk.
2072 */ 2071 */
2073 if ((SCTP_CID_INIT_ACK == cid) && !has_cookie) { 2072 if ((SCTP_CID_INIT_ACK == cid) && !has_cookie)
2074 sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE, 2073 return sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE,
2075 chunk, errp); 2074 chunk, errp);
2076 return 0;
2077 }
2078
2079 /* Find unrecognized parameters. */
2080 2075
2076 /* Verify all the variable length parameters */
2081 sctp_walk_params(param, peer_init, init_hdr.params) { 2077 sctp_walk_params(param, peer_init, init_hdr.params) {
2082 2078
2083 if (!sctp_verify_param(asoc, param, cid, chunk, errp)) { 2079 result = sctp_verify_param(asoc, param, cid, chunk, errp);
2084 if (SCTP_PARAM_HOST_NAME_ADDRESS == param.p->type) 2080 switch (result) {
2081 case SCTP_IERROR_ABORT:
2082 case SCTP_IERROR_NOMEM:
2085 return 0; 2083 return 0;
2086 else 2084 case SCTP_IERROR_ERROR:
2087 return 1; 2085 return 1;
2086 case SCTP_IERROR_NO_ERROR:
2087 default:
2088 break;
2088 } 2089 }
2089 2090
2090 } /* for (loop through all parameters) */ 2091 } /* for (loop through all parameters) */
@@ -2137,11 +2138,14 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
2137 2138
2138 /* If the peer claims support for ADD-IP without support 2139 /* If the peer claims support for ADD-IP without support
2139 * for AUTH, disable support for ADD-IP. 2140 * for AUTH, disable support for ADD-IP.
2141 * Do this only if backward compatible mode is turned off.
2140 */ 2142 */
2141 if (asoc->peer.addip_capable && !asoc->peer.auth_capable) { 2143 if (!sctp_addip_noauth &&
2144 (asoc->peer.asconf_capable && !asoc->peer.auth_capable)) {
2142 asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP | 2145 asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP |
2143 SCTP_PARAM_DEL_IP | 2146 SCTP_PARAM_DEL_IP |
2144 SCTP_PARAM_SET_PRIMARY); 2147 SCTP_PARAM_SET_PRIMARY);
2148 asoc->peer.asconf_capable = 0;
2145 } 2149 }
2146 2150
2147 /* Walk list of transports, removing transports in the UNKNOWN state. */ 2151 /* Walk list of transports, removing transports in the UNKNOWN state. */
@@ -2848,10 +2852,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2848 2852
2849 __be16 err_code; 2853 __be16 err_code;
2850 int length = 0; 2854 int length = 0;
2851 int chunk_len = asconf->skb->len; 2855 int chunk_len;
2852 __u32 serial; 2856 __u32 serial;
2853 int all_param_pass = 1; 2857 int all_param_pass = 1;
2854 2858
2859 chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
2855 hdr = (sctp_addiphdr_t *)asconf->skb->data; 2860 hdr = (sctp_addiphdr_t *)asconf->skb->data;
2856 serial = ntohl(hdr->serial); 2861 serial = ntohl(hdr->serial);
2857 2862
@@ -2952,13 +2957,17 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2952 /* This is always done in BH context with a socket lock 2957 /* This is always done in BH context with a socket lock
2953 * held, so the list can not change. 2958 * held, so the list can not change.
2954 */ 2959 */
2960 local_bh_disable();
2955 list_for_each_entry(saddr, &bp->address_list, list) { 2961 list_for_each_entry(saddr, &bp->address_list, list) {
2956 if (sctp_cmp_addr_exact(&saddr->a, &addr)) 2962 if (sctp_cmp_addr_exact(&saddr->a, &addr))
2957 saddr->use_as_src = 1; 2963 saddr->use_as_src = 1;
2958 } 2964 }
2965 local_bh_enable();
2959 break; 2966 break;
2960 case SCTP_PARAM_DEL_IP: 2967 case SCTP_PARAM_DEL_IP:
2961 retval = sctp_del_bind_addr(bp, &addr, call_rcu_bh); 2968 local_bh_disable();
2969 retval = sctp_del_bind_addr(bp, &addr);
2970 local_bh_enable();
2962 list_for_each(pos, &asoc->peer.transport_addr_list) { 2971 list_for_each(pos, &asoc->peer.transport_addr_list) {
2963 transport = list_entry(pos, struct sctp_transport, 2972 transport = list_entry(pos, struct sctp_transport,
2964 transports); 2973 transports);
@@ -2990,7 +2999,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
2990 sctp_addip_param_t *asconf_ack_param; 2999 sctp_addip_param_t *asconf_ack_param;
2991 sctp_errhdr_t *err_param; 3000 sctp_errhdr_t *err_param;
2992 int length; 3001 int length;
2993 int asconf_ack_len = asconf_ack->skb->len; 3002 int asconf_ack_len;
2994 __be16 err_code; 3003 __be16 err_code;
2995 3004
2996 if (no_err) 3005 if (no_err)
@@ -2998,6 +3007,9 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
2998 else 3007 else
2999 err_code = SCTP_ERROR_REQ_REFUSED; 3008 err_code = SCTP_ERROR_REQ_REFUSED;
3000 3009
3010 asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) -
3011 sizeof(sctp_chunkhdr_t);
3012
3001 /* Skip the addiphdr from the asconf_ack chunk and store a pointer to 3013 /* Skip the addiphdr from the asconf_ack chunk and store a pointer to
3002 * the first asconf_ack parameter. 3014 * the first asconf_ack parameter.
3003 */ 3015 */
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index bbdc938da86f..78d1a8a49bd0 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -453,6 +453,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
453 * maximum value discussed in rule C7 above (RTO.max) may be 453 * maximum value discussed in rule C7 above (RTO.max) may be
454 * used to provide an upper bound to this doubling operation. 454 * used to provide an upper bound to this doubling operation.
455 */ 455 */
456 transport->last_rto = transport->rto;
456 transport->rto = min((transport->rto * 2), transport->asoc->rto_max); 457 transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
457} 458}
458 459
@@ -1267,6 +1268,12 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1267 sctp_ootb_pkt_free(packet); 1268 sctp_ootb_pkt_free(packet);
1268 break; 1269 break;
1269 1270
1271 case SCTP_CMD_T1_RETRAN:
1272 /* Mark a transport for retransmission. */
1273 sctp_retransmit(&asoc->outqueue, cmd->obj.transport,
1274 SCTP_RTXR_T1_RTX);
1275 break;
1276
1270 case SCTP_CMD_RETRAN: 1277 case SCTP_CMD_RETRAN:
1271 /* Mark a transport for retransmission. */ 1278 /* Mark a transport for retransmission. */
1272 sctp_retransmit(&asoc->outqueue, cmd->obj.transport, 1279 sctp_retransmit(&asoc->outqueue, cmd->obj.transport,
@@ -1393,7 +1400,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1393 list_for_each(pos, &asoc->peer.transport_addr_list) { 1400 list_for_each(pos, &asoc->peer.transport_addr_list) {
1394 t = list_entry(pos, struct sctp_transport, 1401 t = list_entry(pos, struct sctp_transport,
1395 transports); 1402 transports);
1396 sctp_retransmit_mark(&asoc->outqueue, t, 0); 1403 sctp_retransmit_mark(&asoc->outqueue, t,
1404 SCTP_RTXR_T1_RTX);
1397 } 1405 }
1398 1406
1399 sctp_add_cmd_sf(commands, 1407 sctp_add_cmd_sf(commands,
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f01b408508ff..5ebbe808d801 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2305,7 +2305,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep,
2305 /* If we've sent any data bundled with COOKIE-ECHO we will need to 2305 /* If we've sent any data bundled with COOKIE-ECHO we will need to
2306 * resend 2306 * resend
2307 */ 2307 */
2308 sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, 2308 sctp_add_cmd_sf(commands, SCTP_CMD_T1_RETRAN,
2309 SCTP_TRANSPORT(asoc->peer.primary_path)); 2309 SCTP_TRANSPORT(asoc->peer.primary_path));
2310 2310
2311 /* Cast away the const modifier, as we want to just 2311 /* Cast away the const modifier, as we want to just
@@ -4064,11 +4064,6 @@ static sctp_disposition_t sctp_sf_abort_violation(
4064 struct sctp_chunk *chunk = arg; 4064 struct sctp_chunk *chunk = arg;
4065 struct sctp_chunk *abort = NULL; 4065 struct sctp_chunk *abort = NULL;
4066 4066
4067 /* Make the abort chunk. */
4068 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
4069 if (!abort)
4070 goto nomem;
4071
4072 /* SCTP-AUTH, Section 6.3: 4067 /* SCTP-AUTH, Section 6.3:
4073 * It should be noted that if the receiver wants to tear 4068 * It should be noted that if the receiver wants to tear
4074 * down an association in an authenticated way only, the 4069 * down an association in an authenticated way only, the
@@ -4083,6 +4078,11 @@ static sctp_disposition_t sctp_sf_abort_violation(
4083 if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) 4078 if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
4084 goto discard; 4079 goto discard;
4085 4080
4081 /* Make the abort chunk. */
4082 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
4083 if (!abort)
4084 goto nomem;
4085
4086 if (asoc) { 4086 if (asoc) {
4087 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4087 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4088 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); 4088 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a7ecf3159e53..ff8bc95670ed 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -660,7 +660,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
660 * socket routing and failover schemes. Refer to comments in 660 * socket routing and failover schemes. Refer to comments in
661 * sctp_do_bind(). -daisy 661 * sctp_do_bind(). -daisy
662 */ 662 */
663 retval = sctp_del_bind_addr(bp, sa_addr, call_rcu); 663 retval = sctp_del_bind_addr(bp, sa_addr);
664 664
665 addr_buf += af->sockaddr_len; 665 addr_buf += af->sockaddr_len;
666err_bindx_rem: 666err_bindx_rem:
@@ -5307,6 +5307,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5307{ 5307{
5308 struct sctp_bind_hashbucket *head; /* hash list */ 5308 struct sctp_bind_hashbucket *head; /* hash list */
5309 struct sctp_bind_bucket *pp; /* hash list port iterator */ 5309 struct sctp_bind_bucket *pp; /* hash list port iterator */
5310 struct hlist_node *node;
5310 unsigned short snum; 5311 unsigned short snum;
5311 int ret; 5312 int ret;
5312 5313
@@ -5331,7 +5332,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5331 index = sctp_phashfn(rover); 5332 index = sctp_phashfn(rover);
5332 head = &sctp_port_hashtable[index]; 5333 head = &sctp_port_hashtable[index];
5333 sctp_spin_lock(&head->lock); 5334 sctp_spin_lock(&head->lock);
5334 for (pp = head->chain; pp; pp = pp->next) 5335 sctp_for_each_hentry(pp, node, &head->chain)
5335 if (pp->port == rover) 5336 if (pp->port == rover)
5336 goto next; 5337 goto next;
5337 break; 5338 break;
@@ -5358,7 +5359,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5358 */ 5359 */
5359 head = &sctp_port_hashtable[sctp_phashfn(snum)]; 5360 head = &sctp_port_hashtable[sctp_phashfn(snum)];
5360 sctp_spin_lock(&head->lock); 5361 sctp_spin_lock(&head->lock);
5361 for (pp = head->chain; pp; pp = pp->next) { 5362 sctp_for_each_hentry(pp, node, &head->chain) {
5362 if (pp->port == snum) 5363 if (pp->port == snum)
5363 goto pp_found; 5364 goto pp_found;
5364 } 5365 }
@@ -5702,10 +5703,7 @@ static struct sctp_bind_bucket *sctp_bucket_create(
5702 pp->port = snum; 5703 pp->port = snum;
5703 pp->fastreuse = 0; 5704 pp->fastreuse = 0;
5704 INIT_HLIST_HEAD(&pp->owner); 5705 INIT_HLIST_HEAD(&pp->owner);
5705 if ((pp->next = head->chain) != NULL) 5706 hlist_add_head(&pp->node, &head->chain);
5706 pp->next->pprev = &pp->next;
5707 head->chain = pp;
5708 pp->pprev = &head->chain;
5709 } 5707 }
5710 return pp; 5708 return pp;
5711} 5709}
@@ -5714,9 +5712,7 @@ static struct sctp_bind_bucket *sctp_bucket_create(
5714static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) 5712static void sctp_bucket_destroy(struct sctp_bind_bucket *pp)
5715{ 5713{
5716 if (pp && hlist_empty(&pp->owner)) { 5714 if (pp && hlist_empty(&pp->owner)) {
5717 if (pp->next) 5715 __hlist_del(&pp->node);
5718 pp->next->pprev = pp->pprev;
5719 *(pp->pprev) = pp->next;
5720 kmem_cache_free(sctp_bucket_cachep, pp); 5716 kmem_cache_free(sctp_bucket_cachep, pp);
5721 SCTP_DBG_OBJCNT_DEC(bind_bucket); 5717 SCTP_DBG_OBJCNT_DEC(bind_bucket);
5722 } 5718 }
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 0669778e4335..da4f15734fb1 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -263,6 +263,15 @@ static ctl_table sctp_table[] = {
263 .proc_handler = &proc_dointvec, 263 .proc_handler = &proc_dointvec,
264 .strategy = &sysctl_intvec 264 .strategy = &sysctl_intvec
265 }, 265 },
266 {
267 .ctl_name = CTL_UNNUMBERED,
268 .procname = "addip_noauth_enable",
269 .data = &sctp_addip_noauth,
270 .maxlen = sizeof(int),
271 .mode = 0644,
272 .proc_handler = &proc_dointvec,
273 .strategy = &sysctl_intvec
274 },
266 { .ctl_name = 0 } 275 { .ctl_name = 0 }
267}; 276};
268 277
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 5f467c914f80..d55ce83a020b 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -74,8 +74,8 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
74 * given destination transport address, set RTO to the protocol 74 * given destination transport address, set RTO to the protocol
75 * parameter 'RTO.Initial'. 75 * parameter 'RTO.Initial'.
76 */ 76 */
77 peer->last_rto = peer->rto = msecs_to_jiffies(sctp_rto_initial);
77 peer->rtt = 0; 78 peer->rtt = 0;
78 peer->rto = msecs_to_jiffies(sctp_rto_initial);
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
81 peer->rto_pending = 0; 81 peer->rto_pending = 0;
@@ -385,6 +385,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
385 tp->rto = tp->asoc->rto_max; 385 tp->rto = tp->asoc->rto_max;
386 386
387 tp->rtt = rtt; 387 tp->rtt = rtt;
388 tp->last_rto = tp->rto;
388 389
389 /* Reset rto_pending so that a new RTT measurement is started when a 390 /* Reset rto_pending so that a new RTT measurement is started when a
390 * new data chunk is sent. 391 * new data chunk is sent.
@@ -578,7 +579,7 @@ void sctp_transport_reset(struct sctp_transport *t)
578 */ 579 */
579 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); 580 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
580 t->ssthresh = asoc->peer.i.a_rwnd; 581 t->ssthresh = asoc->peer.i.a_rwnd;
581 t->rto = asoc->rto_initial; 582 t->last_rto = t->rto = asoc->rto_initial;
582 t->rtt = 0; 583 t->rtt = 0;
583 t->srtt = 0; 584 t->srtt = 0;
584 t->rttvar = 0; 585 t->rttvar = 0;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 4be92d0a2cab..4908041ffb31 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -862,7 +862,7 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
862 continue; 862 continue;
863 863
864 /* see if this ssn has been marked by skipping */ 864 /* see if this ssn has been marked by skipping */
865 if (!SSN_lt(cssn, sctp_ssn_peek(in, csid))) 865 if (!SSN_lte(cssn, sctp_ssn_peek(in, csid)))
866 break; 866 break;
867 867
868 __skb_unlink(pos, &ulpq->lobby); 868 __skb_unlink(pos, &ulpq->lobby);
diff --git a/net/socket.c b/net/socket.c
index 5d879fd3d01d..74784dfe8e5b 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2319,6 +2319,11 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg)
2319 return err; 2319 return err;
2320} 2320}
2321 2321
2322int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
2323{
2324 return sock->ops->shutdown(sock, how);
2325}
2326
2322/* ABI emulation layers need these two */ 2327/* ABI emulation layers need these two */
2323EXPORT_SYMBOL(move_addr_to_kernel); 2328EXPORT_SYMBOL(move_addr_to_kernel);
2324EXPORT_SYMBOL(move_addr_to_user); 2329EXPORT_SYMBOL(move_addr_to_user);
@@ -2345,3 +2350,4 @@ EXPORT_SYMBOL(kernel_getsockopt);
2345EXPORT_SYMBOL(kernel_setsockopt); 2350EXPORT_SYMBOL(kernel_setsockopt);
2346EXPORT_SYMBOL(kernel_sendpage); 2351EXPORT_SYMBOL(kernel_sendpage);
2347EXPORT_SYMBOL(kernel_sock_ioctl); 2352EXPORT_SYMBOL(kernel_sock_ioctl);
2353EXPORT_SYMBOL(kernel_sock_shutdown);