aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS17
-rw-r--r--arch/arm/configs/ep80219_defconfig1
-rw-r--r--arch/arm/configs/iq31244_defconfig1
-rw-r--r--arch/arm/configs/iq80321_defconfig1
-rw-r--r--arch/arm/configs/iq80331_defconfig1
-rw-r--r--arch/arm/configs/iq80332_defconfig1
-rw-r--r--arch/i386/defconfig2
-rw-r--r--arch/ia64/configs/gensparse_defconfig1
-rw-r--r--arch/ia64/configs/tiger_defconfig1
-rw-r--r--arch/ia64/configs/zx1_defconfig1
-rw-r--r--arch/ia64/defconfig1
-rw-r--r--arch/parisc/configs/a500_defconfig1
-rw-r--r--arch/parisc/configs/c3000_defconfig1
-rw-r--r--arch/powerpc/configs/cell_defconfig1
-rw-r--r--arch/powerpc/configs/g5_defconfig1
-rw-r--r--arch/powerpc/configs/iseries_defconfig1
-rw-r--r--arch/powerpc/configs/maple_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/ppc/configs/bamboo_defconfig1
-rw-r--r--arch/ppc/configs/katana_defconfig1
-rw-r--r--arch/ppc/configs/mpc834x_sys_defconfig1
-rw-r--r--arch/ppc/configs/power3_defconfig1
-rw-r--r--arch/sparc64/defconfig25
-rw-r--r--arch/sparc64/kernel/process.c4
-rw-r--r--arch/sparc64/kernel/setup.c2
-rw-r--r--arch/sparc64/prom/console.c8
-rw-r--r--arch/x86_64/defconfig1
-rw-r--r--drivers/net/Kconfig9
-rw-r--r--drivers/net/cassini.c36
-rw-r--r--drivers/net/e1000/e1000_ethtool.c307
-rw-r--r--drivers/net/e1000/e1000_hw.c18
-rw-r--r--drivers/net/e1000/e1000_hw.h20
-rw-r--r--drivers/net/e1000/e1000_main.c802
-rw-r--r--drivers/net/e1000/e1000_osdep.h2
-rw-r--r--drivers/net/e1000/e1000_param.c44
-rw-r--r--drivers/serial/suncore.c34
-rw-r--r--drivers/serial/sunsab.c7
-rw-r--r--include/asm-sparc64/oplib.h2
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/tipc_config.h7
-rw-r--r--net/Kconfig2
-rw-r--r--net/core/pktgen.c5
-rw-r--r--net/ipv4/igmp.c152
-rw-r--r--net/ipv4/route.c3
-rw-r--r--net/tipc/Kconfig7
-rw-r--r--net/tipc/addr.c10
-rw-r--r--net/tipc/addr.h4
-rw-r--r--net/tipc/bcast.c166
-rw-r--r--net/tipc/bcast.h44
-rw-r--r--net/tipc/bearer.c189
-rw-r--r--net/tipc/bearer.h40
-rw-r--r--net/tipc/cluster.c154
-rw-r--r--net/tipc/cluster.h40
-rw-r--r--net/tipc/config.c218
-rw-r--r--net/tipc/config.h41
-rw-r--r--net/tipc/core.c87
-rw-r--r--net/tipc/core.h35
-rw-r--r--net/tipc/dbg.c112
-rw-r--r--net/tipc/dbg.h18
-rw-r--r--net/tipc/discover.c52
-rw-r--r--net/tipc/discover.h18
-rw-r--r--net/tipc/eth_media.c20
-rw-r--r--net/tipc/handler.c6
-rw-r--r--net/tipc/link.c605
-rw-r--r--net/tipc/link.h73
-rw-r--r--net/tipc/msg.c19
-rw-r--r--net/tipc/msg.h18
-rw-r--r--net/tipc/name_distr.c92
-rw-r--r--net/tipc/name_distr.h10
-rw-r--r--net/tipc/name_table.c206
-rw-r--r--net/tipc/name_table.h26
-rw-r--r--net/tipc/net.c126
-rw-r--r--net/tipc/net.h20
-rw-r--r--net/tipc/netlink.c16
-rw-r--r--net/tipc/node.c215
-rw-r--r--net/tipc/node.h50
-rw-r--r--net/tipc/node_subscr.c20
-rw-r--r--net/tipc/node_subscr.h6
-rw-r--r--net/tipc/port.c274
-rw-r--r--net/tipc/port.h60
-rw-r--r--net/tipc/ref.c72
-rw-r--r--net/tipc/ref.h38
-rw-r--r--net/tipc/socket.c12
-rw-r--r--net/tipc/subscr.c58
-rw-r--r--net/tipc/subscr.h24
-rw-r--r--net/tipc/user_reg.c22
-rw-r--r--net/tipc/user_reg.h8
-rw-r--r--net/tipc/zone.c40
-rw-r--r--net/tipc/zone.h20
90 files changed, 2649 insertions, 2273 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index ff16eac8cf5b..e6dbb21a8e5b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1398,7 +1398,7 @@ IRDA SUBSYSTEM
1398P: Jean Tourrilhes 1398P: Jean Tourrilhes
1399L: irda-users@lists.sourceforge.net (subscribers-only) 1399L: irda-users@lists.sourceforge.net (subscribers-only)
1400W: http://irda.sourceforge.net/ 1400W: http://irda.sourceforge.net/
1401S: Maintained 1401S: Odd Fixes
1402 1402
1403ISAPNP 1403ISAPNP
1404P: Jaroslav Kysela 1404P: Jaroslav Kysela
@@ -1843,7 +1843,14 @@ M: yoshfuji@linux-ipv6.org
1843P: Patrick McHardy 1843P: Patrick McHardy
1844M: kaber@coreworks.de 1844M: kaber@coreworks.de
1845L: netdev@vger.kernel.org 1845L: netdev@vger.kernel.org
1846T: git kernel.org:/pub/scm/linux/kernel/davem/net-2.6.git 1846T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git
1847S: Maintained
1848
1849NETWORKING [WIRELESS]
1850P: John W. Linville
1851M: linville@tuxdriver.com
1852L: netdev@vger.kernel.org
1853T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
1847S: Maintained 1854S: Maintained
1848 1855
1849IPVS 1856IPVS
@@ -2536,11 +2543,11 @@ S: Maintained
2536 2543
2537TIPC NETWORK LAYER 2544TIPC NETWORK LAYER
2538P: Per Liden 2545P: Per Liden
2539M: per.liden@nospam.ericsson.com 2546M: per.liden@ericsson.com
2540P: Jon Maloy 2547P: Jon Maloy
2541M: jon.maloy@nospam.ericsson.com 2548M: jon.maloy@ericsson.com
2542P: Allan Stephens 2549P: Allan Stephens
2543M: allan.stephens@nospam.windriver.com 2550M: allan.stephens@windriver.com
2544L: tipc-discussion@lists.sourceforge.net 2551L: tipc-discussion@lists.sourceforge.net
2545W: http://tipc.sourceforge.net/ 2552W: http://tipc.sourceforge.net/
2546W: http://tipc.cslab.ericsson.net/ 2553W: http://tipc.cslab.ericsson.net/
diff --git a/arch/arm/configs/ep80219_defconfig b/arch/arm/configs/ep80219_defconfig
index fbe312e757cb..3c73b707c2f3 100644
--- a/arch/arm/configs/ep80219_defconfig
+++ b/arch/arm/configs/ep80219_defconfig
@@ -522,6 +522,7 @@ CONFIG_E100=y
522# CONFIG_DL2K is not set 522# CONFIG_DL2K is not set
523CONFIG_E1000=y 523CONFIG_E1000=y
524CONFIG_E1000_NAPI=y 524CONFIG_E1000_NAPI=y
525# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
525# CONFIG_NS83820 is not set 526# CONFIG_NS83820 is not set
526# CONFIG_HAMACHI is not set 527# CONFIG_HAMACHI is not set
527# CONFIG_YELLOWFIN is not set 528# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq31244_defconfig b/arch/arm/configs/iq31244_defconfig
index c07628ceaf0c..32467160a6df 100644
--- a/arch/arm/configs/iq31244_defconfig
+++ b/arch/arm/configs/iq31244_defconfig
@@ -493,6 +493,7 @@ CONFIG_NETDEVICES=y
493# CONFIG_DL2K is not set 493# CONFIG_DL2K is not set
494CONFIG_E1000=y 494CONFIG_E1000=y
495CONFIG_E1000_NAPI=y 495CONFIG_E1000_NAPI=y
496# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
496# CONFIG_NS83820 is not set 497# CONFIG_NS83820 is not set
497# CONFIG_HAMACHI is not set 498# CONFIG_HAMACHI is not set
498# CONFIG_YELLOWFIN is not set 499# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80321_defconfig b/arch/arm/configs/iq80321_defconfig
index 18fa1615fdfd..b000da753c41 100644
--- a/arch/arm/configs/iq80321_defconfig
+++ b/arch/arm/configs/iq80321_defconfig
@@ -415,6 +415,7 @@ CONFIG_NETDEVICES=y
415# CONFIG_DL2K is not set 415# CONFIG_DL2K is not set
416CONFIG_E1000=y 416CONFIG_E1000=y
417CONFIG_E1000_NAPI=y 417CONFIG_E1000_NAPI=y
418# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
418# CONFIG_NS83820 is not set 419# CONFIG_NS83820 is not set
419# CONFIG_HAMACHI is not set 420# CONFIG_HAMACHI is not set
420# CONFIG_YELLOWFIN is not set 421# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80331_defconfig b/arch/arm/configs/iq80331_defconfig
index f50035de1fff..46c79e1efe07 100644
--- a/arch/arm/configs/iq80331_defconfig
+++ b/arch/arm/configs/iq80331_defconfig
@@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y
496# CONFIG_DL2K is not set 496# CONFIG_DL2K is not set
497CONFIG_E1000=y 497CONFIG_E1000=y
498CONFIG_E1000_NAPI=y 498CONFIG_E1000_NAPI=y
499# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
499# CONFIG_NS83820 is not set 500# CONFIG_NS83820 is not set
500# CONFIG_HAMACHI is not set 501# CONFIG_HAMACHI is not set
501# CONFIG_YELLOWFIN is not set 502# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80332_defconfig b/arch/arm/configs/iq80332_defconfig
index 18b3f372ed68..11959b705d82 100644
--- a/arch/arm/configs/iq80332_defconfig
+++ b/arch/arm/configs/iq80332_defconfig
@@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y
496# CONFIG_DL2K is not set 496# CONFIG_DL2K is not set
497CONFIG_E1000=y 497CONFIG_E1000=y
498CONFIG_E1000_NAPI=y 498CONFIG_E1000_NAPI=y
499# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
499# CONFIG_NS83820 is not set 500# CONFIG_NS83820 is not set
500# CONFIG_HAMACHI is not set 501# CONFIG_HAMACHI is not set
501# CONFIG_YELLOWFIN is not set 502# CONFIG_YELLOWFIN is not set
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 6a431b926019..3cbe6e9cb9fc 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -644,6 +644,8 @@ CONFIG_8139TOO_PIO=y
644# CONFIG_ACENIC is not set 644# CONFIG_ACENIC is not set
645# CONFIG_DL2K is not set 645# CONFIG_DL2K is not set
646# CONFIG_E1000 is not set 646# CONFIG_E1000 is not set
647# CONFIG_E1000_NAPI is not set
648# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
647# CONFIG_NS83820 is not set 649# CONFIG_NS83820 is not set
648# CONFIG_HAMACHI is not set 650# CONFIG_HAMACHI is not set
649# CONFIG_YELLOWFIN is not set 651# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index 1d07d8072ec2..991c07b57c24 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -557,6 +557,7 @@ CONFIG_E100=m
557# CONFIG_DL2K is not set 557# CONFIG_DL2K is not set
558CONFIG_E1000=y 558CONFIG_E1000=y
559# CONFIG_E1000_NAPI is not set 559# CONFIG_E1000_NAPI is not set
560# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
560# CONFIG_NS83820 is not set 561# CONFIG_NS83820 is not set
561# CONFIG_HAMACHI is not set 562# CONFIG_HAMACHI is not set
562# CONFIG_YELLOWFIN is not set 563# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index b1e8f09e9fd5..6859119bc9dd 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -565,6 +565,7 @@ CONFIG_E100=m
565# CONFIG_DL2K is not set 565# CONFIG_DL2K is not set
566CONFIG_E1000=y 566CONFIG_E1000=y
567# CONFIG_E1000_NAPI is not set 567# CONFIG_E1000_NAPI is not set
568# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
568# CONFIG_NS83820 is not set 569# CONFIG_NS83820 is not set
569# CONFIG_HAMACHI is not set 570# CONFIG_HAMACHI is not set
570# CONFIG_YELLOWFIN is not set 571# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 0856ca67dd50..53899dc8eb53 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -548,6 +548,7 @@ CONFIG_E100=y
548# CONFIG_DL2K is not set 548# CONFIG_DL2K is not set
549CONFIG_E1000=y 549CONFIG_E1000=y
550# CONFIG_E1000_NAPI is not set 550# CONFIG_E1000_NAPI is not set
551# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
551# CONFIG_NS83820 is not set 552# CONFIG_NS83820 is not set
552# CONFIG_HAMACHI is not set 553# CONFIG_HAMACHI is not set
553# CONFIG_YELLOWFIN is not set 554# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 275a26c6e5aa..dcbc78a4cfa4 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -565,6 +565,7 @@ CONFIG_E100=m
565# CONFIG_DL2K is not set 565# CONFIG_DL2K is not set
566CONFIG_E1000=y 566CONFIG_E1000=y
567# CONFIG_E1000_NAPI is not set 567# CONFIG_E1000_NAPI is not set
568# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
568# CONFIG_NS83820 is not set 569# CONFIG_NS83820 is not set
569# CONFIG_HAMACHI is not set 570# CONFIG_HAMACHI is not set
570# CONFIG_YELLOWFIN is not set 571# CONFIG_YELLOWFIN is not set
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index 955ef5084f3e..959ad3c4e372 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -602,6 +602,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
602# CONFIG_DL2K is not set 602# CONFIG_DL2K is not set
603CONFIG_E1000=m 603CONFIG_E1000=m
604CONFIG_E1000_NAPI=y 604CONFIG_E1000_NAPI=y
605# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
605# CONFIG_NS83820 is not set 606# CONFIG_NS83820 is not set
606# CONFIG_HAMACHI is not set 607# CONFIG_HAMACHI is not set
607# CONFIG_YELLOWFIN is not set 608# CONFIG_YELLOWFIN is not set
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 9d86b6b1ebd1..0b1c8c1fa8a3 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -626,6 +626,7 @@ CONFIG_ACENIC=m
626# CONFIG_DL2K is not set 626# CONFIG_DL2K is not set
627CONFIG_E1000=m 627CONFIG_E1000=m
628# CONFIG_E1000_NAPI is not set 628# CONFIG_E1000_NAPI is not set
629# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
629# CONFIG_NS83820 is not set 630# CONFIG_NS83820 is not set
630# CONFIG_HAMACHI is not set 631# CONFIG_HAMACHI is not set
631# CONFIG_YELLOWFIN is not set 632# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index b657f7e44762..063b84f2cbea 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -533,6 +533,7 @@ CONFIG_MII=y
533# CONFIG_DL2K is not set 533# CONFIG_DL2K is not set
534CONFIG_E1000=m 534CONFIG_E1000=m
535# CONFIG_E1000_NAPI is not set 535# CONFIG_E1000_NAPI is not set
536# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
536# CONFIG_NS83820 is not set 537# CONFIG_NS83820 is not set
537# CONFIG_HAMACHI is not set 538# CONFIG_HAMACHI is not set
538# CONFIG_YELLOWFIN is not set 539# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 3c22ccb18519..d6fed3f56580 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -675,6 +675,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
675# CONFIG_DL2K is not set 675# CONFIG_DL2K is not set
676CONFIG_E1000=y 676CONFIG_E1000=y
677# CONFIG_E1000_NAPI is not set 677# CONFIG_E1000_NAPI is not set
678# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
678# CONFIG_NS83820 is not set 679# CONFIG_NS83820 is not set
679# CONFIG_HAMACHI is not set 680# CONFIG_HAMACHI is not set
680# CONFIG_YELLOWFIN is not set 681# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
index 751a622fb7a7..c775027947f9 100644
--- a/arch/powerpc/configs/iseries_defconfig
+++ b/arch/powerpc/configs/iseries_defconfig
@@ -567,6 +567,7 @@ CONFIG_ACENIC=m
567# CONFIG_DL2K is not set 567# CONFIG_DL2K is not set
568CONFIG_E1000=m 568CONFIG_E1000=m
569# CONFIG_E1000_NAPI is not set 569# CONFIG_E1000_NAPI is not set
570# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
570# CONFIG_NS83820 is not set 571# CONFIG_NS83820 is not set
571# CONFIG_HAMACHI is not set 572# CONFIG_HAMACHI is not set
572# CONFIG_YELLOWFIN is not set 573# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index 07b6d3d23360..68194c03f6d1 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_defconfig
@@ -454,6 +454,7 @@ CONFIG_AMD8111_ETH=y
454# CONFIG_DL2K is not set 454# CONFIG_DL2K is not set
455CONFIG_E1000=y 455CONFIG_E1000=y
456# CONFIG_E1000_NAPI is not set 456# CONFIG_E1000_NAPI is not set
457# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
457# CONFIG_NS83820 is not set 458# CONFIG_NS83820 is not set
458# CONFIG_HAMACHI is not set 459# CONFIG_HAMACHI is not set
459# CONFIG_YELLOWFIN is not set 460# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 0b2b55a79c3c..6f6c6bed1aa5 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -724,6 +724,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
724# CONFIG_DL2K is not set 724# CONFIG_DL2K is not set
725CONFIG_E1000=y 725CONFIG_E1000=y
726# CONFIG_E1000_NAPI is not set 726# CONFIG_E1000_NAPI is not set
727# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
727# CONFIG_NS83820 is not set 728# CONFIG_NS83820 is not set
728# CONFIG_HAMACHI is not set 729# CONFIG_HAMACHI is not set
729# CONFIG_YELLOWFIN is not set 730# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index a50ce0fa9243..aa9893a1f6e8 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -671,6 +671,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
671# CONFIG_DL2K is not set 671# CONFIG_DL2K is not set
672CONFIG_E1000=y 672CONFIG_E1000=y
673# CONFIG_E1000_NAPI is not set 673# CONFIG_E1000_NAPI is not set
674# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
674# CONFIG_NS83820 is not set 675# CONFIG_NS83820 is not set
675# CONFIG_HAMACHI is not set 676# CONFIG_HAMACHI is not set
676# CONFIG_YELLOWFIN is not set 677# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/bamboo_defconfig b/arch/ppc/configs/bamboo_defconfig
index 0ba4e70d50b6..41fd3938fa5c 100644
--- a/arch/ppc/configs/bamboo_defconfig
+++ b/arch/ppc/configs/bamboo_defconfig
@@ -499,6 +499,7 @@ CONFIG_NATSEMI=y
499# CONFIG_DL2K is not set 499# CONFIG_DL2K is not set
500CONFIG_E1000=y 500CONFIG_E1000=y
501# CONFIG_E1000_NAPI is not set 501# CONFIG_E1000_NAPI is not set
502# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
502# CONFIG_NS83820 is not set 503# CONFIG_NS83820 is not set
503# CONFIG_HAMACHI is not set 504# CONFIG_HAMACHI is not set
504# CONFIG_YELLOWFIN is not set 505# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/katana_defconfig b/arch/ppc/configs/katana_defconfig
index 0f3bb9af9c22..7311fe6b42de 100644
--- a/arch/ppc/configs/katana_defconfig
+++ b/arch/ppc/configs/katana_defconfig
@@ -488,6 +488,7 @@ CONFIG_E100=y
488# CONFIG_DL2K is not set 488# CONFIG_DL2K is not set
489CONFIG_E1000=y 489CONFIG_E1000=y
490# CONFIG_E1000_NAPI is not set 490# CONFIG_E1000_NAPI is not set
491# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
491# CONFIG_NS83820 is not set 492# CONFIG_NS83820 is not set
492# CONFIG_HAMACHI is not set 493# CONFIG_HAMACHI is not set
493# CONFIG_YELLOWFIN is not set 494# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig
index 673dc64ebcb1..b96a6d6dad0e 100644
--- a/arch/ppc/configs/mpc834x_sys_defconfig
+++ b/arch/ppc/configs/mpc834x_sys_defconfig
@@ -402,6 +402,7 @@ CONFIG_E100=y
402# CONFIG_DL2K is not set 402# CONFIG_DL2K is not set
403CONFIG_E1000=y 403CONFIG_E1000=y
404# CONFIG_E1000_NAPI is not set 404# CONFIG_E1000_NAPI is not set
405# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
405# CONFIG_NS83820 is not set 406# CONFIG_NS83820 is not set
406# CONFIG_HAMACHI is not set 407# CONFIG_HAMACHI is not set
407# CONFIG_YELLOWFIN is not set 408# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
index 93da595a4738..a1ef929bca59 100644
--- a/arch/ppc/configs/power3_defconfig
+++ b/arch/ppc/configs/power3_defconfig
@@ -442,6 +442,7 @@ CONFIG_E100=y
442# CONFIG_DL2K is not set 442# CONFIG_DL2K is not set
443CONFIG_E1000=y 443CONFIG_E1000=y
444# CONFIG_E1000_NAPI is not set 444# CONFIG_E1000_NAPI is not set
445# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
445# CONFIG_NS83820 is not set 446# CONFIG_NS83820 is not set
446# CONFIG_HAMACHI is not set 447# CONFIG_HAMACHI is not set
447# CONFIG_YELLOWFIN is not set 448# CONFIG_YELLOWFIN is not set
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index a3fb3376ffa0..9ceddad0fb49 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15 3# Linux kernel version: 2.6.16-rc1
4# Mon Jan 9 14:36:29 2006 4# Wed Jan 18 13:41:02 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -233,6 +233,11 @@ CONFIG_VLAN_8021Q=m
233# CONFIG_ATALK is not set 233# CONFIG_ATALK is not set
234# CONFIG_X25 is not set 234# CONFIG_X25 is not set
235# CONFIG_LAPB is not set 235# CONFIG_LAPB is not set
236
237#
238# TIPC Configuration (EXPERIMENTAL)
239#
240# CONFIG_TIPC is not set
236# CONFIG_NET_DIVERT is not set 241# CONFIG_NET_DIVERT is not set
237# CONFIG_ECONET is not set 242# CONFIG_ECONET is not set
238# CONFIG_WAN_ROUTER is not set 243# CONFIG_WAN_ROUTER is not set
@@ -420,8 +425,7 @@ CONFIG_ISCSI_TCP=m
420# CONFIG_SCSI_QLOGIC_FC is not set 425# CONFIG_SCSI_QLOGIC_FC is not set
421# CONFIG_SCSI_QLOGIC_1280 is not set 426# CONFIG_SCSI_QLOGIC_1280 is not set
422# CONFIG_SCSI_QLOGICPTI is not set 427# CONFIG_SCSI_QLOGICPTI is not set
423CONFIG_SCSI_QLA2XXX=y 428# CONFIG_SCSI_QLA_FC is not set
424# CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set
425# CONFIG_SCSI_LPFC is not set 429# CONFIG_SCSI_LPFC is not set
426# CONFIG_SCSI_DC395x is not set 430# CONFIG_SCSI_DC395x is not set
427# CONFIG_SCSI_DC390T is not set 431# CONFIG_SCSI_DC390T is not set
@@ -529,6 +533,7 @@ CONFIG_NET_PCI=y
529# CONFIG_DL2K is not set 533# CONFIG_DL2K is not set
530CONFIG_E1000=m 534CONFIG_E1000=m
531CONFIG_E1000_NAPI=y 535CONFIG_E1000_NAPI=y
536# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
532# CONFIG_MYRI_SBUS is not set 537# CONFIG_MYRI_SBUS is not set
533# CONFIG_NS83820 is not set 538# CONFIG_NS83820 is not set
534# CONFIG_HAMACHI is not set 539# CONFIG_HAMACHI is not set
@@ -652,7 +657,6 @@ CONFIG_SERIAL_SUNSU_CONSOLE=y
652CONFIG_SERIAL_SUNSAB=m 657CONFIG_SERIAL_SUNSAB=m
653CONFIG_SERIAL_CORE=y 658CONFIG_SERIAL_CORE=y
654CONFIG_SERIAL_CORE_CONSOLE=y 659CONFIG_SERIAL_CORE_CONSOLE=y
655# CONFIG_SERIAL_JSM is not set
656CONFIG_UNIX98_PTYS=y 660CONFIG_UNIX98_PTYS=y
657# CONFIG_LEGACY_PTYS is not set 661# CONFIG_LEGACY_PTYS is not set
658 662
@@ -738,6 +742,12 @@ CONFIG_I2C_ALGOBIT=y
738# CONFIG_I2C_DEBUG_CHIP is not set 742# CONFIG_I2C_DEBUG_CHIP is not set
739 743
740# 744#
745# SPI support
746#
747# CONFIG_SPI is not set
748# CONFIG_SPI_MASTER is not set
749
750#
741# Dallas's 1-wire bus 751# Dallas's 1-wire bus
742# 752#
743# CONFIG_W1 is not set 753# CONFIG_W1 is not set
@@ -1014,6 +1024,7 @@ CONFIG_USB_UHCI_HCD=m
1014# 1024#
1015CONFIG_USB_HID=y 1025CONFIG_USB_HID=y
1016CONFIG_USB_HIDINPUT=y 1026CONFIG_USB_HIDINPUT=y
1027# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1017# CONFIG_HID_FF is not set 1028# CONFIG_HID_FF is not set
1018CONFIG_USB_HIDDEV=y 1029CONFIG_USB_HIDDEV=y
1019# CONFIG_USB_AIPTEK is not set 1030# CONFIG_USB_AIPTEK is not set
@@ -1268,12 +1279,13 @@ CONFIG_KPROBES=y
1268# Kernel hacking 1279# Kernel hacking
1269# 1280#
1270CONFIG_PRINTK_TIME=y 1281CONFIG_PRINTK_TIME=y
1271CONFIG_DEBUG_KERNEL=y
1272CONFIG_MAGIC_SYSRQ=y 1282CONFIG_MAGIC_SYSRQ=y
1283CONFIG_DEBUG_KERNEL=y
1273CONFIG_LOG_BUF_SHIFT=18 1284CONFIG_LOG_BUF_SHIFT=18
1274CONFIG_DETECT_SOFTLOCKUP=y 1285CONFIG_DETECT_SOFTLOCKUP=y
1275CONFIG_SCHEDSTATS=y 1286CONFIG_SCHEDSTATS=y
1276# CONFIG_DEBUG_SLAB is not set 1287# CONFIG_DEBUG_SLAB is not set
1288# CONFIG_DEBUG_MUTEXES is not set
1277# CONFIG_DEBUG_SPINLOCK is not set 1289# CONFIG_DEBUG_SPINLOCK is not set
1278# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1290# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1279# CONFIG_DEBUG_KOBJECT is not set 1291# CONFIG_DEBUG_KOBJECT is not set
@@ -1281,6 +1293,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1281# CONFIG_DEBUG_INFO is not set 1293# CONFIG_DEBUG_INFO is not set
1282CONFIG_DEBUG_FS=y 1294CONFIG_DEBUG_FS=y
1283# CONFIG_DEBUG_VM is not set 1295# CONFIG_DEBUG_VM is not set
1296CONFIG_FORCED_INLINING=y
1284# CONFIG_RCU_TORTURE_TEST is not set 1297# CONFIG_RCU_TORTURE_TEST is not set
1285# CONFIG_DEBUG_STACK_USAGE is not set 1298# CONFIG_DEBUG_STACK_USAGE is not set
1286# CONFIG_DEBUG_DCFLUSH is not set 1299# CONFIG_DEBUG_DCFLUSH is not set
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 1dc3650c5cae..059b0d025224 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -164,6 +164,7 @@ void machine_restart(char * cmd)
164 panic("Reboot failed!"); 164 panic("Reboot failed!");
165} 165}
166 166
167#ifdef CONFIG_COMPAT
167static void show_regwindow32(struct pt_regs *regs) 168static void show_regwindow32(struct pt_regs *regs)
168{ 169{
169 struct reg_window32 __user *rw; 170 struct reg_window32 __user *rw;
@@ -189,6 +190,9 @@ static void show_regwindow32(struct pt_regs *regs)
189 r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3], 190 r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3],
190 r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]); 191 r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]);
191} 192}
193#else
194#define show_regwindow32(regs) do { } while (0)
195#endif
192 196
193static void show_regwindow(struct pt_regs *regs) 197static void show_regwindow(struct pt_regs *regs)
194{ 198{
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 250745896aee..054461e6946d 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -561,6 +561,8 @@ static int __init set_preferred_console(void)
561 serial_console = 1; 561 serial_console = 1;
562 } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { 562 } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
563 serial_console = 2; 563 serial_console = 2;
564 } else if (idev == PROMDEV_IRSC && odev == PROMDEV_ORSC) {
565 serial_console = 3;
564 } else { 566 } else {
565 prom_printf("Inconsistent console: " 567 prom_printf("Inconsistent console: "
566 "input %d, output %d\n", 568 "input %d, output %d\n",
diff --git a/arch/sparc64/prom/console.c b/arch/sparc64/prom/console.c
index eae5db8dda56..ac6d035dd150 100644
--- a/arch/sparc64/prom/console.c
+++ b/arch/sparc64/prom/console.c
@@ -99,8 +99,12 @@ prom_query_input_device(void)
99 if (!strncmp(propb, "keyboard", 8)) 99 if (!strncmp(propb, "keyboard", 8))
100 return PROMDEV_ITTYA; 100 return PROMDEV_ITTYA;
101 101
102 if (!strncmp (propb, "rsc", 3))
103 return PROMDEV_IRSC;
104
102 if (strncmp (propb, "tty", 3) || !propb[3]) 105 if (strncmp (propb, "tty", 3) || !propb[3])
103 return PROMDEV_I_UNK; 106 return PROMDEV_I_UNK;
107
104 switch (propb[3]) { 108 switch (propb[3]) {
105 case 'a': return PROMDEV_ITTYA; 109 case 'a': return PROMDEV_ITTYA;
106 case 'b': return PROMDEV_ITTYB; 110 case 'b': return PROMDEV_ITTYB;
@@ -136,8 +140,12 @@ prom_query_output_device(void)
136 if (!strncmp(propb, "screen", 6)) 140 if (!strncmp(propb, "screen", 6))
137 return PROMDEV_OTTYA; 141 return PROMDEV_OTTYA;
138 142
143 if (!strncmp (propb, "rsc", 3))
144 return PROMDEV_ORSC;
145
139 if (strncmp (propb, "tty", 3) || !propb[3]) 146 if (strncmp (propb, "tty", 3) || !propb[3])
140 return PROMDEV_O_UNK; 147 return PROMDEV_O_UNK;
148
141 switch (propb[3]) { 149 switch (propb[3]) {
142 case 'a': return PROMDEV_OTTYA; 150 case 'a': return PROMDEV_OTTYA;
143 case 'b': return PROMDEV_OTTYB; 151 case 'b': return PROMDEV_OTTYB;
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 5231fe83ea4b..09a3eb743315 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -646,6 +646,7 @@ CONFIG_8139TOO=y
646# CONFIG_DL2K is not set 646# CONFIG_DL2K is not set
647CONFIG_E1000=y 647CONFIG_E1000=y
648# CONFIG_E1000_NAPI is not set 648# CONFIG_E1000_NAPI is not set
649# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
649# CONFIG_NS83820 is not set 650# CONFIG_NS83820 is not set
650# CONFIG_HAMACHI is not set 651# CONFIG_HAMACHI is not set
651# CONFIG_YELLOWFIN is not set 652# CONFIG_YELLOWFIN is not set
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 1421941487c4..0c69918671ca 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1914,6 +1914,15 @@ config E1000_NAPI
1914 1914
1915 If in doubt, say N. 1915 If in doubt, say N.
1916 1916
1917config E1000_DISABLE_PACKET_SPLIT
1918 bool "Disable Packet Split for PCI express adapters"
1919 depends on E1000
1920 help
1921 Say Y here if you want to use the legacy receive path for PCI express
1922 hadware.
1923
1924 If in doubt, say N.
1925
1917source "drivers/net/ixp2000/Kconfig" 1926source "drivers/net/ixp2000/Kconfig"
1918 1927
1919config MYRI_SBUS 1928config MYRI_SBUS
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index dde631f8f685..6e295fce5c6f 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -335,6 +335,30 @@ static inline void cas_mask_intr(struct cas *cp)
335 cas_disable_irq(cp, i); 335 cas_disable_irq(cp, i);
336} 336}
337 337
338static inline void cas_buffer_init(cas_page_t *cp)
339{
340 struct page *page = cp->buffer;
341 atomic_set((atomic_t *)&page->lru.next, 1);
342}
343
344static inline int cas_buffer_count(cas_page_t *cp)
345{
346 struct page *page = cp->buffer;
347 return atomic_read((atomic_t *)&page->lru.next);
348}
349
350static inline void cas_buffer_inc(cas_page_t *cp)
351{
352 struct page *page = cp->buffer;
353 atomic_inc((atomic_t *)&page->lru.next);
354}
355
356static inline void cas_buffer_dec(cas_page_t *cp)
357{
358 struct page *page = cp->buffer;
359 atomic_dec((atomic_t *)&page->lru.next);
360}
361
338static void cas_enable_irq(struct cas *cp, const int ring) 362static void cas_enable_irq(struct cas *cp, const int ring)
339{ 363{
340 if (ring == 0) { /* all but TX_DONE */ 364 if (ring == 0) { /* all but TX_DONE */
@@ -472,6 +496,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page)
472{ 496{
473 pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, 497 pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
474 PCI_DMA_FROMDEVICE); 498 PCI_DMA_FROMDEVICE);
499 cas_buffer_dec(page);
475 __free_pages(page->buffer, cp->page_order); 500 __free_pages(page->buffer, cp->page_order);
476 kfree(page); 501 kfree(page);
477 return 0; 502 return 0;
@@ -501,6 +526,7 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags)
501 page->buffer = alloc_pages(flags, cp->page_order); 526 page->buffer = alloc_pages(flags, cp->page_order);
502 if (!page->buffer) 527 if (!page->buffer)
503 goto page_err; 528 goto page_err;
529 cas_buffer_init(page);
504 page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, 530 page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
505 cp->page_size, PCI_DMA_FROMDEVICE); 531 cp->page_size, PCI_DMA_FROMDEVICE);
506 return page; 532 return page;
@@ -579,7 +605,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
579 list_for_each_safe(elem, tmp, &list) { 605 list_for_each_safe(elem, tmp, &list) {
580 cas_page_t *page = list_entry(elem, cas_page_t, list); 606 cas_page_t *page = list_entry(elem, cas_page_t, list);
581 607
582 if (page_count(page->buffer) > 1) 608 if (cas_buffer_count(page) > 1)
583 continue; 609 continue;
584 610
585 list_del(elem); 611 list_del(elem);
@@ -1347,7 +1373,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
1347 cas_page_t *page = cp->rx_pages[1][index]; 1373 cas_page_t *page = cp->rx_pages[1][index];
1348 cas_page_t *new; 1374 cas_page_t *new;
1349 1375
1350 if (page_count(page->buffer) == 1) 1376 if (cas_buffer_count(page) == 1)
1351 return page; 1377 return page;
1352 1378
1353 new = cas_page_dequeue(cp); 1379 new = cas_page_dequeue(cp);
@@ -1367,7 +1393,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
1367 cas_page_t **page1 = cp->rx_pages[1]; 1393 cas_page_t **page1 = cp->rx_pages[1];
1368 1394
1369 /* swap if buffer is in use */ 1395 /* swap if buffer is in use */
1370 if (page_count(page0[index]->buffer) > 1) { 1396 if (cas_buffer_count(page0[index]) > 1) {
1371 cas_page_t *new = cas_page_spare(cp, index); 1397 cas_page_t *new = cas_page_spare(cp, index);
1372 if (new) { 1398 if (new) {
1373 page1[index] = page0[index]; 1399 page1[index] = page0[index];
@@ -2039,6 +2065,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2039 skb->len += hlen - swivel; 2065 skb->len += hlen - swivel;
2040 2066
2041 get_page(page->buffer); 2067 get_page(page->buffer);
2068 cas_buffer_inc(page);
2042 frag->page = page->buffer; 2069 frag->page = page->buffer;
2043 frag->page_offset = off; 2070 frag->page_offset = off;
2044 frag->size = hlen - swivel; 2071 frag->size = hlen - swivel;
@@ -2063,6 +2090,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2063 frag++; 2090 frag++;
2064 2091
2065 get_page(page->buffer); 2092 get_page(page->buffer);
2093 cas_buffer_inc(page);
2066 frag->page = page->buffer; 2094 frag->page = page->buffer;
2067 frag->page_offset = 0; 2095 frag->page_offset = 0;
2068 frag->size = hlen; 2096 frag->size = hlen;
@@ -2225,7 +2253,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
2225 released = 0; 2253 released = 0;
2226 while (entry != last) { 2254 while (entry != last) {
2227 /* make a new buffer if it's still in use */ 2255 /* make a new buffer if it's still in use */
2228 if (page_count(page[entry]->buffer) > 1) { 2256 if (cas_buffer_count(page[entry]) > 1) {
2229 cas_page_t *new = cas_page_dequeue(cp); 2257 cas_page_t *new = cas_page_dequeue(cp);
2230 if (!new) { 2258 if (!new) {
2231 /* let the timer know that we need to 2259 /* let the timer know that we need to
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index d252297e4db0..5cedc81786e3 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -121,7 +121,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
121 struct e1000_adapter *adapter = netdev_priv(netdev); 121 struct e1000_adapter *adapter = netdev_priv(netdev);
122 struct e1000_hw *hw = &adapter->hw; 122 struct e1000_hw *hw = &adapter->hw;
123 123
124 if(hw->media_type == e1000_media_type_copper) { 124 if (hw->media_type == e1000_media_type_copper) {
125 125
126 ecmd->supported = (SUPPORTED_10baseT_Half | 126 ecmd->supported = (SUPPORTED_10baseT_Half |
127 SUPPORTED_10baseT_Full | 127 SUPPORTED_10baseT_Full |
@@ -133,7 +133,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
133 133
134 ecmd->advertising = ADVERTISED_TP; 134 ecmd->advertising = ADVERTISED_TP;
135 135
136 if(hw->autoneg == 1) { 136 if (hw->autoneg == 1) {
137 ecmd->advertising |= ADVERTISED_Autoneg; 137 ecmd->advertising |= ADVERTISED_Autoneg;
138 138
139 /* the e1000 autoneg seems to match ethtool nicely */ 139 /* the e1000 autoneg seems to match ethtool nicely */
@@ -144,7 +144,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
144 ecmd->port = PORT_TP; 144 ecmd->port = PORT_TP;
145 ecmd->phy_address = hw->phy_addr; 145 ecmd->phy_address = hw->phy_addr;
146 146
147 if(hw->mac_type == e1000_82543) 147 if (hw->mac_type == e1000_82543)
148 ecmd->transceiver = XCVR_EXTERNAL; 148 ecmd->transceiver = XCVR_EXTERNAL;
149 else 149 else
150 ecmd->transceiver = XCVR_INTERNAL; 150 ecmd->transceiver = XCVR_INTERNAL;
@@ -160,13 +160,13 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
160 160
161 ecmd->port = PORT_FIBRE; 161 ecmd->port = PORT_FIBRE;
162 162
163 if(hw->mac_type >= e1000_82545) 163 if (hw->mac_type >= e1000_82545)
164 ecmd->transceiver = XCVR_INTERNAL; 164 ecmd->transceiver = XCVR_INTERNAL;
165 else 165 else
166 ecmd->transceiver = XCVR_EXTERNAL; 166 ecmd->transceiver = XCVR_EXTERNAL;
167 } 167 }
168 168
169 if(netif_carrier_ok(adapter->netdev)) { 169 if (netif_carrier_ok(adapter->netdev)) {
170 170
171 e1000_get_speed_and_duplex(hw, &adapter->link_speed, 171 e1000_get_speed_and_duplex(hw, &adapter->link_speed,
172 &adapter->link_duplex); 172 &adapter->link_duplex);
@@ -175,7 +175,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
175 /* unfortunatly FULL_DUPLEX != DUPLEX_FULL 175 /* unfortunatly FULL_DUPLEX != DUPLEX_FULL
176 * and HALF_DUPLEX != DUPLEX_HALF */ 176 * and HALF_DUPLEX != DUPLEX_HALF */
177 177
178 if(adapter->link_duplex == FULL_DUPLEX) 178 if (adapter->link_duplex == FULL_DUPLEX)
179 ecmd->duplex = DUPLEX_FULL; 179 ecmd->duplex = DUPLEX_FULL;
180 else 180 else
181 ecmd->duplex = DUPLEX_HALF; 181 ecmd->duplex = DUPLEX_HALF;
@@ -205,11 +205,11 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
205 205
206 if (ecmd->autoneg == AUTONEG_ENABLE) { 206 if (ecmd->autoneg == AUTONEG_ENABLE) {
207 hw->autoneg = 1; 207 hw->autoneg = 1;
208 if(hw->media_type == e1000_media_type_fiber) 208 if (hw->media_type == e1000_media_type_fiber)
209 hw->autoneg_advertised = ADVERTISED_1000baseT_Full | 209 hw->autoneg_advertised = ADVERTISED_1000baseT_Full |
210 ADVERTISED_FIBRE | 210 ADVERTISED_FIBRE |
211 ADVERTISED_Autoneg; 211 ADVERTISED_Autoneg;
212 else 212 else
213 hw->autoneg_advertised = ADVERTISED_10baseT_Half | 213 hw->autoneg_advertised = ADVERTISED_10baseT_Half |
214 ADVERTISED_10baseT_Full | 214 ADVERTISED_10baseT_Full |
215 ADVERTISED_100baseT_Half | 215 ADVERTISED_100baseT_Half |
@@ -219,12 +219,12 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
219 ADVERTISED_TP; 219 ADVERTISED_TP;
220 ecmd->advertising = hw->autoneg_advertised; 220 ecmd->advertising = hw->autoneg_advertised;
221 } else 221 } else
222 if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) 222 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex))
223 return -EINVAL; 223 return -EINVAL;
224 224
225 /* reset the link */ 225 /* reset the link */
226 226
227 if(netif_running(adapter->netdev)) { 227 if (netif_running(adapter->netdev)) {
228 e1000_down(adapter); 228 e1000_down(adapter);
229 e1000_reset(adapter); 229 e1000_reset(adapter);
230 e1000_up(adapter); 230 e1000_up(adapter);
@@ -241,14 +241,14 @@ e1000_get_pauseparam(struct net_device *netdev,
241 struct e1000_adapter *adapter = netdev_priv(netdev); 241 struct e1000_adapter *adapter = netdev_priv(netdev);
242 struct e1000_hw *hw = &adapter->hw; 242 struct e1000_hw *hw = &adapter->hw;
243 243
244 pause->autoneg = 244 pause->autoneg =
245 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); 245 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
246 246
247 if(hw->fc == e1000_fc_rx_pause) 247 if (hw->fc == e1000_fc_rx_pause)
248 pause->rx_pause = 1; 248 pause->rx_pause = 1;
249 else if(hw->fc == e1000_fc_tx_pause) 249 else if (hw->fc == e1000_fc_tx_pause)
250 pause->tx_pause = 1; 250 pause->tx_pause = 1;
251 else if(hw->fc == e1000_fc_full) { 251 else if (hw->fc == e1000_fc_full) {
252 pause->rx_pause = 1; 252 pause->rx_pause = 1;
253 pause->tx_pause = 1; 253 pause->tx_pause = 1;
254 } 254 }
@@ -260,31 +260,30 @@ e1000_set_pauseparam(struct net_device *netdev,
260{ 260{
261 struct e1000_adapter *adapter = netdev_priv(netdev); 261 struct e1000_adapter *adapter = netdev_priv(netdev);
262 struct e1000_hw *hw = &adapter->hw; 262 struct e1000_hw *hw = &adapter->hw;
263 263
264 adapter->fc_autoneg = pause->autoneg; 264 adapter->fc_autoneg = pause->autoneg;
265 265
266 if(pause->rx_pause && pause->tx_pause) 266 if (pause->rx_pause && pause->tx_pause)
267 hw->fc = e1000_fc_full; 267 hw->fc = e1000_fc_full;
268 else if(pause->rx_pause && !pause->tx_pause) 268 else if (pause->rx_pause && !pause->tx_pause)
269 hw->fc = e1000_fc_rx_pause; 269 hw->fc = e1000_fc_rx_pause;
270 else if(!pause->rx_pause && pause->tx_pause) 270 else if (!pause->rx_pause && pause->tx_pause)
271 hw->fc = e1000_fc_tx_pause; 271 hw->fc = e1000_fc_tx_pause;
272 else if(!pause->rx_pause && !pause->tx_pause) 272 else if (!pause->rx_pause && !pause->tx_pause)
273 hw->fc = e1000_fc_none; 273 hw->fc = e1000_fc_none;
274 274
275 hw->original_fc = hw->fc; 275 hw->original_fc = hw->fc;
276 276
277 if(adapter->fc_autoneg == AUTONEG_ENABLE) { 277 if (adapter->fc_autoneg == AUTONEG_ENABLE) {
278 if(netif_running(adapter->netdev)) { 278 if (netif_running(adapter->netdev)) {
279 e1000_down(adapter); 279 e1000_down(adapter);
280 e1000_up(adapter); 280 e1000_up(adapter);
281 } else 281 } else
282 e1000_reset(adapter); 282 e1000_reset(adapter);
283 } 283 } else
284 else
285 return ((hw->media_type == e1000_media_type_fiber) ? 284 return ((hw->media_type == e1000_media_type_fiber) ?
286 e1000_setup_link(hw) : e1000_force_mac_fc(hw)); 285 e1000_setup_link(hw) : e1000_force_mac_fc(hw));
287 286
288 return 0; 287 return 0;
289} 288}
290 289
@@ -301,14 +300,14 @@ e1000_set_rx_csum(struct net_device *netdev, uint32_t data)
301 struct e1000_adapter *adapter = netdev_priv(netdev); 300 struct e1000_adapter *adapter = netdev_priv(netdev);
302 adapter->rx_csum = data; 301 adapter->rx_csum = data;
303 302
304 if(netif_running(netdev)) { 303 if (netif_running(netdev)) {
305 e1000_down(adapter); 304 e1000_down(adapter);
306 e1000_up(adapter); 305 e1000_up(adapter);
307 } else 306 } else
308 e1000_reset(adapter); 307 e1000_reset(adapter);
309 return 0; 308 return 0;
310} 309}
311 310
312static uint32_t 311static uint32_t
313e1000_get_tx_csum(struct net_device *netdev) 312e1000_get_tx_csum(struct net_device *netdev)
314{ 313{
@@ -320,7 +319,7 @@ e1000_set_tx_csum(struct net_device *netdev, uint32_t data)
320{ 319{
321 struct e1000_adapter *adapter = netdev_priv(netdev); 320 struct e1000_adapter *adapter = netdev_priv(netdev);
322 321
323 if(adapter->hw.mac_type < e1000_82543) { 322 if (adapter->hw.mac_type < e1000_82543) {
324 if (!data) 323 if (!data)
325 return -EINVAL; 324 return -EINVAL;
326 return 0; 325 return 0;
@@ -339,8 +338,8 @@ static int
339e1000_set_tso(struct net_device *netdev, uint32_t data) 338e1000_set_tso(struct net_device *netdev, uint32_t data)
340{ 339{
341 struct e1000_adapter *adapter = netdev_priv(netdev); 340 struct e1000_adapter *adapter = netdev_priv(netdev);
342 if((adapter->hw.mac_type < e1000_82544) || 341 if ((adapter->hw.mac_type < e1000_82544) ||
343 (adapter->hw.mac_type == e1000_82547)) 342 (adapter->hw.mac_type == e1000_82547))
344 return data ? -EINVAL : 0; 343 return data ? -EINVAL : 0;
345 344
346 if (data) 345 if (data)
@@ -348,7 +347,7 @@ e1000_set_tso(struct net_device *netdev, uint32_t data)
348 else 347 else
349 netdev->features &= ~NETIF_F_TSO; 348 netdev->features &= ~NETIF_F_TSO;
350 return 0; 349 return 0;
351} 350}
352#endif /* NETIF_F_TSO */ 351#endif /* NETIF_F_TSO */
353 352
354static uint32_t 353static uint32_t
@@ -365,7 +364,7 @@ e1000_set_msglevel(struct net_device *netdev, uint32_t data)
365 adapter->msg_enable = data; 364 adapter->msg_enable = data;
366} 365}
367 366
368static int 367static int
369e1000_get_regs_len(struct net_device *netdev) 368e1000_get_regs_len(struct net_device *netdev)
370{ 369{
371#define E1000_REGS_LEN 32 370#define E1000_REGS_LEN 32
@@ -401,7 +400,7 @@ e1000_get_regs(struct net_device *netdev,
401 regs_buff[11] = E1000_READ_REG(hw, TIDV); 400 regs_buff[11] = E1000_READ_REG(hw, TIDV);
402 401
403 regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */ 402 regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */
404 if(hw->phy_type == e1000_phy_igp) { 403 if (hw->phy_type == e1000_phy_igp) {
405 e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 404 e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT,
406 IGP01E1000_PHY_AGC_A); 405 IGP01E1000_PHY_AGC_A);
407 e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A & 406 e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A &
@@ -455,7 +454,7 @@ e1000_get_regs(struct net_device *netdev,
455 e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); 454 e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data);
456 regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */ 455 regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */
457 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ 456 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */
458 if(hw->mac_type >= e1000_82540 && 457 if (hw->mac_type >= e1000_82540 &&
459 hw->media_type == e1000_media_type_copper) { 458 hw->media_type == e1000_media_type_copper) {
460 regs_buff[26] = E1000_READ_REG(hw, MANC); 459 regs_buff[26] = E1000_READ_REG(hw, MANC);
461 } 460 }
@@ -479,7 +478,7 @@ e1000_get_eeprom(struct net_device *netdev,
479 int ret_val = 0; 478 int ret_val = 0;
480 uint16_t i; 479 uint16_t i;
481 480
482 if(eeprom->len == 0) 481 if (eeprom->len == 0)
483 return -EINVAL; 482 return -EINVAL;
484 483
485 eeprom->magic = hw->vendor_id | (hw->device_id << 16); 484 eeprom->magic = hw->vendor_id | (hw->device_id << 16);
@@ -489,16 +488,16 @@ e1000_get_eeprom(struct net_device *netdev,
489 488
490 eeprom_buff = kmalloc(sizeof(uint16_t) * 489 eeprom_buff = kmalloc(sizeof(uint16_t) *
491 (last_word - first_word + 1), GFP_KERNEL); 490 (last_word - first_word + 1), GFP_KERNEL);
492 if(!eeprom_buff) 491 if (!eeprom_buff)
493 return -ENOMEM; 492 return -ENOMEM;
494 493
495 if(hw->eeprom.type == e1000_eeprom_spi) 494 if (hw->eeprom.type == e1000_eeprom_spi)
496 ret_val = e1000_read_eeprom(hw, first_word, 495 ret_val = e1000_read_eeprom(hw, first_word,
497 last_word - first_word + 1, 496 last_word - first_word + 1,
498 eeprom_buff); 497 eeprom_buff);
499 else { 498 else {
500 for (i = 0; i < last_word - first_word + 1; i++) 499 for (i = 0; i < last_word - first_word + 1; i++)
501 if((ret_val = e1000_read_eeprom(hw, first_word + i, 1, 500 if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1,
502 &eeprom_buff[i]))) 501 &eeprom_buff[i])))
503 break; 502 break;
504 } 503 }
@@ -525,10 +524,10 @@ e1000_set_eeprom(struct net_device *netdev,
525 int max_len, first_word, last_word, ret_val = 0; 524 int max_len, first_word, last_word, ret_val = 0;
526 uint16_t i; 525 uint16_t i;
527 526
528 if(eeprom->len == 0) 527 if (eeprom->len == 0)
529 return -EOPNOTSUPP; 528 return -EOPNOTSUPP;
530 529
531 if(eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) 530 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16)))
532 return -EFAULT; 531 return -EFAULT;
533 532
534 max_len = hw->eeprom.word_size * 2; 533 max_len = hw->eeprom.word_size * 2;
@@ -536,19 +535,19 @@ e1000_set_eeprom(struct net_device *netdev,
536 first_word = eeprom->offset >> 1; 535 first_word = eeprom->offset >> 1;
537 last_word = (eeprom->offset + eeprom->len - 1) >> 1; 536 last_word = (eeprom->offset + eeprom->len - 1) >> 1;
538 eeprom_buff = kmalloc(max_len, GFP_KERNEL); 537 eeprom_buff = kmalloc(max_len, GFP_KERNEL);
539 if(!eeprom_buff) 538 if (!eeprom_buff)
540 return -ENOMEM; 539 return -ENOMEM;
541 540
542 ptr = (void *)eeprom_buff; 541 ptr = (void *)eeprom_buff;
543 542
544 if(eeprom->offset & 1) { 543 if (eeprom->offset & 1) {
545 /* need read/modify/write of first changed EEPROM word */ 544 /* need read/modify/write of first changed EEPROM word */
546 /* only the second byte of the word is being modified */ 545 /* only the second byte of the word is being modified */
547 ret_val = e1000_read_eeprom(hw, first_word, 1, 546 ret_val = e1000_read_eeprom(hw, first_word, 1,
548 &eeprom_buff[0]); 547 &eeprom_buff[0]);
549 ptr++; 548 ptr++;
550 } 549 }
551 if(((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { 550 if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) {
552 /* need read/modify/write of last changed EEPROM word */ 551 /* need read/modify/write of last changed EEPROM word */
553 /* only the first byte of the word is being modified */ 552 /* only the first byte of the word is being modified */
554 ret_val = e1000_read_eeprom(hw, last_word, 1, 553 ret_val = e1000_read_eeprom(hw, last_word, 1,
@@ -567,9 +566,9 @@ e1000_set_eeprom(struct net_device *netdev,
567 ret_val = e1000_write_eeprom(hw, first_word, 566 ret_val = e1000_write_eeprom(hw, first_word,
568 last_word - first_word + 1, eeprom_buff); 567 last_word - first_word + 1, eeprom_buff);
569 568
570 /* Update the checksum over the first part of the EEPROM if needed 569 /* Update the checksum over the first part of the EEPROM if needed
571 * and flush shadow RAM for 82573 conrollers */ 570 * and flush shadow RAM for 82573 conrollers */
572 if((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || 571 if ((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) ||
573 (hw->mac_type == e1000_82573))) 572 (hw->mac_type == e1000_82573)))
574 e1000_update_eeprom_checksum(hw); 573 e1000_update_eeprom_checksum(hw);
575 574
@@ -633,7 +632,7 @@ e1000_get_ringparam(struct net_device *netdev,
633 ring->rx_jumbo_pending = 0; 632 ring->rx_jumbo_pending = 0;
634} 633}
635 634
636static int 635static int
637e1000_set_ringparam(struct net_device *netdev, 636e1000_set_ringparam(struct net_device *netdev,
638 struct ethtool_ringparam *ring) 637 struct ethtool_ringparam *ring)
639{ 638{
@@ -670,25 +669,25 @@ e1000_set_ringparam(struct net_device *netdev,
670 txdr = adapter->tx_ring; 669 txdr = adapter->tx_ring;
671 rxdr = adapter->rx_ring; 670 rxdr = adapter->rx_ring;
672 671
673 if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 672 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
674 return -EINVAL; 673 return -EINVAL;
675 674
676 rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); 675 rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD);
677 rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? 676 rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ?
678 E1000_MAX_RXD : E1000_MAX_82544_RXD)); 677 E1000_MAX_RXD : E1000_MAX_82544_RXD));
679 E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); 678 E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
680 679
681 txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD); 680 txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD);
682 txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ? 681 txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ?
683 E1000_MAX_TXD : E1000_MAX_82544_TXD)); 682 E1000_MAX_TXD : E1000_MAX_82544_TXD));
684 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); 683 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
685 684
686 for (i = 0; i < adapter->num_tx_queues; i++) 685 for (i = 0; i < adapter->num_tx_queues; i++)
687 txdr[i].count = txdr->count; 686 txdr[i].count = txdr->count;
688 for (i = 0; i < adapter->num_rx_queues; i++) 687 for (i = 0; i < adapter->num_rx_queues; i++)
689 rxdr[i].count = rxdr->count; 688 rxdr[i].count = rxdr->count;
690 689
691 if(netif_running(adapter->netdev)) { 690 if (netif_running(adapter->netdev)) {
692 /* Try to get new resources before deleting old */ 691 /* Try to get new resources before deleting old */
693 if ((err = e1000_setup_all_rx_resources(adapter))) 692 if ((err = e1000_setup_all_rx_resources(adapter)))
694 goto err_setup_rx; 693 goto err_setup_rx;
@@ -708,7 +707,7 @@ e1000_set_ringparam(struct net_device *netdev,
708 kfree(rx_old); 707 kfree(rx_old);
709 adapter->rx_ring = rx_new; 708 adapter->rx_ring = rx_new;
710 adapter->tx_ring = tx_new; 709 adapter->tx_ring = tx_new;
711 if((err = e1000_up(adapter))) 710 if ((err = e1000_up(adapter)))
712 return err; 711 return err;
713 } 712 }
714 713
@@ -727,10 +726,10 @@ err_setup_rx:
727 uint32_t pat, value; \ 726 uint32_t pat, value; \
728 uint32_t test[] = \ 727 uint32_t test[] = \
729 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ 728 {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \
730 for(pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \ 729 for (pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \
731 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ 730 E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \
732 value = E1000_READ_REG(&adapter->hw, R); \ 731 value = E1000_READ_REG(&adapter->hw, R); \
733 if(value != (test[pat] & W & M)) { \ 732 if (value != (test[pat] & W & M)) { \
734 DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ 733 DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \
735 "0x%08X expected 0x%08X\n", \ 734 "0x%08X expected 0x%08X\n", \
736 E1000_##R, value, (test[pat] & W & M)); \ 735 E1000_##R, value, (test[pat] & W & M)); \
@@ -746,7 +745,7 @@ err_setup_rx:
746 uint32_t value; \ 745 uint32_t value; \
747 E1000_WRITE_REG(&adapter->hw, R, W & M); \ 746 E1000_WRITE_REG(&adapter->hw, R, W & M); \
748 value = E1000_READ_REG(&adapter->hw, R); \ 747 value = E1000_READ_REG(&adapter->hw, R); \
749 if((W & M) != (value & M)) { \ 748 if ((W & M) != (value & M)) { \
750 DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ 749 DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
751 "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ 750 "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \
752 *data = (adapter->hw.mac_type < e1000_82543) ? \ 751 *data = (adapter->hw.mac_type < e1000_82543) ? \
@@ -782,7 +781,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
782 value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); 781 value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle);
783 E1000_WRITE_REG(&adapter->hw, STATUS, toggle); 782 E1000_WRITE_REG(&adapter->hw, STATUS, toggle);
784 after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; 783 after = E1000_READ_REG(&adapter->hw, STATUS) & toggle;
785 if(value != after) { 784 if (value != after) {
786 DPRINTK(DRV, ERR, "failed STATUS register test got: " 785 DPRINTK(DRV, ERR, "failed STATUS register test got: "
787 "0x%08X expected: 0x%08X\n", after, value); 786 "0x%08X expected: 0x%08X\n", after, value);
788 *data = 1; 787 *data = 1;
@@ -810,7 +809,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
810 REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB); 809 REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB);
811 REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); 810 REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000);
812 811
813 if(adapter->hw.mac_type >= e1000_82543) { 812 if (adapter->hw.mac_type >= e1000_82543) {
814 813
815 REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF); 814 REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF);
816 REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); 815 REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
@@ -818,7 +817,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
818 REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); 817 REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
819 REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); 818 REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF);
820 819
821 for(i = 0; i < E1000_RAR_ENTRIES; i++) { 820 for (i = 0; i < E1000_RAR_ENTRIES; i++) {
822 REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF, 821 REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF,
823 0xFFFFFFFF); 822 0xFFFFFFFF);
824 REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, 823 REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF,
@@ -834,7 +833,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
834 833
835 } 834 }
836 835
837 for(i = 0; i < E1000_MC_TBL_SIZE; i++) 836 for (i = 0; i < E1000_MC_TBL_SIZE; i++)
838 REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); 837 REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF);
839 838
840 *data = 0; 839 *data = 0;
@@ -850,8 +849,8 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data)
850 849
851 *data = 0; 850 *data = 0;
852 /* Read and add up the contents of the EEPROM */ 851 /* Read and add up the contents of the EEPROM */
853 for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { 852 for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
854 if((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { 853 if ((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) {
855 *data = 1; 854 *data = 1;
856 break; 855 break;
857 } 856 }
@@ -859,7 +858,7 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data)
859 } 858 }
860 859
861 /* If Checksum is not Correct return error else test passed */ 860 /* If Checksum is not Correct return error else test passed */
862 if((checksum != (uint16_t) EEPROM_SUM) && !(*data)) 861 if ((checksum != (uint16_t) EEPROM_SUM) && !(*data))
863 *data = 2; 862 *data = 2;
864 863
865 return *data; 864 return *data;
@@ -888,9 +887,9 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
888 *data = 0; 887 *data = 0;
889 888
890 /* Hook up test interrupt handler just for this test */ 889 /* Hook up test interrupt handler just for this test */
891 if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { 890 if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
892 shared_int = FALSE; 891 shared_int = FALSE;
893 } else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ, 892 } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ,
894 netdev->name, netdev)){ 893 netdev->name, netdev)){
895 *data = 1; 894 *data = 1;
896 return -1; 895 return -1;
@@ -901,12 +900,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
901 msec_delay(10); 900 msec_delay(10);
902 901
903 /* Test each interrupt */ 902 /* Test each interrupt */
904 for(; i < 10; i++) { 903 for (; i < 10; i++) {
905 904
906 /* Interrupt to test */ 905 /* Interrupt to test */
907 mask = 1 << i; 906 mask = 1 << i;
908 907
909 if(!shared_int) { 908 if (!shared_int) {
910 /* Disable the interrupt to be reported in 909 /* Disable the interrupt to be reported in
911 * the cause register and then force the same 910 * the cause register and then force the same
912 * interrupt and see if one gets posted. If 911 * interrupt and see if one gets posted. If
@@ -917,8 +916,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
917 E1000_WRITE_REG(&adapter->hw, IMC, mask); 916 E1000_WRITE_REG(&adapter->hw, IMC, mask);
918 E1000_WRITE_REG(&adapter->hw, ICS, mask); 917 E1000_WRITE_REG(&adapter->hw, ICS, mask);
919 msec_delay(10); 918 msec_delay(10);
920 919
921 if(adapter->test_icr & mask) { 920 if (adapter->test_icr & mask) {
922 *data = 3; 921 *data = 3;
923 break; 922 break;
924 } 923 }
@@ -935,12 +934,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
935 E1000_WRITE_REG(&adapter->hw, ICS, mask); 934 E1000_WRITE_REG(&adapter->hw, ICS, mask);
936 msec_delay(10); 935 msec_delay(10);
937 936
938 if(!(adapter->test_icr & mask)) { 937 if (!(adapter->test_icr & mask)) {
939 *data = 4; 938 *data = 4;
940 break; 939 break;
941 } 940 }
942 941
943 if(!shared_int) { 942 if (!shared_int) {
944 /* Disable the other interrupts to be reported in 943 /* Disable the other interrupts to be reported in
945 * the cause register and then force the other 944 * the cause register and then force the other
946 * interrupts and see if any get posted. If 945 * interrupts and see if any get posted. If
@@ -952,7 +951,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
952 E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF); 951 E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF);
953 msec_delay(10); 952 msec_delay(10);
954 953
955 if(adapter->test_icr) { 954 if (adapter->test_icr) {
956 *data = 5; 955 *data = 5;
957 break; 956 break;
958 } 957 }
@@ -977,24 +976,24 @@ e1000_free_desc_rings(struct e1000_adapter *adapter)
977 struct pci_dev *pdev = adapter->pdev; 976 struct pci_dev *pdev = adapter->pdev;
978 int i; 977 int i;
979 978
980 if(txdr->desc && txdr->buffer_info) { 979 if (txdr->desc && txdr->buffer_info) {
981 for(i = 0; i < txdr->count; i++) { 980 for (i = 0; i < txdr->count; i++) {
982 if(txdr->buffer_info[i].dma) 981 if (txdr->buffer_info[i].dma)
983 pci_unmap_single(pdev, txdr->buffer_info[i].dma, 982 pci_unmap_single(pdev, txdr->buffer_info[i].dma,
984 txdr->buffer_info[i].length, 983 txdr->buffer_info[i].length,
985 PCI_DMA_TODEVICE); 984 PCI_DMA_TODEVICE);
986 if(txdr->buffer_info[i].skb) 985 if (txdr->buffer_info[i].skb)
987 dev_kfree_skb(txdr->buffer_info[i].skb); 986 dev_kfree_skb(txdr->buffer_info[i].skb);
988 } 987 }
989 } 988 }
990 989
991 if(rxdr->desc && rxdr->buffer_info) { 990 if (rxdr->desc && rxdr->buffer_info) {
992 for(i = 0; i < rxdr->count; i++) { 991 for (i = 0; i < rxdr->count; i++) {
993 if(rxdr->buffer_info[i].dma) 992 if (rxdr->buffer_info[i].dma)
994 pci_unmap_single(pdev, rxdr->buffer_info[i].dma, 993 pci_unmap_single(pdev, rxdr->buffer_info[i].dma,
995 rxdr->buffer_info[i].length, 994 rxdr->buffer_info[i].length,
996 PCI_DMA_FROMDEVICE); 995 PCI_DMA_FROMDEVICE);
997 if(rxdr->buffer_info[i].skb) 996 if (rxdr->buffer_info[i].skb)
998 dev_kfree_skb(rxdr->buffer_info[i].skb); 997 dev_kfree_skb(rxdr->buffer_info[i].skb);
999 } 998 }
1000 } 999 }
@@ -1027,11 +1026,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1027 1026
1028 /* Setup Tx descriptor ring and Tx buffers */ 1027 /* Setup Tx descriptor ring and Tx buffers */
1029 1028
1030 if(!txdr->count) 1029 if (!txdr->count)
1031 txdr->count = E1000_DEFAULT_TXD; 1030 txdr->count = E1000_DEFAULT_TXD;
1032 1031
1033 size = txdr->count * sizeof(struct e1000_buffer); 1032 size = txdr->count * sizeof(struct e1000_buffer);
1034 if(!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) { 1033 if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
1035 ret_val = 1; 1034 ret_val = 1;
1036 goto err_nomem; 1035 goto err_nomem;
1037 } 1036 }
@@ -1039,7 +1038,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1039 1038
1040 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1039 txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
1041 E1000_ROUNDUP(txdr->size, 4096); 1040 E1000_ROUNDUP(txdr->size, 4096);
1042 if(!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) { 1041 if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) {
1043 ret_val = 2; 1042 ret_val = 2;
1044 goto err_nomem; 1043 goto err_nomem;
1045 } 1044 }
@@ -1058,12 +1057,12 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1058 E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | 1057 E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT |
1059 E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); 1058 E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT);
1060 1059
1061 for(i = 0; i < txdr->count; i++) { 1060 for (i = 0; i < txdr->count; i++) {
1062 struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); 1061 struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i);
1063 struct sk_buff *skb; 1062 struct sk_buff *skb;
1064 unsigned int size = 1024; 1063 unsigned int size = 1024;
1065 1064
1066 if(!(skb = alloc_skb(size, GFP_KERNEL))) { 1065 if (!(skb = alloc_skb(size, GFP_KERNEL))) {
1067 ret_val = 3; 1066 ret_val = 3;
1068 goto err_nomem; 1067 goto err_nomem;
1069 } 1068 }
@@ -1083,18 +1082,18 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1083 1082
1084 /* Setup Rx descriptor ring and Rx buffers */ 1083 /* Setup Rx descriptor ring and Rx buffers */
1085 1084
1086 if(!rxdr->count) 1085 if (!rxdr->count)
1087 rxdr->count = E1000_DEFAULT_RXD; 1086 rxdr->count = E1000_DEFAULT_RXD;
1088 1087
1089 size = rxdr->count * sizeof(struct e1000_buffer); 1088 size = rxdr->count * sizeof(struct e1000_buffer);
1090 if(!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) { 1089 if (!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
1091 ret_val = 4; 1090 ret_val = 4;
1092 goto err_nomem; 1091 goto err_nomem;
1093 } 1092 }
1094 memset(rxdr->buffer_info, 0, size); 1093 memset(rxdr->buffer_info, 0, size);
1095 1094
1096 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); 1095 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
1097 if(!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { 1096 if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) {
1098 ret_val = 5; 1097 ret_val = 5;
1099 goto err_nomem; 1098 goto err_nomem;
1100 } 1099 }
@@ -1114,11 +1113,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
1114 (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); 1113 (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
1115 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 1114 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
1116 1115
1117 for(i = 0; i < rxdr->count; i++) { 1116 for (i = 0; i < rxdr->count; i++) {
1118 struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); 1117 struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i);
1119 struct sk_buff *skb; 1118 struct sk_buff *skb;
1120 1119
1121 if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, 1120 if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN,
1122 GFP_KERNEL))) { 1121 GFP_KERNEL))) {
1123 ret_val = 6; 1122 ret_val = 6;
1124 goto err_nomem; 1123 goto err_nomem;
@@ -1227,15 +1226,15 @@ e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter)
1227 1226
1228 /* Check Phy Configuration */ 1227 /* Check Phy Configuration */
1229 e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); 1228 e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg);
1230 if(phy_reg != 0x4100) 1229 if (phy_reg != 0x4100)
1231 return 9; 1230 return 9;
1232 1231
1233 e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); 1232 e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg);
1234 if(phy_reg != 0x0070) 1233 if (phy_reg != 0x0070)
1235 return 10; 1234 return 10;
1236 1235
1237 e1000_read_phy_reg(&adapter->hw, 29, &phy_reg); 1236 e1000_read_phy_reg(&adapter->hw, 29, &phy_reg);
1238 if(phy_reg != 0x001A) 1237 if (phy_reg != 0x001A)
1239 return 11; 1238 return 11;
1240 1239
1241 return 0; 1240 return 0;
@@ -1249,7 +1248,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1249 1248
1250 adapter->hw.autoneg = FALSE; 1249 adapter->hw.autoneg = FALSE;
1251 1250
1252 if(adapter->hw.phy_type == e1000_phy_m88) { 1251 if (adapter->hw.phy_type == e1000_phy_m88) {
1253 /* Auto-MDI/MDIX Off */ 1252 /* Auto-MDI/MDIX Off */
1254 e1000_write_phy_reg(&adapter->hw, 1253 e1000_write_phy_reg(&adapter->hw,
1255 M88E1000_PHY_SPEC_CTRL, 0x0808); 1254 M88E1000_PHY_SPEC_CTRL, 0x0808);
@@ -1269,14 +1268,14 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1269 E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ 1268 E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
1270 E1000_CTRL_FD); /* Force Duplex to FULL */ 1269 E1000_CTRL_FD); /* Force Duplex to FULL */
1271 1270
1272 if(adapter->hw.media_type == e1000_media_type_copper && 1271 if (adapter->hw.media_type == e1000_media_type_copper &&
1273 adapter->hw.phy_type == e1000_phy_m88) { 1272 adapter->hw.phy_type == e1000_phy_m88) {
1274 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ 1273 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
1275 } else { 1274 } else {
1276 /* Set the ILOS bit on the fiber Nic is half 1275 /* Set the ILOS bit on the fiber Nic is half
1277 * duplex link is detected. */ 1276 * duplex link is detected. */
1278 stat_reg = E1000_READ_REG(&adapter->hw, STATUS); 1277 stat_reg = E1000_READ_REG(&adapter->hw, STATUS);
1279 if((stat_reg & E1000_STATUS_FD) == 0) 1278 if ((stat_reg & E1000_STATUS_FD) == 0)
1280 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); 1279 ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
1281 } 1280 }
1282 1281
@@ -1285,7 +1284,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1285 /* Disable the receiver on the PHY so when a cable is plugged in, the 1284 /* Disable the receiver on the PHY so when a cable is plugged in, the
1286 * PHY does not begin to autoneg when a cable is reconnected to the NIC. 1285 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
1287 */ 1286 */
1288 if(adapter->hw.phy_type == e1000_phy_m88) 1287 if (adapter->hw.phy_type == e1000_phy_m88)
1289 e1000_phy_disable_receiver(adapter); 1288 e1000_phy_disable_receiver(adapter);
1290 1289
1291 udelay(500); 1290 udelay(500);
@@ -1301,14 +1300,14 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter)
1301 1300
1302 switch (adapter->hw.mac_type) { 1301 switch (adapter->hw.mac_type) {
1303 case e1000_82543: 1302 case e1000_82543:
1304 if(adapter->hw.media_type == e1000_media_type_copper) { 1303 if (adapter->hw.media_type == e1000_media_type_copper) {
1305 /* Attempt to setup Loopback mode on Non-integrated PHY. 1304 /* Attempt to setup Loopback mode on Non-integrated PHY.
1306 * Some PHY registers get corrupted at random, so 1305 * Some PHY registers get corrupted at random, so
1307 * attempt this 10 times. 1306 * attempt this 10 times.
1308 */ 1307 */
1309 while(e1000_nonintegrated_phy_loopback(adapter) && 1308 while (e1000_nonintegrated_phy_loopback(adapter) &&
1310 count++ < 10); 1309 count++ < 10);
1311 if(count < 11) 1310 if (count < 11)
1312 return 0; 1311 return 0;
1313 } 1312 }
1314 break; 1313 break;
@@ -1430,8 +1429,8 @@ static int
1430e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) 1429e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size)
1431{ 1430{
1432 frame_size &= ~1; 1431 frame_size &= ~1;
1433 if(*(skb->data + 3) == 0xFF) { 1432 if (*(skb->data + 3) == 0xFF) {
1434 if((*(skb->data + frame_size / 2 + 10) == 0xBE) && 1433 if ((*(skb->data + frame_size / 2 + 10) == 0xBE) &&
1435 (*(skb->data + frame_size / 2 + 12) == 0xAF)) { 1434 (*(skb->data + frame_size / 2 + 12) == 0xAF)) {
1436 return 0; 1435 return 0;
1437 } 1436 }
@@ -1450,53 +1449,53 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
1450 1449
1451 E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); 1450 E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1);
1452 1451
1453 /* Calculate the loop count based on the largest descriptor ring 1452 /* Calculate the loop count based on the largest descriptor ring
1454 * The idea is to wrap the largest ring a number of times using 64 1453 * The idea is to wrap the largest ring a number of times using 64
1455 * send/receive pairs during each loop 1454 * send/receive pairs during each loop
1456 */ 1455 */
1457 1456
1458 if(rxdr->count <= txdr->count) 1457 if (rxdr->count <= txdr->count)
1459 lc = ((txdr->count / 64) * 2) + 1; 1458 lc = ((txdr->count / 64) * 2) + 1;
1460 else 1459 else
1461 lc = ((rxdr->count / 64) * 2) + 1; 1460 lc = ((rxdr->count / 64) * 2) + 1;
1462 1461
1463 k = l = 0; 1462 k = l = 0;
1464 for(j = 0; j <= lc; j++) { /* loop count loop */ 1463 for (j = 0; j <= lc; j++) { /* loop count loop */
1465 for(i = 0; i < 64; i++) { /* send the packets */ 1464 for (i = 0; i < 64; i++) { /* send the packets */
1466 e1000_create_lbtest_frame(txdr->buffer_info[i].skb, 1465 e1000_create_lbtest_frame(txdr->buffer_info[i].skb,
1467 1024); 1466 1024);
1468 pci_dma_sync_single_for_device(pdev, 1467 pci_dma_sync_single_for_device(pdev,
1469 txdr->buffer_info[k].dma, 1468 txdr->buffer_info[k].dma,
1470 txdr->buffer_info[k].length, 1469 txdr->buffer_info[k].length,
1471 PCI_DMA_TODEVICE); 1470 PCI_DMA_TODEVICE);
1472 if(unlikely(++k == txdr->count)) k = 0; 1471 if (unlikely(++k == txdr->count)) k = 0;
1473 } 1472 }
1474 E1000_WRITE_REG(&adapter->hw, TDT, k); 1473 E1000_WRITE_REG(&adapter->hw, TDT, k);
1475 msec_delay(200); 1474 msec_delay(200);
1476 time = jiffies; /* set the start time for the receive */ 1475 time = jiffies; /* set the start time for the receive */
1477 good_cnt = 0; 1476 good_cnt = 0;
1478 do { /* receive the sent packets */ 1477 do { /* receive the sent packets */
1479 pci_dma_sync_single_for_cpu(pdev, 1478 pci_dma_sync_single_for_cpu(pdev,
1480 rxdr->buffer_info[l].dma, 1479 rxdr->buffer_info[l].dma,
1481 rxdr->buffer_info[l].length, 1480 rxdr->buffer_info[l].length,
1482 PCI_DMA_FROMDEVICE); 1481 PCI_DMA_FROMDEVICE);
1483 1482
1484 ret_val = e1000_check_lbtest_frame( 1483 ret_val = e1000_check_lbtest_frame(
1485 rxdr->buffer_info[l].skb, 1484 rxdr->buffer_info[l].skb,
1486 1024); 1485 1024);
1487 if(!ret_val) 1486 if (!ret_val)
1488 good_cnt++; 1487 good_cnt++;
1489 if(unlikely(++l == rxdr->count)) l = 0; 1488 if (unlikely(++l == rxdr->count)) l = 0;
1490 /* time + 20 msecs (200 msecs on 2.4) is more than 1489 /* time + 20 msecs (200 msecs on 2.4) is more than
1491 * enough time to complete the receives, if it's 1490 * enough time to complete the receives, if it's
1492 * exceeded, break and error off 1491 * exceeded, break and error off
1493 */ 1492 */
1494 } while (good_cnt < 64 && jiffies < (time + 20)); 1493 } while (good_cnt < 64 && jiffies < (time + 20));
1495 if(good_cnt != 64) { 1494 if (good_cnt != 64) {
1496 ret_val = 13; /* ret_val is the same as mis-compare */ 1495 ret_val = 13; /* ret_val is the same as mis-compare */
1497 break; 1496 break;
1498 } 1497 }
1499 if(jiffies >= (time + 2)) { 1498 if (jiffies >= (time + 2)) {
1500 ret_val = 14; /* error code for time out error */ 1499 ret_val = 14; /* error code for time out error */
1501 break; 1500 break;
1502 } 1501 }
@@ -1549,17 +1548,17 @@ e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
1549 *data = 1; 1548 *data = 1;
1550 } else { 1549 } else {
1551 e1000_check_for_link(&adapter->hw); 1550 e1000_check_for_link(&adapter->hw);
1552 if(adapter->hw.autoneg) /* if auto_neg is set wait for it */ 1551 if (adapter->hw.autoneg) /* if auto_neg is set wait for it */
1553 msec_delay(4000); 1552 msec_delay(4000);
1554 1553
1555 if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { 1554 if (!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) {
1556 *data = 1; 1555 *data = 1;
1557 } 1556 }
1558 } 1557 }
1559 return *data; 1558 return *data;
1560} 1559}
1561 1560
1562static int 1561static int
1563e1000_diag_test_count(struct net_device *netdev) 1562e1000_diag_test_count(struct net_device *netdev)
1564{ 1563{
1565 return E1000_TEST_LEN; 1564 return E1000_TEST_LEN;
@@ -1572,7 +1571,7 @@ e1000_diag_test(struct net_device *netdev,
1572 struct e1000_adapter *adapter = netdev_priv(netdev); 1571 struct e1000_adapter *adapter = netdev_priv(netdev);
1573 boolean_t if_running = netif_running(netdev); 1572 boolean_t if_running = netif_running(netdev);
1574 1573
1575 if(eth_test->flags == ETH_TEST_FL_OFFLINE) { 1574 if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
1576 /* Offline tests */ 1575 /* Offline tests */
1577 1576
1578 /* save speed, duplex, autoneg settings */ 1577 /* save speed, duplex, autoneg settings */
@@ -1582,27 +1581,27 @@ e1000_diag_test(struct net_device *netdev,
1582 1581
1583 /* Link test performed before hardware reset so autoneg doesn't 1582 /* Link test performed before hardware reset so autoneg doesn't
1584 * interfere with test result */ 1583 * interfere with test result */
1585 if(e1000_link_test(adapter, &data[4])) 1584 if (e1000_link_test(adapter, &data[4]))
1586 eth_test->flags |= ETH_TEST_FL_FAILED; 1585 eth_test->flags |= ETH_TEST_FL_FAILED;
1587 1586
1588 if(if_running) 1587 if (if_running)
1589 e1000_down(adapter); 1588 e1000_down(adapter);
1590 else 1589 else
1591 e1000_reset(adapter); 1590 e1000_reset(adapter);
1592 1591
1593 if(e1000_reg_test(adapter, &data[0])) 1592 if (e1000_reg_test(adapter, &data[0]))
1594 eth_test->flags |= ETH_TEST_FL_FAILED; 1593 eth_test->flags |= ETH_TEST_FL_FAILED;
1595 1594
1596 e1000_reset(adapter); 1595 e1000_reset(adapter);
1597 if(e1000_eeprom_test(adapter, &data[1])) 1596 if (e1000_eeprom_test(adapter, &data[1]))
1598 eth_test->flags |= ETH_TEST_FL_FAILED; 1597 eth_test->flags |= ETH_TEST_FL_FAILED;
1599 1598
1600 e1000_reset(adapter); 1599 e1000_reset(adapter);
1601 if(e1000_intr_test(adapter, &data[2])) 1600 if (e1000_intr_test(adapter, &data[2]))
1602 eth_test->flags |= ETH_TEST_FL_FAILED; 1601 eth_test->flags |= ETH_TEST_FL_FAILED;
1603 1602
1604 e1000_reset(adapter); 1603 e1000_reset(adapter);
1605 if(e1000_loopback_test(adapter, &data[3])) 1604 if (e1000_loopback_test(adapter, &data[3]))
1606 eth_test->flags |= ETH_TEST_FL_FAILED; 1605 eth_test->flags |= ETH_TEST_FL_FAILED;
1607 1606
1608 /* restore speed, duplex, autoneg settings */ 1607 /* restore speed, duplex, autoneg settings */
@@ -1611,11 +1610,11 @@ e1000_diag_test(struct net_device *netdev,
1611 adapter->hw.autoneg = autoneg; 1610 adapter->hw.autoneg = autoneg;
1612 1611
1613 e1000_reset(adapter); 1612 e1000_reset(adapter);
1614 if(if_running) 1613 if (if_running)
1615 e1000_up(adapter); 1614 e1000_up(adapter);
1616 } else { 1615 } else {
1617 /* Online tests */ 1616 /* Online tests */
1618 if(e1000_link_test(adapter, &data[4])) 1617 if (e1000_link_test(adapter, &data[4]))
1619 eth_test->flags |= ETH_TEST_FL_FAILED; 1618 eth_test->flags |= ETH_TEST_FL_FAILED;
1620 1619
1621 /* Offline tests aren't run; pass by default */ 1620 /* Offline tests aren't run; pass by default */
@@ -1633,7 +1632,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1633 struct e1000_adapter *adapter = netdev_priv(netdev); 1632 struct e1000_adapter *adapter = netdev_priv(netdev);
1634 struct e1000_hw *hw = &adapter->hw; 1633 struct e1000_hw *hw = &adapter->hw;
1635 1634
1636 switch(adapter->hw.device_id) { 1635 switch (adapter->hw.device_id) {
1637 case E1000_DEV_ID_82542: 1636 case E1000_DEV_ID_82542:
1638 case E1000_DEV_ID_82543GC_FIBER: 1637 case E1000_DEV_ID_82543GC_FIBER:
1639 case E1000_DEV_ID_82543GC_COPPER: 1638 case E1000_DEV_ID_82543GC_COPPER:
@@ -1649,7 +1648,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1649 case E1000_DEV_ID_82546GB_FIBER: 1648 case E1000_DEV_ID_82546GB_FIBER:
1650 case E1000_DEV_ID_82571EB_FIBER: 1649 case E1000_DEV_ID_82571EB_FIBER:
1651 /* Wake events only supported on port A for dual fiber */ 1650 /* Wake events only supported on port A for dual fiber */
1652 if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { 1651 if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) {
1653 wol->supported = 0; 1652 wol->supported = 0;
1654 wol->wolopts = 0; 1653 wol->wolopts = 0;
1655 return; 1654 return;
@@ -1661,13 +1660,13 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1661 WAKE_BCAST | WAKE_MAGIC; 1660 WAKE_BCAST | WAKE_MAGIC;
1662 1661
1663 wol->wolopts = 0; 1662 wol->wolopts = 0;
1664 if(adapter->wol & E1000_WUFC_EX) 1663 if (adapter->wol & E1000_WUFC_EX)
1665 wol->wolopts |= WAKE_UCAST; 1664 wol->wolopts |= WAKE_UCAST;
1666 if(adapter->wol & E1000_WUFC_MC) 1665 if (adapter->wol & E1000_WUFC_MC)
1667 wol->wolopts |= WAKE_MCAST; 1666 wol->wolopts |= WAKE_MCAST;
1668 if(adapter->wol & E1000_WUFC_BC) 1667 if (adapter->wol & E1000_WUFC_BC)
1669 wol->wolopts |= WAKE_BCAST; 1668 wol->wolopts |= WAKE_BCAST;
1670 if(adapter->wol & E1000_WUFC_MAG) 1669 if (adapter->wol & E1000_WUFC_MAG)
1671 wol->wolopts |= WAKE_MAGIC; 1670 wol->wolopts |= WAKE_MAGIC;
1672 return; 1671 return;
1673 } 1672 }
@@ -1679,7 +1678,7 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1679 struct e1000_adapter *adapter = netdev_priv(netdev); 1678 struct e1000_adapter *adapter = netdev_priv(netdev);
1680 struct e1000_hw *hw = &adapter->hw; 1679 struct e1000_hw *hw = &adapter->hw;
1681 1680
1682 switch(adapter->hw.device_id) { 1681 switch (adapter->hw.device_id) {
1683 case E1000_DEV_ID_82542: 1682 case E1000_DEV_ID_82542:
1684 case E1000_DEV_ID_82543GC_FIBER: 1683 case E1000_DEV_ID_82543GC_FIBER:
1685 case E1000_DEV_ID_82543GC_COPPER: 1684 case E1000_DEV_ID_82543GC_COPPER:
@@ -1693,23 +1692,23 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1693 case E1000_DEV_ID_82546GB_FIBER: 1692 case E1000_DEV_ID_82546GB_FIBER:
1694 case E1000_DEV_ID_82571EB_FIBER: 1693 case E1000_DEV_ID_82571EB_FIBER:
1695 /* Wake events only supported on port A for dual fiber */ 1694 /* Wake events only supported on port A for dual fiber */
1696 if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) 1695 if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
1697 return wol->wolopts ? -EOPNOTSUPP : 0; 1696 return wol->wolopts ? -EOPNOTSUPP : 0;
1698 /* Fall Through */ 1697 /* Fall Through */
1699 1698
1700 default: 1699 default:
1701 if(wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 1700 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
1702 return -EOPNOTSUPP; 1701 return -EOPNOTSUPP;
1703 1702
1704 adapter->wol = 0; 1703 adapter->wol = 0;
1705 1704
1706 if(wol->wolopts & WAKE_UCAST) 1705 if (wol->wolopts & WAKE_UCAST)
1707 adapter->wol |= E1000_WUFC_EX; 1706 adapter->wol |= E1000_WUFC_EX;
1708 if(wol->wolopts & WAKE_MCAST) 1707 if (wol->wolopts & WAKE_MCAST)
1709 adapter->wol |= E1000_WUFC_MC; 1708 adapter->wol |= E1000_WUFC_MC;
1710 if(wol->wolopts & WAKE_BCAST) 1709 if (wol->wolopts & WAKE_BCAST)
1711 adapter->wol |= E1000_WUFC_BC; 1710 adapter->wol |= E1000_WUFC_BC;
1712 if(wol->wolopts & WAKE_MAGIC) 1711 if (wol->wolopts & WAKE_MAGIC)
1713 adapter->wol |= E1000_WUFC_MAG; 1712 adapter->wol |= E1000_WUFC_MAG;
1714 } 1713 }
1715 1714
@@ -1727,7 +1726,7 @@ e1000_led_blink_callback(unsigned long data)
1727{ 1726{
1728 struct e1000_adapter *adapter = (struct e1000_adapter *) data; 1727 struct e1000_adapter *adapter = (struct e1000_adapter *) data;
1729 1728
1730 if(test_and_change_bit(E1000_LED_ON, &adapter->led_status)) 1729 if (test_and_change_bit(E1000_LED_ON, &adapter->led_status))
1731 e1000_led_off(&adapter->hw); 1730 e1000_led_off(&adapter->hw);
1732 else 1731 else
1733 e1000_led_on(&adapter->hw); 1732 e1000_led_on(&adapter->hw);
@@ -1740,11 +1739,11 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
1740{ 1739{
1741 struct e1000_adapter *adapter = netdev_priv(netdev); 1740 struct e1000_adapter *adapter = netdev_priv(netdev);
1742 1741
1743 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 1742 if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
1744 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 1743 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
1745 1744
1746 if(adapter->hw.mac_type < e1000_82571) { 1745 if (adapter->hw.mac_type < e1000_82571) {
1747 if(!adapter->blink_timer.function) { 1746 if (!adapter->blink_timer.function) {
1748 init_timer(&adapter->blink_timer); 1747 init_timer(&adapter->blink_timer);
1749 adapter->blink_timer.function = e1000_led_blink_callback; 1748 adapter->blink_timer.function = e1000_led_blink_callback;
1750 adapter->blink_timer.data = (unsigned long) adapter; 1749 adapter->blink_timer.data = (unsigned long) adapter;
@@ -1782,21 +1781,21 @@ static int
1782e1000_nway_reset(struct net_device *netdev) 1781e1000_nway_reset(struct net_device *netdev)
1783{ 1782{
1784 struct e1000_adapter *adapter = netdev_priv(netdev); 1783 struct e1000_adapter *adapter = netdev_priv(netdev);
1785 if(netif_running(netdev)) { 1784 if (netif_running(netdev)) {
1786 e1000_down(adapter); 1785 e1000_down(adapter);
1787 e1000_up(adapter); 1786 e1000_up(adapter);
1788 } 1787 }
1789 return 0; 1788 return 0;
1790} 1789}
1791 1790
1792static int 1791static int
1793e1000_get_stats_count(struct net_device *netdev) 1792e1000_get_stats_count(struct net_device *netdev)
1794{ 1793{
1795 return E1000_STATS_LEN; 1794 return E1000_STATS_LEN;
1796} 1795}
1797 1796
1798static void 1797static void
1799e1000_get_ethtool_stats(struct net_device *netdev, 1798e1000_get_ethtool_stats(struct net_device *netdev,
1800 struct ethtool_stats *stats, uint64_t *data) 1799 struct ethtool_stats *stats, uint64_t *data)
1801{ 1800{
1802 struct e1000_adapter *adapter = netdev_priv(netdev); 1801 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -1830,7 +1829,7 @@ e1000_get_ethtool_stats(struct net_device *netdev,
1830/* BUG_ON(i != E1000_STATS_LEN); */ 1829/* BUG_ON(i != E1000_STATS_LEN); */
1831} 1830}
1832 1831
1833static void 1832static void
1834e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) 1833e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
1835{ 1834{
1836#ifdef CONFIG_E1000_MQ 1835#ifdef CONFIG_E1000_MQ
@@ -1839,9 +1838,9 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
1839 uint8_t *p = data; 1838 uint8_t *p = data;
1840 int i; 1839 int i;
1841 1840
1842 switch(stringset) { 1841 switch (stringset) {
1843 case ETH_SS_TEST: 1842 case ETH_SS_TEST:
1844 memcpy(data, *e1000_gstrings_test, 1843 memcpy(data, *e1000_gstrings_test,
1845 E1000_TEST_LEN*ETH_GSTRING_LEN); 1844 E1000_TEST_LEN*ETH_GSTRING_LEN);
1846 break; 1845 break;
1847 case ETH_SS_STATS: 1846 case ETH_SS_STATS:
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 2437d362ff63..beeec0fbbeac 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -1600,10 +1600,10 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw)
1600 if(ret_val) 1600 if(ret_val)
1601 return ret_val; 1601 return ret_val;
1602 1602
1603 /* Read the MII 1000Base-T Control Register (Address 9). */ 1603 /* Read the MII 1000Base-T Control Register (Address 9). */
1604 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); 1604 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
1605 if(ret_val) 1605 if(ret_val)
1606 return ret_val; 1606 return ret_val;
1607 1607
1608 /* Need to parse both autoneg_advertised and fc and set up 1608 /* Need to parse both autoneg_advertised and fc and set up
1609 * the appropriate PHY registers. First we will parse for 1609 * the appropriate PHY registers. First we will parse for
@@ -3916,7 +3916,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
3916 } 3916 }
3917 } 3917 }
3918 3918
3919 if(eeprom->use_eerd == TRUE) { 3919 if (eeprom->use_eerd == TRUE) {
3920 ret_val = e1000_read_eeprom_eerd(hw, offset, words, data); 3920 ret_val = e1000_read_eeprom_eerd(hw, offset, words, data);
3921 if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) || 3921 if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) ||
3922 (hw->mac_type != e1000_82573)) 3922 (hw->mac_type != e1000_82573))
@@ -4423,7 +4423,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
4423 return -E1000_ERR_EEPROM; 4423 return -E1000_ERR_EEPROM;
4424 } 4424 }
4425 4425
4426 /* If STM opcode located in bits 15:8 of flop, reset firmware */ 4426 /* If STM opcode located in bits 15:8 of flop, reset firmware */
4427 if ((flop & 0xFF00) == E1000_STM_OPCODE) { 4427 if ((flop & 0xFF00) == E1000_STM_OPCODE) {
4428 E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET); 4428 E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET);
4429 } 4429 }
@@ -4431,7 +4431,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
4431 /* Perform the flash update */ 4431 /* Perform the flash update */
4432 E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD); 4432 E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD);
4433 4433
4434 for (i=0; i < attempts; i++) { 4434 for (i=0; i < attempts; i++) {
4435 eecd = E1000_READ_REG(hw, EECD); 4435 eecd = E1000_READ_REG(hw, EECD);
4436 if ((eecd & E1000_EECD_FLUPD) == 0) { 4436 if ((eecd & E1000_EECD_FLUPD) == 0) {
4437 break; 4437 break;
@@ -4504,6 +4504,7 @@ e1000_read_mac_addr(struct e1000_hw * hw)
4504 hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); 4504 hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF);
4505 hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); 4505 hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8);
4506 } 4506 }
4507
4507 switch (hw->mac_type) { 4508 switch (hw->mac_type) {
4508 default: 4509 default:
4509 break; 4510 break;
@@ -6840,7 +6841,8 @@ int32_t
6840e1000_check_phy_reset_block(struct e1000_hw *hw) 6841e1000_check_phy_reset_block(struct e1000_hw *hw)
6841{ 6842{
6842 uint32_t manc = 0; 6843 uint32_t manc = 0;
6843 if(hw->mac_type > e1000_82547_rev_2) 6844
6845 if (hw->mac_type > e1000_82547_rev_2)
6844 manc = E1000_READ_REG(hw, MANC); 6846 manc = E1000_READ_REG(hw, MANC);
6845 return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? 6847 return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ?
6846 E1000_BLK_PHY_RESET : E1000_SUCCESS; 6848 E1000_BLK_PHY_RESET : E1000_SUCCESS;
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 0b8f6f2b774b..f1219dd9dbac 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -377,6 +377,7 @@ int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);
377void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); 377void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask);
378 378
379/* Filters (multicast, vlan, receive) */ 379/* Filters (multicast, vlan, receive) */
380void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count);
380uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr); 381uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);
381void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value); 382void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);
382void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index); 383void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);
@@ -401,7 +402,9 @@ void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
401void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); 402void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
402/* Port I/O is only supported on 82544 and newer */ 403/* Port I/O is only supported on 82544 and newer */
403uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port); 404uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port);
405uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset);
404void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); 406void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);
407void e1000_enable_pciex_master(struct e1000_hw *hw);
405int32_t e1000_disable_pciex_master(struct e1000_hw *hw); 408int32_t e1000_disable_pciex_master(struct e1000_hw *hw);
406int32_t e1000_get_software_semaphore(struct e1000_hw *hw); 409int32_t e1000_get_software_semaphore(struct e1000_hw *hw);
407void e1000_release_software_semaphore(struct e1000_hw *hw); 410void e1000_release_software_semaphore(struct e1000_hw *hw);
@@ -899,14 +902,14 @@ struct e1000_ffvt_entry {
899#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */ 902#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */
900#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */ 903#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */
901#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ 904#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */
902#define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */ 905#define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */
903#define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */ 906#define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */
904#define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */ 907#define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */
905#define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */ 908#define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */
906#define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */ 909#define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */
907#define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */ 910#define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */
908#define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */ 911#define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */
909#define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */ 912#define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */
910#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ 913#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */
911#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ 914#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */
912#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ 915#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */
@@ -1761,7 +1764,6 @@ struct e1000_hw {
1761#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ 1764#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
1762#define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc. 1765#define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc.
1763 still to be processed. */ 1766 still to be processed. */
1764
1765/* Transmit Configuration Word */ 1767/* Transmit Configuration Word */
1766#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ 1768#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */
1767#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ 1769#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d0a5d1656c5f..31e332935e5a 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -29,11 +29,71 @@
29#include "e1000.h" 29#include "e1000.h"
30 30
31/* Change Log 31/* Change Log
32 * 6.0.58 4/20/05 32 * 6.3.9 12/16/2005
33 * o Accepted ethtool cleanup patch from Stephen Hemminger 33 * o incorporate fix for recycled skbs from IBM LTC
34 * 6.0.44+ 2/15/05 34 * 6.3.7 11/18/2005
35 * o applied Anton's patch to resolve tx hang in hardware 35 * o Honor eeprom setting for enabling/disabling Wake On Lan
36 * o Applied Andrew Mortons patch - e1000 stops working after resume 36 * 6.3.5 11/17/2005
37 * o Fix memory leak in rx ring handling for PCI Express adapters
38 * 6.3.4 11/8/05
39 * o Patch from Jesper Juhl to remove redundant NULL checks for kfree
40 * 6.3.2 9/20/05
41 * o Render logic that sets/resets DRV_LOAD as inline functions to
42 * avoid code replication. If f/w is AMT then set DRV_LOAD only when
43 * network interface is open.
44 * o Handle DRV_LOAD set/reset in cases where AMT uses VLANs.
45 * o Adjust PBA partioning for Jumbo frames using MTU size and not
46 * rx_buffer_len
47 * 6.3.1 9/19/05
48 * o Use adapter->tx_timeout_factor in Tx Hung Detect logic
49 (e1000_clean_tx_irq)
50 * o Support for 8086:10B5 device (Quad Port)
51 * 6.2.14 9/15/05
52 * o In AMT enabled configurations, set/reset DRV_LOAD bit on interface
53 * open/close
54 * 6.2.13 9/14/05
55 * o Invoke e1000_check_mng_mode only for 8257x controllers since it
56 * accesses the FWSM that is not supported in other controllers
57 * 6.2.12 9/9/05
58 * o Add support for device id E1000_DEV_ID_82546GB_QUAD_COPPER
59 * o set RCTL:SECRC only for controllers newer than 82543.
60 * o When the n/w interface comes down reset DRV_LOAD bit to notify f/w.
61 * This code was moved from e1000_remove to e1000_close
62 * 6.2.10 9/6/05
63 * o Fix error in updating RDT in el1000_alloc_rx_buffers[_ps] -- one off.
64 * o Enable fc by default on 82573 controllers (do not read eeprom)
65 * o Fix rx_errors statistic not to include missed_packet_count
66 * o Fix rx_dropped statistic not to include missed_packet_count
67 (Padraig Brady)
68 * 6.2.9 8/30/05
69 * o Remove call to update statistics from the controller ib e1000_get_stats
70 * 6.2.8 8/30/05
71 * o Improved algorithm for rx buffer allocation/rdt update
72 * o Flow control watermarks relative to rx PBA size
73 * o Simplified 'Tx Hung' detect logic
74 * 6.2.7 8/17/05
75 * o Report rx buffer allocation failures and tx timeout counts in stats
76 * 6.2.6 8/16/05
77 * o Implement workaround for controller erratum -- linear non-tso packet
78 * following a TSO gets written back prematurely
79 * 6.2.5 8/15/05
80 * o Set netdev->tx_queue_len based on link speed/duplex settings.
81 * o Fix net_stats.rx_fifo_errors <p@draigBrady.com>
82 * o Do not power off PHY if SoL/IDER session is active
83 * 6.2.4 8/10/05
84 * o Fix loopback test setup/cleanup for 82571/3 controllers
85 * o Fix parsing of outgoing packets (e1000_transfer_dhcp_info) to treat
86 * all packets as raw
87 * o Prevent operations that will cause the PHY to be reset if SoL/IDER
88 * sessions are active and log a message
89 * 6.2.2 7/21/05
90 * o used fixed size descriptors for all MTU sizes, reduces memory load
91 * 6.1.2 4/13/05
92 * o Fixed ethtool diagnostics
93 * o Enabled flow control to take default eeprom settings
94 * o Added stats_lock around e1000_read_phy_reg commands to avoid concurrent
95 * calls, one from mii_ioctl and other from within update_stats while
96 * processing MIIREG ioctl.
37 */ 97 */
38 98
39char e1000_driver_name[] = "e1000"; 99char e1000_driver_name[] = "e1000";
@@ -295,7 +355,7 @@ e1000_irq_disable(struct e1000_adapter *adapter)
295static inline void 355static inline void
296e1000_irq_enable(struct e1000_adapter *adapter) 356e1000_irq_enable(struct e1000_adapter *adapter)
297{ 357{
298 if(likely(atomic_dec_and_test(&adapter->irq_sem))) { 358 if (likely(atomic_dec_and_test(&adapter->irq_sem))) {
299 E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK); 359 E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
300 E1000_WRITE_FLUSH(&adapter->hw); 360 E1000_WRITE_FLUSH(&adapter->hw);
301 } 361 }
@@ -307,17 +367,17 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
307 struct net_device *netdev = adapter->netdev; 367 struct net_device *netdev = adapter->netdev;
308 uint16_t vid = adapter->hw.mng_cookie.vlan_id; 368 uint16_t vid = adapter->hw.mng_cookie.vlan_id;
309 uint16_t old_vid = adapter->mng_vlan_id; 369 uint16_t old_vid = adapter->mng_vlan_id;
310 if(adapter->vlgrp) { 370 if (adapter->vlgrp) {
311 if(!adapter->vlgrp->vlan_devices[vid]) { 371 if (!adapter->vlgrp->vlan_devices[vid]) {
312 if(adapter->hw.mng_cookie.status & 372 if (adapter->hw.mng_cookie.status &
313 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { 373 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
314 e1000_vlan_rx_add_vid(netdev, vid); 374 e1000_vlan_rx_add_vid(netdev, vid);
315 adapter->mng_vlan_id = vid; 375 adapter->mng_vlan_id = vid;
316 } else 376 } else
317 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 377 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
318 378
319 if((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && 379 if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) &&
320 (vid != old_vid) && 380 (vid != old_vid) &&
321 !adapter->vlgrp->vlan_devices[old_vid]) 381 !adapter->vlgrp->vlan_devices[old_vid])
322 e1000_vlan_rx_kill_vid(netdev, old_vid); 382 e1000_vlan_rx_kill_vid(netdev, old_vid);
323 } 383 }
@@ -401,10 +461,10 @@ e1000_up(struct e1000_adapter *adapter)
401 /* hardware has been reset, we need to reload some things */ 461 /* hardware has been reset, we need to reload some things */
402 462
403 /* Reset the PHY if it was previously powered down */ 463 /* Reset the PHY if it was previously powered down */
404 if(adapter->hw.media_type == e1000_media_type_copper) { 464 if (adapter->hw.media_type == e1000_media_type_copper) {
405 uint16_t mii_reg; 465 uint16_t mii_reg;
406 e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); 466 e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
407 if(mii_reg & MII_CR_POWER_DOWN) 467 if (mii_reg & MII_CR_POWER_DOWN)
408 e1000_phy_reset(&adapter->hw); 468 e1000_phy_reset(&adapter->hw);
409 } 469 }
410 470
@@ -425,16 +485,16 @@ e1000_up(struct e1000_adapter *adapter)
425 } 485 }
426 486
427#ifdef CONFIG_PCI_MSI 487#ifdef CONFIG_PCI_MSI
428 if(adapter->hw.mac_type > e1000_82547_rev_2) { 488 if (adapter->hw.mac_type > e1000_82547_rev_2) {
429 adapter->have_msi = TRUE; 489 adapter->have_msi = TRUE;
430 if((err = pci_enable_msi(adapter->pdev))) { 490 if ((err = pci_enable_msi(adapter->pdev))) {
431 DPRINTK(PROBE, ERR, 491 DPRINTK(PROBE, ERR,
432 "Unable to allocate MSI interrupt Error: %d\n", err); 492 "Unable to allocate MSI interrupt Error: %d\n", err);
433 adapter->have_msi = FALSE; 493 adapter->have_msi = FALSE;
434 } 494 }
435 } 495 }
436#endif 496#endif
437 if((err = request_irq(adapter->pdev->irq, &e1000_intr, 497 if ((err = request_irq(adapter->pdev->irq, &e1000_intr,
438 SA_SHIRQ | SA_SAMPLE_RANDOM, 498 SA_SHIRQ | SA_SAMPLE_RANDOM,
439 netdev->name, netdev))) { 499 netdev->name, netdev))) {
440 DPRINTK(PROBE, ERR, 500 DPRINTK(PROBE, ERR,
@@ -471,7 +531,7 @@ e1000_down(struct e1000_adapter *adapter)
471#endif 531#endif
472 free_irq(adapter->pdev->irq, netdev); 532 free_irq(adapter->pdev->irq, netdev);
473#ifdef CONFIG_PCI_MSI 533#ifdef CONFIG_PCI_MSI
474 if(adapter->hw.mac_type > e1000_82547_rev_2 && 534 if (adapter->hw.mac_type > e1000_82547_rev_2 &&
475 adapter->have_msi == TRUE) 535 adapter->have_msi == TRUE)
476 pci_disable_msi(adapter->pdev); 536 pci_disable_msi(adapter->pdev);
477#endif 537#endif
@@ -537,12 +597,12 @@ e1000_reset(struct e1000_adapter *adapter)
537 break; 597 break;
538 } 598 }
539 599
540 if((adapter->hw.mac_type != e1000_82573) && 600 if ((adapter->hw.mac_type != e1000_82573) &&
541 (adapter->netdev->mtu > E1000_RXBUFFER_8192)) 601 (adapter->netdev->mtu > E1000_RXBUFFER_8192))
542 pba -= 8; /* allocate more FIFO for Tx */ 602 pba -= 8; /* allocate more FIFO for Tx */
543 603
544 604
545 if(adapter->hw.mac_type == e1000_82547) { 605 if (adapter->hw.mac_type == e1000_82547) {
546 adapter->tx_fifo_head = 0; 606 adapter->tx_fifo_head = 0;
547 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT; 607 adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
548 adapter->tx_fifo_size = 608 adapter->tx_fifo_size =
@@ -565,9 +625,9 @@ e1000_reset(struct e1000_adapter *adapter)
565 625
566 /* Allow time for pending master requests to run */ 626 /* Allow time for pending master requests to run */
567 e1000_reset_hw(&adapter->hw); 627 e1000_reset_hw(&adapter->hw);
568 if(adapter->hw.mac_type >= e1000_82544) 628 if (adapter->hw.mac_type >= e1000_82544)
569 E1000_WRITE_REG(&adapter->hw, WUC, 0); 629 E1000_WRITE_REG(&adapter->hw, WUC, 0);
570 if(e1000_init_hw(&adapter->hw)) 630 if (e1000_init_hw(&adapter->hw))
571 DPRINTK(PROBE, ERR, "Hardware Error\n"); 631 DPRINTK(PROBE, ERR, "Hardware Error\n");
572 e1000_update_mng_vlan(adapter); 632 e1000_update_mng_vlan(adapter);
573 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 633 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -606,26 +666,26 @@ e1000_probe(struct pci_dev *pdev,
606 int i, err, pci_using_dac; 666 int i, err, pci_using_dac;
607 uint16_t eeprom_data; 667 uint16_t eeprom_data;
608 uint16_t eeprom_apme_mask = E1000_EEPROM_APME; 668 uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
609 if((err = pci_enable_device(pdev))) 669 if ((err = pci_enable_device(pdev)))
610 return err; 670 return err;
611 671
612 if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { 672 if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
613 pci_using_dac = 1; 673 pci_using_dac = 1;
614 } else { 674 } else {
615 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { 675 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
616 E1000_ERR("No usable DMA configuration, aborting\n"); 676 E1000_ERR("No usable DMA configuration, aborting\n");
617 return err; 677 return err;
618 } 678 }
619 pci_using_dac = 0; 679 pci_using_dac = 0;
620 } 680 }
621 681
622 if((err = pci_request_regions(pdev, e1000_driver_name))) 682 if ((err = pci_request_regions(pdev, e1000_driver_name)))
623 return err; 683 return err;
624 684
625 pci_set_master(pdev); 685 pci_set_master(pdev);
626 686
627 netdev = alloc_etherdev(sizeof(struct e1000_adapter)); 687 netdev = alloc_etherdev(sizeof(struct e1000_adapter));
628 if(!netdev) { 688 if (!netdev) {
629 err = -ENOMEM; 689 err = -ENOMEM;
630 goto err_alloc_etherdev; 690 goto err_alloc_etherdev;
631 } 691 }
@@ -644,15 +704,15 @@ e1000_probe(struct pci_dev *pdev,
644 mmio_len = pci_resource_len(pdev, BAR_0); 704 mmio_len = pci_resource_len(pdev, BAR_0);
645 705
646 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); 706 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
647 if(!adapter->hw.hw_addr) { 707 if (!adapter->hw.hw_addr) {
648 err = -EIO; 708 err = -EIO;
649 goto err_ioremap; 709 goto err_ioremap;
650 } 710 }
651 711
652 for(i = BAR_1; i <= BAR_5; i++) { 712 for (i = BAR_1; i <= BAR_5; i++) {
653 if(pci_resource_len(pdev, i) == 0) 713 if (pci_resource_len(pdev, i) == 0)
654 continue; 714 continue;
655 if(pci_resource_flags(pdev, i) & IORESOURCE_IO) { 715 if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
656 adapter->hw.io_base = pci_resource_start(pdev, i); 716 adapter->hw.io_base = pci_resource_start(pdev, i);
657 break; 717 break;
658 } 718 }
@@ -689,13 +749,13 @@ e1000_probe(struct pci_dev *pdev,
689 749
690 /* setup the private structure */ 750 /* setup the private structure */
691 751
692 if((err = e1000_sw_init(adapter))) 752 if ((err = e1000_sw_init(adapter)))
693 goto err_sw_init; 753 goto err_sw_init;
694 754
695 if((err = e1000_check_phy_reset_block(&adapter->hw))) 755 if ((err = e1000_check_phy_reset_block(&adapter->hw)))
696 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); 756 DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
697 757
698 if(adapter->hw.mac_type >= e1000_82543) { 758 if (adapter->hw.mac_type >= e1000_82543) {
699 netdev->features = NETIF_F_SG | 759 netdev->features = NETIF_F_SG |
700 NETIF_F_HW_CSUM | 760 NETIF_F_HW_CSUM |
701 NETIF_F_HW_VLAN_TX | 761 NETIF_F_HW_VLAN_TX |
@@ -704,16 +764,16 @@ e1000_probe(struct pci_dev *pdev,
704 } 764 }
705 765
706#ifdef NETIF_F_TSO 766#ifdef NETIF_F_TSO
707 if((adapter->hw.mac_type >= e1000_82544) && 767 if ((adapter->hw.mac_type >= e1000_82544) &&
708 (adapter->hw.mac_type != e1000_82547)) 768 (adapter->hw.mac_type != e1000_82547))
709 netdev->features |= NETIF_F_TSO; 769 netdev->features |= NETIF_F_TSO;
710 770
711#ifdef NETIF_F_TSO_IPV6 771#ifdef NETIF_F_TSO_IPV6
712 if(adapter->hw.mac_type > e1000_82547_rev_2) 772 if (adapter->hw.mac_type > e1000_82547_rev_2)
713 netdev->features |= NETIF_F_TSO_IPV6; 773 netdev->features |= NETIF_F_TSO_IPV6;
714#endif 774#endif
715#endif 775#endif
716 if(pci_using_dac) 776 if (pci_using_dac)
717 netdev->features |= NETIF_F_HIGHDMA; 777 netdev->features |= NETIF_F_HIGHDMA;
718 778
719 /* hard_start_xmit is safe against parallel locking */ 779 /* hard_start_xmit is safe against parallel locking */
@@ -721,14 +781,14 @@ e1000_probe(struct pci_dev *pdev,
721 781
722 adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); 782 adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw);
723 783
724 /* before reading the EEPROM, reset the controller to 784 /* before reading the EEPROM, reset the controller to
725 * put the device in a known good starting state */ 785 * put the device in a known good starting state */
726 786
727 e1000_reset_hw(&adapter->hw); 787 e1000_reset_hw(&adapter->hw);
728 788
729 /* make sure the EEPROM is good */ 789 /* make sure the EEPROM is good */
730 790
731 if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) { 791 if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
732 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); 792 DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
733 err = -EIO; 793 err = -EIO;
734 goto err_eeprom; 794 goto err_eeprom;
@@ -736,12 +796,12 @@ e1000_probe(struct pci_dev *pdev,
736 796
737 /* copy the MAC address out of the EEPROM */ 797 /* copy the MAC address out of the EEPROM */
738 798
739 if(e1000_read_mac_addr(&adapter->hw)) 799 if (e1000_read_mac_addr(&adapter->hw))
740 DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); 800 DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
741 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); 801 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
742 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); 802 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
743 803
744 if(!is_valid_ether_addr(netdev->perm_addr)) { 804 if (!is_valid_ether_addr(netdev->perm_addr)) {
745 DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); 805 DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
746 err = -EIO; 806 err = -EIO;
747 goto err_eeprom; 807 goto err_eeprom;
@@ -781,7 +841,7 @@ e1000_probe(struct pci_dev *pdev,
781 * enable the ACPI Magic Packet filter 841 * enable the ACPI Magic Packet filter
782 */ 842 */
783 843
784 switch(adapter->hw.mac_type) { 844 switch (adapter->hw.mac_type) {
785 case e1000_82542_rev2_0: 845 case e1000_82542_rev2_0:
786 case e1000_82542_rev2_1: 846 case e1000_82542_rev2_1:
787 case e1000_82543: 847 case e1000_82543:
@@ -794,7 +854,7 @@ e1000_probe(struct pci_dev *pdev,
794 case e1000_82546: 854 case e1000_82546:
795 case e1000_82546_rev_3: 855 case e1000_82546_rev_3:
796 case e1000_82571: 856 case e1000_82571:
797 if(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1){ 857 if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1){
798 e1000_read_eeprom(&adapter->hw, 858 e1000_read_eeprom(&adapter->hw,
799 EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); 859 EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
800 break; 860 break;
@@ -805,7 +865,7 @@ e1000_probe(struct pci_dev *pdev,
805 EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); 865 EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
806 break; 866 break;
807 } 867 }
808 if(eeprom_data & eeprom_apme_mask) 868 if (eeprom_data & eeprom_apme_mask)
809 adapter->wol |= E1000_WUFC_MAG; 869 adapter->wol |= E1000_WUFC_MAG;
810 870
811 /* print bus type/speed/width info */ 871 /* print bus type/speed/width info */
@@ -840,7 +900,7 @@ e1000_probe(struct pci_dev *pdev,
840 e1000_get_hw_control(adapter); 900 e1000_get_hw_control(adapter);
841 901
842 strcpy(netdev->name, "eth%d"); 902 strcpy(netdev->name, "eth%d");
843 if((err = register_netdev(netdev))) 903 if ((err = register_netdev(netdev)))
844 goto err_register; 904 goto err_register;
845 905
846 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); 906 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
@@ -881,10 +941,10 @@ e1000_remove(struct pci_dev *pdev)
881 941
882 flush_scheduled_work(); 942 flush_scheduled_work();
883 943
884 if(adapter->hw.mac_type >= e1000_82540 && 944 if (adapter->hw.mac_type >= e1000_82540 &&
885 adapter->hw.media_type == e1000_media_type_copper) { 945 adapter->hw.media_type == e1000_media_type_copper) {
886 manc = E1000_READ_REG(&adapter->hw, MANC); 946 manc = E1000_READ_REG(&adapter->hw, MANC);
887 if(manc & E1000_MANC_SMBUS_EN) { 947 if (manc & E1000_MANC_SMBUS_EN) {
888 manc |= E1000_MANC_ARP_EN; 948 manc |= E1000_MANC_ARP_EN;
889 E1000_WRITE_REG(&adapter->hw, MANC, manc); 949 E1000_WRITE_REG(&adapter->hw, MANC, manc);
890 } 950 }
@@ -900,7 +960,7 @@ e1000_remove(struct pci_dev *pdev)
900 __dev_put(&adapter->polling_netdev[i]); 960 __dev_put(&adapter->polling_netdev[i]);
901#endif 961#endif
902 962
903 if(!e1000_check_phy_reset_block(&adapter->hw)) 963 if (!e1000_check_phy_reset_block(&adapter->hw))
904 e1000_phy_hw_reset(&adapter->hw); 964 e1000_phy_hw_reset(&adapter->hw);
905 965
906 kfree(adapter->tx_ring); 966 kfree(adapter->tx_ring);
@@ -959,19 +1019,19 @@ e1000_sw_init(struct e1000_adapter *adapter)
959 1019
960 /* identify the MAC */ 1020 /* identify the MAC */
961 1021
962 if(e1000_set_mac_type(hw)) { 1022 if (e1000_set_mac_type(hw)) {
963 DPRINTK(PROBE, ERR, "Unknown MAC Type\n"); 1023 DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
964 return -EIO; 1024 return -EIO;
965 } 1025 }
966 1026
967 /* initialize eeprom parameters */ 1027 /* initialize eeprom parameters */
968 1028
969 if(e1000_init_eeprom_params(hw)) { 1029 if (e1000_init_eeprom_params(hw)) {
970 E1000_ERR("EEPROM initialization failed\n"); 1030 E1000_ERR("EEPROM initialization failed\n");
971 return -EIO; 1031 return -EIO;
972 } 1032 }
973 1033
974 switch(hw->mac_type) { 1034 switch (hw->mac_type) {
975 default: 1035 default:
976 break; 1036 break;
977 case e1000_82541: 1037 case e1000_82541:
@@ -990,7 +1050,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
990 1050
991 /* Copper options */ 1051 /* Copper options */
992 1052
993 if(hw->media_type == e1000_media_type_copper) { 1053 if (hw->media_type == e1000_media_type_copper) {
994 hw->mdix = AUTO_ALL_MODES; 1054 hw->mdix = AUTO_ALL_MODES;
995 hw->disable_polarity_correction = FALSE; 1055 hw->disable_polarity_correction = FALSE;
996 hw->master_slave = E1000_MASTER_SLAVE; 1056 hw->master_slave = E1000_MASTER_SLAVE;
@@ -1166,10 +1226,10 @@ e1000_open(struct net_device *netdev)
1166 if ((err = e1000_setup_all_rx_resources(adapter))) 1226 if ((err = e1000_setup_all_rx_resources(adapter)))
1167 goto err_setup_rx; 1227 goto err_setup_rx;
1168 1228
1169 if((err = e1000_up(adapter))) 1229 if ((err = e1000_up(adapter)))
1170 goto err_up; 1230 goto err_up;
1171 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 1231 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
1172 if((adapter->hw.mng_cookie.status & 1232 if ((adapter->hw.mng_cookie.status &
1173 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { 1233 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
1174 e1000_update_mng_vlan(adapter); 1234 e1000_update_mng_vlan(adapter);
1175 } 1235 }
@@ -1214,7 +1274,7 @@ e1000_close(struct net_device *netdev)
1214 e1000_free_all_tx_resources(adapter); 1274 e1000_free_all_tx_resources(adapter);
1215 e1000_free_all_rx_resources(adapter); 1275 e1000_free_all_rx_resources(adapter);
1216 1276
1217 if((adapter->hw.mng_cookie.status & 1277 if ((adapter->hw.mng_cookie.status &
1218 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { 1278 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
1219 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 1279 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
1220 } 1280 }
@@ -1269,7 +1329,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
1269 size = sizeof(struct e1000_buffer) * txdr->count; 1329 size = sizeof(struct e1000_buffer) * txdr->count;
1270 1330
1271 txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); 1331 txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus));
1272 if(!txdr->buffer_info) { 1332 if (!txdr->buffer_info) {
1273 DPRINTK(PROBE, ERR, 1333 DPRINTK(PROBE, ERR,
1274 "Unable to allocate memory for the transmit descriptor ring\n"); 1334 "Unable to allocate memory for the transmit descriptor ring\n");
1275 return -ENOMEM; 1335 return -ENOMEM;
@@ -1282,7 +1342,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
1282 E1000_ROUNDUP(txdr->size, 4096); 1342 E1000_ROUNDUP(txdr->size, 4096);
1283 1343
1284 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); 1344 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
1285 if(!txdr->desc) { 1345 if (!txdr->desc) {
1286setup_tx_desc_die: 1346setup_tx_desc_die:
1287 vfree(txdr->buffer_info); 1347 vfree(txdr->buffer_info);
1288 DPRINTK(PROBE, ERR, 1348 DPRINTK(PROBE, ERR,
@@ -1298,8 +1358,8 @@ setup_tx_desc_die:
1298 "at %p\n", txdr->size, txdr->desc); 1358 "at %p\n", txdr->size, txdr->desc);
1299 /* Try again, without freeing the previous */ 1359 /* Try again, without freeing the previous */
1300 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); 1360 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
1301 if(!txdr->desc) {
1302 /* Failed allocation, critical failure */ 1361 /* Failed allocation, critical failure */
1362 if (!txdr->desc) {
1303 pci_free_consistent(pdev, txdr->size, olddesc, olddma); 1363 pci_free_consistent(pdev, txdr->size, olddesc, olddma);
1304 goto setup_tx_desc_die; 1364 goto setup_tx_desc_die;
1305 } 1365 }
@@ -1499,7 +1559,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
1499 1559
1500 size = sizeof(struct e1000_ps_page) * rxdr->count; 1560 size = sizeof(struct e1000_ps_page) * rxdr->count;
1501 rxdr->ps_page = kmalloc(size, GFP_KERNEL); 1561 rxdr->ps_page = kmalloc(size, GFP_KERNEL);
1502 if(!rxdr->ps_page) { 1562 if (!rxdr->ps_page) {
1503 vfree(rxdr->buffer_info); 1563 vfree(rxdr->buffer_info);
1504 DPRINTK(PROBE, ERR, 1564 DPRINTK(PROBE, ERR,
1505 "Unable to allocate memory for the receive descriptor ring\n"); 1565 "Unable to allocate memory for the receive descriptor ring\n");
@@ -1509,7 +1569,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
1509 1569
1510 size = sizeof(struct e1000_ps_page_dma) * rxdr->count; 1570 size = sizeof(struct e1000_ps_page_dma) * rxdr->count;
1511 rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL); 1571 rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL);
1512 if(!rxdr->ps_page_dma) { 1572 if (!rxdr->ps_page_dma) {
1513 vfree(rxdr->buffer_info); 1573 vfree(rxdr->buffer_info);
1514 kfree(rxdr->ps_page); 1574 kfree(rxdr->ps_page);
1515 DPRINTK(PROBE, ERR, 1575 DPRINTK(PROBE, ERR,
@@ -1518,7 +1578,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
1518 } 1578 }
1519 memset(rxdr->ps_page_dma, 0, size); 1579 memset(rxdr->ps_page_dma, 0, size);
1520 1580
1521 if(adapter->hw.mac_type <= e1000_82547_rev_2) 1581 if (adapter->hw.mac_type <= e1000_82547_rev_2)
1522 desc_len = sizeof(struct e1000_rx_desc); 1582 desc_len = sizeof(struct e1000_rx_desc);
1523 else 1583 else
1524 desc_len = sizeof(union e1000_rx_desc_packet_split); 1584 desc_len = sizeof(union e1000_rx_desc_packet_split);
@@ -1621,7 +1681,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1621{ 1681{
1622 uint32_t rctl, rfctl; 1682 uint32_t rctl, rfctl;
1623 uint32_t psrctl = 0; 1683 uint32_t psrctl = 0;
1624#ifdef CONFIG_E1000_PACKET_SPLIT 1684#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
1625 uint32_t pages = 0; 1685 uint32_t pages = 0;
1626#endif 1686#endif
1627 1687
@@ -1647,32 +1707,17 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1647 rctl |= E1000_RCTL_LPE; 1707 rctl |= E1000_RCTL_LPE;
1648 1708
1649 /* Setup buffer sizes */ 1709 /* Setup buffer sizes */
1650 if(adapter->hw.mac_type >= e1000_82571) { 1710 if (adapter->hw.mac_type >= e1000_82571) {
1651 /* We can now specify buffers in 1K increments. 1711 /* We can now specify buffers in 1K increments.
1652 * BSIZE and BSEX are ignored in this case. */ 1712 * BSIZE and BSEX are ignored in this case. */
1653 rctl |= adapter->rx_buffer_len << 0x11; 1713 rctl |= adapter->rx_buffer_len << 0x11;
1654 } else { 1714 } else {
1655 rctl &= ~E1000_RCTL_SZ_4096; 1715 rctl &= ~E1000_RCTL_SZ_4096;
1656 rctl |= E1000_RCTL_BSEX; 1716 rctl &= ~E1000_RCTL_BSEX;
1657 switch (adapter->rx_buffer_len) { 1717 rctl |= E1000_RCTL_SZ_2048;
1658 case E1000_RXBUFFER_2048:
1659 default:
1660 rctl |= E1000_RCTL_SZ_2048;
1661 rctl &= ~E1000_RCTL_BSEX;
1662 break;
1663 case E1000_RXBUFFER_4096:
1664 rctl |= E1000_RCTL_SZ_4096;
1665 break;
1666 case E1000_RXBUFFER_8192:
1667 rctl |= E1000_RCTL_SZ_8192;
1668 break;
1669 case E1000_RXBUFFER_16384:
1670 rctl |= E1000_RCTL_SZ_16384;
1671 break;
1672 }
1673 } 1718 }
1674 1719
1675#ifdef CONFIG_E1000_PACKET_SPLIT 1720#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
1676 /* 82571 and greater support packet-split where the protocol 1721 /* 82571 and greater support packet-split where the protocol
1677 * header is placed in skb->data and the packet data is 1722 * header is placed in skb->data and the packet data is
1678 * placed in pages hanging off of skb_shinfo(skb)->nr_frags. 1723 * placed in pages hanging off of skb_shinfo(skb)->nr_frags.
@@ -1696,7 +1741,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1696 E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); 1741 E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
1697 1742
1698 rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC; 1743 rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
1699 1744
1700 psrctl |= adapter->rx_ps_bsize0 >> 1745 psrctl |= adapter->rx_ps_bsize0 >>
1701 E1000_PSRCTL_BSIZE0_SHIFT; 1746 E1000_PSRCTL_BSIZE0_SHIFT;
1702 1747
@@ -1758,7 +1803,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1758 1803
1759 if (hw->mac_type >= e1000_82540) { 1804 if (hw->mac_type >= e1000_82540) {
1760 E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay); 1805 E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay);
1761 if(adapter->itr > 1) 1806 if (adapter->itr > 1)
1762 E1000_WRITE_REG(hw, ITR, 1807 E1000_WRITE_REG(hw, ITR,
1763 1000000000 / (adapter->itr * 256)); 1808 1000000000 / (adapter->itr * 256));
1764 } 1809 }
@@ -1847,13 +1892,13 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1847 /* Enable 82543 Receive Checksum Offload for TCP and UDP */ 1892 /* Enable 82543 Receive Checksum Offload for TCP and UDP */
1848 if (hw->mac_type >= e1000_82543) { 1893 if (hw->mac_type >= e1000_82543) {
1849 rxcsum = E1000_READ_REG(hw, RXCSUM); 1894 rxcsum = E1000_READ_REG(hw, RXCSUM);
1850 if(adapter->rx_csum == TRUE) { 1895 if (adapter->rx_csum == TRUE) {
1851 rxcsum |= E1000_RXCSUM_TUOFL; 1896 rxcsum |= E1000_RXCSUM_TUOFL;
1852 1897
1853 /* Enable 82571 IPv4 payload checksum for UDP fragments 1898 /* Enable 82571 IPv4 payload checksum for UDP fragments
1854 * Must be used in conjunction with packet-split. */ 1899 * Must be used in conjunction with packet-split. */
1855 if ((hw->mac_type >= e1000_82571) && 1900 if ((hw->mac_type >= e1000_82571) &&
1856 (adapter->rx_ps_pages)) { 1901 (adapter->rx_ps_pages)) {
1857 rxcsum |= E1000_RXCSUM_IPPCSE; 1902 rxcsum |= E1000_RXCSUM_IPPCSE;
1858 } 1903 }
1859 } else { 1904 } else {
@@ -1915,7 +1960,7 @@ static inline void
1915e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, 1960e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter,
1916 struct e1000_buffer *buffer_info) 1961 struct e1000_buffer *buffer_info)
1917{ 1962{
1918 if(buffer_info->dma) { 1963 if (buffer_info->dma) {
1919 pci_unmap_page(adapter->pdev, 1964 pci_unmap_page(adapter->pdev,
1920 buffer_info->dma, 1965 buffer_info->dma,
1921 buffer_info->length, 1966 buffer_info->length,
@@ -1942,7 +1987,7 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter,
1942 1987
1943 /* Free all the Tx ring sk_buffs */ 1988 /* Free all the Tx ring sk_buffs */
1944 1989
1945 for(i = 0; i < tx_ring->count; i++) { 1990 for (i = 0; i < tx_ring->count; i++) {
1946 buffer_info = &tx_ring->buffer_info[i]; 1991 buffer_info = &tx_ring->buffer_info[i];
1947 e1000_unmap_and_free_tx_resource(adapter, buffer_info); 1992 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
1948 } 1993 }
@@ -2038,10 +2083,9 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter,
2038 unsigned int i, j; 2083 unsigned int i, j;
2039 2084
2040 /* Free all the Rx ring sk_buffs */ 2085 /* Free all the Rx ring sk_buffs */
2041 2086 for (i = 0; i < rx_ring->count; i++) {
2042 for(i = 0; i < rx_ring->count; i++) {
2043 buffer_info = &rx_ring->buffer_info[i]; 2087 buffer_info = &rx_ring->buffer_info[i];
2044 if(buffer_info->skb) { 2088 if (buffer_info->skb) {
2045 pci_unmap_single(pdev, 2089 pci_unmap_single(pdev,
2046 buffer_info->dma, 2090 buffer_info->dma,
2047 buffer_info->length, 2091 buffer_info->length,
@@ -2122,7 +2166,7 @@ e1000_enter_82542_rst(struct e1000_adapter *adapter)
2122 E1000_WRITE_FLUSH(&adapter->hw); 2166 E1000_WRITE_FLUSH(&adapter->hw);
2123 mdelay(5); 2167 mdelay(5);
2124 2168
2125 if(netif_running(netdev)) 2169 if (netif_running(netdev))
2126 e1000_clean_all_rx_rings(adapter); 2170 e1000_clean_all_rx_rings(adapter);
2127} 2171}
2128 2172
@@ -2138,13 +2182,13 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter)
2138 E1000_WRITE_FLUSH(&adapter->hw); 2182 E1000_WRITE_FLUSH(&adapter->hw);
2139 mdelay(5); 2183 mdelay(5);
2140 2184
2141 if(adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE) 2185 if (adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE)
2142 e1000_pci_set_mwi(&adapter->hw); 2186 e1000_pci_set_mwi(&adapter->hw);
2143 2187
2144 if(netif_running(netdev)) { 2188 if (netif_running(netdev)) {
2145 e1000_configure_rx(adapter);
2146 /* No need to loop, because 82542 supports only 1 queue */ 2189 /* No need to loop, because 82542 supports only 1 queue */
2147 struct e1000_rx_ring *ring = &adapter->rx_ring[0]; 2190 struct e1000_rx_ring *ring = &adapter->rx_ring[0];
2191 e1000_configure_rx(adapter);
2148 adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring)); 2192 adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
2149 } 2193 }
2150} 2194}
@@ -2163,12 +2207,12 @@ e1000_set_mac(struct net_device *netdev, void *p)
2163 struct e1000_adapter *adapter = netdev_priv(netdev); 2207 struct e1000_adapter *adapter = netdev_priv(netdev);
2164 struct sockaddr *addr = p; 2208 struct sockaddr *addr = p;
2165 2209
2166 if(!is_valid_ether_addr(addr->sa_data)) 2210 if (!is_valid_ether_addr(addr->sa_data))
2167 return -EADDRNOTAVAIL; 2211 return -EADDRNOTAVAIL;
2168 2212
2169 /* 82542 2.0 needs to be in reset to write receive address registers */ 2213 /* 82542 2.0 needs to be in reset to write receive address registers */
2170 2214
2171 if(adapter->hw.mac_type == e1000_82542_rev2_0) 2215 if (adapter->hw.mac_type == e1000_82542_rev2_0)
2172 e1000_enter_82542_rst(adapter); 2216 e1000_enter_82542_rst(adapter);
2173 2217
2174 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 2218 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
@@ -2182,17 +2226,17 @@ e1000_set_mac(struct net_device *netdev, void *p)
2182 /* activate the work around */ 2226 /* activate the work around */
2183 adapter->hw.laa_is_present = 1; 2227 adapter->hw.laa_is_present = 1;
2184 2228
2185 /* Hold a copy of the LAA in RAR[14] This is done so that 2229 /* Hold a copy of the LAA in RAR[14] This is done so that
2186 * between the time RAR[0] gets clobbered and the time it 2230 * between the time RAR[0] gets clobbered and the time it
2187 * gets fixed (in e1000_watchdog), the actual LAA is in one 2231 * gets fixed (in e1000_watchdog), the actual LAA is in one
2188 * of the RARs and no incoming packets directed to this port 2232 * of the RARs and no incoming packets directed to this port
2189 * are dropped. Eventaully the LAA will be in RAR[0] and 2233 * are dropped. Eventaully the LAA will be in RAR[0] and
2190 * RAR[14] */ 2234 * RAR[14] */
2191 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 2235 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr,
2192 E1000_RAR_ENTRIES - 1); 2236 E1000_RAR_ENTRIES - 1);
2193 } 2237 }
2194 2238
2195 if(adapter->hw.mac_type == e1000_82542_rev2_0) 2239 if (adapter->hw.mac_type == e1000_82542_rev2_0)
2196 e1000_leave_82542_rst(adapter); 2240 e1000_leave_82542_rst(adapter);
2197 2241
2198 return 0; 2242 return 0;
@@ -2226,9 +2270,9 @@ e1000_set_multi(struct net_device *netdev)
2226 2270
2227 rctl = E1000_READ_REG(hw, RCTL); 2271 rctl = E1000_READ_REG(hw, RCTL);
2228 2272
2229 if(netdev->flags & IFF_PROMISC) { 2273 if (netdev->flags & IFF_PROMISC) {
2230 rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); 2274 rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
2231 } else if(netdev->flags & IFF_ALLMULTI) { 2275 } else if (netdev->flags & IFF_ALLMULTI) {
2232 rctl |= E1000_RCTL_MPE; 2276 rctl |= E1000_RCTL_MPE;
2233 rctl &= ~E1000_RCTL_UPE; 2277 rctl &= ~E1000_RCTL_UPE;
2234 } else { 2278 } else {
@@ -2239,7 +2283,7 @@ e1000_set_multi(struct net_device *netdev)
2239 2283
2240 /* 82542 2.0 needs to be in reset to write receive address registers */ 2284 /* 82542 2.0 needs to be in reset to write receive address registers */
2241 2285
2242 if(hw->mac_type == e1000_82542_rev2_0) 2286 if (hw->mac_type == e1000_82542_rev2_0)
2243 e1000_enter_82542_rst(adapter); 2287 e1000_enter_82542_rst(adapter);
2244 2288
2245 /* load the first 14 multicast address into the exact filters 1-14 2289 /* load the first 14 multicast address into the exact filters 1-14
@@ -2249,7 +2293,7 @@ e1000_set_multi(struct net_device *netdev)
2249 */ 2293 */
2250 mc_ptr = netdev->mc_list; 2294 mc_ptr = netdev->mc_list;
2251 2295
2252 for(i = 1; i < rar_entries; i++) { 2296 for (i = 1; i < rar_entries; i++) {
2253 if (mc_ptr) { 2297 if (mc_ptr) {
2254 e1000_rar_set(hw, mc_ptr->dmi_addr, i); 2298 e1000_rar_set(hw, mc_ptr->dmi_addr, i);
2255 mc_ptr = mc_ptr->next; 2299 mc_ptr = mc_ptr->next;
@@ -2261,17 +2305,17 @@ e1000_set_multi(struct net_device *netdev)
2261 2305
2262 /* clear the old settings from the multicast hash table */ 2306 /* clear the old settings from the multicast hash table */
2263 2307
2264 for(i = 0; i < E1000_NUM_MTA_REGISTERS; i++) 2308 for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++)
2265 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); 2309 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
2266 2310
2267 /* load any remaining addresses into the hash table */ 2311 /* load any remaining addresses into the hash table */
2268 2312
2269 for(; mc_ptr; mc_ptr = mc_ptr->next) { 2313 for (; mc_ptr; mc_ptr = mc_ptr->next) {
2270 hash_value = e1000_hash_mc_addr(hw, mc_ptr->dmi_addr); 2314 hash_value = e1000_hash_mc_addr(hw, mc_ptr->dmi_addr);
2271 e1000_mta_set(hw, hash_value); 2315 e1000_mta_set(hw, hash_value);
2272 } 2316 }
2273 2317
2274 if(hw->mac_type == e1000_82542_rev2_0) 2318 if (hw->mac_type == e1000_82542_rev2_0)
2275 e1000_leave_82542_rst(adapter); 2319 e1000_leave_82542_rst(adapter);
2276} 2320}
2277 2321
@@ -2297,8 +2341,8 @@ e1000_82547_tx_fifo_stall(unsigned long data)
2297 struct net_device *netdev = adapter->netdev; 2341 struct net_device *netdev = adapter->netdev;
2298 uint32_t tctl; 2342 uint32_t tctl;
2299 2343
2300 if(atomic_read(&adapter->tx_fifo_stall)) { 2344 if (atomic_read(&adapter->tx_fifo_stall)) {
2301 if((E1000_READ_REG(&adapter->hw, TDT) == 2345 if ((E1000_READ_REG(&adapter->hw, TDT) ==
2302 E1000_READ_REG(&adapter->hw, TDH)) && 2346 E1000_READ_REG(&adapter->hw, TDH)) &&
2303 (E1000_READ_REG(&adapter->hw, TDFT) == 2347 (E1000_READ_REG(&adapter->hw, TDFT) ==
2304 E1000_READ_REG(&adapter->hw, TDFH)) && 2348 E1000_READ_REG(&adapter->hw, TDFH)) &&
@@ -2350,18 +2394,18 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
2350 e1000_check_for_link(&adapter->hw); 2394 e1000_check_for_link(&adapter->hw);
2351 if (adapter->hw.mac_type == e1000_82573) { 2395 if (adapter->hw.mac_type == e1000_82573) {
2352 e1000_enable_tx_pkt_filtering(&adapter->hw); 2396 e1000_enable_tx_pkt_filtering(&adapter->hw);
2353 if(adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) 2397 if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
2354 e1000_update_mng_vlan(adapter); 2398 e1000_update_mng_vlan(adapter);
2355 } 2399 }
2356 2400
2357 if((adapter->hw.media_type == e1000_media_type_internal_serdes) && 2401 if ((adapter->hw.media_type == e1000_media_type_internal_serdes) &&
2358 !(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE)) 2402 !(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE))
2359 link = !adapter->hw.serdes_link_down; 2403 link = !adapter->hw.serdes_link_down;
2360 else 2404 else
2361 link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU; 2405 link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU;
2362 2406
2363 if(link) { 2407 if (link) {
2364 if(!netif_carrier_ok(netdev)) { 2408 if (!netif_carrier_ok(netdev)) {
2365 e1000_get_speed_and_duplex(&adapter->hw, 2409 e1000_get_speed_and_duplex(&adapter->hw,
2366 &adapter->link_speed, 2410 &adapter->link_speed,
2367 &adapter->link_duplex); 2411 &adapter->link_duplex);
@@ -2392,7 +2436,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
2392 adapter->smartspeed = 0; 2436 adapter->smartspeed = 0;
2393 } 2437 }
2394 } else { 2438 } else {
2395 if(netif_carrier_ok(netdev)) { 2439 if (netif_carrier_ok(netdev)) {
2396 adapter->link_speed = 0; 2440 adapter->link_speed = 0;
2397 adapter->link_duplex = 0; 2441 adapter->link_duplex = 0;
2398 DPRINTK(LINK, INFO, "NIC Link is Down\n"); 2442 DPRINTK(LINK, INFO, "NIC Link is Down\n");
@@ -2432,12 +2476,12 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
2432 } 2476 }
2433 2477
2434 /* Dynamic mode for Interrupt Throttle Rate (ITR) */ 2478 /* Dynamic mode for Interrupt Throttle Rate (ITR) */
2435 if(adapter->hw.mac_type >= e1000_82540 && adapter->itr == 1) { 2479 if (adapter->hw.mac_type >= e1000_82540 && adapter->itr == 1) {
2436 /* Symmetric Tx/Rx gets a reduced ITR=2000; Total 2480 /* Symmetric Tx/Rx gets a reduced ITR=2000; Total
2437 * asymmetrical Tx or Rx gets ITR=8000; everyone 2481 * asymmetrical Tx or Rx gets ITR=8000; everyone
2438 * else is between 2000-8000. */ 2482 * else is between 2000-8000. */
2439 uint32_t goc = (adapter->gotcl + adapter->gorcl) / 10000; 2483 uint32_t goc = (adapter->gotcl + adapter->gorcl) / 10000;
2440 uint32_t dif = (adapter->gotcl > adapter->gorcl ? 2484 uint32_t dif = (adapter->gotcl > adapter->gorcl ?
2441 adapter->gotcl - adapter->gorcl : 2485 adapter->gotcl - adapter->gorcl :
2442 adapter->gorcl - adapter->gotcl) / 10000; 2486 adapter->gorcl - adapter->gotcl) / 10000;
2443 uint32_t itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000; 2487 uint32_t itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000;
@@ -2450,7 +2494,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
2450 /* Force detection of hung controller every watchdog period */ 2494 /* Force detection of hung controller every watchdog period */
2451 adapter->detect_tx_hung = TRUE; 2495 adapter->detect_tx_hung = TRUE;
2452 2496
2453 /* With 82571 controllers, LAA may be overwritten due to controller 2497 /* With 82571 controllers, LAA may be overwritten due to controller
2454 * reset from the other port. Set the appropriate LAA in RAR[0] */ 2498 * reset from the other port. Set the appropriate LAA in RAR[0] */
2455 if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present) 2499 if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present)
2456 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); 2500 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
@@ -2479,7 +2523,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2479 uint8_t ipcss, ipcso, tucss, tucso, hdr_len; 2523 uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
2480 int err; 2524 int err;
2481 2525
2482 if(skb_shinfo(skb)->tso_size) { 2526 if (skb_shinfo(skb)->tso_size) {
2483 if (skb_header_cloned(skb)) { 2527 if (skb_header_cloned(skb)) {
2484 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 2528 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
2485 if (err) 2529 if (err)
@@ -2488,7 +2532,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2488 2532
2489 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 2533 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
2490 mss = skb_shinfo(skb)->tso_size; 2534 mss = skb_shinfo(skb)->tso_size;
2491 if(skb->protocol == ntohs(ETH_P_IP)) { 2535 if (skb->protocol == ntohs(ETH_P_IP)) {
2492 skb->nh.iph->tot_len = 0; 2536 skb->nh.iph->tot_len = 0;
2493 skb->nh.iph->check = 0; 2537 skb->nh.iph->check = 0;
2494 skb->h.th->check = 2538 skb->h.th->check =
@@ -2500,7 +2544,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2500 cmd_length = E1000_TXD_CMD_IP; 2544 cmd_length = E1000_TXD_CMD_IP;
2501 ipcse = skb->h.raw - skb->data - 1; 2545 ipcse = skb->h.raw - skb->data - 1;
2502#ifdef NETIF_F_TSO_IPV6 2546#ifdef NETIF_F_TSO_IPV6
2503 } else if(skb->protocol == ntohs(ETH_P_IPV6)) { 2547 } else if (skb->protocol == ntohs(ETH_P_IPV6)) {
2504 skb->nh.ipv6h->payload_len = 0; 2548 skb->nh.ipv6h->payload_len = 0;
2505 skb->h.th->check = 2549 skb->h.th->check =
2506 ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, 2550 ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
@@ -2555,7 +2599,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2555 unsigned int i; 2599 unsigned int i;
2556 uint8_t css; 2600 uint8_t css;
2557 2601
2558 if(likely(skb->ip_summed == CHECKSUM_HW)) { 2602 if (likely(skb->ip_summed == CHECKSUM_HW)) {
2559 css = skb->h.raw - skb->data; 2603 css = skb->h.raw - skb->data;
2560 2604
2561 i = tx_ring->next_to_use; 2605 i = tx_ring->next_to_use;
@@ -2595,7 +2639,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2595 2639
2596 i = tx_ring->next_to_use; 2640 i = tx_ring->next_to_use;
2597 2641
2598 while(len) { 2642 while (len) {
2599 buffer_info = &tx_ring->buffer_info[i]; 2643 buffer_info = &tx_ring->buffer_info[i];
2600 size = min(len, max_per_txd); 2644 size = min(len, max_per_txd);
2601#ifdef NETIF_F_TSO 2645#ifdef NETIF_F_TSO
@@ -2611,7 +2655,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2611 2655
2612 /* Workaround for premature desc write-backs 2656 /* Workaround for premature desc write-backs
2613 * in TSO mode. Append 4-byte sentinel desc */ 2657 * in TSO mode. Append 4-byte sentinel desc */
2614 if(unlikely(mss && !nr_frags && size == len && size > 8)) 2658 if (unlikely(mss && !nr_frags && size == len && size > 8))
2615 size -= 4; 2659 size -= 4;
2616#endif 2660#endif
2617 /* work-around for errata 10 and it applies 2661 /* work-around for errata 10 and it applies
@@ -2619,13 +2663,13 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2619 * The fix is to make sure that the first descriptor of a 2663 * The fix is to make sure that the first descriptor of a
2620 * packet is smaller than 2048 - 16 - 16 (or 2016) bytes 2664 * packet is smaller than 2048 - 16 - 16 (or 2016) bytes
2621 */ 2665 */
2622 if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && 2666 if (unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) &&
2623 (size > 2015) && count == 0)) 2667 (size > 2015) && count == 0))
2624 size = 2015; 2668 size = 2015;
2625 2669
2626 /* Workaround for potential 82544 hang in PCI-X. Avoid 2670 /* Workaround for potential 82544 hang in PCI-X. Avoid
2627 * terminating buffers within evenly-aligned dwords. */ 2671 * terminating buffers within evenly-aligned dwords. */
2628 if(unlikely(adapter->pcix_82544 && 2672 if (unlikely(adapter->pcix_82544 &&
2629 !((unsigned long)(skb->data + offset + size - 1) & 4) && 2673 !((unsigned long)(skb->data + offset + size - 1) & 4) &&
2630 size > 4)) 2674 size > 4))
2631 size -= 4; 2675 size -= 4;
@@ -2641,29 +2685,29 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2641 len -= size; 2685 len -= size;
2642 offset += size; 2686 offset += size;
2643 count++; 2687 count++;
2644 if(unlikely(++i == tx_ring->count)) i = 0; 2688 if (unlikely(++i == tx_ring->count)) i = 0;
2645 } 2689 }
2646 2690
2647 for(f = 0; f < nr_frags; f++) { 2691 for (f = 0; f < nr_frags; f++) {
2648 struct skb_frag_struct *frag; 2692 struct skb_frag_struct *frag;
2649 2693
2650 frag = &skb_shinfo(skb)->frags[f]; 2694 frag = &skb_shinfo(skb)->frags[f];
2651 len = frag->size; 2695 len = frag->size;
2652 offset = frag->page_offset; 2696 offset = frag->page_offset;
2653 2697
2654 while(len) { 2698 while (len) {
2655 buffer_info = &tx_ring->buffer_info[i]; 2699 buffer_info = &tx_ring->buffer_info[i];
2656 size = min(len, max_per_txd); 2700 size = min(len, max_per_txd);
2657#ifdef NETIF_F_TSO 2701#ifdef NETIF_F_TSO
2658 /* Workaround for premature desc write-backs 2702 /* Workaround for premature desc write-backs
2659 * in TSO mode. Append 4-byte sentinel desc */ 2703 * in TSO mode. Append 4-byte sentinel desc */
2660 if(unlikely(mss && f == (nr_frags-1) && size == len && size > 8)) 2704 if (unlikely(mss && f == (nr_frags-1) && size == len && size > 8))
2661 size -= 4; 2705 size -= 4;
2662#endif 2706#endif
2663 /* Workaround for potential 82544 hang in PCI-X. 2707 /* Workaround for potential 82544 hang in PCI-X.
2664 * Avoid terminating buffers within evenly-aligned 2708 * Avoid terminating buffers within evenly-aligned
2665 * dwords. */ 2709 * dwords. */
2666 if(unlikely(adapter->pcix_82544 && 2710 if (unlikely(adapter->pcix_82544 &&
2667 !((unsigned long)(frag->page+offset+size-1) & 4) && 2711 !((unsigned long)(frag->page+offset+size-1) & 4) &&
2668 size > 4)) 2712 size > 4))
2669 size -= 4; 2713 size -= 4;
@@ -2680,7 +2724,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2680 len -= size; 2724 len -= size;
2681 offset += size; 2725 offset += size;
2682 count++; 2726 count++;
2683 if(unlikely(++i == tx_ring->count)) i = 0; 2727 if (unlikely(++i == tx_ring->count)) i = 0;
2684 } 2728 }
2685 } 2729 }
2686 2730
@@ -2700,35 +2744,35 @@ e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2700 uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; 2744 uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS;
2701 unsigned int i; 2745 unsigned int i;
2702 2746
2703 if(likely(tx_flags & E1000_TX_FLAGS_TSO)) { 2747 if (likely(tx_flags & E1000_TX_FLAGS_TSO)) {
2704 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D | 2748 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D |
2705 E1000_TXD_CMD_TSE; 2749 E1000_TXD_CMD_TSE;
2706 txd_upper |= E1000_TXD_POPTS_TXSM << 8; 2750 txd_upper |= E1000_TXD_POPTS_TXSM << 8;
2707 2751
2708 if(likely(tx_flags & E1000_TX_FLAGS_IPV4)) 2752 if (likely(tx_flags & E1000_TX_FLAGS_IPV4))
2709 txd_upper |= E1000_TXD_POPTS_IXSM << 8; 2753 txd_upper |= E1000_TXD_POPTS_IXSM << 8;
2710 } 2754 }
2711 2755
2712 if(likely(tx_flags & E1000_TX_FLAGS_CSUM)) { 2756 if (likely(tx_flags & E1000_TX_FLAGS_CSUM)) {
2713 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; 2757 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D;
2714 txd_upper |= E1000_TXD_POPTS_TXSM << 8; 2758 txd_upper |= E1000_TXD_POPTS_TXSM << 8;
2715 } 2759 }
2716 2760
2717 if(unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) { 2761 if (unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) {
2718 txd_lower |= E1000_TXD_CMD_VLE; 2762 txd_lower |= E1000_TXD_CMD_VLE;
2719 txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK); 2763 txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK);
2720 } 2764 }
2721 2765
2722 i = tx_ring->next_to_use; 2766 i = tx_ring->next_to_use;
2723 2767
2724 while(count--) { 2768 while (count--) {
2725 buffer_info = &tx_ring->buffer_info[i]; 2769 buffer_info = &tx_ring->buffer_info[i];
2726 tx_desc = E1000_TX_DESC(*tx_ring, i); 2770 tx_desc = E1000_TX_DESC(*tx_ring, i);
2727 tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); 2771 tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
2728 tx_desc->lower.data = 2772 tx_desc->lower.data =
2729 cpu_to_le32(txd_lower | buffer_info->length); 2773 cpu_to_le32(txd_lower | buffer_info->length);
2730 tx_desc->upper.data = cpu_to_le32(txd_upper); 2774 tx_desc->upper.data = cpu_to_le32(txd_upper);
2731 if(unlikely(++i == tx_ring->count)) i = 0; 2775 if (unlikely(++i == tx_ring->count)) i = 0;
2732 } 2776 }
2733 2777
2734 tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); 2778 tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);
@@ -2763,20 +2807,20 @@ e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb)
2763 2807
2764 E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR); 2808 E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR);
2765 2809
2766 if(adapter->link_duplex != HALF_DUPLEX) 2810 if (adapter->link_duplex != HALF_DUPLEX)
2767 goto no_fifo_stall_required; 2811 goto no_fifo_stall_required;
2768 2812
2769 if(atomic_read(&adapter->tx_fifo_stall)) 2813 if (atomic_read(&adapter->tx_fifo_stall))
2770 return 1; 2814 return 1;
2771 2815
2772 if(skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) { 2816 if (skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) {
2773 atomic_set(&adapter->tx_fifo_stall, 1); 2817 atomic_set(&adapter->tx_fifo_stall, 1);
2774 return 1; 2818 return 1;
2775 } 2819 }
2776 2820
2777no_fifo_stall_required: 2821no_fifo_stall_required:
2778 adapter->tx_fifo_head += skb_fifo_len; 2822 adapter->tx_fifo_head += skb_fifo_len;
2779 if(adapter->tx_fifo_head >= adapter->tx_fifo_size) 2823 if (adapter->tx_fifo_head >= adapter->tx_fifo_size)
2780 adapter->tx_fifo_head -= adapter->tx_fifo_size; 2824 adapter->tx_fifo_head -= adapter->tx_fifo_size;
2781 return 0; 2825 return 0;
2782} 2826}
@@ -2787,27 +2831,27 @@ e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb)
2787{ 2831{
2788 struct e1000_hw *hw = &adapter->hw; 2832 struct e1000_hw *hw = &adapter->hw;
2789 uint16_t length, offset; 2833 uint16_t length, offset;
2790 if(vlan_tx_tag_present(skb)) { 2834 if (vlan_tx_tag_present(skb)) {
2791 if(!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && 2835 if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) &&
2792 ( adapter->hw.mng_cookie.status & 2836 ( adapter->hw.mng_cookie.status &
2793 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) ) 2837 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) )
2794 return 0; 2838 return 0;
2795 } 2839 }
2796 if ((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) { 2840 if ((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) {
2797 struct ethhdr *eth = (struct ethhdr *) skb->data; 2841 struct ethhdr *eth = (struct ethhdr *) skb->data;
2798 if((htons(ETH_P_IP) == eth->h_proto)) { 2842 if ((htons(ETH_P_IP) == eth->h_proto)) {
2799 const struct iphdr *ip = 2843 const struct iphdr *ip =
2800 (struct iphdr *)((uint8_t *)skb->data+14); 2844 (struct iphdr *)((uint8_t *)skb->data+14);
2801 if(IPPROTO_UDP == ip->protocol) { 2845 if (IPPROTO_UDP == ip->protocol) {
2802 struct udphdr *udp = 2846 struct udphdr *udp =
2803 (struct udphdr *)((uint8_t *)ip + 2847 (struct udphdr *)((uint8_t *)ip +
2804 (ip->ihl << 2)); 2848 (ip->ihl << 2));
2805 if(ntohs(udp->dest) == 67) { 2849 if (ntohs(udp->dest) == 67) {
2806 offset = (uint8_t *)udp + 8 - skb->data; 2850 offset = (uint8_t *)udp + 8 - skb->data;
2807 length = skb->len - offset; 2851 length = skb->len - offset;
2808 2852
2809 return e1000_mng_write_dhcp_info(hw, 2853 return e1000_mng_write_dhcp_info(hw,
2810 (uint8_t *)udp + 8, 2854 (uint8_t *)udp + 8,
2811 length); 2855 length);
2812 } 2856 }
2813 } 2857 }
@@ -2830,7 +2874,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2830 unsigned int nr_frags = 0; 2874 unsigned int nr_frags = 0;
2831 unsigned int mss = 0; 2875 unsigned int mss = 0;
2832 int count = 0; 2876 int count = 0;
2833 int tso; 2877 int tso;
2834 unsigned int f; 2878 unsigned int f;
2835 len -= skb->data_len; 2879 len -= skb->data_len;
2836 2880
@@ -2853,7 +2897,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2853 * 4 = ceil(buffer len/mss). To make sure we don't 2897 * 4 = ceil(buffer len/mss). To make sure we don't
2854 * overrun the FIFO, adjust the max buffer len if mss 2898 * overrun the FIFO, adjust the max buffer len if mss
2855 * drops. */ 2899 * drops. */
2856 if(mss) { 2900 if (mss) {
2857 uint8_t hdr_len; 2901 uint8_t hdr_len;
2858 max_per_txd = min(mss << 2, max_per_txd); 2902 max_per_txd = min(mss << 2, max_per_txd);
2859 max_txd_pwr = fls(max_per_txd) - 1; 2903 max_txd_pwr = fls(max_per_txd) - 1;
@@ -2876,12 +2920,12 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2876 } 2920 }
2877 } 2921 }
2878 2922
2879 if((mss) || (skb->ip_summed == CHECKSUM_HW))
2880 /* reserve a descriptor for the offload context */ 2923 /* reserve a descriptor for the offload context */
2924 if ((mss) || (skb->ip_summed == CHECKSUM_HW))
2881 count++; 2925 count++;
2882 count++; 2926 count++;
2883#else 2927#else
2884 if(skb->ip_summed == CHECKSUM_HW) 2928 if (skb->ip_summed == CHECKSUM_HW)
2885 count++; 2929 count++;
2886#endif 2930#endif
2887 2931
@@ -2894,24 +2938,24 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2894 2938
2895 count += TXD_USE_COUNT(len, max_txd_pwr); 2939 count += TXD_USE_COUNT(len, max_txd_pwr);
2896 2940
2897 if(adapter->pcix_82544) 2941 if (adapter->pcix_82544)
2898 count++; 2942 count++;
2899 2943
2900 /* work-around for errata 10 and it applies to all controllers 2944 /* work-around for errata 10 and it applies to all controllers
2901 * in PCI-X mode, so add one more descriptor to the count 2945 * in PCI-X mode, so add one more descriptor to the count
2902 */ 2946 */
2903 if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && 2947 if (unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) &&
2904 (len > 2015))) 2948 (len > 2015)))
2905 count++; 2949 count++;
2906 2950
2907 nr_frags = skb_shinfo(skb)->nr_frags; 2951 nr_frags = skb_shinfo(skb)->nr_frags;
2908 for(f = 0; f < nr_frags; f++) 2952 for (f = 0; f < nr_frags; f++)
2909 count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size, 2953 count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size,
2910 max_txd_pwr); 2954 max_txd_pwr);
2911 if(adapter->pcix_82544) 2955 if (adapter->pcix_82544)
2912 count += nr_frags; 2956 count += nr_frags;
2913 2957
2914 if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) 2958 if (adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) )
2915 e1000_transfer_dhcp_info(adapter, skb); 2959 e1000_transfer_dhcp_info(adapter, skb);
2916 2960
2917 local_irq_save(flags); 2961 local_irq_save(flags);
@@ -2929,8 +2973,8 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2929 return NETDEV_TX_BUSY; 2973 return NETDEV_TX_BUSY;
2930 } 2974 }
2931 2975
2932 if(unlikely(adapter->hw.mac_type == e1000_82547)) { 2976 if (unlikely(adapter->hw.mac_type == e1000_82547)) {
2933 if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { 2977 if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) {
2934 netif_stop_queue(netdev); 2978 netif_stop_queue(netdev);
2935 mod_timer(&adapter->tx_fifo_stall_timer, jiffies); 2979 mod_timer(&adapter->tx_fifo_stall_timer, jiffies);
2936 spin_unlock_irqrestore(&tx_ring->tx_lock, flags); 2980 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
@@ -2938,13 +2982,13 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2938 } 2982 }
2939 } 2983 }
2940 2984
2941 if(unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { 2985 if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
2942 tx_flags |= E1000_TX_FLAGS_VLAN; 2986 tx_flags |= E1000_TX_FLAGS_VLAN;
2943 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); 2987 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
2944 } 2988 }
2945 2989
2946 first = tx_ring->next_to_use; 2990 first = tx_ring->next_to_use;
2947 2991
2948 tso = e1000_tso(adapter, tx_ring, skb); 2992 tso = e1000_tso(adapter, tx_ring, skb);
2949 if (tso < 0) { 2993 if (tso < 0) {
2950 dev_kfree_skb_any(skb); 2994 dev_kfree_skb_any(skb);
@@ -3033,9 +3077,9 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
3033 struct e1000_adapter *adapter = netdev_priv(netdev); 3077 struct e1000_adapter *adapter = netdev_priv(netdev);
3034 int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; 3078 int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
3035 3079
3036 if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || 3080 if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
3037 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 3081 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
3038 DPRINTK(PROBE, ERR, "Invalid MTU setting\n"); 3082 DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
3039 return -EINVAL; 3083 return -EINVAL;
3040 } 3084 }
3041 3085
@@ -3083,7 +3127,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
3083 3127
3084 netdev->mtu = new_mtu; 3128 netdev->mtu = new_mtu;
3085 3129
3086 if(netif_running(netdev)) { 3130 if (netif_running(netdev)) {
3087 e1000_down(adapter); 3131 e1000_down(adapter);
3088 e1000_up(adapter); 3132 e1000_up(adapter);
3089 } 3133 }
@@ -3170,7 +3214,7 @@ e1000_update_stats(struct e1000_adapter *adapter)
3170 hw->collision_delta = E1000_READ_REG(hw, COLC); 3214 hw->collision_delta = E1000_READ_REG(hw, COLC);
3171 adapter->stats.colc += hw->collision_delta; 3215 adapter->stats.colc += hw->collision_delta;
3172 3216
3173 if(hw->mac_type >= e1000_82543) { 3217 if (hw->mac_type >= e1000_82543) {
3174 adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC); 3218 adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC);
3175 adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC); 3219 adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC);
3176 adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS); 3220 adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS);
@@ -3178,7 +3222,7 @@ e1000_update_stats(struct e1000_adapter *adapter)
3178 adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC); 3222 adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC);
3179 adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC); 3223 adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC);
3180 } 3224 }
3181 if(hw->mac_type > e1000_82547_rev_2) { 3225 if (hw->mac_type > e1000_82547_rev_2) {
3182 adapter->stats.iac += E1000_READ_REG(hw, IAC); 3226 adapter->stats.iac += E1000_READ_REG(hw, IAC);
3183 adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); 3227 adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
3184 adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); 3228 adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
@@ -3222,14 +3266,14 @@ e1000_update_stats(struct e1000_adapter *adapter)
3222 3266
3223 /* Phy Stats */ 3267 /* Phy Stats */
3224 3268
3225 if(hw->media_type == e1000_media_type_copper) { 3269 if (hw->media_type == e1000_media_type_copper) {
3226 if((adapter->link_speed == SPEED_1000) && 3270 if ((adapter->link_speed == SPEED_1000) &&
3227 (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) { 3271 (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
3228 phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; 3272 phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
3229 adapter->phy_stats.idle_errors += phy_tmp; 3273 adapter->phy_stats.idle_errors += phy_tmp;
3230 } 3274 }
3231 3275
3232 if((hw->mac_type <= e1000_82546) && 3276 if ((hw->mac_type <= e1000_82546) &&
3233 (hw->phy_type == e1000_phy_m88) && 3277 (hw->phy_type == e1000_phy_m88) &&
3234 !e1000_read_phy_reg(hw, M88E1000_RX_ERR_CNTR, &phy_tmp)) 3278 !e1000_read_phy_reg(hw, M88E1000_RX_ERR_CNTR, &phy_tmp))
3235 adapter->phy_stats.receive_errors += phy_tmp; 3279 adapter->phy_stats.receive_errors += phy_tmp;
@@ -3294,7 +3338,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
3294 return IRQ_NONE; /* Not our interrupt */ 3338 return IRQ_NONE; /* Not our interrupt */
3295 } 3339 }
3296 3340
3297 if(unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { 3341 if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) {
3298 hw->get_link_status = 1; 3342 hw->get_link_status = 1;
3299 mod_timer(&adapter->watchdog_timer, jiffies); 3343 mod_timer(&adapter->watchdog_timer, jiffies);
3300 } 3344 }
@@ -3326,26 +3370,26 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
3326 3370
3327#else /* if !CONFIG_E1000_NAPI */ 3371#else /* if !CONFIG_E1000_NAPI */
3328 /* Writing IMC and IMS is needed for 82547. 3372 /* Writing IMC and IMS is needed for 82547.
3329 Due to Hub Link bus being occupied, an interrupt 3373 * Due to Hub Link bus being occupied, an interrupt
3330 de-assertion message is not able to be sent. 3374 * de-assertion message is not able to be sent.
3331 When an interrupt assertion message is generated later, 3375 * When an interrupt assertion message is generated later,
3332 two messages are re-ordered and sent out. 3376 * two messages are re-ordered and sent out.
3333 That causes APIC to think 82547 is in de-assertion 3377 * That causes APIC to think 82547 is in de-assertion
3334 state, while 82547 is in assertion state, resulting 3378 * state, while 82547 is in assertion state, resulting
3335 in dead lock. Writing IMC forces 82547 into 3379 * in dead lock. Writing IMC forces 82547 into
3336 de-assertion state. 3380 * de-assertion state.
3337 */ 3381 */
3338 if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2){ 3382 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) {
3339 atomic_inc(&adapter->irq_sem); 3383 atomic_inc(&adapter->irq_sem);
3340 E1000_WRITE_REG(hw, IMC, ~0); 3384 E1000_WRITE_REG(hw, IMC, ~0);
3341 } 3385 }
3342 3386
3343 for(i = 0; i < E1000_MAX_INTR; i++) 3387 for (i = 0; i < E1000_MAX_INTR; i++)
3344 if(unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & 3388 if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
3345 !e1000_clean_tx_irq(adapter, adapter->tx_ring))) 3389 !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
3346 break; 3390 break;
3347 3391
3348 if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) 3392 if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)
3349 e1000_irq_enable(adapter); 3393 e1000_irq_enable(adapter);
3350 3394
3351#endif /* CONFIG_E1000_NAPI */ 3395#endif /* CONFIG_E1000_NAPI */
@@ -3397,9 +3441,9 @@ e1000_clean(struct net_device *poll_dev, int *budget)
3397 3441
3398 *budget -= work_done; 3442 *budget -= work_done;
3399 poll_dev->quota -= work_done; 3443 poll_dev->quota -= work_done;
3400 3444
3401 /* If no Tx and not enough Rx work done, exit the polling mode */ 3445 /* If no Tx and not enough Rx work done, exit the polling mode */
3402 if((!tx_cleaned && (work_done == 0)) || 3446 if ((!tx_cleaned && (work_done == 0)) ||
3403 !netif_running(adapter->netdev)) { 3447 !netif_running(adapter->netdev)) {
3404quit_polling: 3448quit_polling:
3405 netif_rx_complete(poll_dev); 3449 netif_rx_complete(poll_dev);
@@ -3431,7 +3475,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3431 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3475 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3432 3476
3433 while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { 3477 while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) {
3434 for(cleaned = FALSE; !cleaned; ) { 3478 for (cleaned = FALSE; !cleaned; ) {
3435 tx_desc = E1000_TX_DESC(*tx_ring, i); 3479 tx_desc = E1000_TX_DESC(*tx_ring, i);
3436 buffer_info = &tx_ring->buffer_info[i]; 3480 buffer_info = &tx_ring->buffer_info[i];
3437 cleaned = (i == eop); 3481 cleaned = (i == eop);
@@ -3442,7 +3486,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3442 e1000_unmap_and_free_tx_resource(adapter, buffer_info); 3486 e1000_unmap_and_free_tx_resource(adapter, buffer_info);
3443 memset(tx_desc, 0, sizeof(struct e1000_tx_desc)); 3487 memset(tx_desc, 0, sizeof(struct e1000_tx_desc));
3444 3488
3445 if(unlikely(++i == tx_ring->count)) i = 0; 3489 if (unlikely(++i == tx_ring->count)) i = 0;
3446 } 3490 }
3447 3491
3448#ifdef CONFIG_E1000_MQ 3492#ifdef CONFIG_E1000_MQ
@@ -3457,7 +3501,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
3457 3501
3458 spin_lock(&tx_ring->tx_lock); 3502 spin_lock(&tx_ring->tx_lock);
3459 3503
3460 if(unlikely(cleaned && netif_queue_stopped(netdev) && 3504 if (unlikely(cleaned && netif_queue_stopped(netdev) &&
3461 netif_carrier_ok(netdev))) 3505 netif_carrier_ok(netdev)))
3462 netif_wake_queue(netdev); 3506 netif_wake_queue(netdev);
3463 3507
@@ -3519,21 +3563,21 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
3519 skb->ip_summed = CHECKSUM_NONE; 3563 skb->ip_summed = CHECKSUM_NONE;
3520 3564
3521 /* 82543 or newer only */ 3565 /* 82543 or newer only */
3522 if(unlikely(adapter->hw.mac_type < e1000_82543)) return; 3566 if (unlikely(adapter->hw.mac_type < e1000_82543)) return;
3523 /* Ignore Checksum bit is set */ 3567 /* Ignore Checksum bit is set */
3524 if(unlikely(status & E1000_RXD_STAT_IXSM)) return; 3568 if (unlikely(status & E1000_RXD_STAT_IXSM)) return;
3525 /* TCP/UDP checksum error bit is set */ 3569 /* TCP/UDP checksum error bit is set */
3526 if(unlikely(errors & E1000_RXD_ERR_TCPE)) { 3570 if (unlikely(errors & E1000_RXD_ERR_TCPE)) {
3527 /* let the stack verify checksum errors */ 3571 /* let the stack verify checksum errors */
3528 adapter->hw_csum_err++; 3572 adapter->hw_csum_err++;
3529 return; 3573 return;
3530 } 3574 }
3531 /* TCP/UDP Checksum has not been calculated */ 3575 /* TCP/UDP Checksum has not been calculated */
3532 if(adapter->hw.mac_type <= e1000_82547_rev_2) { 3576 if (adapter->hw.mac_type <= e1000_82547_rev_2) {
3533 if(!(status & E1000_RXD_STAT_TCPCS)) 3577 if (!(status & E1000_RXD_STAT_TCPCS))
3534 return; 3578 return;
3535 } else { 3579 } else {
3536 if(!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) 3580 if (!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)))
3537 return; 3581 return;
3538 } 3582 }
3539 /* It must be a TCP or UDP packet with a valid checksum */ 3583 /* It must be a TCP or UDP packet with a valid checksum */
@@ -3569,9 +3613,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3569{ 3613{
3570 struct net_device *netdev = adapter->netdev; 3614 struct net_device *netdev = adapter->netdev;
3571 struct pci_dev *pdev = adapter->pdev; 3615 struct pci_dev *pdev = adapter->pdev;
3572 struct e1000_rx_desc *rx_desc; 3616 struct e1000_rx_desc *rx_desc, *next_rxd;
3573 struct e1000_buffer *buffer_info; 3617 struct e1000_buffer *buffer_info, *next_buffer;
3574 struct sk_buff *skb;
3575 unsigned long flags; 3618 unsigned long flags;
3576 uint32_t length; 3619 uint32_t length;
3577 uint8_t last_byte; 3620 uint8_t last_byte;
@@ -3581,16 +3624,25 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3581 3624
3582 i = rx_ring->next_to_clean; 3625 i = rx_ring->next_to_clean;
3583 rx_desc = E1000_RX_DESC(*rx_ring, i); 3626 rx_desc = E1000_RX_DESC(*rx_ring, i);
3627 buffer_info = &rx_ring->buffer_info[i];
3584 3628
3585 while(rx_desc->status & E1000_RXD_STAT_DD) { 3629 while (rx_desc->status & E1000_RXD_STAT_DD) {
3586 buffer_info = &rx_ring->buffer_info[i]; 3630 struct sk_buff *skb, *next_skb;
3587 u8 status; 3631 u8 status;
3588#ifdef CONFIG_E1000_NAPI 3632#ifdef CONFIG_E1000_NAPI
3589 if(*work_done >= work_to_do) 3633 if (*work_done >= work_to_do)
3590 break; 3634 break;
3591 (*work_done)++; 3635 (*work_done)++;
3592#endif 3636#endif
3593 status = rx_desc->status; 3637 status = rx_desc->status;
3638 skb = buffer_info->skb;
3639 buffer_info->skb = NULL;
3640
3641 if (++i == rx_ring->count) i = 0;
3642 next_rxd = E1000_RX_DESC(*rx_ring, i);
3643 next_buffer = &rx_ring->buffer_info[i];
3644 next_skb = next_buffer->skb;
3645
3594 cleaned = TRUE; 3646 cleaned = TRUE;
3595 cleaned_count++; 3647 cleaned_count++;
3596 pci_unmap_single(pdev, 3648 pci_unmap_single(pdev,
@@ -3598,20 +3650,50 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3598 buffer_info->length, 3650 buffer_info->length,
3599 PCI_DMA_FROMDEVICE); 3651 PCI_DMA_FROMDEVICE);
3600 3652
3601 skb = buffer_info->skb;
3602 length = le16_to_cpu(rx_desc->length); 3653 length = le16_to_cpu(rx_desc->length);
3603 3654
3604 if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) { 3655 skb_put(skb, length);
3605 /* All receives must fit into a single buffer */ 3656
3606 E1000_DBG("%s: Receive packet consumed multiple" 3657 if (!(status & E1000_RXD_STAT_EOP)) {
3607 " buffers\n", netdev->name); 3658 if (!rx_ring->rx_skb_top) {
3608 dev_kfree_skb_irq(skb); 3659 rx_ring->rx_skb_top = skb;
3660 rx_ring->rx_skb_top->len = length;
3661 rx_ring->rx_skb_prev = skb;
3662 } else {
3663 if (skb_shinfo(rx_ring->rx_skb_top)->frag_list) {
3664 rx_ring->rx_skb_prev->next = skb;
3665 skb->prev = rx_ring->rx_skb_prev;
3666 } else {
3667 skb_shinfo(rx_ring->rx_skb_top)->frag_list = skb;
3668 }
3669 rx_ring->rx_skb_prev = skb;
3670 rx_ring->rx_skb_top->data_len += length;
3671 }
3609 goto next_desc; 3672 goto next_desc;
3673 } else {
3674 if (rx_ring->rx_skb_top) {
3675 if (skb_shinfo(rx_ring->rx_skb_top)
3676 ->frag_list) {
3677 rx_ring->rx_skb_prev->next = skb;
3678 skb->prev = rx_ring->rx_skb_prev;
3679 } else
3680 skb_shinfo(rx_ring->rx_skb_top)
3681 ->frag_list = skb;
3682
3683 rx_ring->rx_skb_top->data_len += length;
3684 rx_ring->rx_skb_top->len +=
3685 rx_ring->rx_skb_top->data_len;
3686
3687 skb = rx_ring->rx_skb_top;
3688 multi_descriptor = TRUE;
3689 rx_ring->rx_skb_top = NULL;
3690 rx_ring->rx_skb_prev = NULL;
3691 }
3610 } 3692 }
3611 3693
3612 if(unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) { 3694 if (unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
3613 last_byte = *(skb->data + length - 1); 3695 last_byte = *(skb->data + length - 1);
3614 if(TBI_ACCEPT(&adapter->hw, rx_desc->status, 3696 if (TBI_ACCEPT(&adapter->hw, status,
3615 rx_desc->errors, length, last_byte)) { 3697 rx_desc->errors, length, last_byte)) {
3616 spin_lock_irqsave(&adapter->stats_lock, flags); 3698 spin_lock_irqsave(&adapter->stats_lock, flags);
3617 e1000_tbi_adjust_stats(&adapter->hw, 3699 e1000_tbi_adjust_stats(&adapter->hw,
@@ -3656,9 +3738,10 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3656 (uint32_t)(status) | 3738 (uint32_t)(status) |
3657 ((uint32_t)(rx_desc->errors) << 24), 3739 ((uint32_t)(rx_desc->errors) << 24),
3658 rx_desc->csum, skb); 3740 rx_desc->csum, skb);
3741
3659 skb->protocol = eth_type_trans(skb, netdev); 3742 skb->protocol = eth_type_trans(skb, netdev);
3660#ifdef CONFIG_E1000_NAPI 3743#ifdef CONFIG_E1000_NAPI
3661 if(unlikely(adapter->vlgrp && 3744 if (unlikely(adapter->vlgrp &&
3662 (status & E1000_RXD_STAT_VP))) { 3745 (status & E1000_RXD_STAT_VP))) {
3663 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 3746 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
3664 le16_to_cpu(rx_desc->special) & 3747 le16_to_cpu(rx_desc->special) &
@@ -3667,8 +3750,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3667 netif_receive_skb(skb); 3750 netif_receive_skb(skb);
3668 } 3751 }
3669#else /* CONFIG_E1000_NAPI */ 3752#else /* CONFIG_E1000_NAPI */
3670 if(unlikely(adapter->vlgrp && 3753 if (unlikely(adapter->vlgrp &&
3671 (rx_desc->status & E1000_RXD_STAT_VP))) { 3754 (status & E1000_RXD_STAT_VP))) {
3672 vlan_hwaccel_rx(skb, adapter->vlgrp, 3755 vlan_hwaccel_rx(skb, adapter->vlgrp,
3673 le16_to_cpu(rx_desc->special) & 3756 le16_to_cpu(rx_desc->special) &
3674 E1000_RXD_SPC_VLAN_MASK); 3757 E1000_RXD_SPC_VLAN_MASK);
@@ -3691,6 +3774,8 @@ next_desc:
3691 cleaned_count = 0; 3774 cleaned_count = 0;
3692 } 3775 }
3693 3776
3777 rx_desc = next_rxd;
3778 buffer_info = next_buffer;
3694 } 3779 }
3695 rx_ring->next_to_clean = i; 3780 rx_ring->next_to_clean = i;
3696 3781
@@ -3716,13 +3801,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3716 struct e1000_rx_ring *rx_ring) 3801 struct e1000_rx_ring *rx_ring)
3717#endif 3802#endif
3718{ 3803{
3719 union e1000_rx_desc_packet_split *rx_desc; 3804 union e1000_rx_desc_packet_split *rx_desc, *next_rxd;
3720 struct net_device *netdev = adapter->netdev; 3805 struct net_device *netdev = adapter->netdev;
3721 struct pci_dev *pdev = adapter->pdev; 3806 struct pci_dev *pdev = adapter->pdev;
3722 struct e1000_buffer *buffer_info; 3807 struct e1000_buffer *buffer_info, *next_buffer;
3723 struct e1000_ps_page *ps_page; 3808 struct e1000_ps_page *ps_page;
3724 struct e1000_ps_page_dma *ps_page_dma; 3809 struct e1000_ps_page_dma *ps_page_dma;
3725 struct sk_buff *skb; 3810 struct sk_buff *skb, *next_skb;
3726 unsigned int i, j; 3811 unsigned int i, j;
3727 uint32_t length, staterr; 3812 uint32_t length, staterr;
3728 int cleaned_count = 0; 3813 int cleaned_count = 0;
@@ -3731,39 +3816,44 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3731 i = rx_ring->next_to_clean; 3816 i = rx_ring->next_to_clean;
3732 rx_desc = E1000_RX_DESC_PS(*rx_ring, i); 3817 rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
3733 staterr = le32_to_cpu(rx_desc->wb.middle.status_error); 3818 staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
3819 buffer_info = &rx_ring->buffer_info[i];
3734 3820
3735 while(staterr & E1000_RXD_STAT_DD) { 3821 while (staterr & E1000_RXD_STAT_DD) {
3736 buffer_info = &rx_ring->buffer_info[i];
3737 ps_page = &rx_ring->ps_page[i]; 3822 ps_page = &rx_ring->ps_page[i];
3738 ps_page_dma = &rx_ring->ps_page_dma[i]; 3823 ps_page_dma = &rx_ring->ps_page_dma[i];
3739#ifdef CONFIG_E1000_NAPI 3824#ifdef CONFIG_E1000_NAPI
3740 if(unlikely(*work_done >= work_to_do)) 3825 if (unlikely(*work_done >= work_to_do))
3741 break; 3826 break;
3742 (*work_done)++; 3827 (*work_done)++;
3743#endif 3828#endif
3829 skb = buffer_info->skb;
3830
3831 if (++i == rx_ring->count) i = 0;
3832 next_rxd = E1000_RX_DESC_PS(*rx_ring, i);
3833 next_buffer = &rx_ring->buffer_info[i];
3834 next_skb = next_buffer->skb;
3835
3744 cleaned = TRUE; 3836 cleaned = TRUE;
3745 cleaned_count++; 3837 cleaned_count++;
3746 pci_unmap_single(pdev, buffer_info->dma, 3838 pci_unmap_single(pdev, buffer_info->dma,
3747 buffer_info->length, 3839 buffer_info->length,
3748 PCI_DMA_FROMDEVICE); 3840 PCI_DMA_FROMDEVICE);
3749 3841
3750 skb = buffer_info->skb; 3842 if (unlikely(!(staterr & E1000_RXD_STAT_EOP))) {
3751
3752 if(unlikely(!(staterr & E1000_RXD_STAT_EOP))) {
3753 E1000_DBG("%s: Packet Split buffers didn't pick up" 3843 E1000_DBG("%s: Packet Split buffers didn't pick up"
3754 " the full packet\n", netdev->name); 3844 " the full packet\n", netdev->name);
3755 dev_kfree_skb_irq(skb); 3845 dev_kfree_skb_irq(skb);
3756 goto next_desc; 3846 goto next_desc;
3757 } 3847 }
3758 3848
3759 if(unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) { 3849 if (unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) {
3760 dev_kfree_skb_irq(skb); 3850 dev_kfree_skb_irq(skb);
3761 goto next_desc; 3851 goto next_desc;
3762 } 3852 }
3763 3853
3764 length = le16_to_cpu(rx_desc->wb.middle.length0); 3854 length = le16_to_cpu(rx_desc->wb.middle.length0);
3765 3855
3766 if(unlikely(!length)) { 3856 if (unlikely(!length)) {
3767 E1000_DBG("%s: Last part of the packet spanning" 3857 E1000_DBG("%s: Last part of the packet spanning"
3768 " multiple descriptors\n", netdev->name); 3858 " multiple descriptors\n", netdev->name);
3769 dev_kfree_skb_irq(skb); 3859 dev_kfree_skb_irq(skb);
@@ -3773,8 +3863,8 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3773 /* Good Receive */ 3863 /* Good Receive */
3774 skb_put(skb, length); 3864 skb_put(skb, length);
3775 3865
3776 for(j = 0; j < adapter->rx_ps_pages; j++) { 3866 for (j = 0; j < adapter->rx_ps_pages; j++) {
3777 if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) 3867 if (!(length = le16_to_cpu(rx_desc->wb.upper.length[j])))
3778 break; 3868 break;
3779 3869
3780 pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j], 3870 pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
@@ -3794,15 +3884,11 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3794 rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); 3884 rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
3795 skb->protocol = eth_type_trans(skb, netdev); 3885 skb->protocol = eth_type_trans(skb, netdev);
3796 3886
3797 if(likely(rx_desc->wb.upper.header_status & 3887 if (likely(rx_desc->wb.upper.header_status &
3798 E1000_RXDPS_HDRSTAT_HDRSP)) { 3888 E1000_RXDPS_HDRSTAT_HDRSP))
3799 adapter->rx_hdr_split++; 3889 adapter->rx_hdr_split++;
3800#ifdef HAVE_RX_ZERO_COPY
3801 skb_shinfo(skb)->zero_copy = TRUE;
3802#endif
3803 }
3804#ifdef CONFIG_E1000_NAPI 3890#ifdef CONFIG_E1000_NAPI
3805 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { 3891 if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
3806 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 3892 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
3807 le16_to_cpu(rx_desc->wb.middle.vlan) & 3893 le16_to_cpu(rx_desc->wb.middle.vlan) &
3808 E1000_RXD_SPC_VLAN_MASK); 3894 E1000_RXD_SPC_VLAN_MASK);
@@ -3810,7 +3896,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
3810 netif_receive_skb(skb); 3896 netif_receive_skb(skb);
3811 } 3897 }
3812#else /* CONFIG_E1000_NAPI */ 3898#else /* CONFIG_E1000_NAPI */
3813 if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { 3899 if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
3814 vlan_hwaccel_rx(skb, adapter->vlgrp, 3900 vlan_hwaccel_rx(skb, adapter->vlgrp,
3815 le16_to_cpu(rx_desc->wb.middle.vlan) & 3901 le16_to_cpu(rx_desc->wb.middle.vlan) &
3816 E1000_RXD_SPC_VLAN_MASK); 3902 E1000_RXD_SPC_VLAN_MASK);
@@ -3834,6 +3920,9 @@ next_desc:
3834 cleaned_count = 0; 3920 cleaned_count = 0;
3835 } 3921 }
3836 3922
3923 rx_desc = next_rxd;
3924 buffer_info = next_buffer;
3925
3837 staterr = le32_to_cpu(rx_desc->wb.middle.status_error); 3926 staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
3838 } 3927 }
3839 rx_ring->next_to_clean = i; 3928 rx_ring->next_to_clean = i;
@@ -3875,7 +3964,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
3875 } 3964 }
3876 3965
3877 3966
3878 if(unlikely(!skb)) { 3967 if (unlikely(!skb)) {
3879 /* Better luck next round */ 3968 /* Better luck next round */
3880 adapter->alloc_rx_buff_failed++; 3969 adapter->alloc_rx_buff_failed++;
3881 break; 3970 break;
@@ -3940,20 +4029,23 @@ map_skb:
3940 rx_desc = E1000_RX_DESC(*rx_ring, i); 4029 rx_desc = E1000_RX_DESC(*rx_ring, i);
3941 rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); 4030 rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
3942 4031
3943 if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { 4032 if (unlikely(++i == rx_ring->count))
3944 /* Force memory writes to complete before letting h/w 4033 i = 0;
3945 * know there are new descriptors to fetch. (Only
3946 * applicable for weak-ordered memory model archs,
3947 * such as IA-64). */
3948 wmb();
3949 writel(i, adapter->hw.hw_addr + rx_ring->rdt);
3950 }
3951
3952 if(unlikely(++i == rx_ring->count)) i = 0;
3953 buffer_info = &rx_ring->buffer_info[i]; 4034 buffer_info = &rx_ring->buffer_info[i];
3954 } 4035 }
3955 4036
3956 rx_ring->next_to_use = i; 4037 if (likely(rx_ring->next_to_use != i)) {
4038 rx_ring->next_to_use = i;
4039 if (unlikely(i-- == 0))
4040 i = (rx_ring->count - 1);
4041
4042 /* Force memory writes to complete before letting h/w
4043 * know there are new descriptors to fetch. (Only
4044 * applicable for weak-ordered memory model archs,
4045 * such as IA-64). */
4046 wmb();
4047 writel(i, adapter->hw.hw_addr + rx_ring->rdt);
4048 }
3957} 4049}
3958 4050
3959/** 4051/**
@@ -3983,13 +4075,15 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
3983 while (cleaned_count--) { 4075 while (cleaned_count--) {
3984 rx_desc = E1000_RX_DESC_PS(*rx_ring, i); 4076 rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
3985 4077
3986 for(j = 0; j < PS_PAGE_BUFFERS; j++) { 4078 for (j = 0; j < PS_PAGE_BUFFERS; j++) {
3987 if (j < adapter->rx_ps_pages) { 4079 if (j < adapter->rx_ps_pages) {
3988 if (likely(!ps_page->ps_page[j])) { 4080 if (likely(!ps_page->ps_page[j])) {
3989 ps_page->ps_page[j] = 4081 ps_page->ps_page[j] =
3990 alloc_page(GFP_ATOMIC); 4082 alloc_page(GFP_ATOMIC);
3991 if (unlikely(!ps_page->ps_page[j])) 4083 if (unlikely(!ps_page->ps_page[j])) {
4084 adapter->alloc_rx_buff_failed++;
3992 goto no_buffers; 4085 goto no_buffers;
4086 }
3993 ps_page_dma->ps_page_dma[j] = 4087 ps_page_dma->ps_page_dma[j] =
3994 pci_map_page(pdev, 4088 pci_map_page(pdev,
3995 ps_page->ps_page[j], 4089 ps_page->ps_page[j],
@@ -3997,7 +4091,7 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
3997 PCI_DMA_FROMDEVICE); 4091 PCI_DMA_FROMDEVICE);
3998 } 4092 }
3999 /* Refresh the desc even if buffer_addrs didn't 4093 /* Refresh the desc even if buffer_addrs didn't
4000 * change because each write-back erases 4094 * change because each write-back erases
4001 * this info. 4095 * this info.
4002 */ 4096 */
4003 rx_desc->read.buffer_addr[j+1] = 4097 rx_desc->read.buffer_addr[j+1] =
@@ -4008,8 +4102,10 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
4008 4102
4009 skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); 4103 skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN);
4010 4104
4011 if(unlikely(!skb)) 4105 if (unlikely(!skb)) {
4106 adapter->alloc_rx_buff_failed++;
4012 break; 4107 break;
4108 }
4013 4109
4014 /* Make buffer alignment 2 beyond a 16 byte boundary 4110 /* Make buffer alignment 2 beyond a 16 byte boundary
4015 * this will result in a 16 byte aligned IP header after 4111 * this will result in a 16 byte aligned IP header after
@@ -4027,27 +4123,28 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
4027 4123
4028 rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); 4124 rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma);
4029 4125
4030 if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { 4126 if (unlikely(++i == rx_ring->count)) i = 0;
4031 /* Force memory writes to complete before letting h/w
4032 * know there are new descriptors to fetch. (Only
4033 * applicable for weak-ordered memory model archs,
4034 * such as IA-64). */
4035 wmb();
4036 /* Hardware increments by 16 bytes, but packet split
4037 * descriptors are 32 bytes...so we increment tail
4038 * twice as much.
4039 */
4040 writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt);
4041 }
4042
4043 if(unlikely(++i == rx_ring->count)) i = 0;
4044 buffer_info = &rx_ring->buffer_info[i]; 4127 buffer_info = &rx_ring->buffer_info[i];
4045 ps_page = &rx_ring->ps_page[i]; 4128 ps_page = &rx_ring->ps_page[i];
4046 ps_page_dma = &rx_ring->ps_page_dma[i]; 4129 ps_page_dma = &rx_ring->ps_page_dma[i];
4047 } 4130 }
4048 4131
4049no_buffers: 4132no_buffers:
4050 rx_ring->next_to_use = i; 4133 if (likely(rx_ring->next_to_use != i)) {
4134 rx_ring->next_to_use = i;
4135 if (unlikely(i-- == 0)) i = (rx_ring->count - 1);
4136
4137 /* Force memory writes to complete before letting h/w
4138 * know there are new descriptors to fetch. (Only
4139 * applicable for weak-ordered memory model archs,
4140 * such as IA-64). */
4141 wmb();
4142 /* Hardware increments by 16 bytes, but packet split
4143 * descriptors are 32 bytes...so we increment tail
4144 * twice as much.
4145 */
4146 writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt);
4147 }
4051} 4148}
4052 4149
4053/** 4150/**
@@ -4061,24 +4158,24 @@ e1000_smartspeed(struct e1000_adapter *adapter)
4061 uint16_t phy_status; 4158 uint16_t phy_status;
4062 uint16_t phy_ctrl; 4159 uint16_t phy_ctrl;
4063 4160
4064 if((adapter->hw.phy_type != e1000_phy_igp) || !adapter->hw.autoneg || 4161 if ((adapter->hw.phy_type != e1000_phy_igp) || !adapter->hw.autoneg ||
4065 !(adapter->hw.autoneg_advertised & ADVERTISE_1000_FULL)) 4162 !(adapter->hw.autoneg_advertised & ADVERTISE_1000_FULL))
4066 return; 4163 return;
4067 4164
4068 if(adapter->smartspeed == 0) { 4165 if (adapter->smartspeed == 0) {
4069 /* If Master/Slave config fault is asserted twice, 4166 /* If Master/Slave config fault is asserted twice,
4070 * we assume back-to-back */ 4167 * we assume back-to-back */
4071 e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); 4168 e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
4072 if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; 4169 if (!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return;
4073 e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); 4170 e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
4074 if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; 4171 if (!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return;
4075 e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); 4172 e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
4076 if(phy_ctrl & CR_1000T_MS_ENABLE) { 4173 if (phy_ctrl & CR_1000T_MS_ENABLE) {
4077 phy_ctrl &= ~CR_1000T_MS_ENABLE; 4174 phy_ctrl &= ~CR_1000T_MS_ENABLE;
4078 e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, 4175 e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL,
4079 phy_ctrl); 4176 phy_ctrl);
4080 adapter->smartspeed++; 4177 adapter->smartspeed++;
4081 if(!e1000_phy_setup_autoneg(&adapter->hw) && 4178 if (!e1000_phy_setup_autoneg(&adapter->hw) &&
4082 !e1000_read_phy_reg(&adapter->hw, PHY_CTRL, 4179 !e1000_read_phy_reg(&adapter->hw, PHY_CTRL,
4083 &phy_ctrl)) { 4180 &phy_ctrl)) {
4084 phy_ctrl |= (MII_CR_AUTO_NEG_EN | 4181 phy_ctrl |= (MII_CR_AUTO_NEG_EN |
@@ -4088,12 +4185,12 @@ e1000_smartspeed(struct e1000_adapter *adapter)
4088 } 4185 }
4089 } 4186 }
4090 return; 4187 return;
4091 } else if(adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) { 4188 } else if (adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) {
4092 /* If still no link, perhaps using 2/3 pair cable */ 4189 /* If still no link, perhaps using 2/3 pair cable */
4093 e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); 4190 e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
4094 phy_ctrl |= CR_1000T_MS_ENABLE; 4191 phy_ctrl |= CR_1000T_MS_ENABLE;
4095 e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl); 4192 e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl);
4096 if(!e1000_phy_setup_autoneg(&adapter->hw) && 4193 if (!e1000_phy_setup_autoneg(&adapter->hw) &&
4097 !e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) { 4194 !e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) {
4098 phy_ctrl |= (MII_CR_AUTO_NEG_EN | 4195 phy_ctrl |= (MII_CR_AUTO_NEG_EN |
4099 MII_CR_RESTART_AUTO_NEG); 4196 MII_CR_RESTART_AUTO_NEG);
@@ -4101,7 +4198,7 @@ e1000_smartspeed(struct e1000_adapter *adapter)
4101 } 4198 }
4102 } 4199 }
4103 /* Restart process after E1000_SMARTSPEED_MAX iterations */ 4200 /* Restart process after E1000_SMARTSPEED_MAX iterations */
4104 if(adapter->smartspeed++ == E1000_SMARTSPEED_MAX) 4201 if (adapter->smartspeed++ == E1000_SMARTSPEED_MAX)
4105 adapter->smartspeed = 0; 4202 adapter->smartspeed = 0;
4106} 4203}
4107 4204
@@ -4142,7 +4239,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4142 uint16_t spddplx; 4239 uint16_t spddplx;
4143 unsigned long flags; 4240 unsigned long flags;
4144 4241
4145 if(adapter->hw.media_type != e1000_media_type_copper) 4242 if (adapter->hw.media_type != e1000_media_type_copper)
4146 return -EOPNOTSUPP; 4243 return -EOPNOTSUPP;
4147 4244
4148 switch (cmd) { 4245 switch (cmd) {
@@ -4150,10 +4247,10 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4150 data->phy_id = adapter->hw.phy_addr; 4247 data->phy_id = adapter->hw.phy_addr;
4151 break; 4248 break;
4152 case SIOCGMIIREG: 4249 case SIOCGMIIREG:
4153 if(!capable(CAP_NET_ADMIN)) 4250 if (!capable(CAP_NET_ADMIN))
4154 return -EPERM; 4251 return -EPERM;
4155 spin_lock_irqsave(&adapter->stats_lock, flags); 4252 spin_lock_irqsave(&adapter->stats_lock, flags);
4156 if(e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, 4253 if (e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
4157 &data->val_out)) { 4254 &data->val_out)) {
4158 spin_unlock_irqrestore(&adapter->stats_lock, flags); 4255 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4159 return -EIO; 4256 return -EIO;
@@ -4161,23 +4258,23 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4161 spin_unlock_irqrestore(&adapter->stats_lock, flags); 4258 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4162 break; 4259 break;
4163 case SIOCSMIIREG: 4260 case SIOCSMIIREG:
4164 if(!capable(CAP_NET_ADMIN)) 4261 if (!capable(CAP_NET_ADMIN))
4165 return -EPERM; 4262 return -EPERM;
4166 if(data->reg_num & ~(0x1F)) 4263 if (data->reg_num & ~(0x1F))
4167 return -EFAULT; 4264 return -EFAULT;
4168 mii_reg = data->val_in; 4265 mii_reg = data->val_in;
4169 spin_lock_irqsave(&adapter->stats_lock, flags); 4266 spin_lock_irqsave(&adapter->stats_lock, flags);
4170 if(e1000_write_phy_reg(&adapter->hw, data->reg_num, 4267 if (e1000_write_phy_reg(&adapter->hw, data->reg_num,
4171 mii_reg)) { 4268 mii_reg)) {
4172 spin_unlock_irqrestore(&adapter->stats_lock, flags); 4269 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4173 return -EIO; 4270 return -EIO;
4174 } 4271 }
4175 if(adapter->hw.phy_type == e1000_phy_m88) { 4272 if (adapter->hw.phy_type == e1000_phy_m88) {
4176 switch (data->reg_num) { 4273 switch (data->reg_num) {
4177 case PHY_CTRL: 4274 case PHY_CTRL:
4178 if(mii_reg & MII_CR_POWER_DOWN) 4275 if (mii_reg & MII_CR_POWER_DOWN)
4179 break; 4276 break;
4180 if(mii_reg & MII_CR_AUTO_NEG_EN) { 4277 if (mii_reg & MII_CR_AUTO_NEG_EN) {
4181 adapter->hw.autoneg = 1; 4278 adapter->hw.autoneg = 1;
4182 adapter->hw.autoneg_advertised = 0x2F; 4279 adapter->hw.autoneg_advertised = 0x2F;
4183 } else { 4280 } else {
@@ -4192,14 +4289,14 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4192 HALF_DUPLEX; 4289 HALF_DUPLEX;
4193 retval = e1000_set_spd_dplx(adapter, 4290 retval = e1000_set_spd_dplx(adapter,
4194 spddplx); 4291 spddplx);
4195 if(retval) { 4292 if (retval) {
4196 spin_unlock_irqrestore( 4293 spin_unlock_irqrestore(
4197 &adapter->stats_lock, 4294 &adapter->stats_lock,
4198 flags); 4295 flags);
4199 return retval; 4296 return retval;
4200 } 4297 }
4201 } 4298 }
4202 if(netif_running(adapter->netdev)) { 4299 if (netif_running(adapter->netdev)) {
4203 e1000_down(adapter); 4300 e1000_down(adapter);
4204 e1000_up(adapter); 4301 e1000_up(adapter);
4205 } else 4302 } else
@@ -4207,7 +4304,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4207 break; 4304 break;
4208 case M88E1000_PHY_SPEC_CTRL: 4305 case M88E1000_PHY_SPEC_CTRL:
4209 case M88E1000_EXT_PHY_SPEC_CTRL: 4306 case M88E1000_EXT_PHY_SPEC_CTRL:
4210 if(e1000_phy_reset(&adapter->hw)) { 4307 if (e1000_phy_reset(&adapter->hw)) {
4211 spin_unlock_irqrestore( 4308 spin_unlock_irqrestore(
4212 &adapter->stats_lock, flags); 4309 &adapter->stats_lock, flags);
4213 return -EIO; 4310 return -EIO;
@@ -4217,9 +4314,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4217 } else { 4314 } else {
4218 switch (data->reg_num) { 4315 switch (data->reg_num) {
4219 case PHY_CTRL: 4316 case PHY_CTRL:
4220 if(mii_reg & MII_CR_POWER_DOWN) 4317 if (mii_reg & MII_CR_POWER_DOWN)
4221 break; 4318 break;
4222 if(netif_running(adapter->netdev)) { 4319 if (netif_running(adapter->netdev)) {
4223 e1000_down(adapter); 4320 e1000_down(adapter);
4224 e1000_up(adapter); 4321 e1000_up(adapter);
4225 } else 4322 } else
@@ -4241,7 +4338,7 @@ e1000_pci_set_mwi(struct e1000_hw *hw)
4241 struct e1000_adapter *adapter = hw->back; 4338 struct e1000_adapter *adapter = hw->back;
4242 int ret_val = pci_set_mwi(adapter->pdev); 4339 int ret_val = pci_set_mwi(adapter->pdev);
4243 4340
4244 if(ret_val) 4341 if (ret_val)
4245 DPRINTK(PROBE, ERR, "Error in setting MWI\n"); 4342 DPRINTK(PROBE, ERR, "Error in setting MWI\n");
4246} 4343}
4247 4344
@@ -4290,7 +4387,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
4290 e1000_irq_disable(adapter); 4387 e1000_irq_disable(adapter);
4291 adapter->vlgrp = grp; 4388 adapter->vlgrp = grp;
4292 4389
4293 if(grp) { 4390 if (grp) {
4294 /* enable VLAN tag insert/strip */ 4391 /* enable VLAN tag insert/strip */
4295 ctrl = E1000_READ_REG(&adapter->hw, CTRL); 4392 ctrl = E1000_READ_REG(&adapter->hw, CTRL);
4296 ctrl |= E1000_CTRL_VME; 4393 ctrl |= E1000_CTRL_VME;
@@ -4312,7 +4409,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
4312 rctl = E1000_READ_REG(&adapter->hw, RCTL); 4409 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4313 rctl &= ~E1000_RCTL_VFE; 4410 rctl &= ~E1000_RCTL_VFE;
4314 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 4411 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4315 if(adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) { 4412 if (adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) {
4316 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 4413 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
4317 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 4414 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
4318 } 4415 }
@@ -4326,9 +4423,10 @@ e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
4326{ 4423{
4327 struct e1000_adapter *adapter = netdev_priv(netdev); 4424 struct e1000_adapter *adapter = netdev_priv(netdev);
4328 uint32_t vfta, index; 4425 uint32_t vfta, index;
4329 if((adapter->hw.mng_cookie.status & 4426
4330 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 4427 if ((adapter->hw.mng_cookie.status &
4331 (vid == adapter->mng_vlan_id)) 4428 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
4429 (vid == adapter->mng_vlan_id))
4332 return; 4430 return;
4333 /* add VID to filter table */ 4431 /* add VID to filter table */
4334 index = (vid >> 5) & 0x7F; 4432 index = (vid >> 5) & 0x7F;
@@ -4345,13 +4443,13 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
4345 4443
4346 e1000_irq_disable(adapter); 4444 e1000_irq_disable(adapter);
4347 4445
4348 if(adapter->vlgrp) 4446 if (adapter->vlgrp)
4349 adapter->vlgrp->vlan_devices[vid] = NULL; 4447 adapter->vlgrp->vlan_devices[vid] = NULL;
4350 4448
4351 e1000_irq_enable(adapter); 4449 e1000_irq_enable(adapter);
4352 4450
4353 if((adapter->hw.mng_cookie.status & 4451 if ((adapter->hw.mng_cookie.status &
4354 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 4452 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
4355 (vid == adapter->mng_vlan_id)) { 4453 (vid == adapter->mng_vlan_id)) {
4356 /* release control to f/w */ 4454 /* release control to f/w */
4357 e1000_release_hw_control(adapter); 4455 e1000_release_hw_control(adapter);
@@ -4370,10 +4468,10 @@ e1000_restore_vlan(struct e1000_adapter *adapter)
4370{ 4468{
4371 e1000_vlan_rx_register(adapter->netdev, adapter->vlgrp); 4469 e1000_vlan_rx_register(adapter->netdev, adapter->vlgrp);
4372 4470
4373 if(adapter->vlgrp) { 4471 if (adapter->vlgrp) {
4374 uint16_t vid; 4472 uint16_t vid;
4375 for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { 4473 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
4376 if(!adapter->vlgrp->vlan_devices[vid]) 4474 if (!adapter->vlgrp->vlan_devices[vid])
4377 continue; 4475 continue;
4378 e1000_vlan_rx_add_vid(adapter->netdev, vid); 4476 e1000_vlan_rx_add_vid(adapter->netdev, vid);
4379 } 4477 }
@@ -4386,13 +4484,13 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
4386 adapter->hw.autoneg = 0; 4484 adapter->hw.autoneg = 0;
4387 4485
4388 /* Fiber NICs only allow 1000 gbps Full duplex */ 4486 /* Fiber NICs only allow 1000 gbps Full duplex */
4389 if((adapter->hw.media_type == e1000_media_type_fiber) && 4487 if ((adapter->hw.media_type == e1000_media_type_fiber) &&
4390 spddplx != (SPEED_1000 + DUPLEX_FULL)) { 4488 spddplx != (SPEED_1000 + DUPLEX_FULL)) {
4391 DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); 4489 DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
4392 return -EINVAL; 4490 return -EINVAL;
4393 } 4491 }
4394 4492
4395 switch(spddplx) { 4493 switch (spddplx) {
4396 case SPEED_10 + DUPLEX_HALF: 4494 case SPEED_10 + DUPLEX_HALF:
4397 adapter->hw.forced_speed_duplex = e1000_10_half; 4495 adapter->hw.forced_speed_duplex = e1000_10_half;
4398 break; 4496 break;
@@ -4418,6 +4516,54 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
4418} 4516}
4419 4517
4420#ifdef CONFIG_PM 4518#ifdef CONFIG_PM
4519/* these functions save and restore 16 or 64 dwords (64-256 bytes) of config
4520 * space versus the 64 bytes that pci_[save|restore]_state handle
4521 */
4522#define PCIE_CONFIG_SPACE_LEN 256
4523#define PCI_CONFIG_SPACE_LEN 64
4524static int
4525e1000_pci_save_state(struct e1000_adapter *adapter)
4526{
4527 struct pci_dev *dev = adapter->pdev;
4528 int size;
4529 int i;
4530 if (adapter->hw.mac_type >= e1000_82571)
4531 size = PCIE_CONFIG_SPACE_LEN;
4532 else
4533 size = PCI_CONFIG_SPACE_LEN;
4534
4535 WARN_ON(adapter->config_space != NULL);
4536
4537 adapter->config_space = kmalloc(size, GFP_KERNEL);
4538 if (!adapter->config_space) {
4539 DPRINTK(PROBE, ERR, "unable to allocate %d bytes\n", size);
4540 return -ENOMEM;
4541 }
4542 for (i = 0; i < (size / 4); i++)
4543 pci_read_config_dword(dev, i * 4, &adapter->config_space[i]);
4544 return 0;
4545}
4546
4547static void
4548e1000_pci_restore_state(struct e1000_adapter *adapter)
4549{
4550 struct pci_dev *dev = adapter->pdev;
4551 int size;
4552 int i;
4553 if (adapter->config_space == NULL)
4554 return;
4555 if (adapter->hw.mac_type >= e1000_82571)
4556 size = PCIE_CONFIG_SPACE_LEN;
4557 else
4558 size = PCI_CONFIG_SPACE_LEN;
4559 for (i = 0; i < (size / 4); i++)
4560 pci_write_config_dword(dev, i * 4, adapter->config_space[i]);
4561 kfree(adapter->config_space);
4562 adapter->config_space = NULL;
4563 return;
4564}
4565#endif /* CONFIG_PM */
4566
4421static int 4567static int
4422e1000_suspend(struct pci_dev *pdev, pm_message_t state) 4568e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4423{ 4569{
@@ -4429,25 +4575,33 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4429 4575
4430 netif_device_detach(netdev); 4576 netif_device_detach(netdev);
4431 4577
4432 if(netif_running(netdev)) 4578 if (netif_running(netdev))
4433 e1000_down(adapter); 4579 e1000_down(adapter);
4434 4580
4581#ifdef CONFIG_PM
4582 /* implement our own version of pci_save_state(pdev) because pci
4583 * express adapters have larger 256 byte config spaces */
4584 retval = e1000_pci_save_state(adapter);
4585 if (retval)
4586 return retval;
4587#endif
4588
4435 status = E1000_READ_REG(&adapter->hw, STATUS); 4589 status = E1000_READ_REG(&adapter->hw, STATUS);
4436 if(status & E1000_STATUS_LU) 4590 if (status & E1000_STATUS_LU)
4437 wufc &= ~E1000_WUFC_LNKC; 4591 wufc &= ~E1000_WUFC_LNKC;
4438 4592
4439 if(wufc) { 4593 if (wufc) {
4440 e1000_setup_rctl(adapter); 4594 e1000_setup_rctl(adapter);
4441 e1000_set_multi(netdev); 4595 e1000_set_multi(netdev);
4442 4596
4443 /* turn on all-multi mode if wake on multicast is enabled */ 4597 /* turn on all-multi mode if wake on multicast is enabled */
4444 if(adapter->wol & E1000_WUFC_MC) { 4598 if (adapter->wol & E1000_WUFC_MC) {
4445 rctl = E1000_READ_REG(&adapter->hw, RCTL); 4599 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4446 rctl |= E1000_RCTL_MPE; 4600 rctl |= E1000_RCTL_MPE;
4447 E1000_WRITE_REG(&adapter->hw, RCTL, rctl); 4601 E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4448 } 4602 }
4449 4603
4450 if(adapter->hw.mac_type >= e1000_82540) { 4604 if (adapter->hw.mac_type >= e1000_82540) {
4451 ctrl = E1000_READ_REG(&adapter->hw, CTRL); 4605 ctrl = E1000_READ_REG(&adapter->hw, CTRL);
4452 /* advertise wake from D3Cold */ 4606 /* advertise wake from D3Cold */
4453 #define E1000_CTRL_ADVD3WUC 0x00100000 4607 #define E1000_CTRL_ADVD3WUC 0x00100000
@@ -4458,7 +4612,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4458 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); 4612 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
4459 } 4613 }
4460 4614
4461 if(adapter->hw.media_type == e1000_media_type_fiber || 4615 if (adapter->hw.media_type == e1000_media_type_fiber ||
4462 adapter->hw.media_type == e1000_media_type_internal_serdes) { 4616 adapter->hw.media_type == e1000_media_type_internal_serdes) {
4463 /* keep the laser running in D3 */ 4617 /* keep the laser running in D3 */
4464 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); 4618 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
@@ -4488,12 +4642,10 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4488 DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n"); 4642 DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
4489 } 4643 }
4490 4644
4491 pci_save_state(pdev); 4645 if (adapter->hw.mac_type >= e1000_82540 &&
4492
4493 if(adapter->hw.mac_type >= e1000_82540 &&
4494 adapter->hw.media_type == e1000_media_type_copper) { 4646 adapter->hw.media_type == e1000_media_type_copper) {
4495 manc = E1000_READ_REG(&adapter->hw, MANC); 4647 manc = E1000_READ_REG(&adapter->hw, MANC);
4496 if(manc & E1000_MANC_SMBUS_EN) { 4648 if (manc & E1000_MANC_SMBUS_EN) {
4497 manc |= E1000_MANC_ARP_EN; 4649 manc |= E1000_MANC_ARP_EN;
4498 E1000_WRITE_REG(&adapter->hw, MANC, manc); 4650 E1000_WRITE_REG(&adapter->hw, MANC, manc);
4499 retval = pci_enable_wake(pdev, PCI_D3hot, 1); 4651 retval = pci_enable_wake(pdev, PCI_D3hot, 1);
@@ -4518,6 +4670,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4518 return 0; 4670 return 0;
4519} 4671}
4520 4672
4673#ifdef CONFIG_PM
4521static int 4674static int
4522e1000_resume(struct pci_dev *pdev) 4675e1000_resume(struct pci_dev *pdev)
4523{ 4676{
@@ -4529,6 +4682,7 @@ e1000_resume(struct pci_dev *pdev)
4529 retval = pci_set_power_state(pdev, PCI_D0); 4682 retval = pci_set_power_state(pdev, PCI_D0);
4530 if (retval) 4683 if (retval)
4531 DPRINTK(PROBE, ERR, "Error in setting power state\n"); 4684 DPRINTK(PROBE, ERR, "Error in setting power state\n");
4685 e1000_pci_restore_state(adapter);
4532 ret_val = pci_enable_device(pdev); 4686 ret_val = pci_enable_device(pdev);
4533 pci_set_master(pdev); 4687 pci_set_master(pdev);
4534 4688
@@ -4542,12 +4696,12 @@ e1000_resume(struct pci_dev *pdev)
4542 e1000_reset(adapter); 4696 e1000_reset(adapter);
4543 E1000_WRITE_REG(&adapter->hw, WUS, ~0); 4697 E1000_WRITE_REG(&adapter->hw, WUS, ~0);
4544 4698
4545 if(netif_running(netdev)) 4699 if (netif_running(netdev))
4546 e1000_up(adapter); 4700 e1000_up(adapter);
4547 4701
4548 netif_device_attach(netdev); 4702 netif_device_attach(netdev);
4549 4703
4550 if(adapter->hw.mac_type >= e1000_82540 && 4704 if (adapter->hw.mac_type >= e1000_82540 &&
4551 adapter->hw.media_type == e1000_media_type_copper) { 4705 adapter->hw.media_type == e1000_media_type_copper) {
4552 manc = E1000_READ_REG(&adapter->hw, MANC); 4706 manc = E1000_READ_REG(&adapter->hw, MANC);
4553 manc &= ~(E1000_MANC_ARP_EN); 4707 manc &= ~(E1000_MANC_ARP_EN);
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index aac64de61437..9790db974dc1 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -47,7 +47,7 @@
47 BUG(); \ 47 BUG(); \
48 } else { \ 48 } else { \
49 msleep(x); \ 49 msleep(x); \
50 } } while(0) 50 } } while (0)
51 51
52/* Some workarounds require millisecond delays and are run during interrupt 52/* Some workarounds require millisecond delays and are run during interrupt
53 * context. Most notably, when establishing link, the phy may need tweaking 53 * context. Most notably, when establishing link, the phy may need tweaking
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index 0a7918c62557..3768d83cd577 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -227,7 +227,7 @@ static int __devinit
227e1000_validate_option(int *value, struct e1000_option *opt, 227e1000_validate_option(int *value, struct e1000_option *opt,
228 struct e1000_adapter *adapter) 228 struct e1000_adapter *adapter)
229{ 229{
230 if(*value == OPTION_UNSET) { 230 if (*value == OPTION_UNSET) {
231 *value = opt->def; 231 *value = opt->def;
232 return 0; 232 return 0;
233 } 233 }
@@ -244,7 +244,7 @@ e1000_validate_option(int *value, struct e1000_option *opt,
244 } 244 }
245 break; 245 break;
246 case range_option: 246 case range_option:
247 if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) { 247 if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
248 DPRINTK(PROBE, INFO, 248 DPRINTK(PROBE, INFO,
249 "%s set to %i\n", opt->name, *value); 249 "%s set to %i\n", opt->name, *value);
250 return 0; 250 return 0;
@@ -254,10 +254,10 @@ e1000_validate_option(int *value, struct e1000_option *opt,
254 int i; 254 int i;
255 struct e1000_opt_list *ent; 255 struct e1000_opt_list *ent;
256 256
257 for(i = 0; i < opt->arg.l.nr; i++) { 257 for (i = 0; i < opt->arg.l.nr; i++) {
258 ent = &opt->arg.l.p[i]; 258 ent = &opt->arg.l.p[i];
259 if(*value == ent->i) { 259 if (*value == ent->i) {
260 if(ent->str[0] != '\0') 260 if (ent->str[0] != '\0')
261 DPRINTK(PROBE, INFO, "%s\n", ent->str); 261 DPRINTK(PROBE, INFO, "%s\n", ent->str);
262 return 0; 262 return 0;
263 } 263 }
@@ -291,7 +291,7 @@ void __devinit
291e1000_check_options(struct e1000_adapter *adapter) 291e1000_check_options(struct e1000_adapter *adapter)
292{ 292{
293 int bd = adapter->bd_number; 293 int bd = adapter->bd_number;
294 if(bd >= E1000_MAX_NIC) { 294 if (bd >= E1000_MAX_NIC) {
295 DPRINTK(PROBE, NOTICE, 295 DPRINTK(PROBE, NOTICE,
296 "Warning: no configuration for board #%i\n", bd); 296 "Warning: no configuration for board #%i\n", bd);
297 DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); 297 DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
@@ -315,7 +315,7 @@ e1000_check_options(struct e1000_adapter *adapter)
315 if (num_TxDescriptors > bd) { 315 if (num_TxDescriptors > bd) {
316 tx_ring->count = TxDescriptors[bd]; 316 tx_ring->count = TxDescriptors[bd];
317 e1000_validate_option(&tx_ring->count, &opt, adapter); 317 e1000_validate_option(&tx_ring->count, &opt, adapter);
318 E1000_ROUNDUP(tx_ring->count, 318 E1000_ROUNDUP(tx_ring->count,
319 REQ_TX_DESCRIPTOR_MULTIPLE); 319 REQ_TX_DESCRIPTOR_MULTIPLE);
320 } else { 320 } else {
321 tx_ring->count = opt.def; 321 tx_ring->count = opt.def;
@@ -341,7 +341,7 @@ e1000_check_options(struct e1000_adapter *adapter)
341 if (num_RxDescriptors > bd) { 341 if (num_RxDescriptors > bd) {
342 rx_ring->count = RxDescriptors[bd]; 342 rx_ring->count = RxDescriptors[bd];
343 e1000_validate_option(&rx_ring->count, &opt, adapter); 343 e1000_validate_option(&rx_ring->count, &opt, adapter);
344 E1000_ROUNDUP(rx_ring->count, 344 E1000_ROUNDUP(rx_ring->count,
345 REQ_RX_DESCRIPTOR_MULTIPLE); 345 REQ_RX_DESCRIPTOR_MULTIPLE);
346 } else { 346 } else {
347 rx_ring->count = opt.def; 347 rx_ring->count = opt.def;
@@ -403,7 +403,7 @@ e1000_check_options(struct e1000_adapter *adapter)
403 403
404 if (num_TxIntDelay > bd) { 404 if (num_TxIntDelay > bd) {
405 adapter->tx_int_delay = TxIntDelay[bd]; 405 adapter->tx_int_delay = TxIntDelay[bd];
406 e1000_validate_option(&adapter->tx_int_delay, &opt, 406 e1000_validate_option(&adapter->tx_int_delay, &opt,
407 adapter); 407 adapter);
408 } else { 408 } else {
409 adapter->tx_int_delay = opt.def; 409 adapter->tx_int_delay = opt.def;
@@ -421,7 +421,7 @@ e1000_check_options(struct e1000_adapter *adapter)
421 421
422 if (num_TxAbsIntDelay > bd) { 422 if (num_TxAbsIntDelay > bd) {
423 adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; 423 adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
424 e1000_validate_option(&adapter->tx_abs_int_delay, &opt, 424 e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
425 adapter); 425 adapter);
426 } else { 426 } else {
427 adapter->tx_abs_int_delay = opt.def; 427 adapter->tx_abs_int_delay = opt.def;
@@ -439,7 +439,7 @@ e1000_check_options(struct e1000_adapter *adapter)
439 439
440 if (num_RxIntDelay > bd) { 440 if (num_RxIntDelay > bd) {
441 adapter->rx_int_delay = RxIntDelay[bd]; 441 adapter->rx_int_delay = RxIntDelay[bd];
442 e1000_validate_option(&adapter->rx_int_delay, &opt, 442 e1000_validate_option(&adapter->rx_int_delay, &opt,
443 adapter); 443 adapter);
444 } else { 444 } else {
445 adapter->rx_int_delay = opt.def; 445 adapter->rx_int_delay = opt.def;
@@ -457,7 +457,7 @@ e1000_check_options(struct e1000_adapter *adapter)
457 457
458 if (num_RxAbsIntDelay > bd) { 458 if (num_RxAbsIntDelay > bd) {
459 adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; 459 adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
460 e1000_validate_option(&adapter->rx_abs_int_delay, &opt, 460 e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
461 adapter); 461 adapter);
462 } else { 462 } else {
463 adapter->rx_abs_int_delay = opt.def; 463 adapter->rx_abs_int_delay = opt.def;
@@ -475,17 +475,17 @@ e1000_check_options(struct e1000_adapter *adapter)
475 475
476 if (num_InterruptThrottleRate > bd) { 476 if (num_InterruptThrottleRate > bd) {
477 adapter->itr = InterruptThrottleRate[bd]; 477 adapter->itr = InterruptThrottleRate[bd];
478 switch(adapter->itr) { 478 switch (adapter->itr) {
479 case 0: 479 case 0:
480 DPRINTK(PROBE, INFO, "%s turned off\n", 480 DPRINTK(PROBE, INFO, "%s turned off\n",
481 opt.name); 481 opt.name);
482 break; 482 break;
483 case 1: 483 case 1:
484 DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", 484 DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
485 opt.name); 485 opt.name);
486 break; 486 break;
487 default: 487 default:
488 e1000_validate_option(&adapter->itr, &opt, 488 e1000_validate_option(&adapter->itr, &opt,
489 adapter); 489 adapter);
490 break; 490 break;
491 } 491 }
@@ -494,7 +494,7 @@ e1000_check_options(struct e1000_adapter *adapter)
494 } 494 }
495 } 495 }
496 496
497 switch(adapter->hw.media_type) { 497 switch (adapter->hw.media_type) {
498 case e1000_media_type_fiber: 498 case e1000_media_type_fiber:
499 case e1000_media_type_internal_serdes: 499 case e1000_media_type_internal_serdes:
500 e1000_check_fiber_options(adapter); 500 e1000_check_fiber_options(adapter);
@@ -518,17 +518,17 @@ static void __devinit
518e1000_check_fiber_options(struct e1000_adapter *adapter) 518e1000_check_fiber_options(struct e1000_adapter *adapter)
519{ 519{
520 int bd = adapter->bd_number; 520 int bd = adapter->bd_number;
521 if(num_Speed > bd) { 521 if (num_Speed > bd) {
522 DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " 522 DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
523 "parameter ignored\n"); 523 "parameter ignored\n");
524 } 524 }
525 525
526 if(num_Duplex > bd) { 526 if (num_Duplex > bd) {
527 DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " 527 DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
528 "parameter ignored\n"); 528 "parameter ignored\n");
529 } 529 }
530 530
531 if((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { 531 if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
532 DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " 532 DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
533 "not valid for fiber adapters, " 533 "not valid for fiber adapters, "
534 "parameter ignored\n"); 534 "parameter ignored\n");
@@ -598,7 +598,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
598 } 598 }
599 } 599 }
600 600
601 if((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { 601 if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
602 DPRINTK(PROBE, INFO, 602 DPRINTK(PROBE, INFO,
603 "AutoNeg specified along with Speed or Duplex, " 603 "AutoNeg specified along with Speed or Duplex, "
604 "parameter ignored\n"); 604 "parameter ignored\n");
@@ -659,7 +659,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
659 switch (speed + dplx) { 659 switch (speed + dplx) {
660 case 0: 660 case 0:
661 adapter->hw.autoneg = adapter->fc_autoneg = 1; 661 adapter->hw.autoneg = adapter->fc_autoneg = 1;
662 if((num_Speed > bd) && (speed != 0 || dplx != 0)) 662 if ((num_Speed > bd) && (speed != 0 || dplx != 0))
663 DPRINTK(PROBE, INFO, 663 DPRINTK(PROBE, INFO,
664 "Speed and duplex autonegotiation enabled\n"); 664 "Speed and duplex autonegotiation enabled\n");
665 break; 665 break;
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index 5fc4a62173d9..fa4ae94243c2 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -34,6 +34,7 @@ sunserial_console_termios(struct console *con)
34 char *mode_prop = "ttyX-mode"; 34 char *mode_prop = "ttyX-mode";
35 char *cd_prop = "ttyX-ignore-cd"; 35 char *cd_prop = "ttyX-ignore-cd";
36 char *dtr_prop = "ttyX-rts-dtr-off"; 36 char *dtr_prop = "ttyX-rts-dtr-off";
37 char *ssp_console_modes_prop = "ssp-console-modes";
37 int baud, bits, stop, cflag; 38 int baud, bits, stop, cflag;
38 char parity; 39 char parity;
39 int carrier = 0; 40 int carrier = 0;
@@ -43,14 +44,39 @@ sunserial_console_termios(struct console *con)
43 if (!serial_console) 44 if (!serial_console)
44 return; 45 return;
45 46
46 if (serial_console == 1) { 47 switch (serial_console) {
48 case PROMDEV_OTTYA:
47 mode_prop[3] = 'a'; 49 mode_prop[3] = 'a';
48 cd_prop[3] = 'a'; 50 cd_prop[3] = 'a';
49 dtr_prop[3] = 'a'; 51 dtr_prop[3] = 'a';
50 } else { 52 break;
53
54 case PROMDEV_OTTYB:
51 mode_prop[3] = 'b'; 55 mode_prop[3] = 'b';
52 cd_prop[3] = 'b'; 56 cd_prop[3] = 'b';
53 dtr_prop[3] = 'b'; 57 dtr_prop[3] = 'b';
58 break;
59
60 case PROMDEV_ORSC:
61
62 nd = prom_pathtoinode("rsc");
63 if (!nd) {
64 strcpy(mode, "115200,8,n,1,-");
65 goto no_options;
66 }
67
68 if (!prom_node_has_property(nd, ssp_console_modes_prop)) {
69 strcpy(mode, "115200,8,n,1,-");
70 goto no_options;
71 }
72
73 memset(mode, 0, sizeof(mode));
74 prom_getstring(nd, ssp_console_modes_prop, mode, sizeof(mode));
75 goto no_options;
76
77 default:
78 strcpy(mode, "9600,8,n,1,-");
79 goto no_options;
54 } 80 }
55 81
56 topnd = prom_getchild(prom_root_node); 82 topnd = prom_getchild(prom_root_node);
@@ -110,6 +136,10 @@ no_options:
110 case 9600: cflag |= B9600; break; 136 case 9600: cflag |= B9600; break;
111 case 19200: cflag |= B19200; break; 137 case 19200: cflag |= B19200; break;
112 case 38400: cflag |= B38400; break; 138 case 38400: cflag |= B38400; break;
139 case 57600: cflag |= B57600; break;
140 case 115200: cflag |= B115200; break;
141 case 230400: cflag |= B230400; break;
142 case 460800: cflag |= B460800; break;
113 default: baud = 9600; cflag |= B9600; break; 143 default: baud = 9600; cflag |= B9600; break;
114 } 144 }
115 145
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 7e773ff76c61..8bcaebcc0ad7 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -897,9 +897,6 @@ static int sunsab_console_setup(struct console *con, char *options)
897 897
898 sunserial_console_termios(con); 898 sunserial_console_termios(con);
899 899
900 /* Firmware console speed is limited to 150-->38400 baud so
901 * this hackish cflag thing is OK.
902 */
903 switch (con->cflag & CBAUD) { 900 switch (con->cflag & CBAUD) {
904 case B150: baud = 150; break; 901 case B150: baud = 150; break;
905 case B300: baud = 300; break; 902 case B300: baud = 300; break;
@@ -910,6 +907,10 @@ static int sunsab_console_setup(struct console *con, char *options)
910 default: case B9600: baud = 9600; break; 907 default: case B9600: baud = 9600; break;
911 case B19200: baud = 19200; break; 908 case B19200: baud = 19200; break;
912 case B38400: baud = 38400; break; 909 case B38400: baud = 38400; break;
910 case B57600: baud = 57600; break;
911 case B115200: baud = 115200; break;
912 case B230400: baud = 230400; break;
913 case B460800: baud = 460800; break;
913 }; 914 };
914 915
915 /* 916 /*
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index d02f1e8ae1a6..3c59b2693fb9 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -163,6 +163,7 @@ enum prom_input_device {
163 PROMDEV_IKBD, /* input from keyboard */ 163 PROMDEV_IKBD, /* input from keyboard */
164 PROMDEV_ITTYA, /* input from ttya */ 164 PROMDEV_ITTYA, /* input from ttya */
165 PROMDEV_ITTYB, /* input from ttyb */ 165 PROMDEV_ITTYB, /* input from ttyb */
166 PROMDEV_IRSC, /* input from rsc */
166 PROMDEV_I_UNK, 167 PROMDEV_I_UNK,
167}; 168};
168 169
@@ -174,6 +175,7 @@ enum prom_output_device {
174 PROMDEV_OSCREEN, /* to screen */ 175 PROMDEV_OSCREEN, /* to screen */
175 PROMDEV_OTTYA, /* to ttya */ 176 PROMDEV_OTTYA, /* to ttya */
176 PROMDEV_OTTYB, /* to ttyb */ 177 PROMDEV_OTTYB, /* to ttyb */
178 PROMDEV_ORSC, /* to rsc */
177 PROMDEV_O_UNK, 179 PROMDEV_O_UNK,
178}; 180};
179 181
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index fe26d431de87..7a92c1ce1457 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -72,6 +72,7 @@
72 * over Ethernet 72 * over Ethernet
73 */ 73 */
74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
75#define ETH_P_TIPC 0x88CA /* TIPC */
75 76
76/* 77/*
77 * Non DIX types. Won't clash for 1500 types. 78 * Non DIX types. Won't clash for 1500 types.
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index a52c8c64a5a3..33a653913d94 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -168,10 +168,13 @@
168#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */ 168#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
169 169
170/* 170/*
171 * Link priority limits (range from 0 to # priorities - 1) 171 * Link priority limits (min, default, max, media default)
172 */ 172 */
173 173
174#define TIPC_NUM_LINK_PRI 32 174#define TIPC_MIN_LINK_PRI 0
175#define TIPC_DEF_LINK_PRI 10
176#define TIPC_MAX_LINK_PRI 31
177#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1)
175 178
176/* 179/*
177 * Link tolerance limits (min, default, max), in ms 180 * Link tolerance limits (min, default, max), in ms
diff --git a/net/Kconfig b/net/Kconfig
index 9296b269d675..bc603d9aea56 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -150,6 +150,7 @@ endif
150 150
151source "net/dccp/Kconfig" 151source "net/dccp/Kconfig"
152source "net/sctp/Kconfig" 152source "net/sctp/Kconfig"
153source "net/tipc/Kconfig"
153source "net/atm/Kconfig" 154source "net/atm/Kconfig"
154source "net/bridge/Kconfig" 155source "net/bridge/Kconfig"
155source "net/8021q/Kconfig" 156source "net/8021q/Kconfig"
@@ -159,7 +160,6 @@ source "net/ipx/Kconfig"
159source "drivers/net/appletalk/Kconfig" 160source "drivers/net/appletalk/Kconfig"
160source "net/x25/Kconfig" 161source "net/x25/Kconfig"
161source "net/lapb/Kconfig" 162source "net/lapb/Kconfig"
162source "net/tipc/Kconfig"
163 163
164config NET_DIVERT 164config NET_DIVERT
165 bool "Frame Diverter (EXPERIMENTAL)" 165 bool "Frame Diverter (EXPERIMENTAL)"
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 3827f881f429..da16f8fd1494 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1860,13 +1860,14 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
1860 */ 1860 */
1861 mod_cur_headers(pkt_dev); 1861 mod_cur_headers(pkt_dev);
1862 1862
1863 skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC); 1863 datalen = (odev->hard_header_len + 16) & ~0xf;
1864 skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen, GFP_ATOMIC);
1864 if (!skb) { 1865 if (!skb) {
1865 sprintf(pkt_dev->result, "No memory"); 1866 sprintf(pkt_dev->result, "No memory");
1866 return NULL; 1867 return NULL;
1867 } 1868 }
1868 1869
1869 skb_reserve(skb, 16); 1870 skb_reserve(skb, datalen);
1870 1871
1871 /* Reserve for ethernet and IP header */ 1872 /* Reserve for ethernet and IP header */
1872 eth = (__u8 *) skb_push(skb, 14); 1873 eth = (__u8 *) skb_push(skb, 14);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 192092b89e53..d8ce7133cd8f 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -233,7 +233,18 @@ static int is_in(struct ip_mc_list *pmc, struct ip_sf_list *psf, int type,
233 case IGMPV3_MODE_IS_EXCLUDE: 233 case IGMPV3_MODE_IS_EXCLUDE:
234 if (gdeleted || sdeleted) 234 if (gdeleted || sdeleted)
235 return 0; 235 return 0;
236 return !(pmc->gsquery && !psf->sf_gsresp); 236 if (!(pmc->gsquery && !psf->sf_gsresp)) {
237 if (pmc->sfmode == MCAST_INCLUDE)
238 return 1;
239 /* don't include if this source is excluded
240 * in all filters
241 */
242 if (psf->sf_count[MCAST_INCLUDE])
243 return type == IGMPV3_MODE_IS_INCLUDE;
244 return pmc->sfcount[MCAST_EXCLUDE] ==
245 psf->sf_count[MCAST_EXCLUDE];
246 }
247 return 0;
237 case IGMPV3_CHANGE_TO_INCLUDE: 248 case IGMPV3_CHANGE_TO_INCLUDE:
238 if (gdeleted || sdeleted) 249 if (gdeleted || sdeleted)
239 return 0; 250 return 0;
@@ -385,7 +396,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
385 struct igmpv3_report *pih; 396 struct igmpv3_report *pih;
386 struct igmpv3_grec *pgr = NULL; 397 struct igmpv3_grec *pgr = NULL;
387 struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list; 398 struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list;
388 int scount, first, isquery, truncate; 399 int scount, stotal, first, isquery, truncate;
389 400
390 if (pmc->multiaddr == IGMP_ALL_HOSTS) 401 if (pmc->multiaddr == IGMP_ALL_HOSTS)
391 return skb; 402 return skb;
@@ -395,25 +406,13 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
395 truncate = type == IGMPV3_MODE_IS_EXCLUDE || 406 truncate = type == IGMPV3_MODE_IS_EXCLUDE ||
396 type == IGMPV3_CHANGE_TO_EXCLUDE; 407 type == IGMPV3_CHANGE_TO_EXCLUDE;
397 408
409 stotal = scount = 0;
410
398 psf_list = sdeleted ? &pmc->tomb : &pmc->sources; 411 psf_list = sdeleted ? &pmc->tomb : &pmc->sources;
399 412
400 if (!*psf_list) { 413 if (!*psf_list)
401 if (type == IGMPV3_ALLOW_NEW_SOURCES || 414 goto empty_source;
402 type == IGMPV3_BLOCK_OLD_SOURCES) 415
403 return skb;
404 if (pmc->crcount || isquery) {
405 /* make sure we have room for group header and at
406 * least one source.
407 */
408 if (skb && AVAILABLE(skb) < sizeof(struct igmpv3_grec)+
409 sizeof(__u32)) {
410 igmpv3_sendpack(skb);
411 skb = NULL; /* add_grhead will get a new one */
412 }
413 skb = add_grhead(skb, pmc, type, &pgr);
414 }
415 return skb;
416 }
417 pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL; 416 pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL;
418 417
419 /* EX and TO_EX get a fresh packet, if needed */ 418 /* EX and TO_EX get a fresh packet, if needed */
@@ -426,7 +425,6 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
426 } 425 }
427 } 426 }
428 first = 1; 427 first = 1;
429 scount = 0;
430 psf_prev = NULL; 428 psf_prev = NULL;
431 for (psf=*psf_list; psf; psf=psf_next) { 429 for (psf=*psf_list; psf; psf=psf_next) {
432 u32 *psrc; 430 u32 *psrc;
@@ -460,7 +458,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
460 } 458 }
461 psrc = (u32 *)skb_put(skb, sizeof(u32)); 459 psrc = (u32 *)skb_put(skb, sizeof(u32));
462 *psrc = psf->sf_inaddr; 460 *psrc = psf->sf_inaddr;
463 scount++; 461 scount++; stotal++;
464 if ((type == IGMPV3_ALLOW_NEW_SOURCES || 462 if ((type == IGMPV3_ALLOW_NEW_SOURCES ||
465 type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) { 463 type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) {
466 psf->sf_crcount--; 464 psf->sf_crcount--;
@@ -475,6 +473,21 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
475 } 473 }
476 psf_prev = psf; 474 psf_prev = psf;
477 } 475 }
476
477empty_source:
478 if (!stotal) {
479 if (type == IGMPV3_ALLOW_NEW_SOURCES ||
480 type == IGMPV3_BLOCK_OLD_SOURCES)
481 return skb;
482 if (pmc->crcount || isquery) {
483 /* make sure we have room for group header */
484 if (skb && AVAILABLE(skb)<sizeof(struct igmpv3_grec)) {
485 igmpv3_sendpack(skb);
486 skb = NULL; /* add_grhead will get a new one */
487 }
488 skb = add_grhead(skb, pmc, type, &pgr);
489 }
490 }
478 if (pgr) 491 if (pgr)
479 pgr->grec_nsrcs = htons(scount); 492 pgr->grec_nsrcs = htons(scount);
480 493
@@ -557,11 +570,11 @@ static void igmpv3_send_cr(struct in_device *in_dev)
557 skb = add_grec(skb, pmc, dtype, 1, 1); 570 skb = add_grec(skb, pmc, dtype, 1, 1);
558 } 571 }
559 if (pmc->crcount) { 572 if (pmc->crcount) {
560 pmc->crcount--;
561 if (pmc->sfmode == MCAST_EXCLUDE) { 573 if (pmc->sfmode == MCAST_EXCLUDE) {
562 type = IGMPV3_CHANGE_TO_INCLUDE; 574 type = IGMPV3_CHANGE_TO_INCLUDE;
563 skb = add_grec(skb, pmc, type, 1, 0); 575 skb = add_grec(skb, pmc, type, 1, 0);
564 } 576 }
577 pmc->crcount--;
565 if (pmc->crcount == 0) { 578 if (pmc->crcount == 0) {
566 igmpv3_clear_zeros(&pmc->tomb); 579 igmpv3_clear_zeros(&pmc->tomb);
567 igmpv3_clear_zeros(&pmc->sources); 580 igmpv3_clear_zeros(&pmc->sources);
@@ -594,12 +607,12 @@ static void igmpv3_send_cr(struct in_device *in_dev)
594 607
595 /* filter mode changes */ 608 /* filter mode changes */
596 if (pmc->crcount) { 609 if (pmc->crcount) {
597 pmc->crcount--;
598 if (pmc->sfmode == MCAST_EXCLUDE) 610 if (pmc->sfmode == MCAST_EXCLUDE)
599 type = IGMPV3_CHANGE_TO_EXCLUDE; 611 type = IGMPV3_CHANGE_TO_EXCLUDE;
600 else 612 else
601 type = IGMPV3_CHANGE_TO_INCLUDE; 613 type = IGMPV3_CHANGE_TO_INCLUDE;
602 skb = add_grec(skb, pmc, type, 0, 0); 614 skb = add_grec(skb, pmc, type, 0, 0);
615 pmc->crcount--;
603 } 616 }
604 spin_unlock_bh(&pmc->lock); 617 spin_unlock_bh(&pmc->lock);
605 } 618 }
@@ -735,11 +748,43 @@ static void igmp_timer_expire(unsigned long data)
735 ip_ma_put(im); 748 ip_ma_put(im);
736} 749}
737 750
738static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) 751/* mark EXCLUDE-mode sources */
752static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
753{
754 struct ip_sf_list *psf;
755 int i, scount;
756
757 scount = 0;
758 for (psf=pmc->sources; psf; psf=psf->sf_next) {
759 if (scount == nsrcs)
760 break;
761 for (i=0; i<nsrcs; i++) {
762 /* skip inactive filters */
763 if (pmc->sfcount[MCAST_INCLUDE] ||
764 pmc->sfcount[MCAST_EXCLUDE] !=
765 psf->sf_count[MCAST_EXCLUDE])
766 continue;
767 if (srcs[i] == psf->sf_inaddr) {
768 scount++;
769 break;
770 }
771 }
772 }
773 pmc->gsquery = 0;
774 if (scount == nsrcs) /* all sources excluded */
775 return 0;
776 return 1;
777}
778
779static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
739{ 780{
740 struct ip_sf_list *psf; 781 struct ip_sf_list *psf;
741 int i, scount; 782 int i, scount;
742 783
784 if (pmc->sfmode == MCAST_EXCLUDE)
785 return igmp_xmarksources(pmc, nsrcs, srcs);
786
787 /* mark INCLUDE-mode sources */
743 scount = 0; 788 scount = 0;
744 for (psf=pmc->sources; psf; psf=psf->sf_next) { 789 for (psf=pmc->sources; psf; psf=psf->sf_next) {
745 if (scount == nsrcs) 790 if (scount == nsrcs)
@@ -751,6 +796,12 @@ static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs)
751 break; 796 break;
752 } 797 }
753 } 798 }
799 if (!scount) {
800 pmc->gsquery = 0;
801 return 0;
802 }
803 pmc->gsquery = 1;
804 return 1;
754} 805}
755 806
756static void igmp_heard_report(struct in_device *in_dev, u32 group) 807static void igmp_heard_report(struct in_device *in_dev, u32 group)
@@ -845,6 +896,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
845 */ 896 */
846 read_lock(&in_dev->mc_list_lock); 897 read_lock(&in_dev->mc_list_lock);
847 for (im=in_dev->mc_list; im!=NULL; im=im->next) { 898 for (im=in_dev->mc_list; im!=NULL; im=im->next) {
899 int changed;
900
848 if (group && group != im->multiaddr) 901 if (group && group != im->multiaddr)
849 continue; 902 continue;
850 if (im->multiaddr == IGMP_ALL_HOSTS) 903 if (im->multiaddr == IGMP_ALL_HOSTS)
@@ -854,10 +907,11 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
854 im->gsquery = im->gsquery && mark; 907 im->gsquery = im->gsquery && mark;
855 else 908 else
856 im->gsquery = mark; 909 im->gsquery = mark;
857 if (im->gsquery) 910 changed = !im->gsquery ||
858 igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); 911 igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs);
859 spin_unlock_bh(&im->lock); 912 spin_unlock_bh(&im->lock);
860 igmp_mod_timer(im, max_delay); 913 if (changed)
914 igmp_mod_timer(im, max_delay);
861 } 915 }
862 read_unlock(&in_dev->mc_list_lock); 916 read_unlock(&in_dev->mc_list_lock);
863} 917}
@@ -1510,7 +1564,7 @@ static void sf_markstate(struct ip_mc_list *pmc)
1510 1564
1511static int sf_setstate(struct ip_mc_list *pmc) 1565static int sf_setstate(struct ip_mc_list *pmc)
1512{ 1566{
1513 struct ip_sf_list *psf; 1567 struct ip_sf_list *psf, *dpsf;
1514 int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; 1568 int mca_xcount = pmc->sfcount[MCAST_EXCLUDE];
1515 int qrv = pmc->interface->mr_qrv; 1569 int qrv = pmc->interface->mr_qrv;
1516 int new_in, rv; 1570 int new_in, rv;
@@ -1522,8 +1576,46 @@ static int sf_setstate(struct ip_mc_list *pmc)
1522 !psf->sf_count[MCAST_INCLUDE]; 1576 !psf->sf_count[MCAST_INCLUDE];
1523 } else 1577 } else
1524 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0;
1525 if (new_in != psf->sf_oldin) { 1579 if (new_in) {
1526 psf->sf_crcount = qrv; 1580 if (!psf->sf_oldin) {
1581 struct ip_sf_list *prev = 0;
1582
1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) {
1584 if (dpsf->sf_inaddr == psf->sf_inaddr)
1585 break;
1586 prev = dpsf;
1587 }
1588 if (dpsf) {
1589 if (prev)
1590 prev->sf_next = dpsf->sf_next;
1591 else
1592 pmc->tomb = dpsf->sf_next;
1593 kfree(dpsf);
1594 }
1595 psf->sf_crcount = qrv;
1596 rv++;
1597 }
1598 } else if (psf->sf_oldin) {
1599
1600 psf->sf_crcount = 0;
1601 /*
1602 * add or update "delete" records if an active filter
1603 * is now inactive
1604 */
1605 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next)
1606 if (dpsf->sf_inaddr == psf->sf_inaddr)
1607 break;
1608 if (!dpsf) {
1609 dpsf = (struct ip_sf_list *)
1610 kmalloc(sizeof(*dpsf), GFP_ATOMIC);
1611 if (!dpsf)
1612 continue;
1613 *dpsf = *psf;
1614 /* pmc->lock held by callers */
1615 dpsf->sf_next = pmc->tomb;
1616 pmc->tomb = dpsf;
1617 }
1618 dpsf->sf_crcount = qrv;
1527 rv++; 1619 rv++;
1528 } 1620 }
1529 } 1621 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f2e82afc15b3..d82c242ea704 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -241,7 +241,8 @@ static int rt_hash_log;
241static unsigned int rt_hash_rnd; 241static unsigned int rt_hash_rnd;
242 242
243static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); 243static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
244#define RT_CACHE_STAT_INC(field) (__get_cpu_var(rt_cache_stat).field++) 244#define RT_CACHE_STAT_INC(field) \
245 (per_cpu(rt_cache_stat, raw_smp_processor_id()).field++)
245 246
246static int rt_intern_hash(unsigned hash, struct rtable *rth, 247static int rt_intern_hash(unsigned hash, struct rtable *rth,
247 struct rtable **res); 248 struct rtable **res);
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index 05ab18e62dee..3891cc00087d 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -8,7 +8,12 @@ menu "TIPC Configuration (EXPERIMENTAL)"
8config TIPC 8config TIPC
9 tristate "The TIPC Protocol (EXPERIMENTAL)" 9 tristate "The TIPC Protocol (EXPERIMENTAL)"
10 ---help--- 10 ---help---
11 TBD. 11 The Transparent Inter Process Communication (TIPC) protocol is
12 specially designed for intra cluster communication. This protocol
13 originates from Ericsson where it has been used in carrier grade
14 cluster applications for many years.
15
16 For more information about TIPC, see http://tipc.sourceforge.net.
12 17
13 This protocol support is also available as a module ( = code which 18 This protocol support is also available as a module ( = code which
14 can be inserted in and removed from the running kernel whenever you 19 can be inserted in and removed from the running kernel whenever you
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index eca22260c98c..0be25e175b93 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -47,7 +47,7 @@ u32 tipc_get_addr(void)
47} 47}
48 48
49/** 49/**
50 * addr_domain_valid - validates a network domain address 50 * tipc_addr_domain_valid - validates a network domain address
51 * 51 *
52 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, 52 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
53 * where Z, C, and N are non-zero and do not exceed the configured limits. 53 * where Z, C, and N are non-zero and do not exceed the configured limits.
@@ -55,7 +55,7 @@ u32 tipc_get_addr(void)
55 * Returns 1 if domain address is valid, otherwise 0 55 * Returns 1 if domain address is valid, otherwise 0
56 */ 56 */
57 57
58int addr_domain_valid(u32 addr) 58int tipc_addr_domain_valid(u32 addr)
59{ 59{
60 u32 n = tipc_node(addr); 60 u32 n = tipc_node(addr);
61 u32 c = tipc_cluster(addr); 61 u32 c = tipc_cluster(addr);
@@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr)
79} 79}
80 80
81/** 81/**
82 * addr_node_valid - validates a proposed network address for this node 82 * tipc_addr_node_valid - validates a proposed network address for this node
83 * 83 *
84 * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed 84 * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed
85 * the configured limits. 85 * the configured limits.
@@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr)
87 * Returns 1 if address can be used, otherwise 0 87 * Returns 1 if address can be used, otherwise 0
88 */ 88 */
89 89
90int addr_node_valid(u32 addr) 90int tipc_addr_node_valid(u32 addr)
91{ 91{
92 return (addr_domain_valid(addr) && tipc_node(addr)); 92 return (tipc_addr_domain_valid(addr) && tipc_node(addr));
93} 93}
94 94
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index 02ca71783e2e..bcfebb3cbbf3 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -122,7 +122,7 @@ static inline char *addr_string_fill(char *string, u32 addr)
122 return string; 122 return string;
123} 123}
124 124
125int addr_domain_valid(u32); 125int tipc_addr_domain_valid(u32);
126int addr_node_valid(u32 addr); 126int tipc_addr_node_valid(u32 addr);
127 127
128#endif 128#endif
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 9713d622efb8..a7b04f397c12 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -82,7 +82,7 @@ struct bcbearer {
82 struct bearer bearer; 82 struct bearer bearer;
83 struct media media; 83 struct media media;
84 struct bcbearer_pair bpairs[MAX_BEARERS]; 84 struct bcbearer_pair bpairs[MAX_BEARERS];
85 struct bcbearer_pair bpairs_temp[TIPC_NUM_LINK_PRI]; 85 struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1];
86}; 86};
87 87
88/** 88/**
@@ -104,7 +104,7 @@ static struct bclink *bclink = NULL;
104static struct link *bcl = NULL; 104static struct link *bcl = NULL;
105static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED; 105static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED;
106 106
107char bc_link_name[] = "multicast-link"; 107char tipc_bclink_name[] = "multicast-link";
108 108
109 109
110static inline u32 buf_seqno(struct sk_buff *buf) 110static inline u32 buf_seqno(struct sk_buff *buf)
@@ -178,19 +178,19 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
178 buf = buf->next; 178 buf = buf->next;
179 } 179 }
180 if (buf != NULL) 180 if (buf != NULL)
181 link_retransmit(bcl, buf, mod(to - after)); 181 tipc_link_retransmit(bcl, buf, mod(to - after));
182 spin_unlock_bh(&bc_lock); 182 spin_unlock_bh(&bc_lock);
183} 183}
184 184
185/** 185/**
186 * bclink_acknowledge - handle acknowledgement of broadcast packets 186 * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets
187 * @n_ptr: node that sent acknowledgement info 187 * @n_ptr: node that sent acknowledgement info
188 * @acked: broadcast sequence # that has been acknowledged 188 * @acked: broadcast sequence # that has been acknowledged
189 * 189 *
190 * Node is locked, bc_lock unlocked. 190 * Node is locked, bc_lock unlocked.
191 */ 191 */
192 192
193void bclink_acknowledge(struct node *n_ptr, u32 acked) 193void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked)
194{ 194{
195 struct sk_buff *crs; 195 struct sk_buff *crs;
196 struct sk_buff *next; 196 struct sk_buff *next;
@@ -226,16 +226,16 @@ void bclink_acknowledge(struct node *n_ptr, u32 acked)
226 /* Try resolving broadcast link congestion, if necessary */ 226 /* Try resolving broadcast link congestion, if necessary */
227 227
228 if (unlikely(bcl->next_out)) 228 if (unlikely(bcl->next_out))
229 link_push_queue(bcl); 229 tipc_link_push_queue(bcl);
230 if (unlikely(released && !list_empty(&bcl->waiting_ports))) 230 if (unlikely(released && !list_empty(&bcl->waiting_ports)))
231 link_wakeup_ports(bcl, 0); 231 tipc_link_wakeup_ports(bcl, 0);
232 spin_unlock_bh(&bc_lock); 232 spin_unlock_bh(&bc_lock);
233} 233}
234 234
235/** 235/**
236 * bclink_send_ack - unicast an ACK msg 236 * bclink_send_ack - unicast an ACK msg
237 * 237 *
238 * net_lock and node lock set 238 * tipc_net_lock and node lock set
239 */ 239 */
240 240
241static void bclink_send_ack(struct node *n_ptr) 241static void bclink_send_ack(struct node *n_ptr)
@@ -243,13 +243,13 @@ static void bclink_send_ack(struct node *n_ptr)
243 struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1]; 243 struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1];
244 244
245 if (l_ptr != NULL) 245 if (l_ptr != NULL)
246 link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 246 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
247} 247}
248 248
249/** 249/**
250 * bclink_send_nack- broadcast a NACK msg 250 * bclink_send_nack- broadcast a NACK msg
251 * 251 *
252 * net_lock and node lock set 252 * tipc_net_lock and node lock set
253 */ 253 */
254 254
255static void bclink_send_nack(struct node *n_ptr) 255static void bclink_send_nack(struct node *n_ptr)
@@ -271,11 +271,11 @@ static void bclink_send_nack(struct node *n_ptr)
271 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); 271 msg_set_bcgap_to(msg, n_ptr->bclink.gap_to);
272 msg_set_bcast_tag(msg, tipc_own_tag); 272 msg_set_bcast_tag(msg, tipc_own_tag);
273 273
274 if (bearer_send(&bcbearer->bearer, buf, 0)) { 274 if (tipc_bearer_send(&bcbearer->bearer, buf, 0)) {
275 bcl->stats.sent_nacks++; 275 bcl->stats.sent_nacks++;
276 buf_discard(buf); 276 buf_discard(buf);
277 } else { 277 } else {
278 bearer_schedule(bcl->b_ptr, bcl); 278 tipc_bearer_schedule(bcl->b_ptr, bcl);
279 bcl->proto_msg_queue = buf; 279 bcl->proto_msg_queue = buf;
280 bcl->stats.bearer_congs++; 280 bcl->stats.bearer_congs++;
281 } 281 }
@@ -291,12 +291,12 @@ static void bclink_send_nack(struct node *n_ptr)
291} 291}
292 292
293/** 293/**
294 * bclink_check_gap - send a NACK if a sequence gap exists 294 * tipc_bclink_check_gap - send a NACK if a sequence gap exists
295 * 295 *
296 * net_lock and node lock set 296 * tipc_net_lock and node lock set
297 */ 297 */
298 298
299void bclink_check_gap(struct node *n_ptr, u32 last_sent) 299void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent)
300{ 300{
301 if (!n_ptr->bclink.supported || 301 if (!n_ptr->bclink.supported ||
302 less_eq(last_sent, mod(n_ptr->bclink.last_in))) 302 less_eq(last_sent, mod(n_ptr->bclink.last_in)))
@@ -309,19 +309,19 @@ void bclink_check_gap(struct node *n_ptr, u32 last_sent)
309} 309}
310 310
311/** 311/**
312 * bclink_peek_nack - process a NACK msg meant for another node 312 * tipc_bclink_peek_nack - process a NACK msg meant for another node
313 * 313 *
314 * Only net_lock set. 314 * Only tipc_net_lock set.
315 */ 315 */
316 316
317void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) 317void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to)
318{ 318{
319 struct node *n_ptr = node_find(dest); 319 struct node *n_ptr = tipc_node_find(dest);
320 u32 my_after, my_to; 320 u32 my_after, my_to;
321 321
322 if (unlikely(!n_ptr || !node_is_up(n_ptr))) 322 if (unlikely(!n_ptr || !tipc_node_is_up(n_ptr)))
323 return; 323 return;
324 node_lock(n_ptr); 324 tipc_node_lock(n_ptr);
325 /* 325 /*
326 * Modify gap to suppress unnecessary NACKs from this node 326 * Modify gap to suppress unnecessary NACKs from this node
327 */ 327 */
@@ -364,20 +364,20 @@ void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to)
364 bclink_set_gap(n_ptr); 364 bclink_set_gap(n_ptr);
365 } 365 }
366 } 366 }
367 node_unlock(n_ptr); 367 tipc_node_unlock(n_ptr);
368} 368}
369 369
370/** 370/**
371 * bclink_send_msg - broadcast a packet to all nodes in cluster 371 * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster
372 */ 372 */
373 373
374int bclink_send_msg(struct sk_buff *buf) 374int tipc_bclink_send_msg(struct sk_buff *buf)
375{ 375{
376 int res; 376 int res;
377 377
378 spin_lock_bh(&bc_lock); 378 spin_lock_bh(&bc_lock);
379 379
380 res = link_send_buf(bcl, buf); 380 res = tipc_link_send_buf(bcl, buf);
381 if (unlikely(res == -ELINKCONG)) 381 if (unlikely(res == -ELINKCONG))
382 buf_discard(buf); 382 buf_discard(buf);
383 else 383 else
@@ -393,22 +393,22 @@ int bclink_send_msg(struct sk_buff *buf)
393} 393}
394 394
395/** 395/**
396 * bclink_recv_pkt - receive a broadcast packet, and deliver upwards 396 * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards
397 * 397 *
398 * net_lock is read_locked, no other locks set 398 * tipc_net_lock is read_locked, no other locks set
399 */ 399 */
400 400
401void bclink_recv_pkt(struct sk_buff *buf) 401void tipc_bclink_recv_pkt(struct sk_buff *buf)
402{ 402{
403 struct tipc_msg *msg = buf_msg(buf); 403 struct tipc_msg *msg = buf_msg(buf);
404 struct node* node = node_find(msg_prevnode(msg)); 404 struct node* node = tipc_node_find(msg_prevnode(msg));
405 u32 next_in; 405 u32 next_in;
406 u32 seqno; 406 u32 seqno;
407 struct sk_buff *deferred; 407 struct sk_buff *deferred;
408 408
409 msg_dbg(msg, "<BC<<<"); 409 msg_dbg(msg, "<BC<<<");
410 410
411 if (unlikely(!node || !node_is_up(node) || !node->bclink.supported || 411 if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported ||
412 (msg_mc_netid(msg) != tipc_net_id))) { 412 (msg_mc_netid(msg) != tipc_net_id))) {
413 buf_discard(buf); 413 buf_discard(buf);
414 return; 414 return;
@@ -417,14 +417,14 @@ void bclink_recv_pkt(struct sk_buff *buf)
417 if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { 417 if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) {
418 msg_dbg(msg, "<BCNACK<<<"); 418 msg_dbg(msg, "<BCNACK<<<");
419 if (msg_destnode(msg) == tipc_own_addr) { 419 if (msg_destnode(msg) == tipc_own_addr) {
420 node_lock(node); 420 tipc_node_lock(node);
421 bclink_acknowledge(node, msg_bcast_ack(msg)); 421 tipc_bclink_acknowledge(node, msg_bcast_ack(msg));
422 node_unlock(node); 422 tipc_node_unlock(node);
423 bcl->stats.recv_nacks++; 423 bcl->stats.recv_nacks++;
424 bclink_retransmit_pkt(msg_bcgap_after(msg), 424 bclink_retransmit_pkt(msg_bcgap_after(msg),
425 msg_bcgap_to(msg)); 425 msg_bcgap_to(msg));
426 } else { 426 } else {
427 bclink_peek_nack(msg_destnode(msg), 427 tipc_bclink_peek_nack(msg_destnode(msg),
428 msg_bcast_tag(msg), 428 msg_bcast_tag(msg),
429 msg_bcgap_after(msg), 429 msg_bcgap_after(msg),
430 msg_bcgap_to(msg)); 430 msg_bcgap_to(msg));
@@ -433,7 +433,7 @@ void bclink_recv_pkt(struct sk_buff *buf)
433 return; 433 return;
434 } 434 }
435 435
436 node_lock(node); 436 tipc_node_lock(node);
437receive: 437receive:
438 deferred = node->bclink.deferred_head; 438 deferred = node->bclink.deferred_head;
439 next_in = mod(node->bclink.last_in + 1); 439 next_in = mod(node->bclink.last_in + 1);
@@ -448,26 +448,26 @@ receive:
448 bcl->stats.sent_acks++; 448 bcl->stats.sent_acks++;
449 } 449 }
450 if (likely(msg_isdata(msg))) { 450 if (likely(msg_isdata(msg))) {
451 node_unlock(node); 451 tipc_node_unlock(node);
452 port_recv_mcast(buf, NULL); 452 tipc_port_recv_mcast(buf, NULL);
453 } else if (msg_user(msg) == MSG_BUNDLER) { 453 } else if (msg_user(msg) == MSG_BUNDLER) {
454 bcl->stats.recv_bundles++; 454 bcl->stats.recv_bundles++;
455 bcl->stats.recv_bundled += msg_msgcnt(msg); 455 bcl->stats.recv_bundled += msg_msgcnt(msg);
456 node_unlock(node); 456 tipc_node_unlock(node);
457 link_recv_bundle(buf); 457 tipc_link_recv_bundle(buf);
458 } else if (msg_user(msg) == MSG_FRAGMENTER) { 458 } else if (msg_user(msg) == MSG_FRAGMENTER) {
459 bcl->stats.recv_fragments++; 459 bcl->stats.recv_fragments++;
460 if (link_recv_fragment(&node->bclink.defragm, 460 if (tipc_link_recv_fragment(&node->bclink.defragm,
461 &buf, &msg)) 461 &buf, &msg))
462 bcl->stats.recv_fragmented++; 462 bcl->stats.recv_fragmented++;
463 node_unlock(node); 463 tipc_node_unlock(node);
464 net_route_msg(buf); 464 tipc_net_route_msg(buf);
465 } else { 465 } else {
466 node_unlock(node); 466 tipc_node_unlock(node);
467 net_route_msg(buf); 467 tipc_net_route_msg(buf);
468 } 468 }
469 if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) { 469 if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) {
470 node_lock(node); 470 tipc_node_lock(node);
471 buf = deferred; 471 buf = deferred;
472 msg = buf_msg(buf); 472 msg = buf_msg(buf);
473 node->bclink.deferred_head = deferred->next; 473 node->bclink.deferred_head = deferred->next;
@@ -478,9 +478,9 @@ receive:
478 u32 gap_after = node->bclink.gap_after; 478 u32 gap_after = node->bclink.gap_after;
479 u32 gap_to = node->bclink.gap_to; 479 u32 gap_to = node->bclink.gap_to;
480 480
481 if (link_defer_pkt(&node->bclink.deferred_head, 481 if (tipc_link_defer_pkt(&node->bclink.deferred_head,
482 &node->bclink.deferred_tail, 482 &node->bclink.deferred_tail,
483 buf)) { 483 buf)) {
484 node->bclink.nack_sync++; 484 node->bclink.nack_sync++;
485 bcl->stats.deferred_recv++; 485 bcl->stats.deferred_recv++;
486 if (seqno == mod(gap_after + 1)) 486 if (seqno == mod(gap_after + 1))
@@ -497,10 +497,10 @@ receive:
497 bcl->stats.duplicates++; 497 bcl->stats.duplicates++;
498 buf_discard(buf); 498 buf_discard(buf);
499 } 499 }
500 node_unlock(node); 500 tipc_node_unlock(node);
501} 501}
502 502
503u32 bclink_get_last_sent(void) 503u32 tipc_bclink_get_last_sent(void)
504{ 504{
505 u32 last_sent = mod(bcl->next_out_no - 1); 505 u32 last_sent = mod(bcl->next_out_no - 1);
506 506
@@ -509,15 +509,15 @@ u32 bclink_get_last_sent(void)
509 return last_sent; 509 return last_sent;
510} 510}
511 511
512u32 bclink_acks_missing(struct node *n_ptr) 512u32 tipc_bclink_acks_missing(struct node *n_ptr)
513{ 513{
514 return (n_ptr->bclink.supported && 514 return (n_ptr->bclink.supported &&
515 (bclink_get_last_sent() != n_ptr->bclink.acked)); 515 (tipc_bclink_get_last_sent() != n_ptr->bclink.acked));
516} 516}
517 517
518 518
519/** 519/**
520 * bcbearer_send - send a packet through the broadcast pseudo-bearer 520 * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer
521 * 521 *
522 * Send through as many bearers as necessary to reach all nodes 522 * Send through as many bearers as necessary to reach all nodes
523 * that support TIPC multicasting. 523 * that support TIPC multicasting.
@@ -525,9 +525,9 @@ u32 bclink_acks_missing(struct node *n_ptr)
525 * Returns 0 if packet sent successfully, non-zero if not 525 * Returns 0 if packet sent successfully, non-zero if not
526 */ 526 */
527 527
528int bcbearer_send(struct sk_buff *buf, 528int tipc_bcbearer_send(struct sk_buff *buf,
529 struct tipc_bearer *unused1, 529 struct tipc_bearer *unused1,
530 struct tipc_media_addr *unused2) 530 struct tipc_media_addr *unused2)
531{ 531{
532 static int send_count = 0; 532 static int send_count = 0;
533 533
@@ -541,8 +541,8 @@ int bcbearer_send(struct sk_buff *buf,
541 if (likely(!msg_non_seq(buf_msg(buf)))) { 541 if (likely(!msg_non_seq(buf_msg(buf)))) {
542 struct tipc_msg *msg; 542 struct tipc_msg *msg;
543 543
544 assert(cluster_bcast_nodes.count != 0); 544 assert(tipc_cltr_bcast_nodes.count != 0);
545 bcbuf_set_acks(buf, cluster_bcast_nodes.count); 545 bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count);
546 msg = buf_msg(buf); 546 msg = buf_msg(buf);
547 msg_set_non_seq(msg); 547 msg_set_non_seq(msg);
548 msg_set_mc_netid(msg, tipc_net_id); 548 msg_set_mc_netid(msg, tipc_net_id);
@@ -555,7 +555,7 @@ int bcbearer_send(struct sk_buff *buf,
555 555
556 /* Send buffer over bearers until all targets reached */ 556 /* Send buffer over bearers until all targets reached */
557 557
558 remains = cluster_bcast_nodes; 558 remains = tipc_cltr_bcast_nodes;
559 559
560 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { 560 for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
561 struct bearer *p = bcbearer->bpairs[bp_index].primary; 561 struct bearer *p = bcbearer->bpairs[bp_index].primary;
@@ -564,7 +564,7 @@ int bcbearer_send(struct sk_buff *buf,
564 if (!p) 564 if (!p)
565 break; /* no more bearers to try */ 565 break; /* no more bearers to try */
566 566
567 nmap_diff(&remains, &p->nodes, &remains_new); 567 tipc_nmap_diff(&remains, &p->nodes, &remains_new);
568 if (remains_new.count == remains.count) 568 if (remains_new.count == remains.count)
569 continue; /* bearer pair doesn't add anything */ 569 continue; /* bearer pair doesn't add anything */
570 570
@@ -597,10 +597,10 @@ update:
597} 597}
598 598
599/** 599/**
600 * bcbearer_sort - create sets of bearer pairs used by broadcast bearer 600 * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer
601 */ 601 */
602 602
603void bcbearer_sort(void) 603void tipc_bcbearer_sort(void)
604{ 604{
605 struct bcbearer_pair *bp_temp = bcbearer->bpairs_temp; 605 struct bcbearer_pair *bp_temp = bcbearer->bpairs_temp;
606 struct bcbearer_pair *bp_curr; 606 struct bcbearer_pair *bp_curr;
@@ -614,7 +614,7 @@ void bcbearer_sort(void)
614 memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); 614 memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp));
615 615
616 for (b_index = 0; b_index < MAX_BEARERS; b_index++) { 616 for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
617 struct bearer *b = &bearers[b_index]; 617 struct bearer *b = &tipc_bearers[b_index];
618 618
619 if (!b->active || !b->nodes.count) 619 if (!b->active || !b->nodes.count)
620 continue; 620 continue;
@@ -630,7 +630,7 @@ void bcbearer_sort(void)
630 bp_curr = bcbearer->bpairs; 630 bp_curr = bcbearer->bpairs;
631 memset(bcbearer->bpairs, 0, sizeof(bcbearer->bpairs)); 631 memset(bcbearer->bpairs, 0, sizeof(bcbearer->bpairs));
632 632
633 for (pri = (TIPC_NUM_LINK_PRI - 1); pri >= 0; pri--) { 633 for (pri = TIPC_MAX_LINK_PRI; pri >= 0; pri--) {
634 634
635 if (!bp_temp[pri].primary) 635 if (!bp_temp[pri].primary)
636 continue; 636 continue;
@@ -638,8 +638,8 @@ void bcbearer_sort(void)
638 bp_curr->primary = bp_temp[pri].primary; 638 bp_curr->primary = bp_temp[pri].primary;
639 639
640 if (bp_temp[pri].secondary) { 640 if (bp_temp[pri].secondary) {
641 if (nmap_equal(&bp_temp[pri].primary->nodes, 641 if (tipc_nmap_equal(&bp_temp[pri].primary->nodes,
642 &bp_temp[pri].secondary->nodes)) { 642 &bp_temp[pri].secondary->nodes)) {
643 bp_curr->secondary = bp_temp[pri].secondary; 643 bp_curr->secondary = bp_temp[pri].secondary;
644 } else { 644 } else {
645 bp_curr++; 645 bp_curr++;
@@ -654,14 +654,14 @@ void bcbearer_sort(void)
654} 654}
655 655
656/** 656/**
657 * bcbearer_push - resolve bearer congestion 657 * tipc_bcbearer_push - resolve bearer congestion
658 * 658 *
659 * Forces bclink to push out any unsent packets, until all packets are gone 659 * Forces bclink to push out any unsent packets, until all packets are gone
660 * or congestion reoccurs. 660 * or congestion reoccurs.
661 * No locks set when function called 661 * No locks set when function called
662 */ 662 */
663 663
664void bcbearer_push(void) 664void tipc_bcbearer_push(void)
665{ 665{
666 struct bearer *b_ptr; 666 struct bearer *b_ptr;
667 667
@@ -669,20 +669,20 @@ void bcbearer_push(void)
669 b_ptr = &bcbearer->bearer; 669 b_ptr = &bcbearer->bearer;
670 if (b_ptr->publ.blocked) { 670 if (b_ptr->publ.blocked) {
671 b_ptr->publ.blocked = 0; 671 b_ptr->publ.blocked = 0;
672 bearer_lock_push(b_ptr); 672 tipc_bearer_lock_push(b_ptr);
673 } 673 }
674 spin_unlock_bh(&bc_lock); 674 spin_unlock_bh(&bc_lock);
675} 675}
676 676
677 677
678int bclink_stats(char *buf, const u32 buf_size) 678int tipc_bclink_stats(char *buf, const u32 buf_size)
679{ 679{
680 struct print_buf pb; 680 struct print_buf pb;
681 681
682 if (!bcl) 682 if (!bcl)
683 return 0; 683 return 0;
684 684
685 printbuf_init(&pb, buf, buf_size); 685 tipc_printbuf_init(&pb, buf, buf_size);
686 686
687 spin_lock_bh(&bc_lock); 687 spin_lock_bh(&bc_lock);
688 688
@@ -718,10 +718,10 @@ int bclink_stats(char *buf, const u32 buf_size)
718 : 0); 718 : 0);
719 719
720 spin_unlock_bh(&bc_lock); 720 spin_unlock_bh(&bc_lock);
721 return printbuf_validate(&pb); 721 return tipc_printbuf_validate(&pb);
722} 722}
723 723
724int bclink_reset_stats(void) 724int tipc_bclink_reset_stats(void)
725{ 725{
726 if (!bcl) 726 if (!bcl)
727 return -ENOPROTOOPT; 727 return -ENOPROTOOPT;
@@ -732,7 +732,7 @@ int bclink_reset_stats(void)
732 return TIPC_OK; 732 return TIPC_OK;
733} 733}
734 734
735int bclink_set_queue_limits(u32 limit) 735int tipc_bclink_set_queue_limits(u32 limit)
736{ 736{
737 if (!bcl) 737 if (!bcl)
738 return -ENOPROTOOPT; 738 return -ENOPROTOOPT;
@@ -740,12 +740,12 @@ int bclink_set_queue_limits(u32 limit)
740 return -EINVAL; 740 return -EINVAL;
741 741
742 spin_lock_bh(&bc_lock); 742 spin_lock_bh(&bc_lock);
743 link_set_queue_limits(bcl, limit); 743 tipc_link_set_queue_limits(bcl, limit);
744 spin_unlock_bh(&bc_lock); 744 spin_unlock_bh(&bc_lock);
745 return TIPC_OK; 745 return TIPC_OK;
746} 746}
747 747
748int bclink_init(void) 748int tipc_bclink_init(void)
749{ 749{
750 bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); 750 bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC);
751 bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); 751 bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC);
@@ -762,7 +762,7 @@ int bclink_init(void)
762 memset(bcbearer, 0, sizeof(struct bcbearer)); 762 memset(bcbearer, 0, sizeof(struct bcbearer));
763 INIT_LIST_HEAD(&bcbearer->bearer.cong_links); 763 INIT_LIST_HEAD(&bcbearer->bearer.cong_links);
764 bcbearer->bearer.media = &bcbearer->media; 764 bcbearer->bearer.media = &bcbearer->media;
765 bcbearer->media.send_msg = bcbearer_send; 765 bcbearer->media.send_msg = tipc_bcbearer_send;
766 sprintf(bcbearer->media.name, "tipc-multicast"); 766 sprintf(bcbearer->media.name, "tipc-multicast");
767 767
768 bcl = &bclink->link; 768 bcl = &bclink->link;
@@ -772,27 +772,27 @@ int bclink_init(void)
772 bclink->node.lock = SPIN_LOCK_UNLOCKED; 772 bclink->node.lock = SPIN_LOCK_UNLOCKED;
773 bcl->owner = &bclink->node; 773 bcl->owner = &bclink->node;
774 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; 774 bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
775 link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); 775 tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
776 bcl->b_ptr = &bcbearer->bearer; 776 bcl->b_ptr = &bcbearer->bearer;
777 bcl->state = WORKING_WORKING; 777 bcl->state = WORKING_WORKING;
778 sprintf(bcl->name, bc_link_name); 778 sprintf(bcl->name, tipc_bclink_name);
779 779
780 if (BCLINK_LOG_BUF_SIZE) { 780 if (BCLINK_LOG_BUF_SIZE) {
781 char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC); 781 char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC);
782 782
783 if (!pb) 783 if (!pb)
784 goto nomem; 784 goto nomem;
785 printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE); 785 tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE);
786 } 786 }
787 787
788 return TIPC_OK; 788 return TIPC_OK;
789} 789}
790 790
791void bclink_stop(void) 791void tipc_bclink_stop(void)
792{ 792{
793 spin_lock_bh(&bc_lock); 793 spin_lock_bh(&bc_lock);
794 if (bcbearer) { 794 if (bcbearer) {
795 link_stop(bcl); 795 tipc_link_stop(bcl);
796 if (BCLINK_LOG_BUF_SIZE) 796 if (BCLINK_LOG_BUF_SIZE)
797 kfree(bcl->print_buf.buf); 797 kfree(bcl->print_buf.buf);
798 bcl = NULL; 798 bcl = NULL;
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index 5430e524b4f9..0e3be2ab3307 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -70,14 +70,14 @@ struct port_list {
70 70
71struct node; 71struct node;
72 72
73extern char bc_link_name[]; 73extern char tipc_bclink_name[];
74 74
75 75
76/** 76/**
77 * nmap_get - determine if node exists in a node map 77 * nmap_get - determine if node exists in a node map
78 */ 78 */
79 79
80static inline int nmap_get(struct node_map *nm_ptr, u32 node) 80static inline int tipc_nmap_get(struct node_map *nm_ptr, u32 node)
81{ 81{
82 int n = tipc_node(node); 82 int n = tipc_node(node);
83 int w = n / WSIZE; 83 int w = n / WSIZE;
@@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node)
90 * nmap_add - add a node to a node map 90 * nmap_add - add a node to a node map
91 */ 91 */
92 92
93static inline void nmap_add(struct node_map *nm_ptr, u32 node) 93static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node)
94{ 94{
95 int n = tipc_node(node); 95 int n = tipc_node(node);
96 int w = n / WSIZE; 96 int w = n / WSIZE;
@@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node)
106 * nmap_remove - remove a node from a node map 106 * nmap_remove - remove a node from a node map
107 */ 107 */
108 108
109static inline void nmap_remove(struct node_map *nm_ptr, u32 node) 109static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node)
110{ 110{
111 int n = tipc_node(node); 111 int n = tipc_node(node);
112 int w = n / WSIZE; 112 int w = n / WSIZE;
@@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node)
122 * nmap_equal - test for equality of node maps 122 * nmap_equal - test for equality of node maps
123 */ 123 */
124 124
125static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) 125static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
126{ 126{
127 return !memcmp(nm_a, nm_b, sizeof(*nm_a)); 127 return !memcmp(nm_a, nm_b, sizeof(*nm_a));
128} 128}
@@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
134 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) 134 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
135 */ 135 */
136 136
137static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, 137static inline void tipc_nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
138 struct node_map *nm_diff) 138 struct node_map *nm_diff)
139{ 139{
140 int stop = sizeof(nm_a->map) / sizeof(u32); 140 int stop = sizeof(nm_a->map) / sizeof(u32);
141 int w; 141 int w;
@@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
159 * port_list_add - add a port to a port list, ensuring no duplicates 159 * port_list_add - add a port to a port list, ensuring no duplicates
160 */ 160 */
161 161
162static inline void port_list_add(struct port_list *pl_ptr, u32 port) 162static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
163{ 163{
164 struct port_list *item = pl_ptr; 164 struct port_list *item = pl_ptr;
165 int i; 165 int i;
@@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port)
194 * Note: First item is on stack, so it doesn't need to be released 194 * Note: First item is on stack, so it doesn't need to be released
195 */ 195 */
196 196
197static inline void port_list_free(struct port_list *pl_ptr) 197static inline void tipc_port_list_free(struct port_list *pl_ptr)
198{ 198{
199 struct port_list *item; 199 struct port_list *item;
200 struct port_list *next; 200 struct port_list *next;
@@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr)
206} 206}
207 207
208 208
209int bclink_init(void); 209int tipc_bclink_init(void);
210void bclink_stop(void); 210void tipc_bclink_stop(void);
211void bclink_acknowledge(struct node *n_ptr, u32 acked); 211void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked);
212int bclink_send_msg(struct sk_buff *buf); 212int tipc_bclink_send_msg(struct sk_buff *buf);
213void bclink_recv_pkt(struct sk_buff *buf); 213void tipc_bclink_recv_pkt(struct sk_buff *buf);
214u32 bclink_get_last_sent(void); 214u32 tipc_bclink_get_last_sent(void);
215u32 bclink_acks_missing(struct node *n_ptr); 215u32 tipc_bclink_acks_missing(struct node *n_ptr);
216void bclink_check_gap(struct node *n_ptr, u32 seqno); 216void tipc_bclink_check_gap(struct node *n_ptr, u32 seqno);
217int bclink_stats(char *stats_buf, const u32 buf_size); 217int tipc_bclink_stats(char *stats_buf, const u32 buf_size);
218int bclink_reset_stats(void); 218int tipc_bclink_reset_stats(void);
219int bclink_set_queue_limits(u32 limit); 219int tipc_bclink_set_queue_limits(u32 limit);
220void bcbearer_sort(void); 220void tipc_bcbearer_sort(void);
221void bcbearer_push(void); 221void tipc_bcbearer_push(void);
222 222
223#endif 223#endif
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 3dd19fdc5a2c..64dcb0f3a8b2 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -48,7 +48,7 @@
48static struct media *media_list = 0; 48static struct media *media_list = 0;
49static u32 media_count = 0; 49static u32 media_count = 0;
50 50
51struct bearer *bearers = 0; 51struct bearer *tipc_bearers = 0;
52 52
53/** 53/**
54 * media_name_valid - validate media name 54 * media_name_valid - validate media name
@@ -107,7 +107,7 @@ int tipc_register_media(u32 media_type,
107 u32 i; 107 u32 i;
108 int res = -EINVAL; 108 int res = -EINVAL;
109 109
110 write_lock_bh(&net_lock); 110 write_lock_bh(&tipc_net_lock);
111 if (!media_list) 111 if (!media_list)
112 goto exit; 112 goto exit;
113 113
@@ -119,7 +119,8 @@ int tipc_register_media(u32 media_type,
119 warn("Media registration error: no broadcast address supplied\n"); 119 warn("Media registration error: no broadcast address supplied\n");
120 goto exit; 120 goto exit;
121 } 121 }
122 if (bearer_priority >= TIPC_NUM_LINK_PRI) { 122 if ((bearer_priority < TIPC_MIN_LINK_PRI) &&
123 (bearer_priority > TIPC_MAX_LINK_PRI)) {
123 warn("Media registration error: priority %u\n", bearer_priority); 124 warn("Media registration error: priority %u\n", bearer_priority);
124 goto exit; 125 goto exit;
125 } 126 }
@@ -164,15 +165,15 @@ int tipc_register_media(u32 media_type,
164 dbg("Media <%s> registered\n", name); 165 dbg("Media <%s> registered\n", name);
165 res = 0; 166 res = 0;
166exit: 167exit:
167 write_unlock_bh(&net_lock); 168 write_unlock_bh(&tipc_net_lock);
168 return res; 169 return res;
169} 170}
170 171
171/** 172/**
172 * media_addr_printf - record media address in print buffer 173 * tipc_media_addr_printf - record media address in print buffer
173 */ 174 */
174 175
175void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) 176void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
176{ 177{
177 struct media *m_ptr; 178 struct media *m_ptr;
178 u32 media_type; 179 u32 media_type;
@@ -200,25 +201,25 @@ void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
200} 201}
201 202
202/** 203/**
203 * media_get_names - record names of registered media in buffer 204 * tipc_media_get_names - record names of registered media in buffer
204 */ 205 */
205 206
206struct sk_buff *media_get_names(void) 207struct sk_buff *tipc_media_get_names(void)
207{ 208{
208 struct sk_buff *buf; 209 struct sk_buff *buf;
209 struct media *m_ptr; 210 struct media *m_ptr;
210 int i; 211 int i;
211 212
212 buf = cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); 213 buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME));
213 if (!buf) 214 if (!buf)
214 return NULL; 215 return NULL;
215 216
216 read_lock_bh(&net_lock); 217 read_lock_bh(&tipc_net_lock);
217 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { 218 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
218 cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, 219 tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name,
219 strlen(m_ptr->name) + 1); 220 strlen(m_ptr->name) + 1);
220 } 221 }
221 read_unlock_bh(&net_lock); 222 read_unlock_bh(&tipc_net_lock);
222 return buf; 223 return buf;
223} 224}
224 225
@@ -282,7 +283,7 @@ static struct bearer *bearer_find(const char *name)
282 struct bearer *b_ptr; 283 struct bearer *b_ptr;
283 u32 i; 284 u32 i;
284 285
285 for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { 286 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
286 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) 287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
287 return b_ptr; 288 return b_ptr;
288 } 289 }
@@ -290,16 +291,16 @@ static struct bearer *bearer_find(const char *name)
290} 291}
291 292
292/** 293/**
293 * bearer_find - locates bearer object with matching interface name 294 * tipc_bearer_find_interface - locates bearer object with matching interface name
294 */ 295 */
295 296
296struct bearer *bearer_find_interface(const char *if_name) 297struct bearer *tipc_bearer_find_interface(const char *if_name)
297{ 298{
298 struct bearer *b_ptr; 299 struct bearer *b_ptr;
299 char *b_if_name; 300 char *b_if_name;
300 u32 i; 301 u32 i;
301 302
302 for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { 303 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
303 if (!b_ptr->active) 304 if (!b_ptr->active)
304 continue; 305 continue;
305 b_if_name = strchr(b_ptr->publ.name, ':') + 1; 306 b_if_name = strchr(b_ptr->publ.name, ':') + 1;
@@ -310,54 +311,54 @@ struct bearer *bearer_find_interface(const char *if_name)
310} 311}
311 312
312/** 313/**
313 * bearer_get_names - record names of bearers in buffer 314 * tipc_bearer_get_names - record names of bearers in buffer
314 */ 315 */
315 316
316struct sk_buff *bearer_get_names(void) 317struct sk_buff *tipc_bearer_get_names(void)
317{ 318{
318 struct sk_buff *buf; 319 struct sk_buff *buf;
319 struct media *m_ptr; 320 struct media *m_ptr;
320 struct bearer *b_ptr; 321 struct bearer *b_ptr;
321 int i, j; 322 int i, j;
322 323
323 buf = cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); 324 buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME));
324 if (!buf) 325 if (!buf)
325 return NULL; 326 return NULL;
326 327
327 read_lock_bh(&net_lock); 328 read_lock_bh(&tipc_net_lock);
328 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { 329 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
329 for (j = 0; j < MAX_BEARERS; j++) { 330 for (j = 0; j < MAX_BEARERS; j++) {
330 b_ptr = &bearers[j]; 331 b_ptr = &tipc_bearers[j];
331 if (b_ptr->active && (b_ptr->media == m_ptr)) { 332 if (b_ptr->active && (b_ptr->media == m_ptr)) {
332 cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, 333 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
333 b_ptr->publ.name, 334 b_ptr->publ.name,
334 strlen(b_ptr->publ.name) + 1); 335 strlen(b_ptr->publ.name) + 1);
335 } 336 }
336 } 337 }
337 } 338 }
338 read_unlock_bh(&net_lock); 339 read_unlock_bh(&tipc_net_lock);
339 return buf; 340 return buf;
340} 341}
341 342
342void bearer_add_dest(struct bearer *b_ptr, u32 dest) 343void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest)
343{ 344{
344 nmap_add(&b_ptr->nodes, dest); 345 tipc_nmap_add(&b_ptr->nodes, dest);
345 disc_update_link_req(b_ptr->link_req); 346 tipc_disc_update_link_req(b_ptr->link_req);
346 bcbearer_sort(); 347 tipc_bcbearer_sort();
347} 348}
348 349
349void bearer_remove_dest(struct bearer *b_ptr, u32 dest) 350void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest)
350{ 351{
351 nmap_remove(&b_ptr->nodes, dest); 352 tipc_nmap_remove(&b_ptr->nodes, dest);
352 disc_update_link_req(b_ptr->link_req); 353 tipc_disc_update_link_req(b_ptr->link_req);
353 bcbearer_sort(); 354 tipc_bcbearer_sort();
354} 355}
355 356
356/* 357/*
357 * bearer_push(): Resolve bearer congestion. Force the waiting 358 * bearer_push(): Resolve bearer congestion. Force the waiting
358 * links to push out their unsent packets, one packet per link 359 * links to push out their unsent packets, one packet per link
359 * per iteration, until all packets are gone or congestion reoccurs. 360 * per iteration, until all packets are gone or congestion reoccurs.
360 * 'net_lock' is read_locked when this function is called 361 * 'tipc_net_lock' is read_locked when this function is called
361 * bearer.lock must be taken before calling 362 * bearer.lock must be taken before calling
362 * Returns binary true(1) ore false(0) 363 * Returns binary true(1) ore false(0)
363 */ 364 */
@@ -371,7 +372,7 @@ static int bearer_push(struct bearer *b_ptr)
371 372
372 while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { 373 while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) {
373 list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) { 374 list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) {
374 res = link_push_packet(ln); 375 res = tipc_link_push_packet(ln);
375 if (res == PUSH_FAILED) 376 if (res == PUSH_FAILED)
376 break; 377 break;
377 if (res == PUSH_FINISHED) 378 if (res == PUSH_FINISHED)
@@ -381,7 +382,7 @@ static int bearer_push(struct bearer *b_ptr)
381 return list_empty(&b_ptr->cong_links); 382 return list_empty(&b_ptr->cong_links);
382} 383}
383 384
384void bearer_lock_push(struct bearer *b_ptr) 385void tipc_bearer_lock_push(struct bearer *b_ptr)
385{ 386{
386 int res; 387 int res;
387 388
@@ -389,7 +390,7 @@ void bearer_lock_push(struct bearer *b_ptr)
389 res = bearer_push(b_ptr); 390 res = bearer_push(b_ptr);
390 spin_unlock_bh(&b_ptr->publ.lock); 391 spin_unlock_bh(&b_ptr->publ.lock);
391 if (res) 392 if (res)
392 bcbearer_push(); 393 tipc_bcbearer_push();
393} 394}
394 395
395 396
@@ -404,7 +405,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
404 spin_lock_bh(&b_ptr->publ.lock); 405 spin_lock_bh(&b_ptr->publ.lock);
405 b_ptr->continue_count++; 406 b_ptr->continue_count++;
406 if (!list_empty(&b_ptr->cong_links)) 407 if (!list_empty(&b_ptr->cong_links))
407 k_signal((Handler)bearer_lock_push, (unsigned long)b_ptr); 408 tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr);
408 b_ptr->publ.blocked = 0; 409 b_ptr->publ.blocked = 0;
409 spin_unlock_bh(&b_ptr->publ.lock); 410 spin_unlock_bh(&b_ptr->publ.lock);
410} 411}
@@ -413,11 +414,11 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
413 * Schedule link for sending of messages after the bearer 414 * Schedule link for sending of messages after the bearer
414 * has been deblocked by 'continue()'. This method is called 415 * has been deblocked by 'continue()'. This method is called
415 * when somebody tries to send a message via this link while 416 * when somebody tries to send a message via this link while
416 * the bearer is congested. 'net_lock' is in read_lock here 417 * the bearer is congested. 'tipc_net_lock' is in read_lock here
417 * bearer.lock is busy 418 * bearer.lock is busy
418 */ 419 */
419 420
420static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) 421static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
421{ 422{
422 list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); 423 list_move_tail(&l_ptr->link_list, &b_ptr->cong_links);
423} 424}
@@ -426,24 +427,24 @@ static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
426 * Schedule link for sending of messages after the bearer 427 * Schedule link for sending of messages after the bearer
427 * has been deblocked by 'continue()'. This method is called 428 * has been deblocked by 'continue()'. This method is called
428 * when somebody tries to send a message via this link while 429 * when somebody tries to send a message via this link while
429 * the bearer is congested. 'net_lock' is in read_lock here, 430 * the bearer is congested. 'tipc_net_lock' is in read_lock here,
430 * bearer.lock is free 431 * bearer.lock is free
431 */ 432 */
432 433
433void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) 434void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr)
434{ 435{
435 spin_lock_bh(&b_ptr->publ.lock); 436 spin_lock_bh(&b_ptr->publ.lock);
436 bearer_schedule_unlocked(b_ptr, l_ptr); 437 tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
437 spin_unlock_bh(&b_ptr->publ.lock); 438 spin_unlock_bh(&b_ptr->publ.lock);
438} 439}
439 440
440 441
441/* 442/*
442 * bearer_resolve_congestion(): Check if there is bearer congestion, 443 * tipc_bearer_resolve_congestion(): Check if there is bearer congestion,
443 * and if there is, try to resolve it before returning. 444 * and if there is, try to resolve it before returning.
444 * 'net_lock' is read_locked when this function is called 445 * 'tipc_net_lock' is read_locked when this function is called
445 */ 446 */
446int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) 447int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
447{ 448{
448 int res = 1; 449 int res = 1;
449 450
@@ -451,7 +452,7 @@ int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
451 return 1; 452 return 1;
452 spin_lock_bh(&b_ptr->publ.lock); 453 spin_lock_bh(&b_ptr->publ.lock);
453 if (!bearer_push(b_ptr)) { 454 if (!bearer_push(b_ptr)) {
454 bearer_schedule_unlocked(b_ptr, l_ptr); 455 tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
455 res = 0; 456 res = 0;
456 } 457 }
457 spin_unlock_bh(&b_ptr->publ.lock); 458 spin_unlock_bh(&b_ptr->publ.lock);
@@ -476,14 +477,19 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
476 477
477 if (tipc_mode != TIPC_NET_MODE) 478 if (tipc_mode != TIPC_NET_MODE)
478 return -ENOPROTOOPT; 479 return -ENOPROTOOPT;
480
479 if (!bearer_name_validate(name, &b_name) || 481 if (!bearer_name_validate(name, &b_name) ||
480 !addr_domain_valid(bcast_scope) || 482 !tipc_addr_domain_valid(bcast_scope) ||
481 !in_scope(bcast_scope, tipc_own_addr) || 483 !in_scope(bcast_scope, tipc_own_addr))
482 (priority > TIPC_NUM_LINK_PRI)) 484 return -EINVAL;
485
486 if ((priority < TIPC_MIN_LINK_PRI ||
487 priority > TIPC_MAX_LINK_PRI) &&
488 (priority != TIPC_MEDIA_LINK_PRI))
483 return -EINVAL; 489 return -EINVAL;
484 490
485 write_lock_bh(&net_lock); 491 write_lock_bh(&tipc_net_lock);
486 if (!bearers) 492 if (!tipc_bearers)
487 goto failed; 493 goto failed;
488 494
489 m_ptr = media_find(b_name.media_name); 495 m_ptr = media_find(b_name.media_name);
@@ -491,22 +497,23 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
491 warn("No media <%s>\n", b_name.media_name); 497 warn("No media <%s>\n", b_name.media_name);
492 goto failed; 498 goto failed;
493 } 499 }
494 if (priority == TIPC_NUM_LINK_PRI) 500
501 if (priority == TIPC_MEDIA_LINK_PRI)
495 priority = m_ptr->priority; 502 priority = m_ptr->priority;
496 503
497restart: 504restart:
498 bearer_id = MAX_BEARERS; 505 bearer_id = MAX_BEARERS;
499 with_this_prio = 1; 506 with_this_prio = 1;
500 for (i = MAX_BEARERS; i-- != 0; ) { 507 for (i = MAX_BEARERS; i-- != 0; ) {
501 if (!bearers[i].active) { 508 if (!tipc_bearers[i].active) {
502 bearer_id = i; 509 bearer_id = i;
503 continue; 510 continue;
504 } 511 }
505 if (!strcmp(name, bearers[i].publ.name)) { 512 if (!strcmp(name, tipc_bearers[i].publ.name)) {
506 warn("Bearer <%s> already enabled\n", name); 513 warn("Bearer <%s> already enabled\n", name);
507 goto failed; 514 goto failed;
508 } 515 }
509 if ((bearers[i].priority == priority) && 516 if ((tipc_bearers[i].priority == priority) &&
510 (++with_this_prio > 2)) { 517 (++with_this_prio > 2)) {
511 if (priority-- == 0) { 518 if (priority-- == 0) {
512 warn("Third bearer <%s> with priority %u, unable to lower to %u\n", 519 warn("Third bearer <%s> with priority %u, unable to lower to %u\n",
@@ -523,7 +530,7 @@ restart:
523 goto failed; 530 goto failed;
524 } 531 }
525 532
526 b_ptr = &bearers[bearer_id]; 533 b_ptr = &tipc_bearers[bearer_id];
527 memset(b_ptr, 0, sizeof(struct bearer)); 534 memset(b_ptr, 0, sizeof(struct bearer));
528 535
529 strcpy(b_ptr->publ.name, name); 536 strcpy(b_ptr->publ.name, name);
@@ -542,16 +549,16 @@ restart:
542 INIT_LIST_HEAD(&b_ptr->cong_links); 549 INIT_LIST_HEAD(&b_ptr->cong_links);
543 INIT_LIST_HEAD(&b_ptr->links); 550 INIT_LIST_HEAD(&b_ptr->links);
544 if (m_ptr->bcast) { 551 if (m_ptr->bcast) {
545 b_ptr->link_req = disc_init_link_req(b_ptr, &m_ptr->bcast_addr, 552 b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr,
546 bcast_scope, 2); 553 bcast_scope, 2);
547 } 554 }
548 b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; 555 b_ptr->publ.lock = SPIN_LOCK_UNLOCKED;
549 write_unlock_bh(&net_lock); 556 write_unlock_bh(&tipc_net_lock);
550 info("Enabled bearer <%s>, discovery domain %s\n", 557 info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
551 name, addr_string_fill(addr_string, bcast_scope)); 558 name, addr_string_fill(addr_string, bcast_scope), priority);
552 return 0; 559 return 0;
553failed: 560failed:
554 write_unlock_bh(&net_lock); 561 write_unlock_bh(&tipc_net_lock);
555 return res; 562 return res;
556} 563}
557 564
@@ -569,11 +576,11 @@ int tipc_block_bearer(const char *name)
569 if (tipc_mode != TIPC_NET_MODE) 576 if (tipc_mode != TIPC_NET_MODE)
570 return -ENOPROTOOPT; 577 return -ENOPROTOOPT;
571 578
572 read_lock_bh(&net_lock); 579 read_lock_bh(&tipc_net_lock);
573 b_ptr = bearer_find(name); 580 b_ptr = bearer_find(name);
574 if (!b_ptr) { 581 if (!b_ptr) {
575 warn("Attempt to block unknown bearer <%s>\n", name); 582 warn("Attempt to block unknown bearer <%s>\n", name);
576 read_unlock_bh(&net_lock); 583 read_unlock_bh(&tipc_net_lock);
577 return -EINVAL; 584 return -EINVAL;
578 } 585 }
579 586
@@ -583,11 +590,11 @@ int tipc_block_bearer(const char *name)
583 struct node *n_ptr = l_ptr->owner; 590 struct node *n_ptr = l_ptr->owner;
584 591
585 spin_lock_bh(&n_ptr->lock); 592 spin_lock_bh(&n_ptr->lock);
586 link_reset(l_ptr); 593 tipc_link_reset(l_ptr);
587 spin_unlock_bh(&n_ptr->lock); 594 spin_unlock_bh(&n_ptr->lock);
588 } 595 }
589 spin_unlock_bh(&b_ptr->publ.lock); 596 spin_unlock_bh(&b_ptr->publ.lock);
590 read_unlock_bh(&net_lock); 597 read_unlock_bh(&tipc_net_lock);
591 info("Blocked bearer <%s>\n", name); 598 info("Blocked bearer <%s>\n", name);
592 return TIPC_OK; 599 return TIPC_OK;
593} 600}
@@ -595,7 +602,7 @@ int tipc_block_bearer(const char *name)
595/** 602/**
596 * bearer_disable - 603 * bearer_disable -
597 * 604 *
598 * Note: This routine assumes caller holds net_lock. 605 * Note: This routine assumes caller holds tipc_net_lock.
599 */ 606 */
600 607
601static int bearer_disable(const char *name) 608static int bearer_disable(const char *name)
@@ -613,19 +620,19 @@ static int bearer_disable(const char *name)
613 return -EINVAL; 620 return -EINVAL;
614 } 621 }
615 622
616 disc_stop_link_req(b_ptr->link_req); 623 tipc_disc_stop_link_req(b_ptr->link_req);
617 spin_lock_bh(&b_ptr->publ.lock); 624 spin_lock_bh(&b_ptr->publ.lock);
618 b_ptr->link_req = NULL; 625 b_ptr->link_req = NULL;
619 b_ptr->publ.blocked = 1; 626 b_ptr->publ.blocked = 1;
620 if (b_ptr->media->disable_bearer) { 627 if (b_ptr->media->disable_bearer) {
621 spin_unlock_bh(&b_ptr->publ.lock); 628 spin_unlock_bh(&b_ptr->publ.lock);
622 write_unlock_bh(&net_lock); 629 write_unlock_bh(&tipc_net_lock);
623 b_ptr->media->disable_bearer(&b_ptr->publ); 630 b_ptr->media->disable_bearer(&b_ptr->publ);
624 write_lock_bh(&net_lock); 631 write_lock_bh(&tipc_net_lock);
625 spin_lock_bh(&b_ptr->publ.lock); 632 spin_lock_bh(&b_ptr->publ.lock);
626 } 633 }
627 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 634 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
628 link_delete(l_ptr); 635 tipc_link_delete(l_ptr);
629 } 636 }
630 spin_unlock_bh(&b_ptr->publ.lock); 637 spin_unlock_bh(&b_ptr->publ.lock);
631 info("Disabled bearer <%s>\n", name); 638 info("Disabled bearer <%s>\n", name);
@@ -637,54 +644,54 @@ int tipc_disable_bearer(const char *name)
637{ 644{
638 int res; 645 int res;
639 646
640 write_lock_bh(&net_lock); 647 write_lock_bh(&tipc_net_lock);
641 res = bearer_disable(name); 648 res = bearer_disable(name);
642 write_unlock_bh(&net_lock); 649 write_unlock_bh(&tipc_net_lock);
643 return res; 650 return res;
644} 651}
645 652
646 653
647 654
648int bearer_init(void) 655int tipc_bearer_init(void)
649{ 656{
650 int res; 657 int res;
651 658
652 write_lock_bh(&net_lock); 659 write_lock_bh(&tipc_net_lock);
653 bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC); 660 tipc_bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC);
654 media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC); 661 media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC);
655 if (bearers && media_list) { 662 if (tipc_bearers && media_list) {
656 memset(bearers, 0, MAX_BEARERS * sizeof(struct bearer)); 663 memset(tipc_bearers, 0, MAX_BEARERS * sizeof(struct bearer));
657 memset(media_list, 0, MAX_MEDIA * sizeof(struct media)); 664 memset(media_list, 0, MAX_MEDIA * sizeof(struct media));
658 res = TIPC_OK; 665 res = TIPC_OK;
659 } else { 666 } else {
660 kfree(bearers); 667 kfree(tipc_bearers);
661 kfree(media_list); 668 kfree(media_list);
662 bearers = 0; 669 tipc_bearers = 0;
663 media_list = 0; 670 media_list = 0;
664 res = -ENOMEM; 671 res = -ENOMEM;
665 } 672 }
666 write_unlock_bh(&net_lock); 673 write_unlock_bh(&tipc_net_lock);
667 return res; 674 return res;
668} 675}
669 676
670void bearer_stop(void) 677void tipc_bearer_stop(void)
671{ 678{
672 u32 i; 679 u32 i;
673 680
674 if (!bearers) 681 if (!tipc_bearers)
675 return; 682 return;
676 683
677 for (i = 0; i < MAX_BEARERS; i++) { 684 for (i = 0; i < MAX_BEARERS; i++) {
678 if (bearers[i].active) 685 if (tipc_bearers[i].active)
679 bearers[i].publ.blocked = 1; 686 tipc_bearers[i].publ.blocked = 1;
680 } 687 }
681 for (i = 0; i < MAX_BEARERS; i++) { 688 for (i = 0; i < MAX_BEARERS; i++) {
682 if (bearers[i].active) 689 if (tipc_bearers[i].active)
683 bearer_disable(bearers[i].publ.name); 690 bearer_disable(tipc_bearers[i].publ.name);
684 } 691 }
685 kfree(bearers); 692 kfree(tipc_bearers);
686 kfree(media_list); 693 kfree(media_list);
687 bearers = 0; 694 tipc_bearers = 0;
688 media_list = 0; 695 media_list = 0;
689 media_count = 0; 696 media_count = 0;
690} 697}
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 21e63d3f0183..c4e7c1c3655b 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -37,7 +37,7 @@
37#ifndef _TIPC_BEARER_H 37#ifndef _TIPC_BEARER_H
38#define _TIPC_BEARER_H 38#define _TIPC_BEARER_H
39 39
40#include <net/tipc/tipc_bearer.h> 40#include "core.h"
41#include "bcast.h" 41#include "bcast.h"
42 42
43#define MAX_BEARERS 8 43#define MAX_BEARERS 8
@@ -114,26 +114,24 @@ struct bearer_name {
114 114
115struct link; 115struct link;
116 116
117extern struct bearer *bearers; 117extern struct bearer *tipc_bearers;
118 118
119void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); 119void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
120struct sk_buff *media_get_names(void); 120struct sk_buff *tipc_media_get_names(void);
121 121
122struct sk_buff *bearer_get_names(void); 122struct sk_buff *tipc_bearer_get_names(void);
123void bearer_add_dest(struct bearer *b_ptr, u32 dest); 123void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest);
124void bearer_remove_dest(struct bearer *b_ptr, u32 dest); 124void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest);
125void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); 125void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr);
126struct bearer *bearer_find_interface(const char *if_name); 126struct bearer *tipc_bearer_find_interface(const char *if_name);
127int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); 127int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr);
128int bearer_init(void); 128int tipc_bearer_init(void);
129void bearer_stop(void); 129void tipc_bearer_stop(void);
130int bearer_broadcast(struct sk_buff *buf, struct tipc_bearer *b_ptr, 130void tipc_bearer_lock_push(struct bearer *b_ptr);
131 struct tipc_media_addr *dest);
132void bearer_lock_push(struct bearer *b_ptr);
133 131
134 132
135/** 133/**
136 * bearer_send- sends buffer to destination over bearer 134 * tipc_bearer_send- sends buffer to destination over bearer
137 * 135 *
138 * Returns true (1) if successful, or false (0) if unable to send 136 * Returns true (1) if successful, or false (0) if unable to send
139 * 137 *
@@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr);
150 * and let TIPC's link code deal with the undelivered message. 148 * and let TIPC's link code deal with the undelivered message.
151 */ 149 */
152 150
153static inline int bearer_send(struct bearer *b_ptr, struct sk_buff *buf, 151static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf,
154 struct tipc_media_addr *dest) 152 struct tipc_media_addr *dest)
155{ 153{
156 return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); 154 return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest);
157} 155}
158 156
159/** 157/**
160 * bearer_congested - determines if bearer is currently congested 158 * tipc_bearer_congested - determines if bearer is currently congested
161 */ 159 */
162 160
163static inline int bearer_congested(struct bearer *b_ptr, struct link *l_ptr) 161static inline int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr)
164{ 162{
165 if (unlikely(b_ptr->publ.blocked)) 163 if (unlikely(b_ptr->publ.blocked))
166 return 1; 164 return 1;
167 if (likely(list_empty(&b_ptr->cong_links))) 165 if (likely(list_empty(&b_ptr->cong_links)))
168 return 0; 166 return 0;
169 return !bearer_resolve_congestion(b_ptr, l_ptr); 167 return !tipc_bearer_resolve_congestion(b_ptr, l_ptr);
170} 168}
171 169
172#endif 170#endif
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index f0f7bac51d41..ab974ca19371 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -44,15 +44,15 @@
44#include "msg.h" 44#include "msg.h"
45#include "bearer.h" 45#include "bearer.h"
46 46
47void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, 47void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
48 u32 lower, u32 upper); 48 u32 lower, u32 upper);
49struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest); 49struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest);
50 50
51struct node **local_nodes = 0; 51struct node **tipc_local_nodes = 0;
52struct node_map cluster_bcast_nodes = {0,{0,}}; 52struct node_map tipc_cltr_bcast_nodes = {0,{0,}};
53u32 highest_allowed_slave = 0; 53u32 tipc_highest_allowed_slave = 0;
54 54
55struct cluster *cluster_create(u32 addr) 55struct cluster *tipc_cltr_create(u32 addr)
56{ 56{
57 struct _zone *z_ptr; 57 struct _zone *z_ptr;
58 struct cluster *c_ptr; 58 struct cluster *c_ptr;
@@ -77,16 +77,16 @@ struct cluster *cluster_create(u32 addr)
77 } 77 }
78 memset(c_ptr->nodes, 0, alloc); 78 memset(c_ptr->nodes, 0, alloc);
79 if (in_own_cluster(addr)) 79 if (in_own_cluster(addr))
80 local_nodes = c_ptr->nodes; 80 tipc_local_nodes = c_ptr->nodes;
81 c_ptr->highest_slave = LOWEST_SLAVE - 1; 81 c_ptr->highest_slave = LOWEST_SLAVE - 1;
82 c_ptr->highest_node = 0; 82 c_ptr->highest_node = 0;
83 83
84 z_ptr = zone_find(tipc_zone(addr)); 84 z_ptr = tipc_zone_find(tipc_zone(addr));
85 if (z_ptr == NULL) { 85 if (z_ptr == NULL) {
86 z_ptr = zone_create(addr); 86 z_ptr = tipc_zone_create(addr);
87 } 87 }
88 if (z_ptr != NULL) { 88 if (z_ptr != NULL) {
89 zone_attach_cluster(z_ptr, c_ptr); 89 tipc_zone_attach_cluster(z_ptr, c_ptr);
90 c_ptr->owner = z_ptr; 90 c_ptr->owner = z_ptr;
91 } 91 }
92 else { 92 else {
@@ -97,23 +97,23 @@ struct cluster *cluster_create(u32 addr)
97 return c_ptr; 97 return c_ptr;
98} 98}
99 99
100void cluster_delete(struct cluster *c_ptr) 100void tipc_cltr_delete(struct cluster *c_ptr)
101{ 101{
102 u32 n_num; 102 u32 n_num;
103 103
104 if (!c_ptr) 104 if (!c_ptr)
105 return; 105 return;
106 for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) { 106 for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) {
107 node_delete(c_ptr->nodes[n_num]); 107 tipc_node_delete(c_ptr->nodes[n_num]);
108 } 108 }
109 for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) { 109 for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) {
110 node_delete(c_ptr->nodes[n_num]); 110 tipc_node_delete(c_ptr->nodes[n_num]);
111 } 111 }
112 kfree(c_ptr->nodes); 112 kfree(c_ptr->nodes);
113 kfree(c_ptr); 113 kfree(c_ptr);
114} 114}
115 115
116u32 cluster_next_node(struct cluster *c_ptr, u32 addr) 116u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
117{ 117{
118 struct node *n_ptr; 118 struct node *n_ptr;
119 u32 n_num = tipc_node(addr) + 1; 119 u32 n_num = tipc_node(addr) + 1;
@@ -122,24 +122,24 @@ u32 cluster_next_node(struct cluster *c_ptr, u32 addr)
122 return addr; 122 return addr;
123 for (; n_num <= c_ptr->highest_node; n_num++) { 123 for (; n_num <= c_ptr->highest_node; n_num++) {
124 n_ptr = c_ptr->nodes[n_num]; 124 n_ptr = c_ptr->nodes[n_num];
125 if (n_ptr && node_has_active_links(n_ptr)) 125 if (n_ptr && tipc_node_has_active_links(n_ptr))
126 return n_ptr->addr; 126 return n_ptr->addr;
127 } 127 }
128 for (n_num = 1; n_num < tipc_node(addr); n_num++) { 128 for (n_num = 1; n_num < tipc_node(addr); n_num++) {
129 n_ptr = c_ptr->nodes[n_num]; 129 n_ptr = c_ptr->nodes[n_num];
130 if (n_ptr && node_has_active_links(n_ptr)) 130 if (n_ptr && tipc_node_has_active_links(n_ptr))
131 return n_ptr->addr; 131 return n_ptr->addr;
132 } 132 }
133 return 0; 133 return 0;
134} 134}
135 135
136void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr) 136void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr)
137{ 137{
138 u32 n_num = tipc_node(n_ptr->addr); 138 u32 n_num = tipc_node(n_ptr->addr);
139 u32 max_n_num = tipc_max_nodes; 139 u32 max_n_num = tipc_max_nodes;
140 140
141 if (in_own_cluster(n_ptr->addr)) 141 if (in_own_cluster(n_ptr->addr))
142 max_n_num = highest_allowed_slave; 142 max_n_num = tipc_highest_allowed_slave;
143 assert(n_num > 0); 143 assert(n_num > 0);
144 assert(n_num <= max_n_num); 144 assert(n_num <= max_n_num);
145 assert(c_ptr->nodes[n_num] == 0); 145 assert(c_ptr->nodes[n_num] == 0);
@@ -149,12 +149,12 @@ void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr)
149} 149}
150 150
151/** 151/**
152 * cluster_select_router - select router to a cluster 152 * tipc_cltr_select_router - select router to a cluster
153 * 153 *
154 * Uses deterministic and fair algorithm. 154 * Uses deterministic and fair algorithm.
155 */ 155 */
156 156
157u32 cluster_select_router(struct cluster *c_ptr, u32 ref) 157u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref)
158{ 158{
159 u32 n_num; 159 u32 n_num;
160 u32 ulim = c_ptr->highest_node; 160 u32 ulim = c_ptr->highest_node;
@@ -174,29 +174,29 @@ u32 cluster_select_router(struct cluster *c_ptr, u32 ref)
174 174
175 /* Lookup upwards with wrap-around */ 175 /* Lookup upwards with wrap-around */
176 do { 176 do {
177 if (node_is_up(c_ptr->nodes[n_num])) 177 if (tipc_node_is_up(c_ptr->nodes[n_num]))
178 break; 178 break;
179 } while (++n_num <= ulim); 179 } while (++n_num <= ulim);
180 if (n_num > ulim) { 180 if (n_num > ulim) {
181 n_num = 1; 181 n_num = 1;
182 do { 182 do {
183 if (node_is_up(c_ptr->nodes[n_num])) 183 if (tipc_node_is_up(c_ptr->nodes[n_num]))
184 break; 184 break;
185 } while (++n_num < tstart); 185 } while (++n_num < tstart);
186 if (n_num == tstart) 186 if (n_num == tstart)
187 return 0; 187 return 0;
188 } 188 }
189 assert(n_num <= ulim); 189 assert(n_num <= ulim);
190 return node_select_router(c_ptr->nodes[n_num], ref); 190 return tipc_node_select_router(c_ptr->nodes[n_num], ref);
191} 191}
192 192
193/** 193/**
194 * cluster_select_node - select destination node within a remote cluster 194 * tipc_cltr_select_node - select destination node within a remote cluster
195 * 195 *
196 * Uses deterministic and fair algorithm. 196 * Uses deterministic and fair algorithm.
197 */ 197 */
198 198
199struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) 199struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
200{ 200{
201 u32 n_num; 201 u32 n_num;
202 u32 mask = tipc_max_nodes; 202 u32 mask = tipc_max_nodes;
@@ -215,11 +215,11 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
215 215
216 /* Lookup upwards with wrap-around */ 216 /* Lookup upwards with wrap-around */
217 for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) { 217 for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) {
218 if (node_has_active_links(c_ptr->nodes[n_num])) 218 if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
219 return c_ptr->nodes[n_num]; 219 return c_ptr->nodes[n_num];
220 } 220 }
221 for (n_num = 1; n_num < start_entry; n_num++) { 221 for (n_num = 1; n_num < start_entry; n_num++) {
222 if (node_has_active_links(c_ptr->nodes[n_num])) 222 if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
223 return c_ptr->nodes[n_num]; 223 return c_ptr->nodes[n_num];
224 } 224 }
225 return 0; 225 return 0;
@@ -229,7 +229,7 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
229 * Routing table management: See description in node.c 229 * Routing table management: See description in node.c
230 */ 230 */
231 231
232struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest) 232struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
233{ 233{
234 u32 size = INT_H_SIZE + data_size; 234 u32 size = INT_H_SIZE + data_size;
235 struct sk_buff *buf = buf_acquire(size); 235 struct sk_buff *buf = buf_acquire(size);
@@ -243,39 +243,39 @@ struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest)
243 return buf; 243 return buf;
244} 244}
245 245
246void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, 246void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest,
247 u32 lower, u32 upper) 247 u32 lower, u32 upper)
248{ 248{
249 struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); 249 struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
250 struct tipc_msg *msg; 250 struct tipc_msg *msg;
251 251
252 if (buf) { 252 if (buf) {
253 msg = buf_msg(buf); 253 msg = buf_msg(buf);
254 msg_set_remote_node(msg, dest); 254 msg_set_remote_node(msg, dest);
255 msg_set_type(msg, ROUTE_ADDITION); 255 msg_set_type(msg, ROUTE_ADDITION);
256 cluster_multicast(c_ptr, buf, lower, upper); 256 tipc_cltr_multicast(c_ptr, buf, lower, upper);
257 } else { 257 } else {
258 warn("Memory squeeze: broadcast of new route failed\n"); 258 warn("Memory squeeze: broadcast of new route failed\n");
259 } 259 }
260} 260}
261 261
262void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, 262void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest,
263 u32 lower, u32 upper) 263 u32 lower, u32 upper)
264{ 264{
265 struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); 265 struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
266 struct tipc_msg *msg; 266 struct tipc_msg *msg;
267 267
268 if (buf) { 268 if (buf) {
269 msg = buf_msg(buf); 269 msg = buf_msg(buf);
270 msg_set_remote_node(msg, dest); 270 msg_set_remote_node(msg, dest);
271 msg_set_type(msg, ROUTE_REMOVAL); 271 msg_set_type(msg, ROUTE_REMOVAL);
272 cluster_multicast(c_ptr, buf, lower, upper); 272 tipc_cltr_multicast(c_ptr, buf, lower, upper);
273 } else { 273 } else {
274 warn("Memory squeeze: broadcast of lost route failed\n"); 274 warn("Memory squeeze: broadcast of lost route failed\n");
275 } 275 }
276} 276}
277 277
278void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) 278void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest)
279{ 279{
280 struct sk_buff *buf; 280 struct sk_buff *buf;
281 struct tipc_msg *msg; 281 struct tipc_msg *msg;
@@ -288,21 +288,21 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
288 assert(in_own_cluster(c_ptr->addr)); 288 assert(in_own_cluster(c_ptr->addr));
289 if (highest <= LOWEST_SLAVE) 289 if (highest <= LOWEST_SLAVE)
290 return; 290 return;
291 buf = cluster_prepare_routing_msg(highest - LOWEST_SLAVE + 1, 291 buf = tipc_cltr_prepare_routing_msg(highest - LOWEST_SLAVE + 1,
292 c_ptr->addr); 292 c_ptr->addr);
293 if (buf) { 293 if (buf) {
294 msg = buf_msg(buf); 294 msg = buf_msg(buf);
295 msg_set_remote_node(msg, c_ptr->addr); 295 msg_set_remote_node(msg, c_ptr->addr);
296 msg_set_type(msg, SLAVE_ROUTING_TABLE); 296 msg_set_type(msg, SLAVE_ROUTING_TABLE);
297 for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { 297 for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) {
298 if (c_ptr->nodes[n_num] && 298 if (c_ptr->nodes[n_num] &&
299 node_has_active_links(c_ptr->nodes[n_num])) { 299 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
300 send = 1; 300 send = 1;
301 msg_set_dataoctet(msg, n_num); 301 msg_set_dataoctet(msg, n_num);
302 } 302 }
303 } 303 }
304 if (send) 304 if (send)
305 link_send(buf, dest, dest); 305 tipc_link_send(buf, dest, dest);
306 else 306 else
307 buf_discard(buf); 307 buf_discard(buf);
308 } else { 308 } else {
@@ -310,7 +310,7 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
310 } 310 }
311} 311}
312 312
313void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) 313void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest)
314{ 314{
315 struct sk_buff *buf; 315 struct sk_buff *buf;
316 struct tipc_msg *msg; 316 struct tipc_msg *msg;
@@ -323,20 +323,20 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
323 assert(!is_slave(dest)); 323 assert(!is_slave(dest));
324 assert(in_own_cluster(dest)); 324 assert(in_own_cluster(dest));
325 highest = c_ptr->highest_node; 325 highest = c_ptr->highest_node;
326 buf = cluster_prepare_routing_msg(highest + 1, c_ptr->addr); 326 buf = tipc_cltr_prepare_routing_msg(highest + 1, c_ptr->addr);
327 if (buf) { 327 if (buf) {
328 msg = buf_msg(buf); 328 msg = buf_msg(buf);
329 msg_set_remote_node(msg, c_ptr->addr); 329 msg_set_remote_node(msg, c_ptr->addr);
330 msg_set_type(msg, EXT_ROUTING_TABLE); 330 msg_set_type(msg, EXT_ROUTING_TABLE);
331 for (n_num = 1; n_num <= highest; n_num++) { 331 for (n_num = 1; n_num <= highest; n_num++) {
332 if (c_ptr->nodes[n_num] && 332 if (c_ptr->nodes[n_num] &&
333 node_has_active_links(c_ptr->nodes[n_num])) { 333 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
334 send = 1; 334 send = 1;
335 msg_set_dataoctet(msg, n_num); 335 msg_set_dataoctet(msg, n_num);
336 } 336 }
337 } 337 }
338 if (send) 338 if (send)
339 link_send(buf, dest, dest); 339 tipc_link_send(buf, dest, dest);
340 else 340 else
341 buf_discard(buf); 341 buf_discard(buf);
342 } else { 342 } else {
@@ -344,7 +344,7 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
344 } 344 }
345} 345}
346 346
347void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) 347void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest)
348{ 348{
349 struct sk_buff *buf; 349 struct sk_buff *buf;
350 struct tipc_msg *msg; 350 struct tipc_msg *msg;
@@ -354,20 +354,20 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
354 354
355 assert(is_slave(dest)); 355 assert(is_slave(dest));
356 assert(in_own_cluster(c_ptr->addr)); 356 assert(in_own_cluster(c_ptr->addr));
357 buf = cluster_prepare_routing_msg(highest, c_ptr->addr); 357 buf = tipc_cltr_prepare_routing_msg(highest, c_ptr->addr);
358 if (buf) { 358 if (buf) {
359 msg = buf_msg(buf); 359 msg = buf_msg(buf);
360 msg_set_remote_node(msg, c_ptr->addr); 360 msg_set_remote_node(msg, c_ptr->addr);
361 msg_set_type(msg, LOCAL_ROUTING_TABLE); 361 msg_set_type(msg, LOCAL_ROUTING_TABLE);
362 for (n_num = 1; n_num <= highest; n_num++) { 362 for (n_num = 1; n_num <= highest; n_num++) {
363 if (c_ptr->nodes[n_num] && 363 if (c_ptr->nodes[n_num] &&
364 node_has_active_links(c_ptr->nodes[n_num])) { 364 tipc_node_has_active_links(c_ptr->nodes[n_num])) {
365 send = 1; 365 send = 1;
366 msg_set_dataoctet(msg, n_num); 366 msg_set_dataoctet(msg, n_num);
367 } 367 }
368 } 368 }
369 if (send) 369 if (send)
370 link_send(buf, dest, dest); 370 tipc_link_send(buf, dest, dest);
371 else 371 else
372 buf_discard(buf); 372 buf_discard(buf);
373 } else { 373 } else {
@@ -375,7 +375,7 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
375 } 375 }
376} 376}
377 377
378void cluster_recv_routing_table(struct sk_buff *buf) 378void tipc_cltr_recv_routing_table(struct sk_buff *buf)
379{ 379{
380 struct tipc_msg *msg = buf_msg(buf); 380 struct tipc_msg *msg = buf_msg(buf);
381 struct cluster *c_ptr; 381 struct cluster *c_ptr;
@@ -388,9 +388,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
388 u32 c_num; 388 u32 c_num;
389 u32 n_num; 389 u32 n_num;
390 390
391 c_ptr = cluster_find(rem_node); 391 c_ptr = tipc_cltr_find(rem_node);
392 if (!c_ptr) { 392 if (!c_ptr) {
393 c_ptr = cluster_create(rem_node); 393 c_ptr = tipc_cltr_create(rem_node);
394 if (!c_ptr) { 394 if (!c_ptr) {
395 buf_discard(buf); 395 buf_discard(buf);
396 return; 396 return;
@@ -412,10 +412,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
412 u32 addr = tipc_addr(z_num, c_num, n_num); 412 u32 addr = tipc_addr(z_num, c_num, n_num);
413 n_ptr = c_ptr->nodes[n_num]; 413 n_ptr = c_ptr->nodes[n_num];
414 if (!n_ptr) { 414 if (!n_ptr) {
415 n_ptr = node_create(addr); 415 n_ptr = tipc_node_create(addr);
416 } 416 }
417 if (n_ptr) 417 if (n_ptr)
418 node_add_router(n_ptr, router); 418 tipc_node_add_router(n_ptr, router);
419 } 419 }
420 } 420 }
421 break; 421 break;
@@ -428,10 +428,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
428 u32 addr = tipc_addr(z_num, c_num, slave_num); 428 u32 addr = tipc_addr(z_num, c_num, slave_num);
429 n_ptr = c_ptr->nodes[slave_num]; 429 n_ptr = c_ptr->nodes[slave_num];
430 if (!n_ptr) { 430 if (!n_ptr) {
431 n_ptr = node_create(addr); 431 n_ptr = tipc_node_create(addr);
432 } 432 }
433 if (n_ptr) 433 if (n_ptr)
434 node_add_router(n_ptr, router); 434 tipc_node_add_router(n_ptr, router);
435 } 435 }
436 } 436 }
437 break; 437 break;
@@ -445,9 +445,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
445 } 445 }
446 n_ptr = c_ptr->nodes[tipc_node(rem_node)]; 446 n_ptr = c_ptr->nodes[tipc_node(rem_node)];
447 if (!n_ptr) 447 if (!n_ptr)
448 n_ptr = node_create(rem_node); 448 n_ptr = tipc_node_create(rem_node);
449 if (n_ptr) 449 if (n_ptr)
450 node_add_router(n_ptr, router); 450 tipc_node_add_router(n_ptr, router);
451 break; 451 break;
452 case ROUTE_REMOVAL: 452 case ROUTE_REMOVAL:
453 if (!is_slave(tipc_own_addr)) { 453 if (!is_slave(tipc_own_addr)) {
@@ -459,7 +459,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
459 } 459 }
460 n_ptr = c_ptr->nodes[tipc_node(rem_node)]; 460 n_ptr = c_ptr->nodes[tipc_node(rem_node)];
461 if (n_ptr) 461 if (n_ptr)
462 node_remove_router(n_ptr, router); 462 tipc_node_remove_router(n_ptr, router);
463 break; 463 break;
464 default: 464 default:
465 assert(!"Illegal routing manager message received\n"); 465 assert(!"Illegal routing manager message received\n");
@@ -467,7 +467,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
467 buf_discard(buf); 467 buf_discard(buf);
468} 468}
469 469
470void cluster_remove_as_router(struct cluster *c_ptr, u32 router) 470void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router)
471{ 471{
472 u32 start_entry; 472 u32 start_entry;
473 u32 tstop; 473 u32 tstop;
@@ -486,17 +486,17 @@ void cluster_remove_as_router(struct cluster *c_ptr, u32 router)
486 486
487 for (n_num = start_entry; n_num <= tstop; n_num++) { 487 for (n_num = start_entry; n_num <= tstop; n_num++) {
488 if (c_ptr->nodes[n_num]) { 488 if (c_ptr->nodes[n_num]) {
489 node_remove_router(c_ptr->nodes[n_num], router); 489 tipc_node_remove_router(c_ptr->nodes[n_num], router);
490 } 490 }
491 } 491 }
492} 492}
493 493
494/** 494/**
495 * cluster_multicast - multicast message to local nodes 495 * tipc_cltr_multicast - multicast message to local nodes
496 */ 496 */
497 497
498void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, 498void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
499 u32 lower, u32 upper) 499 u32 lower, u32 upper)
500{ 500{
501 struct sk_buff *buf_copy; 501 struct sk_buff *buf_copy;
502 struct node *n_ptr; 502 struct node *n_ptr;
@@ -505,9 +505,9 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
505 505
506 assert(lower <= upper); 506 assert(lower <= upper);
507 assert(((lower >= 1) && (lower <= tipc_max_nodes)) || 507 assert(((lower >= 1) && (lower <= tipc_max_nodes)) ||
508 ((lower >= LOWEST_SLAVE) && (lower <= highest_allowed_slave))); 508 ((lower >= LOWEST_SLAVE) && (lower <= tipc_highest_allowed_slave)));
509 assert(((upper >= 1) && (upper <= tipc_max_nodes)) || 509 assert(((upper >= 1) && (upper <= tipc_max_nodes)) ||
510 ((upper >= LOWEST_SLAVE) && (upper <= highest_allowed_slave))); 510 ((upper >= LOWEST_SLAVE) && (upper <= tipc_highest_allowed_slave)));
511 assert(in_own_cluster(c_ptr->addr)); 511 assert(in_own_cluster(c_ptr->addr));
512 512
513 tstop = is_slave(upper) ? c_ptr->highest_slave : c_ptr->highest_node; 513 tstop = is_slave(upper) ? c_ptr->highest_slave : c_ptr->highest_node;
@@ -515,22 +515,22 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
515 tstop = upper; 515 tstop = upper;
516 for (n_num = lower; n_num <= tstop; n_num++) { 516 for (n_num = lower; n_num <= tstop; n_num++) {
517 n_ptr = c_ptr->nodes[n_num]; 517 n_ptr = c_ptr->nodes[n_num];
518 if (n_ptr && node_has_active_links(n_ptr)) { 518 if (n_ptr && tipc_node_has_active_links(n_ptr)) {
519 buf_copy = skb_copy(buf, GFP_ATOMIC); 519 buf_copy = skb_copy(buf, GFP_ATOMIC);
520 if (buf_copy == NULL) 520 if (buf_copy == NULL)
521 break; 521 break;
522 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); 522 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
523 link_send(buf_copy, n_ptr->addr, n_ptr->addr); 523 tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr);
524 } 524 }
525 } 525 }
526 buf_discard(buf); 526 buf_discard(buf);
527} 527}
528 528
529/** 529/**
530 * cluster_broadcast - broadcast message to all nodes within cluster 530 * tipc_cltr_broadcast - broadcast message to all nodes within cluster
531 */ 531 */
532 532
533void cluster_broadcast(struct sk_buff *buf) 533void tipc_cltr_broadcast(struct sk_buff *buf)
534{ 534{
535 struct sk_buff *buf_copy; 535 struct sk_buff *buf_copy;
536 struct cluster *c_ptr; 536 struct cluster *c_ptr;
@@ -541,7 +541,7 @@ void cluster_broadcast(struct sk_buff *buf)
541 u32 node_type; 541 u32 node_type;
542 542
543 if (tipc_mode == TIPC_NET_MODE) { 543 if (tipc_mode == TIPC_NET_MODE) {
544 c_ptr = cluster_find(tipc_own_addr); 544 c_ptr = tipc_cltr_find(tipc_own_addr);
545 assert(in_own_cluster(c_ptr->addr)); /* For now */ 545 assert(in_own_cluster(c_ptr->addr)); /* For now */
546 546
547 /* Send to standard nodes, then repeat loop sending to slaves */ 547 /* Send to standard nodes, then repeat loop sending to slaves */
@@ -550,14 +550,14 @@ void cluster_broadcast(struct sk_buff *buf)
550 for (node_type = 1; node_type <= 2; node_type++) { 550 for (node_type = 1; node_type <= 2; node_type++) {
551 for (n_num = tstart; n_num <= tstop; n_num++) { 551 for (n_num = tstart; n_num <= tstop; n_num++) {
552 n_ptr = c_ptr->nodes[n_num]; 552 n_ptr = c_ptr->nodes[n_num];
553 if (n_ptr && node_has_active_links(n_ptr)) { 553 if (n_ptr && tipc_node_has_active_links(n_ptr)) {
554 buf_copy = skb_copy(buf, GFP_ATOMIC); 554 buf_copy = skb_copy(buf, GFP_ATOMIC);
555 if (buf_copy == NULL) 555 if (buf_copy == NULL)
556 goto exit; 556 goto exit;
557 msg_set_destnode(buf_msg(buf_copy), 557 msg_set_destnode(buf_msg(buf_copy),
558 n_ptr->addr); 558 n_ptr->addr);
559 link_send(buf_copy, n_ptr->addr, 559 tipc_link_send(buf_copy, n_ptr->addr,
560 n_ptr->addr); 560 n_ptr->addr);
561 } 561 }
562 } 562 }
563 tstart = LOWEST_SLAVE; 563 tstart = LOWEST_SLAVE;
@@ -568,9 +568,9 @@ exit:
568 buf_discard(buf); 568 buf_discard(buf);
569} 569}
570 570
571int cluster_init(void) 571int tipc_cltr_init(void)
572{ 572{
573 highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves; 573 tipc_highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves;
574 return cluster_create(tipc_own_addr) ? TIPC_OK : -ENOMEM; 574 return tipc_cltr_create(tipc_own_addr) ? TIPC_OK : -ENOMEM;
575} 575}
576 576
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h
index 1ffb095991df..9963642e1058 100644
--- a/net/tipc/cluster.h
+++ b/net/tipc/cluster.h
@@ -60,29 +60,29 @@ struct cluster {
60}; 60};
61 61
62 62
63extern struct node **local_nodes; 63extern struct node **tipc_local_nodes;
64extern u32 highest_allowed_slave; 64extern u32 tipc_highest_allowed_slave;
65extern struct node_map cluster_bcast_nodes; 65extern struct node_map tipc_cltr_bcast_nodes;
66 66
67void cluster_remove_as_router(struct cluster *c_ptr, u32 router); 67void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router);
68void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest); 68void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest);
69struct node *cluster_select_node(struct cluster *c_ptr, u32 selector); 69struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector);
70u32 cluster_select_router(struct cluster *c_ptr, u32 ref); 70u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref);
71void cluster_recv_routing_table(struct sk_buff *buf); 71void tipc_cltr_recv_routing_table(struct sk_buff *buf);
72struct cluster *cluster_create(u32 addr); 72struct cluster *tipc_cltr_create(u32 addr);
73void cluster_delete(struct cluster *c_ptr); 73void tipc_cltr_delete(struct cluster *c_ptr);
74void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr); 74void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr);
75void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest); 75void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
76void cluster_broadcast(struct sk_buff *buf); 76void tipc_cltr_broadcast(struct sk_buff *buf);
77int cluster_init(void); 77int tipc_cltr_init(void);
78u32 cluster_next_node(struct cluster *c_ptr, u32 addr); 78u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
79void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); 79void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
80void cluster_send_local_routes(struct cluster *c_ptr, u32 dest); 80void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
81void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); 81void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
82 82
83static inline struct cluster *cluster_find(u32 addr) 83static inline struct cluster *tipc_cltr_find(u32 addr)
84{ 84{
85 struct _zone *z_ptr = zone_find(addr); 85 struct _zone *z_ptr = tipc_zone_find(addr);
86 86
87 if (z_ptr) 87 if (z_ptr)
88 return z_ptr->clusters[1]; 88 return z_ptr->clusters[1];
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 8ddef4fce2c2..3c8e6740e5ae 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -70,13 +70,13 @@ static int req_tlv_space; /* request message TLV area size */
70static int rep_headroom; /* reply message headroom to use */ 70static int rep_headroom; /* reply message headroom to use */
71 71
72 72
73void cfg_link_event(u32 addr, char *name, int up) 73void tipc_cfg_link_event(u32 addr, char *name, int up)
74{ 74{
75 /* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */ 75 /* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */
76} 76}
77 77
78 78
79struct sk_buff *cfg_reply_alloc(int payload_size) 79struct sk_buff *tipc_cfg_reply_alloc(int payload_size)
80{ 80{
81 struct sk_buff *buf; 81 struct sk_buff *buf;
82 82
@@ -86,14 +86,14 @@ struct sk_buff *cfg_reply_alloc(int payload_size)
86 return buf; 86 return buf;
87} 87}
88 88
89int cfg_append_tlv(struct sk_buff *buf, int tlv_type, 89int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
90 void *tlv_data, int tlv_data_size) 90 void *tlv_data, int tlv_data_size)
91{ 91{
92 struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; 92 struct tlv_desc *tlv = (struct tlv_desc *)buf->tail;
93 int new_tlv_space = TLV_SPACE(tlv_data_size); 93 int new_tlv_space = TLV_SPACE(tlv_data_size);
94 94
95 if (skb_tailroom(buf) < new_tlv_space) { 95 if (skb_tailroom(buf) < new_tlv_space) {
96 dbg("cfg_append_tlv unable to append TLV\n"); 96 dbg("tipc_cfg_append_tlv unable to append TLV\n");
97 return 0; 97 return 0;
98 } 98 }
99 skb_put(buf, new_tlv_space); 99 skb_put(buf, new_tlv_space);
@@ -104,28 +104,28 @@ int cfg_append_tlv(struct sk_buff *buf, int tlv_type,
104 return 1; 104 return 1;
105} 105}
106 106
107struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value) 107struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
108{ 108{
109 struct sk_buff *buf; 109 struct sk_buff *buf;
110 u32 value_net; 110 u32 value_net;
111 111
112 buf = cfg_reply_alloc(TLV_SPACE(sizeof(value))); 112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value)));
113 if (buf) { 113 if (buf) {
114 value_net = htonl(value); 114 value_net = htonl(value);
115 cfg_append_tlv(buf, tlv_type, &value_net, 115 tipc_cfg_append_tlv(buf, tlv_type, &value_net,
116 sizeof(value_net)); 116 sizeof(value_net));
117 } 117 }
118 return buf; 118 return buf;
119} 119}
120 120
121struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string) 121struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
122{ 122{
123 struct sk_buff *buf; 123 struct sk_buff *buf;
124 int string_len = strlen(string) + 1; 124 int string_len = strlen(string) + 1;
125 125
126 buf = cfg_reply_alloc(TLV_SPACE(string_len)); 126 buf = tipc_cfg_reply_alloc(TLV_SPACE(string_len));
127 if (buf) 127 if (buf)
128 cfg_append_tlv(buf, tlv_type, string, string_len); 128 tipc_cfg_append_tlv(buf, tlv_type, string, string_len);
129 return buf; 129 return buf;
130} 130}
131 131
@@ -246,7 +246,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg,
246 exit: 246 exit:
247 rmsg.result_len = htonl(msg_sect[1].iov_len); 247 rmsg.result_len = htonl(msg_sect[1].iov_len);
248 rmsg.retval = htonl(rv); 248 rmsg.retval = htonl(rv);
249 cfg_respond(msg_sect, 2u, orig); 249 tipc_cfg_respond(msg_sect, 2u, orig);
250} 250}
251#endif 251#endif
252 252
@@ -255,26 +255,26 @@ static struct sk_buff *cfg_enable_bearer(void)
255 struct tipc_bearer_config *args; 255 struct tipc_bearer_config *args;
256 256
257 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_CONFIG)) 257 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_CONFIG))
258 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 258 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
259 259
260 args = (struct tipc_bearer_config *)TLV_DATA(req_tlv_area); 260 args = (struct tipc_bearer_config *)TLV_DATA(req_tlv_area);
261 if (tipc_enable_bearer(args->name, 261 if (tipc_enable_bearer(args->name,
262 ntohl(args->detect_scope), 262 ntohl(args->detect_scope),
263 ntohl(args->priority))) 263 ntohl(args->priority)))
264 return cfg_reply_error_string("unable to enable bearer"); 264 return tipc_cfg_reply_error_string("unable to enable bearer");
265 265
266 return cfg_reply_none(); 266 return tipc_cfg_reply_none();
267} 267}
268 268
269static struct sk_buff *cfg_disable_bearer(void) 269static struct sk_buff *cfg_disable_bearer(void)
270{ 270{
271 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME)) 271 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME))
272 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 272 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
273 273
274 if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area))) 274 if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area)))
275 return cfg_reply_error_string("unable to disable bearer"); 275 return tipc_cfg_reply_error_string("unable to disable bearer");
276 276
277 return cfg_reply_none(); 277 return tipc_cfg_reply_none();
278} 278}
279 279
280static struct sk_buff *cfg_set_own_addr(void) 280static struct sk_buff *cfg_set_own_addr(void)
@@ -282,25 +282,25 @@ static struct sk_buff *cfg_set_own_addr(void)
282 u32 addr; 282 u32 addr;
283 283
284 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 284 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
285 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 285 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
286 286
287 addr = *(u32 *)TLV_DATA(req_tlv_area); 287 addr = *(u32 *)TLV_DATA(req_tlv_area);
288 addr = ntohl(addr); 288 addr = ntohl(addr);
289 if (addr == tipc_own_addr) 289 if (addr == tipc_own_addr)
290 return cfg_reply_none(); 290 return tipc_cfg_reply_none();
291 if (!addr_node_valid(addr)) 291 if (!tipc_addr_node_valid(addr))
292 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 292 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
293 " (node address)"); 293 " (node address)");
294 if (tipc_own_addr) 294 if (tipc_own_addr)
295 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 295 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
296 " (cannot change node address once assigned)"); 296 " (cannot change node address once assigned)");
297 297
298 spin_unlock_bh(&config_lock); 298 spin_unlock_bh(&config_lock);
299 stop_net(); 299 tipc_core_stop_net();
300 tipc_own_addr = addr; 300 tipc_own_addr = addr;
301 start_net(); 301 tipc_core_start_net();
302 spin_lock_bh(&config_lock); 302 spin_lock_bh(&config_lock);
303 return cfg_reply_none(); 303 return tipc_cfg_reply_none();
304} 304}
305 305
306static struct sk_buff *cfg_set_remote_mng(void) 306static struct sk_buff *cfg_set_remote_mng(void)
@@ -308,12 +308,12 @@ static struct sk_buff *cfg_set_remote_mng(void)
308 u32 value; 308 u32 value;
309 309
310 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 310 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
311 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 311 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
312 312
313 value = *(u32 *)TLV_DATA(req_tlv_area); 313 value = *(u32 *)TLV_DATA(req_tlv_area);
314 value = ntohl(value); 314 value = ntohl(value);
315 tipc_remote_management = (value != 0); 315 tipc_remote_management = (value != 0);
316 return cfg_reply_none(); 316 return tipc_cfg_reply_none();
317} 317}
318 318
319static struct sk_buff *cfg_set_max_publications(void) 319static struct sk_buff *cfg_set_max_publications(void)
@@ -321,15 +321,15 @@ static struct sk_buff *cfg_set_max_publications(void)
321 u32 value; 321 u32 value;
322 322
323 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 323 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
324 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 324 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
325 325
326 value = *(u32 *)TLV_DATA(req_tlv_area); 326 value = *(u32 *)TLV_DATA(req_tlv_area);
327 value = ntohl(value); 327 value = ntohl(value);
328 if (value != delimit(value, 1, 65535)) 328 if (value != delimit(value, 1, 65535))
329 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 329 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
330 " (max publications must be 1-65535)"); 330 " (max publications must be 1-65535)");
331 tipc_max_publications = value; 331 tipc_max_publications = value;
332 return cfg_reply_none(); 332 return tipc_cfg_reply_none();
333} 333}
334 334
335static struct sk_buff *cfg_set_max_subscriptions(void) 335static struct sk_buff *cfg_set_max_subscriptions(void)
@@ -337,15 +337,15 @@ static struct sk_buff *cfg_set_max_subscriptions(void)
337 u32 value; 337 u32 value;
338 338
339 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 339 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
340 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 340 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
341 341
342 value = *(u32 *)TLV_DATA(req_tlv_area); 342 value = *(u32 *)TLV_DATA(req_tlv_area);
343 value = ntohl(value); 343 value = ntohl(value);
344 if (value != delimit(value, 1, 65535)) 344 if (value != delimit(value, 1, 65535))
345 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 345 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
346 " (max subscriptions must be 1-65535"); 346 " (max subscriptions must be 1-65535");
347 tipc_max_subscriptions = value; 347 tipc_max_subscriptions = value;
348 return cfg_reply_none(); 348 return tipc_cfg_reply_none();
349} 349}
350 350
351static struct sk_buff *cfg_set_max_ports(void) 351static struct sk_buff *cfg_set_max_ports(void)
@@ -354,31 +354,31 @@ static struct sk_buff *cfg_set_max_ports(void)
354 u32 value; 354 u32 value;
355 355
356 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 356 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
357 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 357 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
358 value = *(u32 *)TLV_DATA(req_tlv_area); 358 value = *(u32 *)TLV_DATA(req_tlv_area);
359 value = ntohl(value); 359 value = ntohl(value);
360 if (value != delimit(value, 127, 65535)) 360 if (value != delimit(value, 127, 65535))
361 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 361 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
362 " (max ports must be 127-65535)"); 362 " (max ports must be 127-65535)");
363 363
364 if (value == tipc_max_ports) 364 if (value == tipc_max_ports)
365 return cfg_reply_none(); 365 return tipc_cfg_reply_none();
366 366
367 if (atomic_read(&tipc_user_count) > 2) 367 if (atomic_read(&tipc_user_count) > 2)
368 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 368 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
369 " (cannot change max ports while TIPC users exist)"); 369 " (cannot change max ports while TIPC users exist)");
370 370
371 spin_unlock_bh(&config_lock); 371 spin_unlock_bh(&config_lock);
372 orig_mode = tipc_get_mode(); 372 orig_mode = tipc_get_mode();
373 if (orig_mode == TIPC_NET_MODE) 373 if (orig_mode == TIPC_NET_MODE)
374 stop_net(); 374 tipc_core_stop_net();
375 stop_core(); 375 tipc_core_stop();
376 tipc_max_ports = value; 376 tipc_max_ports = value;
377 start_core(); 377 tipc_core_start();
378 if (orig_mode == TIPC_NET_MODE) 378 if (orig_mode == TIPC_NET_MODE)
379 start_net(); 379 tipc_core_start_net();
380 spin_lock_bh(&config_lock); 380 spin_lock_bh(&config_lock);
381 return cfg_reply_none(); 381 return tipc_cfg_reply_none();
382} 382}
383 383
384static struct sk_buff *set_net_max(int value, int *parameter) 384static struct sk_buff *set_net_max(int value, int *parameter)
@@ -388,13 +388,13 @@ static struct sk_buff *set_net_max(int value, int *parameter)
388 if (value != *parameter) { 388 if (value != *parameter) {
389 orig_mode = tipc_get_mode(); 389 orig_mode = tipc_get_mode();
390 if (orig_mode == TIPC_NET_MODE) 390 if (orig_mode == TIPC_NET_MODE)
391 stop_net(); 391 tipc_core_stop_net();
392 *parameter = value; 392 *parameter = value;
393 if (orig_mode == TIPC_NET_MODE) 393 if (orig_mode == TIPC_NET_MODE)
394 start_net(); 394 tipc_core_start_net();
395 } 395 }
396 396
397 return cfg_reply_none(); 397 return tipc_cfg_reply_none();
398} 398}
399 399
400static struct sk_buff *cfg_set_max_zones(void) 400static struct sk_buff *cfg_set_max_zones(void)
@@ -402,12 +402,12 @@ static struct sk_buff *cfg_set_max_zones(void)
402 u32 value; 402 u32 value;
403 403
404 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 404 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
405 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 405 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
406 value = *(u32 *)TLV_DATA(req_tlv_area); 406 value = *(u32 *)TLV_DATA(req_tlv_area);
407 value = ntohl(value); 407 value = ntohl(value);
408 if (value != delimit(value, 1, 255)) 408 if (value != delimit(value, 1, 255))
409 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 409 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
410 " (max zones must be 1-255)"); 410 " (max zones must be 1-255)");
411 return set_net_max(value, &tipc_max_zones); 411 return set_net_max(value, &tipc_max_zones);
412} 412}
413 413
@@ -416,13 +416,13 @@ static struct sk_buff *cfg_set_max_clusters(void)
416 u32 value; 416 u32 value;
417 417
418 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 418 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
419 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 419 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
420 value = *(u32 *)TLV_DATA(req_tlv_area); 420 value = *(u32 *)TLV_DATA(req_tlv_area);
421 value = ntohl(value); 421 value = ntohl(value);
422 if (value != 1) 422 if (value != 1)
423 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 423 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
424 " (max clusters fixed at 1)"); 424 " (max clusters fixed at 1)");
425 return cfg_reply_none(); 425 return tipc_cfg_reply_none();
426} 426}
427 427
428static struct sk_buff *cfg_set_max_nodes(void) 428static struct sk_buff *cfg_set_max_nodes(void)
@@ -430,12 +430,12 @@ static struct sk_buff *cfg_set_max_nodes(void)
430 u32 value; 430 u32 value;
431 431
432 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 432 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
433 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 433 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
434 value = *(u32 *)TLV_DATA(req_tlv_area); 434 value = *(u32 *)TLV_DATA(req_tlv_area);
435 value = ntohl(value); 435 value = ntohl(value);
436 if (value != delimit(value, 8, 2047)) 436 if (value != delimit(value, 8, 2047))
437 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 437 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
438 " (max nodes must be 8-2047)"); 438 " (max nodes must be 8-2047)");
439 return set_net_max(value, &tipc_max_nodes); 439 return set_net_max(value, &tipc_max_nodes);
440} 440}
441 441
@@ -444,13 +444,13 @@ static struct sk_buff *cfg_set_max_slaves(void)
444 u32 value; 444 u32 value;
445 445
446 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 446 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
447 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 447 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
448 value = *(u32 *)TLV_DATA(req_tlv_area); 448 value = *(u32 *)TLV_DATA(req_tlv_area);
449 value = ntohl(value); 449 value = ntohl(value);
450 if (value != 0) 450 if (value != 0)
451 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 451 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
452 " (max secondary nodes fixed at 0)"); 452 " (max secondary nodes fixed at 0)");
453 return cfg_reply_none(); 453 return tipc_cfg_reply_none();
454} 454}
455 455
456static struct sk_buff *cfg_set_netid(void) 456static struct sk_buff *cfg_set_netid(void)
@@ -458,22 +458,22 @@ static struct sk_buff *cfg_set_netid(void)
458 u32 value; 458 u32 value;
459 459
460 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 460 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
461 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 461 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
462 value = *(u32 *)TLV_DATA(req_tlv_area); 462 value = *(u32 *)TLV_DATA(req_tlv_area);
463 value = ntohl(value); 463 value = ntohl(value);
464 if (value != delimit(value, 1, 9999)) 464 if (value != delimit(value, 1, 9999))
465 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 465 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
466 " (network id must be 1-9999)"); 466 " (network id must be 1-9999)");
467 467
468 if (tipc_own_addr) 468 if (tipc_own_addr)
469 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 469 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
470 " (cannot change network id once part of network)"); 470 " (cannot change network id once part of network)");
471 471
472 return set_net_max(value, &tipc_net_id); 472 return set_net_max(value, &tipc_net_id);
473} 473}
474 474
475struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, 475struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
476 int request_space, int reply_headroom) 476 int request_space, int reply_headroom)
477{ 477{
478 struct sk_buff *rep_tlv_buf; 478 struct sk_buff *rep_tlv_buf;
479 479
@@ -490,19 +490,19 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
490 if (likely(orig_node == tipc_own_addr)) { 490 if (likely(orig_node == tipc_own_addr)) {
491 /* command is permitted */ 491 /* command is permitted */
492 } else if (cmd >= 0x8000) { 492 } else if (cmd >= 0x8000) {
493 rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 493 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
494 " (cannot be done remotely)"); 494 " (cannot be done remotely)");
495 goto exit; 495 goto exit;
496 } else if (!tipc_remote_management) { 496 } else if (!tipc_remote_management) {
497 rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NO_REMOTE); 497 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NO_REMOTE);
498 goto exit; 498 goto exit;
499 } 499 }
500 else if (cmd >= 0x4000) { 500 else if (cmd >= 0x4000) {
501 u32 domain = 0; 501 u32 domain = 0;
502 502
503 if ((nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) || 503 if ((tipc_nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) ||
504 (domain != orig_node)) { 504 (domain != orig_node)) {
505 rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR); 505 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR);
506 goto exit; 506 goto exit;
507 } 507 }
508 } 508 }
@@ -511,50 +511,50 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
511 511
512 switch (cmd) { 512 switch (cmd) {
513 case TIPC_CMD_NOOP: 513 case TIPC_CMD_NOOP:
514 rep_tlv_buf = cfg_reply_none(); 514 rep_tlv_buf = tipc_cfg_reply_none();
515 break; 515 break;
516 case TIPC_CMD_GET_NODES: 516 case TIPC_CMD_GET_NODES:
517 rep_tlv_buf = node_get_nodes(req_tlv_area, req_tlv_space); 517 rep_tlv_buf = tipc_node_get_nodes(req_tlv_area, req_tlv_space);
518 break; 518 break;
519 case TIPC_CMD_GET_LINKS: 519 case TIPC_CMD_GET_LINKS:
520 rep_tlv_buf = node_get_links(req_tlv_area, req_tlv_space); 520 rep_tlv_buf = tipc_node_get_links(req_tlv_area, req_tlv_space);
521 break; 521 break;
522 case TIPC_CMD_SHOW_LINK_STATS: 522 case TIPC_CMD_SHOW_LINK_STATS:
523 rep_tlv_buf = link_cmd_show_stats(req_tlv_area, req_tlv_space); 523 rep_tlv_buf = tipc_link_cmd_show_stats(req_tlv_area, req_tlv_space);
524 break; 524 break;
525 case TIPC_CMD_RESET_LINK_STATS: 525 case TIPC_CMD_RESET_LINK_STATS:
526 rep_tlv_buf = link_cmd_reset_stats(req_tlv_area, req_tlv_space); 526 rep_tlv_buf = tipc_link_cmd_reset_stats(req_tlv_area, req_tlv_space);
527 break; 527 break;
528 case TIPC_CMD_SHOW_NAME_TABLE: 528 case TIPC_CMD_SHOW_NAME_TABLE:
529 rep_tlv_buf = nametbl_get(req_tlv_area, req_tlv_space); 529 rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space);
530 break; 530 break;
531 case TIPC_CMD_GET_BEARER_NAMES: 531 case TIPC_CMD_GET_BEARER_NAMES:
532 rep_tlv_buf = bearer_get_names(); 532 rep_tlv_buf = tipc_bearer_get_names();
533 break; 533 break;
534 case TIPC_CMD_GET_MEDIA_NAMES: 534 case TIPC_CMD_GET_MEDIA_NAMES:
535 rep_tlv_buf = media_get_names(); 535 rep_tlv_buf = tipc_media_get_names();
536 break; 536 break;
537 case TIPC_CMD_SHOW_PORTS: 537 case TIPC_CMD_SHOW_PORTS:
538 rep_tlv_buf = port_get_ports(); 538 rep_tlv_buf = tipc_port_get_ports();
539 break; 539 break;
540#if 0 540#if 0
541 case TIPC_CMD_SHOW_PORT_STATS: 541 case TIPC_CMD_SHOW_PORT_STATS:
542 rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space); 542 rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space);
543 break; 543 break;
544 case TIPC_CMD_RESET_PORT_STATS: 544 case TIPC_CMD_RESET_PORT_STATS:
545 rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED); 545 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED);
546 break; 546 break;
547#endif 547#endif
548 case TIPC_CMD_SET_LOG_SIZE: 548 case TIPC_CMD_SET_LOG_SIZE:
549 rep_tlv_buf = log_resize(req_tlv_area, req_tlv_space); 549 rep_tlv_buf = tipc_log_resize(req_tlv_area, req_tlv_space);
550 break; 550 break;
551 case TIPC_CMD_DUMP_LOG: 551 case TIPC_CMD_DUMP_LOG:
552 rep_tlv_buf = log_dump(); 552 rep_tlv_buf = tipc_log_dump();
553 break; 553 break;
554 case TIPC_CMD_SET_LINK_TOL: 554 case TIPC_CMD_SET_LINK_TOL:
555 case TIPC_CMD_SET_LINK_PRI: 555 case TIPC_CMD_SET_LINK_PRI:
556 case TIPC_CMD_SET_LINK_WINDOW: 556 case TIPC_CMD_SET_LINK_WINDOW:
557 rep_tlv_buf = link_cmd_config(req_tlv_area, req_tlv_space, cmd); 557 rep_tlv_buf = tipc_link_cmd_config(req_tlv_area, req_tlv_space, cmd);
558 break; 558 break;
559 case TIPC_CMD_ENABLE_BEARER: 559 case TIPC_CMD_ENABLE_BEARER:
560 rep_tlv_buf = cfg_enable_bearer(); 560 rep_tlv_buf = cfg_enable_bearer();
@@ -593,31 +593,31 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
593 rep_tlv_buf = cfg_set_netid(); 593 rep_tlv_buf = cfg_set_netid();
594 break; 594 break;
595 case TIPC_CMD_GET_REMOTE_MNG: 595 case TIPC_CMD_GET_REMOTE_MNG:
596 rep_tlv_buf = cfg_reply_unsigned(tipc_remote_management); 596 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_remote_management);
597 break; 597 break;
598 case TIPC_CMD_GET_MAX_PORTS: 598 case TIPC_CMD_GET_MAX_PORTS:
599 rep_tlv_buf = cfg_reply_unsigned(tipc_max_ports); 599 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_ports);
600 break; 600 break;
601 case TIPC_CMD_GET_MAX_PUBL: 601 case TIPC_CMD_GET_MAX_PUBL:
602 rep_tlv_buf = cfg_reply_unsigned(tipc_max_publications); 602 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_publications);
603 break; 603 break;
604 case TIPC_CMD_GET_MAX_SUBSCR: 604 case TIPC_CMD_GET_MAX_SUBSCR:
605 rep_tlv_buf = cfg_reply_unsigned(tipc_max_subscriptions); 605 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions);
606 break; 606 break;
607 case TIPC_CMD_GET_MAX_ZONES: 607 case TIPC_CMD_GET_MAX_ZONES:
608 rep_tlv_buf = cfg_reply_unsigned(tipc_max_zones); 608 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_zones);
609 break; 609 break;
610 case TIPC_CMD_GET_MAX_CLUSTERS: 610 case TIPC_CMD_GET_MAX_CLUSTERS:
611 rep_tlv_buf = cfg_reply_unsigned(tipc_max_clusters); 611 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters);
612 break; 612 break;
613 case TIPC_CMD_GET_MAX_NODES: 613 case TIPC_CMD_GET_MAX_NODES:
614 rep_tlv_buf = cfg_reply_unsigned(tipc_max_nodes); 614 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes);
615 break; 615 break;
616 case TIPC_CMD_GET_MAX_SLAVES: 616 case TIPC_CMD_GET_MAX_SLAVES:
617 rep_tlv_buf = cfg_reply_unsigned(tipc_max_slaves); 617 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_slaves);
618 break; 618 break;
619 case TIPC_CMD_GET_NETID: 619 case TIPC_CMD_GET_NETID:
620 rep_tlv_buf = cfg_reply_unsigned(tipc_net_id); 620 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id);
621 break; 621 break;
622 default: 622 default:
623 rep_tlv_buf = NULL; 623 rep_tlv_buf = NULL;
@@ -655,11 +655,11 @@ static void cfg_named_msg_event(void *userdata,
655 655
656 /* Generate reply for request (if can't, return request) */ 656 /* Generate reply for request (if can't, return request) */
657 657
658 rep_buf = cfg_do_cmd(orig->node, 658 rep_buf = tipc_cfg_do_cmd(orig->node,
659 ntohs(req_hdr->tcm_type), 659 ntohs(req_hdr->tcm_type),
660 msg + sizeof(*req_hdr), 660 msg + sizeof(*req_hdr),
661 size - sizeof(*req_hdr), 661 size - sizeof(*req_hdr),
662 BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); 662 BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr));
663 if (rep_buf) { 663 if (rep_buf) {
664 skb_push(rep_buf, sizeof(*rep_hdr)); 664 skb_push(rep_buf, sizeof(*rep_hdr));
665 rep_hdr = (struct tipc_cfg_msg_hdr *)rep_buf->data; 665 rep_hdr = (struct tipc_cfg_msg_hdr *)rep_buf->data;
@@ -675,7 +675,7 @@ static void cfg_named_msg_event(void *userdata,
675 tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len); 675 tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len);
676} 676}
677 677
678int cfg_init(void) 678int tipc_cfg_init(void)
679{ 679{
680 struct tipc_name_seq seq; 680 struct tipc_name_seq seq;
681 int res; 681 int res;
@@ -696,7 +696,7 @@ int cfg_init(void)
696 696
697 seq.type = TIPC_CFG_SRV; 697 seq.type = TIPC_CFG_SRV;
698 seq.lower = seq.upper = tipc_own_addr; 698 seq.lower = seq.upper = tipc_own_addr;
699 res = nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq); 699 res = tipc_nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq);
700 if (res) 700 if (res)
701 goto failed; 701 goto failed;
702 702
@@ -709,7 +709,7 @@ failed:
709 return res; 709 return res;
710} 710}
711 711
712void cfg_stop(void) 712void tipc_cfg_stop(void)
713{ 713{
714 if (mng.user_ref) { 714 if (mng.user_ref) {
715 tipc_detach(mng.user_ref); 715 tipc_detach(mng.user_ref);
diff --git a/net/tipc/config.h b/net/tipc/config.h
index 646377d40454..7a728f954d84 100644
--- a/net/tipc/config.h
+++ b/net/tipc/config.h
@@ -39,42 +39,41 @@
39 39
40/* ---------------------------------------------------------------------- */ 40/* ---------------------------------------------------------------------- */
41 41
42#include <linux/tipc.h> 42#include "core.h"
43#include <linux/tipc_config.h>
44#include "link.h" 43#include "link.h"
45 44
46struct sk_buff *cfg_reply_alloc(int payload_size); 45struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
47int cfg_append_tlv(struct sk_buff *buf, int tlv_type, 46int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
48 void *tlv_data, int tlv_data_size); 47 void *tlv_data, int tlv_data_size);
49struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value); 48struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
50struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string); 49struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
51 50
52static inline struct sk_buff *cfg_reply_none(void) 51static inline struct sk_buff *tipc_cfg_reply_none(void)
53{ 52{
54 return cfg_reply_alloc(0); 53 return tipc_cfg_reply_alloc(0);
55} 54}
56 55
57static inline struct sk_buff *cfg_reply_unsigned(u32 value) 56static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
58{ 57{
59 return cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value); 58 return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
60} 59}
61 60
62static inline struct sk_buff *cfg_reply_error_string(char *string) 61static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
63{ 62{
64 return cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); 63 return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
65} 64}
66 65
67static inline struct sk_buff *cfg_reply_ultra_string(char *string) 66static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string)
68{ 67{
69 return cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); 68 return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string);
70} 69}
71 70
72struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, 71struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd,
73 const void *req_tlv_area, int req_tlv_space, 72 const void *req_tlv_area, int req_tlv_space,
74 int headroom); 73 int headroom);
75 74
76void cfg_link_event(u32 addr, char *name, int up); 75void tipc_cfg_link_event(u32 addr, char *name, int up);
77int cfg_init(void); 76int tipc_cfg_init(void);
78void cfg_stop(void); 77void tipc_cfg_stop(void);
79 78
80#endif 79#endif
diff --git a/net/tipc/core.c b/net/tipc/core.c
index e83ac06e31ba..3d0a8ee4e1d3 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -37,7 +37,6 @@
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/version.h>
41#include <linux/random.h> 40#include <linux/random.h>
42 41
43#include "core.h" 42#include "core.h"
@@ -49,14 +48,14 @@
49#include "subscr.h" 48#include "subscr.h"
50#include "config.h" 49#include "config.h"
51 50
52int eth_media_start(void); 51int tipc_eth_media_start(void);
53void eth_media_stop(void); 52void tipc_eth_media_stop(void);
54int handler_start(void); 53int tipc_handler_start(void);
55void handler_stop(void); 54void tipc_handler_stop(void);
56int socket_init(void); 55int tipc_socket_init(void);
57void socket_stop(void); 56void tipc_socket_stop(void);
58int netlink_start(void); 57int tipc_netlink_start(void);
59void netlink_stop(void); 58void tipc_netlink_stop(void);
60 59
61#define MOD_NAME "tipc_start: " 60#define MOD_NAME "tipc_start: "
62 61
@@ -113,56 +112,56 @@ int tipc_get_mode(void)
113} 112}
114 113
115/** 114/**
116 * stop_net - shut down TIPC networking sub-systems 115 * tipc_core_stop_net - shut down TIPC networking sub-systems
117 */ 116 */
118 117
119void stop_net(void) 118void tipc_core_stop_net(void)
120{ 119{
121 eth_media_stop(); 120 tipc_eth_media_stop();
122 tipc_stop_net(); 121 tipc_net_stop();
123} 122}
124 123
125/** 124/**
126 * start_net - start TIPC networking sub-systems 125 * start_net - start TIPC networking sub-systems
127 */ 126 */
128 127
129int start_net(void) 128int tipc_core_start_net(void)
130{ 129{
131 int res; 130 int res;
132 131
133 if ((res = tipc_start_net()) || 132 if ((res = tipc_net_start()) ||
134 (res = eth_media_start())) { 133 (res = tipc_eth_media_start())) {
135 stop_net(); 134 tipc_core_stop_net();
136 } 135 }
137 return res; 136 return res;
138} 137}
139 138
140/** 139/**
141 * stop_core - switch TIPC from SINGLE NODE to NOT RUNNING mode 140 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
142 */ 141 */
143 142
144void stop_core(void) 143void tipc_core_stop(void)
145{ 144{
146 if (tipc_mode != TIPC_NODE_MODE) 145 if (tipc_mode != TIPC_NODE_MODE)
147 return; 146 return;
148 147
149 tipc_mode = TIPC_NOT_RUNNING; 148 tipc_mode = TIPC_NOT_RUNNING;
150 149
151 netlink_stop(); 150 tipc_netlink_stop();
152 handler_stop(); 151 tipc_handler_stop();
153 cfg_stop(); 152 tipc_cfg_stop();
154 subscr_stop(); 153 tipc_subscr_stop();
155 reg_stop(); 154 tipc_reg_stop();
156 nametbl_stop(); 155 tipc_nametbl_stop();
157 ref_table_stop(); 156 tipc_ref_table_stop();
158 socket_stop(); 157 tipc_socket_stop();
159} 158}
160 159
161/** 160/**
162 * start_core - switch TIPC from NOT RUNNING to SINGLE NODE mode 161 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
163 */ 162 */
164 163
165int start_core(void) 164int tipc_core_start(void)
166{ 165{
167 int res; 166 int res;
168 167
@@ -172,16 +171,16 @@ int start_core(void)
172 get_random_bytes(&tipc_random, sizeof(tipc_random)); 171 get_random_bytes(&tipc_random, sizeof(tipc_random));
173 tipc_mode = TIPC_NODE_MODE; 172 tipc_mode = TIPC_NODE_MODE;
174 173
175 if ((res = handler_start()) || 174 if ((res = tipc_handler_start()) ||
176 (res = ref_table_init(tipc_max_ports + tipc_max_subscriptions, 175 (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions,
177 tipc_random)) || 176 tipc_random)) ||
178 (res = reg_start()) || 177 (res = tipc_reg_start()) ||
179 (res = nametbl_init()) || 178 (res = tipc_nametbl_init()) ||
180 (res = k_signal((Handler)subscr_start, 0)) || 179 (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
181 (res = k_signal((Handler)cfg_init, 0)) || 180 (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) ||
182 (res = netlink_start()) || 181 (res = tipc_netlink_start()) ||
183 (res = socket_init())) { 182 (res = tipc_socket_init())) {
184 stop_core(); 183 tipc_core_stop();
185 } 184 }
186 return res; 185 return res;
187} 186}
@@ -191,7 +190,7 @@ static int __init tipc_init(void)
191{ 190{
192 int res; 191 int res;
193 192
194 log_reinit(CONFIG_TIPC_LOG); 193 tipc_log_reinit(CONFIG_TIPC_LOG);
195 info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); 194 info("Activated (compiled " __DATE__ " " __TIME__ ")\n");
196 195
197 tipc_own_addr = 0; 196 tipc_own_addr = 0;
@@ -205,7 +204,7 @@ static int __init tipc_init(void)
205 tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); 204 tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047);
206 tipc_net_id = 4711; 205 tipc_net_id = 4711;
207 206
208 if ((res = start_core())) 207 if ((res = tipc_core_start()))
209 err("Unable to start in single node mode\n"); 208 err("Unable to start in single node mode\n");
210 else 209 else
211 info("Started in single node mode\n"); 210 info("Started in single node mode\n");
@@ -214,10 +213,10 @@ static int __init tipc_init(void)
214 213
215static void __exit tipc_exit(void) 214static void __exit tipc_exit(void)
216{ 215{
217 stop_net(); 216 tipc_core_stop_net();
218 stop_core(); 217 tipc_core_stop();
219 info("Deactivated\n"); 218 info("Deactivated\n");
220 log_stop(); 219 tipc_log_stop();
221} 220}
222 221
223module_init(tipc_init); 222module_init(tipc_init);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index b69b60b2cc86..1f2e8b27a13f 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -37,6 +37,11 @@
37#ifndef _TIPC_CORE_H 37#ifndef _TIPC_CORE_H
38#define _TIPC_CORE_H 38#define _TIPC_CORE_H
39 39
40#include <linux/tipc.h>
41#include <linux/tipc_config.h>
42#include <net/tipc/tipc_msg.h>
43#include <net/tipc/tipc_port.h>
44#include <net/tipc/tipc_bearer.h>
40#include <net/tipc/tipc.h> 45#include <net/tipc/tipc.h>
41#include <linux/types.h> 46#include <linux/types.h>
42#include <linux/kernel.h> 47#include <linux/kernel.h>
@@ -60,9 +65,9 @@
60#define assert(i) BUG_ON(!(i)) 65#define assert(i) BUG_ON(!(i))
61 66
62struct tipc_msg; 67struct tipc_msg;
63extern struct print_buf *CONS, *LOG; 68extern struct print_buf *TIPC_CONS, *TIPC_LOG;
64extern struct print_buf *TEE(struct print_buf *, struct print_buf *); 69extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *);
65void msg_print(struct print_buf*,struct tipc_msg *,const char*); 70void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
66void tipc_printf(struct print_buf *, const char *fmt, ...); 71void tipc_printf(struct print_buf *, const char *fmt, ...);
67void tipc_dump(struct print_buf*,const char *fmt, ...); 72void tipc_dump(struct print_buf*,const char *fmt, ...);
68 73
@@ -79,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
79#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) 84#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
80 85
81#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) 86#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
82#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) msg_print(DBG_OUTPUT, msg, txt);} while(0) 87#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
83#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) 88#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
84 89
85 90
@@ -89,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
89 * here, or on a per .c file basis, by redefining these symbols. The following 94 * here, or on a per .c file basis, by redefining these symbols. The following
90 * print buffer options are available: 95 * print buffer options are available:
91 * 96 *
92 * NULL : Output to null print buffer (i.e. print nowhere) 97 * NULL : Output to null print buffer (i.e. print nowhere)
93 * CONS : Output to system console 98 * TIPC_CONS : Output to system console
94 * LOG : Output to TIPC log buffer 99 * TIPC_LOG : Output to TIPC log buffer
95 * &buf : Output to user-defined buffer (struct print_buf *) 100 * &buf : Output to user-defined buffer (struct print_buf *)
96 * TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TEE(CONS,LOG) ) 101 * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) )
97 */ 102 */
98 103
99#ifndef TIPC_OUTPUT 104#ifndef TIPC_OUTPUT
100#define TIPC_OUTPUT TEE(CONS,LOG) 105#define TIPC_OUTPUT TIPC_TEE(TIPC_CONS,TIPC_LOG)
101#endif 106#endif
102 107
103#ifndef DBG_OUTPUT 108#ifndef DBG_OUTPUT
@@ -162,10 +167,10 @@ extern atomic_t tipc_user_count;
162 * Routines available to privileged subsystems 167 * Routines available to privileged subsystems
163 */ 168 */
164 169
165extern int start_core(void); 170extern int tipc_core_start(void);
166extern void stop_core(void); 171extern void tipc_core_stop(void);
167extern int start_net(void); 172extern int tipc_core_start_net(void);
168extern void stop_net(void); 173extern void tipc_core_stop_net(void);
169 174
170static inline int delimit(int val, int min, int max) 175static inline int delimit(int val, int min, int max)
171{ 176{
@@ -183,7 +188,7 @@ static inline int delimit(int val, int min, int max)
183 188
184typedef void (*Handler) (unsigned long); 189typedef void (*Handler) (unsigned long);
185 190
186u32 k_signal(Handler routine, unsigned long argument); 191u32 tipc_k_signal(Handler routine, unsigned long argument);
187 192
188/** 193/**
189 * k_init_timer - initialize a timer 194 * k_init_timer - initialize a timer
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 7ed60a1cfbb8..4f4beefa7830 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -44,10 +44,10 @@ static char print_string[MAX_STRING];
44static spinlock_t print_lock = SPIN_LOCK_UNLOCKED; 44static spinlock_t print_lock = SPIN_LOCK_UNLOCKED;
45 45
46static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; 46static struct print_buf cons_buf = { NULL, 0, NULL, NULL };
47struct print_buf *CONS = &cons_buf; 47struct print_buf *TIPC_CONS = &cons_buf;
48 48
49static struct print_buf log_buf = { NULL, 0, NULL, NULL }; 49static struct print_buf log_buf = { NULL, 0, NULL, NULL };
50struct print_buf *LOG = &log_buf; 50struct print_buf *TIPC_LOG = &log_buf;
51 51
52 52
53#define FORMAT(PTR,LEN,FMT) \ 53#define FORMAT(PTR,LEN,FMT) \
@@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf;
66 * simultaneous use of the print buffer(s) being manipulated. 66 * simultaneous use of the print buffer(s) being manipulated.
67 * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of 67 * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of
68 * 'print_string' and to protect its print buffer(s). 68 * 'print_string' and to protect its print buffer(s).
69 * 3) TEE() uses 'print_lock' to protect its print buffer(s). 69 * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s).
70 * 4) Routines of the form log_XXX() uses 'print_lock' to protect LOG. 70 * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG.
71 */ 71 */
72 72
73/** 73/**
74 * printbuf_init - initialize print buffer to empty 74 * tipc_printbuf_init - initialize print buffer to empty
75 */ 75 */
76 76
77void printbuf_init(struct print_buf *pb, char *raw, u32 sz) 77void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz)
78{ 78{
79 if (!pb || !raw || (sz < (MAX_STRING + 1))) 79 if (!pb || !raw || (sz < (MAX_STRING + 1)))
80 return; 80 return;
@@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz)
87} 87}
88 88
89/** 89/**
90 * printbuf_reset - reinitialize print buffer to empty state 90 * tipc_printbuf_reset - reinitialize print buffer to empty state
91 */ 91 */
92 92
93void printbuf_reset(struct print_buf *pb) 93void tipc_printbuf_reset(struct print_buf *pb)
94{ 94{
95 if (pb && pb->buf) 95 if (pb && pb->buf)
96 printbuf_init(pb, pb->buf, pb->size); 96 tipc_printbuf_init(pb, pb->buf, pb->size);
97} 97}
98 98
99/** 99/**
100 * printbuf_empty - test if print buffer is in empty state 100 * tipc_printbuf_empty - test if print buffer is in empty state
101 */ 101 */
102 102
103int printbuf_empty(struct print_buf *pb) 103int tipc_printbuf_empty(struct print_buf *pb)
104{ 104{
105 return (!pb || !pb->buf || (pb->crs == pb->buf)); 105 return (!pb || !pb->buf || (pb->crs == pb->buf));
106} 106}
107 107
108/** 108/**
109 * printbuf_validate - check for print buffer overflow 109 * tipc_printbuf_validate - check for print buffer overflow
110 * 110 *
111 * Verifies that a print buffer has captured all data written to it. 111 * Verifies that a print buffer has captured all data written to it.
112 * If data has been lost, linearize buffer and prepend an error message 112 * If data has been lost, linearize buffer and prepend an error message
@@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb)
114 * Returns length of print buffer data string (including trailing NULL) 114 * Returns length of print buffer data string (including trailing NULL)
115 */ 115 */
116 116
117int printbuf_validate(struct print_buf *pb) 117int tipc_printbuf_validate(struct print_buf *pb)
118{ 118{
119 char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; 119 char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n";
120 char *cp_buf; 120 char *cp_buf;
@@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb)
126 if (pb->buf[pb->size - 1] == '\0') { 126 if (pb->buf[pb->size - 1] == '\0') {
127 cp_buf = kmalloc(pb->size, GFP_ATOMIC); 127 cp_buf = kmalloc(pb->size, GFP_ATOMIC);
128 if (cp_buf != NULL){ 128 if (cp_buf != NULL){
129 printbuf_init(&cb, cp_buf, pb->size); 129 tipc_printbuf_init(&cb, cp_buf, pb->size);
130 printbuf_move(&cb, pb); 130 tipc_printbuf_move(&cb, pb);
131 printbuf_move(pb, &cb); 131 tipc_printbuf_move(pb, &cb);
132 kfree(cp_buf); 132 kfree(cp_buf);
133 memcpy(pb->buf, err, strlen(err)); 133 memcpy(pb->buf, err, strlen(err));
134 } else { 134 } else {
135 printbuf_reset(pb); 135 tipc_printbuf_reset(pb);
136 tipc_printf(pb, err); 136 tipc_printf(pb, err);
137 } 137 }
138 } 138 }
@@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb)
140} 140}
141 141
142/** 142/**
143 * printbuf_move - move print buffer contents to another print buffer 143 * tipc_printbuf_move - move print buffer contents to another print buffer
144 * 144 *
145 * Current contents of destination print buffer (if any) are discarded. 145 * Current contents of destination print buffer (if any) are discarded.
146 * Source print buffer becomes empty if a successful move occurs. 146 * Source print buffer becomes empty if a successful move occurs.
147 */ 147 */
148 148
149void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) 149void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
150{ 150{
151 int len; 151 int len;
152 152
@@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
156 return; 156 return;
157 157
158 if (!pb_from || !pb_from->buf) { 158 if (!pb_from || !pb_from->buf) {
159 printbuf_reset(pb_to); 159 tipc_printbuf_reset(pb_to);
160 return; 160 return;
161 } 161 }
162 162
163 if (pb_to->size < pb_from->size) { 163 if (pb_to->size < pb_from->size) {
164 printbuf_reset(pb_to); 164 tipc_printbuf_reset(pb_to);
165 tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); 165 tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***");
166 return; 166 return;
167 } 167 }
@@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
179 strcpy(pb_to->crs, pb_from->buf); 179 strcpy(pb_to->crs, pb_from->buf);
180 pb_to->crs += len; 180 pb_to->crs += len;
181 181
182 printbuf_reset(pb_from); 182 tipc_printbuf_reset(pb_from);
183} 183}
184 184
185/** 185/**
@@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
199 strcpy(print_string, "*** STRING TOO LONG ***"); 199 strcpy(print_string, "*** STRING TOO LONG ***");
200 200
201 while (pb) { 201 while (pb) {
202 if (pb == CONS) 202 if (pb == TIPC_CONS)
203 printk(print_string); 203 printk(print_string);
204 else if (pb->buf) { 204 else if (pb->buf) {
205 chars_left = pb->buf + pb->size - pb->crs - 1; 205 chars_left = pb->buf + pb->size - pb->crs - 1;
@@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
223} 223}
224 224
225/** 225/**
226 * TEE - perform next output operation on both print buffers 226 * TIPC_TEE - perform next output operation on both print buffers
227 */ 227 */
228 228
229struct print_buf *TEE(struct print_buf *b0, struct print_buf *b1) 229struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
230{ 230{
231 struct print_buf *pb = b0; 231 struct print_buf *pb = b0;
232 232
@@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
294 int len; 294 int len;
295 295
296 spin_lock_bh(&print_lock); 296 spin_lock_bh(&print_lock);
297 FORMAT(CONS->buf, len, fmt); 297 FORMAT(TIPC_CONS->buf, len, fmt);
298 printk(CONS->buf); 298 printk(TIPC_CONS->buf);
299 299
300 for (; pb; pb = pb->next) { 300 for (; pb; pb = pb->next) {
301 if (pb == CONS) 301 if (pb == TIPC_CONS)
302 continue; 302 continue;
303 printk("\n---- Start of dump,%s log ----\n\n", 303 printk("\n---- Start of dump,%s log ----\n\n",
304 (pb == LOG) ? "global" : "local"); 304 (pb == TIPC_LOG) ? "global" : "local");
305 printbuf_dump(pb); 305 printbuf_dump(pb);
306 printbuf_reset(pb); 306 tipc_printbuf_reset(pb);
307 printk("\n-------- End of dump --------\n"); 307 printk("\n-------- End of dump --------\n");
308 } 308 }
309 spin_unlock_bh(&print_lock); 309 spin_unlock_bh(&print_lock);
310} 310}
311 311
312/** 312/**
313 * log_stop - free up TIPC log print buffer 313 * tipc_log_stop - free up TIPC log print buffer
314 */ 314 */
315 315
316void log_stop(void) 316void tipc_log_stop(void)
317{ 317{
318 spin_lock_bh(&print_lock); 318 spin_lock_bh(&print_lock);
319 if (LOG->buf) { 319 if (TIPC_LOG->buf) {
320 kfree(LOG->buf); 320 kfree(TIPC_LOG->buf);
321 LOG->buf = NULL; 321 TIPC_LOG->buf = NULL;
322 } 322 }
323 spin_unlock_bh(&print_lock); 323 spin_unlock_bh(&print_lock);
324} 324}
325 325
326/** 326/**
327 * log_reinit - set TIPC log print buffer to specified size 327 * tipc_log_reinit - set TIPC log print buffer to specified size
328 */ 328 */
329 329
330void log_reinit(int log_size) 330void tipc_log_reinit(int log_size)
331{ 331{
332 log_stop(); 332 tipc_log_stop();
333 333
334 if (log_size) { 334 if (log_size) {
335 if (log_size <= MAX_STRING) 335 if (log_size <= MAX_STRING)
336 log_size = MAX_STRING + 1; 336 log_size = MAX_STRING + 1;
337 spin_lock_bh(&print_lock); 337 spin_lock_bh(&print_lock);
338 printbuf_init(LOG, kmalloc(log_size, GFP_ATOMIC), log_size); 338 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size);
339 spin_unlock_bh(&print_lock); 339 spin_unlock_bh(&print_lock);
340 } 340 }
341} 341}
342 342
343/** 343/**
344 * log_resize - reconfigure size of TIPC log buffer 344 * tipc_log_resize - reconfigure size of TIPC log buffer
345 */ 345 */
346 346
347struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space) 347struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
348{ 348{
349 u32 value; 349 u32 value;
350 350
351 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 351 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
352 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 352 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
353 353
354 value = *(u32 *)TLV_DATA(req_tlv_area); 354 value = *(u32 *)TLV_DATA(req_tlv_area);
355 value = ntohl(value); 355 value = ntohl(value);
356 if (value != delimit(value, 0, 32768)) 356 if (value != delimit(value, 0, 32768))
357 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 357 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
358 " (log size must be 0-32768)"); 358 " (log size must be 0-32768)");
359 log_reinit(value); 359 tipc_log_reinit(value);
360 return cfg_reply_none(); 360 return tipc_cfg_reply_none();
361} 361}
362 362
363/** 363/**
364 * log_dump - capture TIPC log buffer contents in configuration message 364 * tipc_log_dump - capture TIPC log buffer contents in configuration message
365 */ 365 */
366 366
367struct sk_buff *log_dump(void) 367struct sk_buff *tipc_log_dump(void)
368{ 368{
369 struct sk_buff *reply; 369 struct sk_buff *reply;
370 370
371 spin_lock_bh(&print_lock); 371 spin_lock_bh(&print_lock);
372 if (!LOG->buf) 372 if (!TIPC_LOG->buf)
373 reply = cfg_reply_ultra_string("log not activated\n"); 373 reply = tipc_cfg_reply_ultra_string("log not activated\n");
374 else if (printbuf_empty(LOG)) 374 else if (tipc_printbuf_empty(TIPC_LOG))
375 reply = cfg_reply_ultra_string("log is empty\n"); 375 reply = tipc_cfg_reply_ultra_string("log is empty\n");
376 else { 376 else {
377 struct tlv_desc *rep_tlv; 377 struct tlv_desc *rep_tlv;
378 struct print_buf pb; 378 struct print_buf pb;
379 int str_len; 379 int str_len;
380 380
381 str_len = min(LOG->size, 32768u); 381 str_len = min(TIPC_LOG->size, 32768u);
382 reply = cfg_reply_alloc(TLV_SPACE(str_len)); 382 reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len));
383 if (reply) { 383 if (reply) {
384 rep_tlv = (struct tlv_desc *)reply->data; 384 rep_tlv = (struct tlv_desc *)reply->data;
385 printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); 385 tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len);
386 printbuf_move(&pb, LOG); 386 tipc_printbuf_move(&pb, TIPC_LOG);
387 str_len = strlen(TLV_DATA(rep_tlv)) + 1; 387 str_len = strlen(TLV_DATA(rep_tlv)) + 1;
388 skb_put(reply, TLV_SPACE(str_len)); 388 skb_put(reply, TLV_SPACE(str_len));
389 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 389 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h
index c6b2a64c224f..227f050d2a52 100644
--- a/net/tipc/dbg.h
+++ b/net/tipc/dbg.h
@@ -44,16 +44,16 @@ struct print_buf {
44 struct print_buf *next; 44 struct print_buf *next;
45}; 45};
46 46
47void printbuf_init(struct print_buf *pb, char *buf, u32 sz); 47void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz);
48void printbuf_reset(struct print_buf *pb); 48void tipc_printbuf_reset(struct print_buf *pb);
49int printbuf_empty(struct print_buf *pb); 49int tipc_printbuf_empty(struct print_buf *pb);
50int printbuf_validate(struct print_buf *pb); 50int tipc_printbuf_validate(struct print_buf *pb);
51void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from); 51void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
52 52
53void log_reinit(int log_size); 53void tipc_log_reinit(int log_size);
54void log_stop(void); 54void tipc_log_stop(void);
55 55
56struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space); 56struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space);
57struct sk_buff *log_dump(void); 57struct sk_buff *tipc_log_dump(void);
58 58
59#endif 59#endif
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index b106ef1621cc..53ba4630c10d 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -93,7 +93,7 @@ int disc_create_link(const struct tipc_link_create *argv)
93 * disc_lost_link(): A link has lost contact 93 * disc_lost_link(): A link has lost contact
94 */ 94 */
95 95
96void disc_link_event(u32 addr, char *name, int up) 96void tipc_disc_link_event(u32 addr, char *name, int up)
97{ 97{
98 if (in_own_cluster(addr)) 98 if (in_own_cluster(addr))
99 return; 99 return;
@@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up)
103} 103}
104 104
105/** 105/**
106 * disc_init_msg - initialize a link setup message 106 * tipc_disc_init_msg - initialize a link setup message
107 * @type: message type (request or response) 107 * @type: message type (request or response)
108 * @req_links: number of links associated with message 108 * @req_links: number of links associated with message
109 * @dest_domain: network domain of node(s) which should respond to message 109 * @dest_domain: network domain of node(s) which should respond to message
110 * @b_ptr: ptr to bearer issuing message 110 * @b_ptr: ptr to bearer issuing message
111 */ 111 */
112 112
113struct sk_buff *disc_init_msg(u32 type, 113struct sk_buff *tipc_disc_init_msg(u32 type,
114 u32 req_links, 114 u32 req_links,
115 u32 dest_domain, 115 u32 dest_domain,
116 struct bearer *b_ptr) 116 struct bearer *b_ptr)
117{ 117{
118 struct sk_buff *buf = buf_acquire(DSC_H_SIZE); 118 struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
119 struct tipc_msg *msg; 119 struct tipc_msg *msg;
@@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type,
132} 132}
133 133
134/** 134/**
135 * disc_recv_msg - handle incoming link setup message (request or response) 135 * tipc_disc_recv_msg - handle incoming link setup message (request or response)
136 * @buf: buffer containing message 136 * @buf: buffer containing message
137 */ 137 */
138 138
139void disc_recv_msg(struct sk_buff *buf) 139void tipc_disc_recv_msg(struct sk_buff *buf)
140{ 140{
141 struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle; 141 struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle;
142 struct link *link; 142 struct link *link;
@@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf)
153 153
154 if (net_id != tipc_net_id) 154 if (net_id != tipc_net_id)
155 return; 155 return;
156 if (!addr_domain_valid(dest)) 156 if (!tipc_addr_domain_valid(dest))
157 return; 157 return;
158 if (!addr_node_valid(orig)) 158 if (!tipc_addr_node_valid(orig))
159 return; 159 return;
160 if (orig == tipc_own_addr) 160 if (orig == tipc_own_addr)
161 return; 161 return;
@@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf)
169 /* Always accept link here */ 169 /* Always accept link here */
170 struct sk_buff *rbuf; 170 struct sk_buff *rbuf;
171 struct tipc_media_addr *addr; 171 struct tipc_media_addr *addr;
172 struct node *n_ptr = node_find(orig); 172 struct node *n_ptr = tipc_node_find(orig);
173 int link_up; 173 int link_up;
174 dbg(" in own cluster\n"); 174 dbg(" in own cluster\n");
175 if (n_ptr == NULL) { 175 if (n_ptr == NULL) {
176 n_ptr = node_create(orig); 176 n_ptr = tipc_node_create(orig);
177 } 177 }
178 if (n_ptr == NULL) { 178 if (n_ptr == NULL) {
179 warn("Memory squeeze; Failed to create node\n"); 179 warn("Memory squeeze; Failed to create node\n");
@@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf)
183 link = n_ptr->links[b_ptr->identity]; 183 link = n_ptr->links[b_ptr->identity];
184 if (!link) { 184 if (!link) {
185 dbg("creating link\n"); 185 dbg("creating link\n");
186 link = link_create(b_ptr, orig, &media_addr); 186 link = tipc_link_create(b_ptr, orig, &media_addr);
187 if (!link) { 187 if (!link) {
188 spin_unlock_bh(&n_ptr->lock); 188 spin_unlock_bh(&n_ptr->lock);
189 return; 189 return;
@@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf)
196 warn("New bearer address for %s\n", 196 warn("New bearer address for %s\n",
197 addr_string_fill(addr_string, orig)); 197 addr_string_fill(addr_string, orig));
198 memcpy(addr, &media_addr, sizeof(*addr)); 198 memcpy(addr, &media_addr, sizeof(*addr));
199 link_reset(link); 199 tipc_link_reset(link);
200 } 200 }
201 link_up = link_is_up(link); 201 link_up = tipc_link_is_up(link);
202 spin_unlock_bh(&n_ptr->lock); 202 spin_unlock_bh(&n_ptr->lock);
203 if ((type == DSC_RESP_MSG) || link_up) 203 if ((type == DSC_RESP_MSG) || link_up)
204 return; 204 return;
205 rbuf = disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); 205 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
206 if (rbuf != NULL) { 206 if (rbuf != NULL) {
207 msg_dbg(buf_msg(rbuf),"SEND:"); 207 msg_dbg(buf_msg(rbuf),"SEND:");
208 b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr); 208 b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr);
@@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf)
212} 212}
213 213
214/** 214/**
215 * disc_stop_link_req - stop sending periodic link setup requests 215 * tipc_disc_stop_link_req - stop sending periodic link setup requests
216 * @req: ptr to link request structure 216 * @req: ptr to link request structure
217 */ 217 */
218 218
219void disc_stop_link_req(struct link_req *req) 219void tipc_disc_stop_link_req(struct link_req *req)
220{ 220{
221 if (!req) 221 if (!req)
222 return; 222 return;
@@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req)
228} 228}
229 229
230/** 230/**
231 * disc_update_link_req - update frequency of periodic link setup requests 231 * tipc_disc_update_link_req - update frequency of periodic link setup requests
232 * @req: ptr to link request structure 232 * @req: ptr to link request structure
233 */ 233 */
234 234
235void disc_update_link_req(struct link_req *req) 235void tipc_disc_update_link_req(struct link_req *req)
236{ 236{
237 if (!req) 237 if (!req)
238 return; 238 return;
@@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req)
282} 282}
283 283
284/** 284/**
285 * disc_init_link_req - start sending periodic link setup requests 285 * tipc_disc_init_link_req - start sending periodic link setup requests
286 * @b_ptr: ptr to bearer issuing requests 286 * @b_ptr: ptr to bearer issuing requests
287 * @dest: destination address for request messages 287 * @dest: destination address for request messages
288 * @dest_domain: network domain of node(s) which should respond to message 288 * @dest_domain: network domain of node(s) which should respond to message
@@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req)
291 * Returns pointer to link request structure, or NULL if unable to create. 291 * Returns pointer to link request structure, or NULL if unable to create.
292 */ 292 */
293 293
294struct link_req *disc_init_link_req(struct bearer *b_ptr, 294struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
295 const struct tipc_media_addr *dest, 295 const struct tipc_media_addr *dest,
296 u32 dest_domain, 296 u32 dest_domain,
297 u32 req_links) 297 u32 req_links)
298{ 298{
299 struct link_req *req; 299 struct link_req *req;
300 300
@@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr,
302 if (!req) 302 if (!req)
303 return NULL; 303 return NULL;
304 304
305 req->buf = disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); 305 req->buf = tipc_disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr);
306 if (!req->buf) { 306 if (!req->buf) {
307 kfree(req); 307 kfree(req);
308 return NULL; 308 return NULL;
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index 2a6114d91626..0454fd1ae7f3 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -37,20 +37,20 @@
37#ifndef _TIPC_DISCOVER_H 37#ifndef _TIPC_DISCOVER_H
38#define _TIPC_DISCOVER_H 38#define _TIPC_DISCOVER_H
39 39
40#include <linux/tipc.h> 40#include "core.h"
41 41
42struct link_req; 42struct link_req;
43 43
44struct link_req *disc_init_link_req(struct bearer *b_ptr, 44struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
45 const struct tipc_media_addr *dest, 45 const struct tipc_media_addr *dest,
46 u32 dest_domain, 46 u32 dest_domain,
47 u32 req_links); 47 u32 req_links);
48void disc_update_link_req(struct link_req *req); 48void tipc_disc_update_link_req(struct link_req *req);
49void disc_stop_link_req(struct link_req *req); 49void tipc_disc_stop_link_req(struct link_req *req);
50 50
51void disc_recv_msg(struct sk_buff *buf); 51void tipc_disc_recv_msg(struct sk_buff *buf);
52 52
53void disc_link_event(u32 addr, char *name, int up); 53void tipc_disc_link_event(u32 addr, char *name, int up);
54#if 0 54#if 0
55int disc_create_link(const struct tipc_link_create *argv); 55int disc_create_link(const struct tipc_link_create *argv);
56#endif 56#endif
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 34d0462db3aa..1f8d83b9c8b4 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -38,13 +38,11 @@
38#include <net/tipc/tipc_bearer.h> 38#include <net/tipc/tipc_bearer.h>
39#include <net/tipc/tipc_msg.h> 39#include <net/tipc/tipc_msg.h>
40#include <linux/netdevice.h> 40#include <linux/netdevice.h>
41#include <linux/version.h>
42 41
43#define MAX_ETH_BEARERS 2 42#define MAX_ETH_BEARERS 2
44#define TIPC_PROTOCOL 0x88ca 43#define ETH_LINK_PRIORITY TIPC_DEF_LINK_PRI
45#define ETH_LINK_PRIORITY 10
46#define ETH_LINK_TOLERANCE TIPC_DEF_LINK_TOL 44#define ETH_LINK_TOLERANCE TIPC_DEF_LINK_TOL
47 45#define ETH_LINK_WINDOW TIPC_DEF_LINK_WIN
48 46
49/** 47/**
50 * struct eth_bearer - Ethernet bearer data structure 48 * struct eth_bearer - Ethernet bearer data structure
@@ -78,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
78 clone->nh.raw = clone->data; 76 clone->nh.raw = clone->data;
79 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; 77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
80 clone->dev = dev; 78 clone->dev = dev;
81 dev->hard_header(clone, dev, TIPC_PROTOCOL, 79 dev->hard_header(clone, dev, ETH_P_TIPC,
82 &dest->dev_addr.eth_addr, 80 &dest->dev_addr.eth_addr,
83 dev->dev_addr, clone->len); 81 dev->dev_addr, clone->len);
84 dev_queue_xmit(clone); 82 dev_queue_xmit(clone);
@@ -141,7 +139,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
141 return -EDQUOT; 139 return -EDQUOT;
142 if (!eb_ptr->dev) { 140 if (!eb_ptr->dev) {
143 eb_ptr->dev = dev; 141 eb_ptr->dev = dev;
144 eb_ptr->tipc_packet_type.type = __constant_htons(TIPC_PROTOCOL); 142 eb_ptr->tipc_packet_type.type = __constant_htons(ETH_P_TIPC);
145 eb_ptr->tipc_packet_type.dev = dev; 143 eb_ptr->tipc_packet_type.dev = dev;
146 eb_ptr->tipc_packet_type.func = recv_msg; 144 eb_ptr->tipc_packet_type.func = recv_msg;
147 eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr; 145 eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr;
@@ -240,13 +238,13 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size
240} 238}
241 239
242/** 240/**
243 * eth_media_start - activate Ethernet bearer support 241 * tipc_eth_media_start - activate Ethernet bearer support
244 * 242 *
245 * Register Ethernet media type with TIPC bearer code. Also register 243 * Register Ethernet media type with TIPC bearer code. Also register
246 * with OS for notifications about device state changes. 244 * with OS for notifications about device state changes.
247 */ 245 */
248 246
249int eth_media_start(void) 247int tipc_eth_media_start(void)
250{ 248{
251 struct tipc_media_addr bcast_addr; 249 struct tipc_media_addr bcast_addr;
252 int res; 250 int res;
@@ -260,7 +258,7 @@ int eth_media_start(void)
260 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", 258 res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth",
261 enable_bearer, disable_bearer, send_msg, 259 enable_bearer, disable_bearer, send_msg,
262 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, 260 eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY,
263 ETH_LINK_TOLERANCE, TIPC_DEF_LINK_WIN); 261 ETH_LINK_TOLERANCE, ETH_LINK_WINDOW);
264 if (res) 262 if (res)
265 return res; 263 return res;
266 264
@@ -273,10 +271,10 @@ int eth_media_start(void)
273} 271}
274 272
275/** 273/**
276 * eth_media_stop - deactivate Ethernet bearer support 274 * tipc_eth_media_stop - deactivate Ethernet bearer support
277 */ 275 */
278 276
279void eth_media_stop(void) 277void tipc_eth_media_stop(void)
280{ 278{
281 int i; 279 int i;
282 280
diff --git a/net/tipc/handler.c b/net/tipc/handler.c
index f320010f8a65..966f70a1b608 100644
--- a/net/tipc/handler.c
+++ b/net/tipc/handler.c
@@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy);
52static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0); 52static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0);
53 53
54 54
55unsigned int k_signal(Handler routine, unsigned long argument) 55unsigned int tipc_k_signal(Handler routine, unsigned long argument)
56{ 56{
57 struct queue_item *item; 57 struct queue_item *item;
58 58
@@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy)
93 spin_unlock_bh(&qitem_lock); 93 spin_unlock_bh(&qitem_lock);
94} 94}
95 95
96int handler_start(void) 96int tipc_handler_start(void)
97{ 97{
98 tipc_queue_item_cache = 98 tipc_queue_item_cache =
99 kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), 99 kmem_cache_create("tipc_queue_items", sizeof(struct queue_item),
@@ -107,7 +107,7 @@ int handler_start(void)
107 return 0; 107 return 0;
108} 108}
109 109
110void handler_stop(void) 110void tipc_handler_stop(void)
111{ 111{
112 struct list_head *l, *n; 112 struct list_head *l, *n;
113 struct queue_item *item; 113 struct queue_item *item;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 7265f4be4766..511872afa459 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -148,12 +148,12 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
148#define LINK_LOG_BUF_SIZE 0 148#define LINK_LOG_BUF_SIZE 0
149 149
150#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0) 150#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0)
151#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) msg_print(&l_ptr->print_buf, msg, txt); } while(0) 151#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0)
152#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0) 152#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0)
153#define dbg_link_dump() do { \ 153#define dbg_link_dump() do { \
154 if (LINK_LOG_BUF_SIZE) { \ 154 if (LINK_LOG_BUF_SIZE) { \
155 tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ 155 tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \
156 printbuf_move(LOG, &l_ptr->print_buf); \ 156 tipc_printbuf_move(LOG, &l_ptr->print_buf); \
157 } \ 157 } \
158} while (0) 158} while (0)
159 159
@@ -252,14 +252,14 @@ static inline u32 link_last_sent(struct link *l_ptr)
252 * Simple non-inlined link routines (i.e. referenced outside this file) 252 * Simple non-inlined link routines (i.e. referenced outside this file)
253 */ 253 */
254 254
255int link_is_up(struct link *l_ptr) 255int tipc_link_is_up(struct link *l_ptr)
256{ 256{
257 if (!l_ptr) 257 if (!l_ptr)
258 return 0; 258 return 0;
259 return (link_working_working(l_ptr) || link_working_unknown(l_ptr)); 259 return (link_working_working(l_ptr) || link_working_unknown(l_ptr));
260} 260}
261 261
262int link_is_active(struct link *l_ptr) 262int tipc_link_is_active(struct link *l_ptr)
263{ 263{
264 return ((l_ptr->owner->active_links[0] == l_ptr) || 264 return ((l_ptr->owner->active_links[0] == l_ptr) ||
265 (l_ptr->owner->active_links[1] == l_ptr)); 265 (l_ptr->owner->active_links[1] == l_ptr));
@@ -338,15 +338,15 @@ static int link_name_validate(const char *name, struct link_name *name_parts)
338 * link_timeout - handle expiration of link timer 338 * link_timeout - handle expiration of link timer
339 * @l_ptr: pointer to link 339 * @l_ptr: pointer to link
340 * 340 *
341 * This routine must not grab "net_lock" to avoid a potential deadlock conflict 341 * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
342 * with link_delete(). (There is no risk that the node will be deleted by 342 * with tipc_link_delete(). (There is no risk that the node will be deleted by
343 * another thread because link_delete() always cancels the link timer before 343 * another thread because tipc_link_delete() always cancels the link timer before
344 * node_delete() is called.) 344 * tipc_node_delete() is called.)
345 */ 345 */
346 346
347static void link_timeout(struct link *l_ptr) 347static void link_timeout(struct link *l_ptr)
348{ 348{
349 node_lock(l_ptr->owner); 349 tipc_node_lock(l_ptr->owner);
350 350
351 /* update counters used in statistical profiling of send traffic */ 351 /* update counters used in statistical profiling of send traffic */
352 352
@@ -391,9 +391,9 @@ static void link_timeout(struct link *l_ptr)
391 link_state_event(l_ptr, TIMEOUT_EVT); 391 link_state_event(l_ptr, TIMEOUT_EVT);
392 392
393 if (l_ptr->next_out) 393 if (l_ptr->next_out)
394 link_push_queue(l_ptr); 394 tipc_link_push_queue(l_ptr);
395 395
396 node_unlock(l_ptr->owner); 396 tipc_node_unlock(l_ptr->owner);
397} 397}
398 398
399static inline void link_set_timer(struct link *l_ptr, u32 time) 399static inline void link_set_timer(struct link *l_ptr, u32 time)
@@ -402,7 +402,7 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
402} 402}
403 403
404/** 404/**
405 * link_create - create a new link 405 * tipc_link_create - create a new link
406 * @b_ptr: pointer to associated bearer 406 * @b_ptr: pointer to associated bearer
407 * @peer: network address of node at other end of link 407 * @peer: network address of node at other end of link
408 * @media_addr: media address to use when sending messages over link 408 * @media_addr: media address to use when sending messages over link
@@ -410,8 +410,8 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
410 * Returns pointer to link. 410 * Returns pointer to link.
411 */ 411 */
412 412
413struct link *link_create(struct bearer *b_ptr, const u32 peer, 413struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
414 const struct tipc_media_addr *media_addr) 414 const struct tipc_media_addr *media_addr)
415{ 415{
416 struct link *l_ptr; 416 struct link *l_ptr;
417 struct tipc_msg *msg; 417 struct tipc_msg *msg;
@@ -449,7 +449,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
449 strcpy((char *)msg_data(msg), if_name); 449 strcpy((char *)msg_data(msg), if_name);
450 450
451 l_ptr->priority = b_ptr->priority; 451 l_ptr->priority = b_ptr->priority;
452 link_set_queue_limits(l_ptr, b_ptr->media->window); 452 tipc_link_set_queue_limits(l_ptr, b_ptr->media->window);
453 453
454 link_init_max_pkt(l_ptr); 454 link_init_max_pkt(l_ptr);
455 455
@@ -458,7 +458,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
458 458
459 link_reset_statistics(l_ptr); 459 link_reset_statistics(l_ptr);
460 460
461 l_ptr->owner = node_attach_link(l_ptr); 461 l_ptr->owner = tipc_node_attach_link(l_ptr);
462 if (!l_ptr->owner) { 462 if (!l_ptr->owner) {
463 kfree(l_ptr); 463 kfree(l_ptr);
464 return NULL; 464 return NULL;
@@ -472,52 +472,52 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
472 warn("Memory squeeze; Failed to create link\n"); 472 warn("Memory squeeze; Failed to create link\n");
473 return NULL; 473 return NULL;
474 } 474 }
475 printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); 475 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
476 } 476 }
477 477
478 k_signal((Handler)link_start, (unsigned long)l_ptr); 478 tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
479 479
480 dbg("link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", 480 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
481 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); 481 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
482 482
483 return l_ptr; 483 return l_ptr;
484} 484}
485 485
486/** 486/**
487 * link_delete - delete a link 487 * tipc_link_delete - delete a link
488 * @l_ptr: pointer to link 488 * @l_ptr: pointer to link
489 * 489 *
490 * Note: 'net_lock' is write_locked, bearer is locked. 490 * Note: 'tipc_net_lock' is write_locked, bearer is locked.
491 * This routine must not grab the node lock until after link timer cancellation 491 * This routine must not grab the node lock until after link timer cancellation
492 * to avoid a potential deadlock situation. 492 * to avoid a potential deadlock situation.
493 */ 493 */
494 494
495void link_delete(struct link *l_ptr) 495void tipc_link_delete(struct link *l_ptr)
496{ 496{
497 if (!l_ptr) { 497 if (!l_ptr) {
498 err("Attempt to delete non-existent link\n"); 498 err("Attempt to delete non-existent link\n");
499 return; 499 return;
500 } 500 }
501 501
502 dbg("link_delete()\n"); 502 dbg("tipc_link_delete()\n");
503 503
504 k_cancel_timer(&l_ptr->timer); 504 k_cancel_timer(&l_ptr->timer);
505 505
506 node_lock(l_ptr->owner); 506 tipc_node_lock(l_ptr->owner);
507 link_reset(l_ptr); 507 tipc_link_reset(l_ptr);
508 node_detach_link(l_ptr->owner, l_ptr); 508 tipc_node_detach_link(l_ptr->owner, l_ptr);
509 link_stop(l_ptr); 509 tipc_link_stop(l_ptr);
510 list_del_init(&l_ptr->link_list); 510 list_del_init(&l_ptr->link_list);
511 if (LINK_LOG_BUF_SIZE) 511 if (LINK_LOG_BUF_SIZE)
512 kfree(l_ptr->print_buf.buf); 512 kfree(l_ptr->print_buf.buf);
513 node_unlock(l_ptr->owner); 513 tipc_node_unlock(l_ptr->owner);
514 k_term_timer(&l_ptr->timer); 514 k_term_timer(&l_ptr->timer);
515 kfree(l_ptr); 515 kfree(l_ptr);
516} 516}
517 517
518void link_start(struct link *l_ptr) 518void tipc_link_start(struct link *l_ptr)
519{ 519{
520 dbg("link_start %x\n", l_ptr); 520 dbg("tipc_link_start %x\n", l_ptr);
521 link_state_event(l_ptr, STARTING_EVT); 521 link_state_event(l_ptr, STARTING_EVT);
522} 522}
523 523
@@ -535,8 +535,8 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
535{ 535{
536 struct port *p_ptr; 536 struct port *p_ptr;
537 537
538 spin_lock_bh(&port_list_lock); 538 spin_lock_bh(&tipc_port_list_lock);
539 p_ptr = port_lock(origport); 539 p_ptr = tipc_port_lock(origport);
540 if (p_ptr) { 540 if (p_ptr) {
541 if (!p_ptr->wakeup) 541 if (!p_ptr->wakeup)
542 goto exit; 542 goto exit;
@@ -548,13 +548,13 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
548 list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); 548 list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports);
549 l_ptr->stats.link_congs++; 549 l_ptr->stats.link_congs++;
550exit: 550exit:
551 port_unlock(p_ptr); 551 tipc_port_unlock(p_ptr);
552 } 552 }
553 spin_unlock_bh(&port_list_lock); 553 spin_unlock_bh(&tipc_port_list_lock);
554 return -ELINKCONG; 554 return -ELINKCONG;
555} 555}
556 556
557void link_wakeup_ports(struct link *l_ptr, int all) 557void tipc_link_wakeup_ports(struct link *l_ptr, int all)
558{ 558{
559 struct port *p_ptr; 559 struct port *p_ptr;
560 struct port *temp_p_ptr; 560 struct port *temp_p_ptr;
@@ -564,7 +564,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
564 win = 100000; 564 win = 100000;
565 if (win <= 0) 565 if (win <= 0)
566 return; 566 return;
567 if (!spin_trylock_bh(&port_list_lock)) 567 if (!spin_trylock_bh(&tipc_port_list_lock))
568 return; 568 return;
569 if (link_congested(l_ptr)) 569 if (link_congested(l_ptr))
570 goto exit; 570 goto exit;
@@ -583,7 +583,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
583 } 583 }
584 584
585exit: 585exit:
586 spin_unlock_bh(&port_list_lock); 586 spin_unlock_bh(&tipc_port_list_lock);
587} 587}
588 588
589/** 589/**
@@ -606,11 +606,11 @@ static void link_release_outqueue(struct link *l_ptr)
606} 606}
607 607
608/** 608/**
609 * link_reset_fragments - purge link's inbound message fragments queue 609 * tipc_link_reset_fragments - purge link's inbound message fragments queue
610 * @l_ptr: pointer to link 610 * @l_ptr: pointer to link
611 */ 611 */
612 612
613void link_reset_fragments(struct link *l_ptr) 613void tipc_link_reset_fragments(struct link *l_ptr)
614{ 614{
615 struct sk_buff *buf = l_ptr->defragm_buf; 615 struct sk_buff *buf = l_ptr->defragm_buf;
616 struct sk_buff *next; 616 struct sk_buff *next;
@@ -624,11 +624,11 @@ void link_reset_fragments(struct link *l_ptr)
624} 624}
625 625
626/** 626/**
627 * link_stop - purge all inbound and outbound messages associated with link 627 * tipc_link_stop - purge all inbound and outbound messages associated with link
628 * @l_ptr: pointer to link 628 * @l_ptr: pointer to link
629 */ 629 */
630 630
631void link_stop(struct link *l_ptr) 631void tipc_link_stop(struct link *l_ptr)
632{ 632{
633 struct sk_buff *buf; 633 struct sk_buff *buf;
634 struct sk_buff *next; 634 struct sk_buff *next;
@@ -647,7 +647,7 @@ void link_stop(struct link *l_ptr)
647 buf = next; 647 buf = next;
648 } 648 }
649 649
650 link_reset_fragments(l_ptr); 650 tipc_link_reset_fragments(l_ptr);
651 651
652 buf_discard(l_ptr->proto_msg_queue); 652 buf_discard(l_ptr->proto_msg_queue);
653 l_ptr->proto_msg_queue = NULL; 653 l_ptr->proto_msg_queue = NULL;
@@ -677,7 +677,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
677 ev->up = up; 677 ev->up = up;
678 ev->fcn = fcn; 678 ev->fcn = fcn;
679 memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME); 679 memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME);
680 k_signal((Handler)link_recv_event, (unsigned long)ev); 680 tipc_k_signal((Handler)link_recv_event, (unsigned long)ev);
681} 681}
682 682
683#else 683#else
@@ -686,7 +686,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
686 686
687#endif 687#endif
688 688
689void link_reset(struct link *l_ptr) 689void tipc_link_reset(struct link *l_ptr)
690{ 690{
691 struct sk_buff *buf; 691 struct sk_buff *buf;
692 u32 prev_state = l_ptr->state; 692 u32 prev_state = l_ptr->state;
@@ -706,13 +706,13 @@ void link_reset(struct link *l_ptr)
706 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET)) 706 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET))
707 return; 707 return;
708 708
709 node_link_down(l_ptr->owner, l_ptr); 709 tipc_node_link_down(l_ptr->owner, l_ptr);
710 bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); 710 tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
711#if 0 711#if 0
712 tipc_printf(CONS, "\nReset link <%s>\n", l_ptr->name); 712 tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name);
713 dbg_link_dump(); 713 dbg_link_dump();
714#endif 714#endif
715 if (node_has_active_links(l_ptr->owner) && 715 if (tipc_node_has_active_links(l_ptr->owner) &&
716 l_ptr->owner->permit_changeover) { 716 l_ptr->owner->permit_changeover) {
717 l_ptr->reset_checkpoint = checkpoint; 717 l_ptr->reset_checkpoint = checkpoint;
718 l_ptr->exp_msg_count = START_CHANGEOVER; 718 l_ptr->exp_msg_count = START_CHANGEOVER;
@@ -730,7 +730,7 @@ void link_reset(struct link *l_ptr)
730 buf = next; 730 buf = next;
731 } 731 }
732 if (!list_empty(&l_ptr->waiting_ports)) 732 if (!list_empty(&l_ptr->waiting_ports))
733 link_wakeup_ports(l_ptr, 1); 733 tipc_link_wakeup_ports(l_ptr, 1);
734 734
735 l_ptr->retransm_queue_head = 0; 735 l_ptr->retransm_queue_head = 0;
736 l_ptr->retransm_queue_size = 0; 736 l_ptr->retransm_queue_size = 0;
@@ -747,20 +747,20 @@ void link_reset(struct link *l_ptr)
747 l_ptr->stale_count = 0; 747 l_ptr->stale_count = 0;
748 link_reset_statistics(l_ptr); 748 link_reset_statistics(l_ptr);
749 749
750 link_send_event(cfg_link_event, l_ptr, 0); 750 link_send_event(tipc_cfg_link_event, l_ptr, 0);
751 if (!in_own_cluster(l_ptr->addr)) 751 if (!in_own_cluster(l_ptr->addr))
752 link_send_event(disc_link_event, l_ptr, 0); 752 link_send_event(tipc_disc_link_event, l_ptr, 0);
753} 753}
754 754
755 755
756static void link_activate(struct link *l_ptr) 756static void link_activate(struct link *l_ptr)
757{ 757{
758 l_ptr->next_in_no = 1; 758 l_ptr->next_in_no = 1;
759 node_link_up(l_ptr->owner, l_ptr); 759 tipc_node_link_up(l_ptr->owner, l_ptr);
760 bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); 760 tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr);
761 link_send_event(cfg_link_event, l_ptr, 1); 761 link_send_event(tipc_cfg_link_event, l_ptr, 1);
762 if (!in_own_cluster(l_ptr->addr)) 762 if (!in_own_cluster(l_ptr->addr))
763 link_send_event(disc_link_event, l_ptr, 1); 763 link_send_event(tipc_disc_link_event, l_ptr, 1);
764} 764}
765 765
766/** 766/**
@@ -799,13 +799,13 @@ static void link_state_event(struct link *l_ptr, unsigned event)
799 dbg_link("TIM "); 799 dbg_link("TIM ");
800 if (l_ptr->next_in_no != l_ptr->checkpoint) { 800 if (l_ptr->next_in_no != l_ptr->checkpoint) {
801 l_ptr->checkpoint = l_ptr->next_in_no; 801 l_ptr->checkpoint = l_ptr->next_in_no;
802 if (bclink_acks_missing(l_ptr->owner)) { 802 if (tipc_bclink_acks_missing(l_ptr->owner)) {
803 link_send_proto_msg(l_ptr, STATE_MSG, 803 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
804 0, 0, 0, 0, 0); 804 0, 0, 0, 0, 0);
805 l_ptr->fsm_msg_cnt++; 805 l_ptr->fsm_msg_cnt++;
806 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { 806 } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
807 link_send_proto_msg(l_ptr, STATE_MSG, 807 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
808 1, 0, 0, 0, 0); 808 1, 0, 0, 0, 0);
809 l_ptr->fsm_msg_cnt++; 809 l_ptr->fsm_msg_cnt++;
810 } 810 }
811 link_set_timer(l_ptr, cont_intv); 811 link_set_timer(l_ptr, cont_intv);
@@ -814,16 +814,16 @@ static void link_state_event(struct link *l_ptr, unsigned event)
814 dbg_link(" -> WU\n"); 814 dbg_link(" -> WU\n");
815 l_ptr->state = WORKING_UNKNOWN; 815 l_ptr->state = WORKING_UNKNOWN;
816 l_ptr->fsm_msg_cnt = 0; 816 l_ptr->fsm_msg_cnt = 0;
817 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 817 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
818 l_ptr->fsm_msg_cnt++; 818 l_ptr->fsm_msg_cnt++;
819 link_set_timer(l_ptr, cont_intv / 4); 819 link_set_timer(l_ptr, cont_intv / 4);
820 break; 820 break;
821 case RESET_MSG: 821 case RESET_MSG:
822 dbg_link("RES -> RR\n"); 822 dbg_link("RES -> RR\n");
823 link_reset(l_ptr); 823 tipc_link_reset(l_ptr);
824 l_ptr->state = RESET_RESET; 824 l_ptr->state = RESET_RESET;
825 l_ptr->fsm_msg_cnt = 0; 825 l_ptr->fsm_msg_cnt = 0;
826 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 826 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
827 l_ptr->fsm_msg_cnt++; 827 l_ptr->fsm_msg_cnt++;
828 link_set_timer(l_ptr, cont_intv); 828 link_set_timer(l_ptr, cont_intv);
829 break; 829 break;
@@ -844,10 +844,10 @@ static void link_state_event(struct link *l_ptr, unsigned event)
844 break; 844 break;
845 case RESET_MSG: 845 case RESET_MSG:
846 dbg_link("RES -> RR\n"); 846 dbg_link("RES -> RR\n");
847 link_reset(l_ptr); 847 tipc_link_reset(l_ptr);
848 l_ptr->state = RESET_RESET; 848 l_ptr->state = RESET_RESET;
849 l_ptr->fsm_msg_cnt = 0; 849 l_ptr->fsm_msg_cnt = 0;
850 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 850 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
851 l_ptr->fsm_msg_cnt++; 851 l_ptr->fsm_msg_cnt++;
852 link_set_timer(l_ptr, cont_intv); 852 link_set_timer(l_ptr, cont_intv);
853 break; 853 break;
@@ -858,9 +858,9 @@ static void link_state_event(struct link *l_ptr, unsigned event)
858 l_ptr->state = WORKING_WORKING; 858 l_ptr->state = WORKING_WORKING;
859 l_ptr->fsm_msg_cnt = 0; 859 l_ptr->fsm_msg_cnt = 0;
860 l_ptr->checkpoint = l_ptr->next_in_no; 860 l_ptr->checkpoint = l_ptr->next_in_no;
861 if (bclink_acks_missing(l_ptr->owner)) { 861 if (tipc_bclink_acks_missing(l_ptr->owner)) {
862 link_send_proto_msg(l_ptr, STATE_MSG, 862 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
863 0, 0, 0, 0, 0); 863 0, 0, 0, 0, 0);
864 l_ptr->fsm_msg_cnt++; 864 l_ptr->fsm_msg_cnt++;
865 } 865 }
866 link_set_timer(l_ptr, cont_intv); 866 link_set_timer(l_ptr, cont_intv);
@@ -868,18 +868,18 @@ static void link_state_event(struct link *l_ptr, unsigned event)
868 dbg_link("Probing %u/%u,timer = %u ms)\n", 868 dbg_link("Probing %u/%u,timer = %u ms)\n",
869 l_ptr->fsm_msg_cnt, l_ptr->abort_limit, 869 l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
870 cont_intv / 4); 870 cont_intv / 4);
871 link_send_proto_msg(l_ptr, STATE_MSG, 871 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
872 1, 0, 0, 0, 0); 872 1, 0, 0, 0, 0);
873 l_ptr->fsm_msg_cnt++; 873 l_ptr->fsm_msg_cnt++;
874 link_set_timer(l_ptr, cont_intv / 4); 874 link_set_timer(l_ptr, cont_intv / 4);
875 } else { /* Link has failed */ 875 } else { /* Link has failed */
876 dbg_link("-> RU (%u probes unanswered)\n", 876 dbg_link("-> RU (%u probes unanswered)\n",
877 l_ptr->fsm_msg_cnt); 877 l_ptr->fsm_msg_cnt);
878 link_reset(l_ptr); 878 tipc_link_reset(l_ptr);
879 l_ptr->state = RESET_UNKNOWN; 879 l_ptr->state = RESET_UNKNOWN;
880 l_ptr->fsm_msg_cnt = 0; 880 l_ptr->fsm_msg_cnt = 0;
881 link_send_proto_msg(l_ptr, RESET_MSG, 881 tipc_link_send_proto_msg(l_ptr, RESET_MSG,
882 0, 0, 0, 0, 0); 882 0, 0, 0, 0, 0);
883 l_ptr->fsm_msg_cnt++; 883 l_ptr->fsm_msg_cnt++;
884 link_set_timer(l_ptr, cont_intv); 884 link_set_timer(l_ptr, cont_intv);
885 } 885 }
@@ -904,7 +904,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
904 l_ptr->state = WORKING_WORKING; 904 l_ptr->state = WORKING_WORKING;
905 l_ptr->fsm_msg_cnt = 0; 905 l_ptr->fsm_msg_cnt = 0;
906 link_activate(l_ptr); 906 link_activate(l_ptr);
907 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 907 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
908 l_ptr->fsm_msg_cnt++; 908 l_ptr->fsm_msg_cnt++;
909 link_set_timer(l_ptr, cont_intv); 909 link_set_timer(l_ptr, cont_intv);
910 break; 910 break;
@@ -913,7 +913,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
913 dbg_link(" -> RR\n"); 913 dbg_link(" -> RR\n");
914 l_ptr->state = RESET_RESET; 914 l_ptr->state = RESET_RESET;
915 l_ptr->fsm_msg_cnt = 0; 915 l_ptr->fsm_msg_cnt = 0;
916 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); 916 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
917 l_ptr->fsm_msg_cnt++; 917 l_ptr->fsm_msg_cnt++;
918 link_set_timer(l_ptr, cont_intv); 918 link_set_timer(l_ptr, cont_intv);
919 break; 919 break;
@@ -923,7 +923,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
923 /* fall through */ 923 /* fall through */
924 case TIMEOUT_EVT: 924 case TIMEOUT_EVT:
925 dbg_link("TIM \n"); 925 dbg_link("TIM \n");
926 link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); 926 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
927 l_ptr->fsm_msg_cnt++; 927 l_ptr->fsm_msg_cnt++;
928 link_set_timer(l_ptr, cont_intv); 928 link_set_timer(l_ptr, cont_intv);
929 break; 929 break;
@@ -947,7 +947,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
947 l_ptr->state = WORKING_WORKING; 947 l_ptr->state = WORKING_WORKING;
948 l_ptr->fsm_msg_cnt = 0; 948 l_ptr->fsm_msg_cnt = 0;
949 link_activate(l_ptr); 949 link_activate(l_ptr);
950 link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 950 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
951 l_ptr->fsm_msg_cnt++; 951 l_ptr->fsm_msg_cnt++;
952 link_set_timer(l_ptr, cont_intv); 952 link_set_timer(l_ptr, cont_intv);
953 break; 953 break;
@@ -956,7 +956,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
956 break; 956 break;
957 case TIMEOUT_EVT: 957 case TIMEOUT_EVT:
958 dbg_link("TIM\n"); 958 dbg_link("TIM\n");
959 link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 959 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
960 l_ptr->fsm_msg_cnt++; 960 l_ptr->fsm_msg_cnt++;
961 link_set_timer(l_ptr, cont_intv); 961 link_set_timer(l_ptr, cont_intv);
962 dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt); 962 dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt);
@@ -1023,12 +1023,12 @@ static inline void link_add_to_outqueue(struct link *l_ptr,
1023} 1023}
1024 1024
1025/* 1025/*
1026 * link_send_buf() is the 'full path' for messages, called from 1026 * tipc_link_send_buf() is the 'full path' for messages, called from
1027 * inside TIPC when the 'fast path' in tipc_send_buf 1027 * inside TIPC when the 'fast path' in tipc_send_buf
1028 * has failed, and from link_send() 1028 * has failed, and from link_send()
1029 */ 1029 */
1030 1030
1031int link_send_buf(struct link *l_ptr, struct sk_buff *buf) 1031int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1032{ 1032{
1033 struct tipc_msg *msg = buf_msg(buf); 1033 struct tipc_msg *msg = buf_msg(buf);
1034 u32 size = msg_size(msg); 1034 u32 size = msg_size(msg);
@@ -1051,7 +1051,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1051 buf_discard(buf); 1051 buf_discard(buf);
1052 if (imp > CONN_MANAGER) { 1052 if (imp > CONN_MANAGER) {
1053 warn("Resetting <%s>, send queue full", l_ptr->name); 1053 warn("Resetting <%s>, send queue full", l_ptr->name);
1054 link_reset(l_ptr); 1054 tipc_link_reset(l_ptr);
1055 } 1055 }
1056 return dsz; 1056 return dsz;
1057 } 1057 }
@@ -1059,21 +1059,21 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1059 /* Fragmentation needed ? */ 1059 /* Fragmentation needed ? */
1060 1060
1061 if (size > max_packet) 1061 if (size > max_packet)
1062 return link_send_long_buf(l_ptr, buf); 1062 return tipc_link_send_long_buf(l_ptr, buf);
1063 1063
1064 /* Packet can be queued or sent: */ 1064 /* Packet can be queued or sent: */
1065 1065
1066 if (queue_size > l_ptr->stats.max_queue_sz) 1066 if (queue_size > l_ptr->stats.max_queue_sz)
1067 l_ptr->stats.max_queue_sz = queue_size; 1067 l_ptr->stats.max_queue_sz = queue_size;
1068 1068
1069 if (likely(!bearer_congested(l_ptr->b_ptr, l_ptr) && 1069 if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
1070 !link_congested(l_ptr))) { 1070 !link_congested(l_ptr))) {
1071 link_add_to_outqueue(l_ptr, buf, msg); 1071 link_add_to_outqueue(l_ptr, buf, msg);
1072 1072
1073 if (likely(bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) { 1073 if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) {
1074 l_ptr->unacked_window = 0; 1074 l_ptr->unacked_window = 0;
1075 } else { 1075 } else {
1076 bearer_schedule(l_ptr->b_ptr, l_ptr); 1076 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1077 l_ptr->stats.bearer_congs++; 1077 l_ptr->stats.bearer_congs++;
1078 l_ptr->next_out = buf; 1078 l_ptr->next_out = buf;
1079 } 1079 }
@@ -1088,7 +1088,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1088 1088
1089 if (l_ptr->next_out && 1089 if (l_ptr->next_out &&
1090 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { 1090 link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
1091 bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 1091 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
1092 return dsz; 1092 return dsz;
1093 } 1093 }
1094 1094
@@ -1114,38 +1114,38 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1114 if (!l_ptr->next_out) 1114 if (!l_ptr->next_out)
1115 l_ptr->next_out = buf; 1115 l_ptr->next_out = buf;
1116 link_add_to_outqueue(l_ptr, buf, msg); 1116 link_add_to_outqueue(l_ptr, buf, msg);
1117 bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); 1117 tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
1118 return dsz; 1118 return dsz;
1119} 1119}
1120 1120
1121/* 1121/*
1122 * link_send(): same as link_send_buf(), but the link to use has 1122 * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has
1123 * not been selected yet, and the the owner node is not locked 1123 * not been selected yet, and the the owner node is not locked
1124 * Called by TIPC internal users, e.g. the name distributor 1124 * Called by TIPC internal users, e.g. the name distributor
1125 */ 1125 */
1126 1126
1127int link_send(struct sk_buff *buf, u32 dest, u32 selector) 1127int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
1128{ 1128{
1129 struct link *l_ptr; 1129 struct link *l_ptr;
1130 struct node *n_ptr; 1130 struct node *n_ptr;
1131 int res = -ELINKCONG; 1131 int res = -ELINKCONG;
1132 1132
1133 read_lock_bh(&net_lock); 1133 read_lock_bh(&tipc_net_lock);
1134 n_ptr = node_select(dest, selector); 1134 n_ptr = tipc_node_select(dest, selector);
1135 if (n_ptr) { 1135 if (n_ptr) {
1136 node_lock(n_ptr); 1136 tipc_node_lock(n_ptr);
1137 l_ptr = n_ptr->active_links[selector & 1]; 1137 l_ptr = n_ptr->active_links[selector & 1];
1138 dbg("link_send: found link %x for dest %x\n", l_ptr, dest); 1138 dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
1139 if (l_ptr) { 1139 if (l_ptr) {
1140 res = link_send_buf(l_ptr, buf); 1140 res = tipc_link_send_buf(l_ptr, buf);
1141 } 1141 }
1142 node_unlock(n_ptr); 1142 tipc_node_unlock(n_ptr);
1143 } else { 1143 } else {
1144 dbg("Attempt to send msg to unknown node:\n"); 1144 dbg("Attempt to send msg to unknown node:\n");
1145 msg_dbg(buf_msg(buf),">>>"); 1145 msg_dbg(buf_msg(buf),">>>");
1146 buf_discard(buf); 1146 buf_discard(buf);
1147 } 1147 }
1148 read_unlock_bh(&net_lock); 1148 read_unlock_bh(&tipc_net_lock);
1149 return res; 1149 return res;
1150} 1150}
1151 1151
@@ -1166,14 +1166,14 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1166 if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) { 1166 if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) {
1167 if (likely(list_empty(&l_ptr->b_ptr->cong_links))) { 1167 if (likely(list_empty(&l_ptr->b_ptr->cong_links))) {
1168 link_add_to_outqueue(l_ptr, buf, msg); 1168 link_add_to_outqueue(l_ptr, buf, msg);
1169 if (likely(bearer_send(l_ptr->b_ptr, buf, 1169 if (likely(tipc_bearer_send(l_ptr->b_ptr, buf,
1170 &l_ptr->media_addr))) { 1170 &l_ptr->media_addr))) {
1171 l_ptr->unacked_window = 0; 1171 l_ptr->unacked_window = 0;
1172 msg_dbg(msg,"SENT_FAST:"); 1172 msg_dbg(msg,"SENT_FAST:");
1173 return res; 1173 return res;
1174 } 1174 }
1175 dbg("failed sent fast...\n"); 1175 dbg("failed sent fast...\n");
1176 bearer_schedule(l_ptr->b_ptr, l_ptr); 1176 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1177 l_ptr->stats.bearer_congs++; 1177 l_ptr->stats.bearer_congs++;
1178 l_ptr->next_out = buf; 1178 l_ptr->next_out = buf;
1179 return res; 1179 return res;
@@ -1182,7 +1182,7 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
1182 else 1182 else
1183 *used_max_pkt = link_max_pkt(l_ptr); 1183 *used_max_pkt = link_max_pkt(l_ptr);
1184 } 1184 }
1185 return link_send_buf(l_ptr, buf); /* All other cases */ 1185 return tipc_link_send_buf(l_ptr, buf); /* All other cases */
1186} 1186}
1187 1187
1188/* 1188/*
@@ -1200,24 +1200,24 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1200 u32 dummy; 1200 u32 dummy;
1201 1201
1202 if (destnode == tipc_own_addr) 1202 if (destnode == tipc_own_addr)
1203 return port_recv_msg(buf); 1203 return tipc_port_recv_msg(buf);
1204 1204
1205 read_lock_bh(&net_lock); 1205 read_lock_bh(&tipc_net_lock);
1206 n_ptr = node_select(destnode, selector); 1206 n_ptr = tipc_node_select(destnode, selector);
1207 if (likely(n_ptr)) { 1207 if (likely(n_ptr)) {
1208 node_lock(n_ptr); 1208 tipc_node_lock(n_ptr);
1209 l_ptr = n_ptr->active_links[selector]; 1209 l_ptr = n_ptr->active_links[selector];
1210 dbg("send_fast: buf %x selected %x, destnode = %x\n", 1210 dbg("send_fast: buf %x selected %x, destnode = %x\n",
1211 buf, l_ptr, destnode); 1211 buf, l_ptr, destnode);
1212 if (likely(l_ptr)) { 1212 if (likely(l_ptr)) {
1213 res = link_send_buf_fast(l_ptr, buf, &dummy); 1213 res = link_send_buf_fast(l_ptr, buf, &dummy);
1214 node_unlock(n_ptr); 1214 tipc_node_unlock(n_ptr);
1215 read_unlock_bh(&net_lock); 1215 read_unlock_bh(&tipc_net_lock);
1216 return res; 1216 return res;
1217 } 1217 }
1218 node_unlock(n_ptr); 1218 tipc_node_unlock(n_ptr);
1219 } 1219 }
1220 read_unlock_bh(&net_lock); 1220 read_unlock_bh(&tipc_net_lock);
1221 res = msg_data_sz(buf_msg(buf)); 1221 res = msg_data_sz(buf_msg(buf));
1222 tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1222 tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1223 return res; 1223 return res;
@@ -1225,15 +1225,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1225 1225
1226 1226
1227/* 1227/*
1228 * link_send_sections_fast: Entry for messages where the 1228 * tipc_link_send_sections_fast: Entry for messages where the
1229 * destination processor is known and the header is complete, 1229 * destination processor is known and the header is complete,
1230 * except for total message length. 1230 * except for total message length.
1231 * Returns user data length or errno. 1231 * Returns user data length or errno.
1232 */ 1232 */
1233int link_send_sections_fast(struct port *sender, 1233int tipc_link_send_sections_fast(struct port *sender,
1234 struct iovec const *msg_sect, 1234 struct iovec const *msg_sect,
1235 const u32 num_sect, 1235 const u32 num_sect,
1236 u32 destaddr) 1236 u32 destaddr)
1237{ 1237{
1238 struct tipc_msg *hdr = &sender->publ.phdr; 1238 struct tipc_msg *hdr = &sender->publ.phdr;
1239 struct link *l_ptr; 1239 struct link *l_ptr;
@@ -1253,10 +1253,10 @@ again:
1253 res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt, 1253 res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt,
1254 !sender->user_port, &buf); 1254 !sender->user_port, &buf);
1255 1255
1256 read_lock_bh(&net_lock); 1256 read_lock_bh(&tipc_net_lock);
1257 node = node_select(destaddr, selector); 1257 node = tipc_node_select(destaddr, selector);
1258 if (likely(node)) { 1258 if (likely(node)) {
1259 node_lock(node); 1259 tipc_node_lock(node);
1260 l_ptr = node->active_links[selector]; 1260 l_ptr = node->active_links[selector];
1261 if (likely(l_ptr)) { 1261 if (likely(l_ptr)) {
1262 if (likely(buf)) { 1262 if (likely(buf)) {
@@ -1265,8 +1265,8 @@ again:
1265 if (unlikely(res < 0)) 1265 if (unlikely(res < 0))
1266 buf_discard(buf); 1266 buf_discard(buf);
1267exit: 1267exit:
1268 node_unlock(node); 1268 tipc_node_unlock(node);
1269 read_unlock_bh(&net_lock); 1269 read_unlock_bh(&tipc_net_lock);
1270 return res; 1270 return res;
1271 } 1271 }
1272 1272
@@ -1290,8 +1290,8 @@ exit:
1290 */ 1290 */
1291 1291
1292 sender->max_pkt = link_max_pkt(l_ptr); 1292 sender->max_pkt = link_max_pkt(l_ptr);
1293 node_unlock(node); 1293 tipc_node_unlock(node);
1294 read_unlock_bh(&net_lock); 1294 read_unlock_bh(&tipc_net_lock);
1295 1295
1296 1296
1297 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) 1297 if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt)
@@ -1300,17 +1300,17 @@ exit:
1300 return link_send_sections_long(sender, msg_sect, 1300 return link_send_sections_long(sender, msg_sect,
1301 num_sect, destaddr); 1301 num_sect, destaddr);
1302 } 1302 }
1303 node_unlock(node); 1303 tipc_node_unlock(node);
1304 } 1304 }
1305 read_unlock_bh(&net_lock); 1305 read_unlock_bh(&tipc_net_lock);
1306 1306
1307 /* Couldn't find a link to the destination node */ 1307 /* Couldn't find a link to the destination node */
1308 1308
1309 if (buf) 1309 if (buf)
1310 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1310 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1311 if (res >= 0) 1311 if (res >= 0)
1312 return port_reject_sections(sender, hdr, msg_sect, num_sect, 1312 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1313 TIPC_ERR_NO_NODE); 1313 TIPC_ERR_NO_NODE);
1314 return res; 1314 return res;
1315} 1315}
1316 1316
@@ -1444,17 +1444,17 @@ error:
1444 * Now we have a buffer chain. Select a link and check 1444 * Now we have a buffer chain. Select a link and check
1445 * that packet size is still OK 1445 * that packet size is still OK
1446 */ 1446 */
1447 node = node_select(destaddr, sender->publ.ref & 1); 1447 node = tipc_node_select(destaddr, sender->publ.ref & 1);
1448 if (likely(node)) { 1448 if (likely(node)) {
1449 node_lock(node); 1449 tipc_node_lock(node);
1450 l_ptr = node->active_links[sender->publ.ref & 1]; 1450 l_ptr = node->active_links[sender->publ.ref & 1];
1451 if (!l_ptr) { 1451 if (!l_ptr) {
1452 node_unlock(node); 1452 tipc_node_unlock(node);
1453 goto reject; 1453 goto reject;
1454 } 1454 }
1455 if (link_max_pkt(l_ptr) < max_pkt) { 1455 if (link_max_pkt(l_ptr) < max_pkt) {
1456 sender->max_pkt = link_max_pkt(l_ptr); 1456 sender->max_pkt = link_max_pkt(l_ptr);
1457 node_unlock(node); 1457 tipc_node_unlock(node);
1458 for (; buf_chain; buf_chain = buf) { 1458 for (; buf_chain; buf_chain = buf) {
1459 buf = buf_chain->next; 1459 buf = buf_chain->next;
1460 buf_discard(buf_chain); 1460 buf_discard(buf_chain);
@@ -1467,8 +1467,8 @@ reject:
1467 buf = buf_chain->next; 1467 buf = buf_chain->next;
1468 buf_discard(buf_chain); 1468 buf_discard(buf_chain);
1469 } 1469 }
1470 return port_reject_sections(sender, hdr, msg_sect, num_sect, 1470 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1471 TIPC_ERR_NO_NODE); 1471 TIPC_ERR_NO_NODE);
1472 } 1472 }
1473 1473
1474 /* Append whole chain to send queue: */ 1474 /* Append whole chain to send queue: */
@@ -1491,15 +1491,15 @@ reject:
1491 1491
1492 /* Send it, if possible: */ 1492 /* Send it, if possible: */
1493 1493
1494 link_push_queue(l_ptr); 1494 tipc_link_push_queue(l_ptr);
1495 node_unlock(node); 1495 tipc_node_unlock(node);
1496 return dsz; 1496 return dsz;
1497} 1497}
1498 1498
1499/* 1499/*
1500 * link_push_packet: Push one unsent packet to the media 1500 * tipc_link_push_packet: Push one unsent packet to the media
1501 */ 1501 */
1502u32 link_push_packet(struct link *l_ptr) 1502u32 tipc_link_push_packet(struct link *l_ptr)
1503{ 1503{
1504 struct sk_buff *buf = l_ptr->first_out; 1504 struct sk_buff *buf = l_ptr->first_out;
1505 u32 r_q_size = l_ptr->retransm_queue_size; 1505 u32 r_q_size = l_ptr->retransm_queue_size;
@@ -1526,7 +1526,7 @@ u32 link_push_packet(struct link *l_ptr)
1526 if (r_q_size && buf && !skb_cloned(buf)) { 1526 if (r_q_size && buf && !skb_cloned(buf)) {
1527 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1527 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1528 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1528 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
1529 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1529 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1530 msg_dbg(buf_msg(buf), ">DEF-RETR>"); 1530 msg_dbg(buf_msg(buf), ">DEF-RETR>");
1531 l_ptr->retransm_queue_head = mod(++r_q_head); 1531 l_ptr->retransm_queue_head = mod(++r_q_head);
1532 l_ptr->retransm_queue_size = --r_q_size; 1532 l_ptr->retransm_queue_size = --r_q_size;
@@ -1545,7 +1545,7 @@ u32 link_push_packet(struct link *l_ptr)
1545 if (buf) { 1545 if (buf) {
1546 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); 1546 msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
1547 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); 1547 msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in);
1548 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1548 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1549 msg_dbg(buf_msg(buf), ">DEF-PROT>"); 1549 msg_dbg(buf_msg(buf), ">DEF-PROT>");
1550 l_ptr->unacked_window = 0; 1550 l_ptr->unacked_window = 0;
1551 buf_discard(buf); 1551 buf_discard(buf);
@@ -1569,7 +1569,7 @@ u32 link_push_packet(struct link *l_ptr)
1569 if (mod(next - first) < l_ptr->queue_limit[0]) { 1569 if (mod(next - first) < l_ptr->queue_limit[0]) {
1570 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1570 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1571 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1571 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1572 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1572 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1573 if (msg_user(msg) == MSG_BUNDLER) 1573 if (msg_user(msg) == MSG_BUNDLER)
1574 msg_set_type(msg, CLOSED_MSG); 1574 msg_set_type(msg, CLOSED_MSG);
1575 msg_dbg(msg, ">PUSH-DATA>"); 1575 msg_dbg(msg, ">PUSH-DATA>");
@@ -1589,29 +1589,29 @@ u32 link_push_packet(struct link *l_ptr)
1589 * push_queue(): push out the unsent messages of a link where 1589 * push_queue(): push out the unsent messages of a link where
1590 * congestion has abated. Node is locked 1590 * congestion has abated. Node is locked
1591 */ 1591 */
1592void link_push_queue(struct link *l_ptr) 1592void tipc_link_push_queue(struct link *l_ptr)
1593{ 1593{
1594 u32 res; 1594 u32 res;
1595 1595
1596 if (bearer_congested(l_ptr->b_ptr, l_ptr)) 1596 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr))
1597 return; 1597 return;
1598 1598
1599 do { 1599 do {
1600 res = link_push_packet(l_ptr); 1600 res = tipc_link_push_packet(l_ptr);
1601 } 1601 }
1602 while (res == TIPC_OK); 1602 while (res == TIPC_OK);
1603 if (res == PUSH_FAILED) 1603 if (res == PUSH_FAILED)
1604 bearer_schedule(l_ptr->b_ptr, l_ptr); 1604 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1605} 1605}
1606 1606
1607void link_retransmit(struct link *l_ptr, struct sk_buff *buf, 1607void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1608 u32 retransmits) 1608 u32 retransmits)
1609{ 1609{
1610 struct tipc_msg *msg; 1610 struct tipc_msg *msg;
1611 1611
1612 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); 1612 dbg("Retransmitting %u in link %x\n", retransmits, l_ptr);
1613 1613
1614 if (bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { 1614 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) {
1615 msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>"); 1615 msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>");
1616 dbg_print_link(l_ptr, " "); 1616 dbg_print_link(l_ptr, " ");
1617 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); 1617 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
@@ -1622,15 +1622,15 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1622 msg = buf_msg(buf); 1622 msg = buf_msg(buf);
1623 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1623 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
1624 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1624 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1625 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1625 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1626 /* Catch if retransmissions fail repeatedly: */ 1626 /* Catch if retransmissions fail repeatedly: */
1627 if (l_ptr->last_retransmitted == msg_seqno(msg)) { 1627 if (l_ptr->last_retransmitted == msg_seqno(msg)) {
1628 if (++l_ptr->stale_count > 100) { 1628 if (++l_ptr->stale_count > 100) {
1629 msg_print(CONS, buf_msg(buf), ">RETR>"); 1629 tipc_msg_print(TIPC_CONS, buf_msg(buf), ">RETR>");
1630 info("...Retransmitted %u times\n", 1630 info("...Retransmitted %u times\n",
1631 l_ptr->stale_count); 1631 l_ptr->stale_count);
1632 link_print(l_ptr, CONS, "Resetting Link\n");; 1632 link_print(l_ptr, TIPC_CONS, "Resetting Link\n");;
1633 link_reset(l_ptr); 1633 tipc_link_reset(l_ptr);
1634 break; 1634 break;
1635 } 1635 }
1636 } else { 1636 } else {
@@ -1643,7 +1643,7 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1643 retransmits--; 1643 retransmits--;
1644 l_ptr->stats.retransmitted++; 1644 l_ptr->stats.retransmitted++;
1645 } else { 1645 } else {
1646 bearer_schedule(l_ptr->b_ptr, l_ptr); 1646 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
1647 l_ptr->stats.bearer_congs++; 1647 l_ptr->stats.bearer_congs++;
1648 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); 1648 l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
1649 l_ptr->retransm_queue_size = retransmits; 1649 l_ptr->retransm_queue_size = retransmits;
@@ -1663,9 +1663,9 @@ static void link_recv_non_seq(struct sk_buff *buf)
1663 struct tipc_msg *msg = buf_msg(buf); 1663 struct tipc_msg *msg = buf_msg(buf);
1664 1664
1665 if (msg_user(msg) == LINK_CONFIG) 1665 if (msg_user(msg) == LINK_CONFIG)
1666 disc_recv_msg(buf); 1666 tipc_disc_recv_msg(buf);
1667 else 1667 else
1668 bclink_recv_pkt(buf); 1668 tipc_bclink_recv_pkt(buf);
1669} 1669}
1670 1670
1671/** 1671/**
@@ -1692,7 +1692,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr,
1692 1692
1693void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) 1693void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1694{ 1694{
1695 read_lock_bh(&net_lock); 1695 read_lock_bh(&tipc_net_lock);
1696 while (head) { 1696 while (head) {
1697 struct bearer *b_ptr; 1697 struct bearer *b_ptr;
1698 struct node *n_ptr; 1698 struct node *n_ptr;
@@ -1720,22 +1720,22 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1720 link_recv_non_seq(buf); 1720 link_recv_non_seq(buf);
1721 continue; 1721 continue;
1722 } 1722 }
1723 n_ptr = node_find(msg_prevnode(msg)); 1723 n_ptr = tipc_node_find(msg_prevnode(msg));
1724 if (unlikely(!n_ptr)) 1724 if (unlikely(!n_ptr))
1725 goto cont; 1725 goto cont;
1726 1726
1727 node_lock(n_ptr); 1727 tipc_node_lock(n_ptr);
1728 l_ptr = n_ptr->links[b_ptr->identity]; 1728 l_ptr = n_ptr->links[b_ptr->identity];
1729 if (unlikely(!l_ptr)) { 1729 if (unlikely(!l_ptr)) {
1730 node_unlock(n_ptr); 1730 tipc_node_unlock(n_ptr);
1731 goto cont; 1731 goto cont;
1732 } 1732 }
1733 /* 1733 /*
1734 * Release acked messages 1734 * Release acked messages
1735 */ 1735 */
1736 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { 1736 if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
1737 if (node_is_up(n_ptr) && n_ptr->bclink.supported) 1737 if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
1738 bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); 1738 tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739 } 1739 }
1740 1740
1741 crs = l_ptr->first_out; 1741 crs = l_ptr->first_out;
@@ -1752,12 +1752,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
1752 l_ptr->out_queue_size -= released; 1752 l_ptr->out_queue_size -= released;
1753 } 1753 }
1754 if (unlikely(l_ptr->next_out)) 1754 if (unlikely(l_ptr->next_out))
1755 link_push_queue(l_ptr); 1755 tipc_link_push_queue(l_ptr);
1756 if (unlikely(!list_empty(&l_ptr->waiting_ports))) 1756 if (unlikely(!list_empty(&l_ptr->waiting_ports)))
1757 link_wakeup_ports(l_ptr, 0); 1757 tipc_link_wakeup_ports(l_ptr, 0);
1758 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) { 1758 if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) {
1759 l_ptr->stats.sent_acks++; 1759 l_ptr->stats.sent_acks++;
1760 link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1760 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1761 } 1761 }
1762 1762
1763protocol_check: 1763protocol_check:
@@ -1770,8 +1770,8 @@ protocol_check:
1770 if (likely(msg_is_dest(msg, tipc_own_addr))) { 1770 if (likely(msg_is_dest(msg, tipc_own_addr))) {
1771deliver: 1771deliver:
1772 if (likely(msg_isdata(msg))) { 1772 if (likely(msg_isdata(msg))) {
1773 node_unlock(n_ptr); 1773 tipc_node_unlock(n_ptr);
1774 port_recv_msg(buf); 1774 tipc_port_recv_msg(buf);
1775 continue; 1775 continue;
1776 } 1776 }
1777 switch (msg_user(msg)) { 1777 switch (msg_user(msg)) {
@@ -1779,34 +1779,32 @@ deliver:
1779 l_ptr->stats.recv_bundles++; 1779 l_ptr->stats.recv_bundles++;
1780 l_ptr->stats.recv_bundled += 1780 l_ptr->stats.recv_bundled +=
1781 msg_msgcnt(msg); 1781 msg_msgcnt(msg);
1782 node_unlock(n_ptr); 1782 tipc_node_unlock(n_ptr);
1783 link_recv_bundle(buf); 1783 tipc_link_recv_bundle(buf);
1784 continue; 1784 continue;
1785 case ROUTE_DISTRIBUTOR: 1785 case ROUTE_DISTRIBUTOR:
1786 node_unlock(n_ptr); 1786 tipc_node_unlock(n_ptr);
1787 cluster_recv_routing_table(buf); 1787 tipc_cltr_recv_routing_table(buf);
1788 continue; 1788 continue;
1789 case NAME_DISTRIBUTOR: 1789 case NAME_DISTRIBUTOR:
1790 node_unlock(n_ptr); 1790 tipc_node_unlock(n_ptr);
1791 named_recv(buf); 1791 tipc_named_recv(buf);
1792 continue; 1792 continue;
1793 case CONN_MANAGER: 1793 case CONN_MANAGER:
1794 node_unlock(n_ptr); 1794 tipc_node_unlock(n_ptr);
1795 port_recv_proto_msg(buf); 1795 tipc_port_recv_proto_msg(buf);
1796 continue; 1796 continue;
1797 case MSG_FRAGMENTER: 1797 case MSG_FRAGMENTER:
1798 l_ptr->stats.recv_fragments++; 1798 l_ptr->stats.recv_fragments++;
1799 if (link_recv_fragment( 1799 if (tipc_link_recv_fragment(&l_ptr->defragm_buf,
1800 &l_ptr->defragm_buf, 1800 &buf, &msg)) {
1801 &buf, &msg)) {
1802 l_ptr->stats.recv_fragmented++; 1801 l_ptr->stats.recv_fragmented++;
1803 goto deliver; 1802 goto deliver;
1804 } 1803 }
1805 break; 1804 break;
1806 case CHANGEOVER_PROTOCOL: 1805 case CHANGEOVER_PROTOCOL:
1807 type = msg_type(msg); 1806 type = msg_type(msg);
1808 if (link_recv_changeover_msg( 1807 if (link_recv_changeover_msg(&l_ptr, &buf)) {
1809 &l_ptr, &buf)) {
1810 msg = buf_msg(buf); 1808 msg = buf_msg(buf);
1811 seq_no = msg_seqno(msg); 1809 seq_no = msg_seqno(msg);
1812 TIPC_SKB_CB(buf)->handle 1810 TIPC_SKB_CB(buf)->handle
@@ -1818,20 +1816,20 @@ deliver:
1818 break; 1816 break;
1819 } 1817 }
1820 } 1818 }
1821 node_unlock(n_ptr); 1819 tipc_node_unlock(n_ptr);
1822 net_route_msg(buf); 1820 tipc_net_route_msg(buf);
1823 continue; 1821 continue;
1824 } 1822 }
1825 link_handle_out_of_seq_msg(l_ptr, buf); 1823 link_handle_out_of_seq_msg(l_ptr, buf);
1826 head = link_insert_deferred_queue(l_ptr, head); 1824 head = link_insert_deferred_queue(l_ptr, head);
1827 node_unlock(n_ptr); 1825 tipc_node_unlock(n_ptr);
1828 continue; 1826 continue;
1829 } 1827 }
1830 1828
1831 if (msg_user(msg) == LINK_PROTOCOL) { 1829 if (msg_user(msg) == LINK_PROTOCOL) {
1832 link_recv_proto_msg(l_ptr, buf); 1830 link_recv_proto_msg(l_ptr, buf);
1833 head = link_insert_deferred_queue(l_ptr, head); 1831 head = link_insert_deferred_queue(l_ptr, head);
1834 node_unlock(n_ptr); 1832 tipc_node_unlock(n_ptr);
1835 continue; 1833 continue;
1836 } 1834 }
1837 msg_dbg(msg,"NSEQ<REC<"); 1835 msg_dbg(msg,"NSEQ<REC<");
@@ -1842,14 +1840,14 @@ deliver:
1842 msg_dbg(msg,"RECV-REINS:"); 1840 msg_dbg(msg,"RECV-REINS:");
1843 buf->next = head; 1841 buf->next = head;
1844 head = buf; 1842 head = buf;
1845 node_unlock(n_ptr); 1843 tipc_node_unlock(n_ptr);
1846 continue; 1844 continue;
1847 } 1845 }
1848 node_unlock(n_ptr); 1846 tipc_node_unlock(n_ptr);
1849cont: 1847cont:
1850 buf_discard(buf); 1848 buf_discard(buf);
1851 } 1849 }
1852 read_unlock_bh(&net_lock); 1850 read_unlock_bh(&tipc_net_lock);
1853} 1851}
1854 1852
1855/* 1853/*
@@ -1858,9 +1856,9 @@ cont:
1858 * Returns the increase of the queue length,i.e. 0 or 1 1856 * Returns the increase of the queue length,i.e. 0 or 1
1859 */ 1857 */
1860 1858
1861u32 link_defer_pkt(struct sk_buff **head, 1859u32 tipc_link_defer_pkt(struct sk_buff **head,
1862 struct sk_buff **tail, 1860 struct sk_buff **tail,
1863 struct sk_buff *buf) 1861 struct sk_buff *buf)
1864{ 1862{
1865 struct sk_buff *prev = 0; 1863 struct sk_buff *prev = 0;
1866 struct sk_buff *crs = *head; 1864 struct sk_buff *crs = *head;
@@ -1939,12 +1937,12 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1939 return; 1937 return;
1940 } 1938 }
1941 1939
1942 if (link_defer_pkt(&l_ptr->oldest_deferred_in, 1940 if (tipc_link_defer_pkt(&l_ptr->oldest_deferred_in,
1943 &l_ptr->newest_deferred_in, buf)) { 1941 &l_ptr->newest_deferred_in, buf)) {
1944 l_ptr->deferred_inqueue_sz++; 1942 l_ptr->deferred_inqueue_sz++;
1945 l_ptr->stats.deferred_recv++; 1943 l_ptr->stats.deferred_recv++;
1946 if ((l_ptr->deferred_inqueue_sz % 16) == 1) 1944 if ((l_ptr->deferred_inqueue_sz % 16) == 1)
1947 link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); 1945 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
1948 } else 1946 } else
1949 l_ptr->stats.duplicates++; 1947 l_ptr->stats.duplicates++;
1950} 1948}
@@ -1952,8 +1950,8 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
1952/* 1950/*
1953 * Send protocol message to the other endpoint. 1951 * Send protocol message to the other endpoint.
1954 */ 1952 */
1955void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, 1953void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
1956 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) 1954 u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
1957{ 1955{
1958 struct sk_buff *buf = 0; 1956 struct sk_buff *buf = 0;
1959 struct tipc_msg *msg = l_ptr->pmsg; 1957 struct tipc_msg *msg = l_ptr->pmsg;
@@ -1964,12 +1962,12 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
1964 msg_set_type(msg, msg_typ); 1962 msg_set_type(msg, msg_typ);
1965 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); 1963 msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
1966 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); 1964 msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in));
1967 msg_set_last_bcast(msg, bclink_get_last_sent()); 1965 msg_set_last_bcast(msg, tipc_bclink_get_last_sent());
1968 1966
1969 if (msg_typ == STATE_MSG) { 1967 if (msg_typ == STATE_MSG) {
1970 u32 next_sent = mod(l_ptr->next_out_no); 1968 u32 next_sent = mod(l_ptr->next_out_no);
1971 1969
1972 if (!link_is_up(l_ptr)) 1970 if (!tipc_link_is_up(l_ptr))
1973 return; 1971 return;
1974 if (l_ptr->next_out) 1972 if (l_ptr->next_out)
1975 next_sent = msg_seqno(buf_msg(l_ptr->next_out)); 1973 next_sent = msg_seqno(buf_msg(l_ptr->next_out));
@@ -2013,7 +2011,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2013 msg_set_max_pkt(msg, l_ptr->max_pkt_target); 2011 msg_set_max_pkt(msg, l_ptr->max_pkt_target);
2014 } 2012 }
2015 2013
2016 if (node_has_redundant_links(l_ptr->owner)) { 2014 if (tipc_node_has_redundant_links(l_ptr->owner)) {
2017 msg_set_redundant_link(msg); 2015 msg_set_redundant_link(msg);
2018 } else { 2016 } else {
2019 msg_clear_redundant_link(msg); 2017 msg_clear_redundant_link(msg);
@@ -2026,7 +2024,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2026 2024
2027 /* Congestion? */ 2025 /* Congestion? */
2028 2026
2029 if (bearer_congested(l_ptr->b_ptr, l_ptr)) { 2027 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2030 if (!l_ptr->proto_msg_queue) { 2028 if (!l_ptr->proto_msg_queue) {
2031 l_ptr->proto_msg_queue = 2029 l_ptr->proto_msg_queue =
2032 buf_acquire(sizeof(l_ptr->proto_msg)); 2030 buf_acquire(sizeof(l_ptr->proto_msg));
@@ -2050,14 +2048,14 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2050 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); 2048 memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
2051 msg_set_size(buf_msg(buf), msg_size); 2049 msg_set_size(buf_msg(buf), msg_size);
2052 2050
2053 if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 2051 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
2054 l_ptr->unacked_window = 0; 2052 l_ptr->unacked_window = 0;
2055 buf_discard(buf); 2053 buf_discard(buf);
2056 return; 2054 return;
2057 } 2055 }
2058 2056
2059 /* New congestion */ 2057 /* New congestion */
2060 bearer_schedule(l_ptr->b_ptr, l_ptr); 2058 tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
2061 l_ptr->proto_msg_queue = buf; 2059 l_ptr->proto_msg_queue = buf;
2062 l_ptr->stats.bearer_congs++; 2060 l_ptr->stats.bearer_congs++;
2063} 2061}
@@ -2131,7 +2129,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2131 l_ptr->peer_bearer_id = msg_bearer_id(msg); 2129 l_ptr->peer_bearer_id = msg_bearer_id(msg);
2132 2130
2133 /* Synchronize broadcast sequence numbers */ 2131 /* Synchronize broadcast sequence numbers */
2134 if (!node_has_redundant_links(l_ptr->owner)) { 2132 if (!tipc_node_has_redundant_links(l_ptr->owner)) {
2135 l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); 2133 l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg));
2136 } 2134 }
2137 break; 2135 break;
@@ -2145,7 +2143,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2145 warn("Changing prio <%s>: %u->%u\n", 2143 warn("Changing prio <%s>: %u->%u\n",
2146 l_ptr->name, l_ptr->priority, msg_linkprio(msg)); 2144 l_ptr->name, l_ptr->priority, msg_linkprio(msg));
2147 l_ptr->priority = msg_linkprio(msg); 2145 l_ptr->priority = msg_linkprio(msg);
2148 link_reset(l_ptr); /* Enforce change to take effect */ 2146 tipc_link_reset(l_ptr); /* Enforce change to take effect */
2149 break; 2147 break;
2150 } 2148 }
2151 link_state_event(l_ptr, TRAFFIC_MSG_EVT); 2149 link_state_event(l_ptr, TRAFFIC_MSG_EVT);
@@ -2176,17 +2174,17 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2176 2174
2177 /* Protocol message before retransmits, reduce loss risk */ 2175 /* Protocol message before retransmits, reduce loss risk */
2178 2176
2179 bclink_check_gap(l_ptr->owner, msg_last_bcast(msg)); 2177 tipc_bclink_check_gap(l_ptr->owner, msg_last_bcast(msg));
2180 2178
2181 if (rec_gap || (msg_probe(msg))) { 2179 if (rec_gap || (msg_probe(msg))) {
2182 link_send_proto_msg(l_ptr, STATE_MSG, 2180 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2183 0, rec_gap, 0, 0, max_pkt_ack); 2181 0, rec_gap, 0, 0, max_pkt_ack);
2184 } 2182 }
2185 if (msg_seq_gap(msg)) { 2183 if (msg_seq_gap(msg)) {
2186 msg_dbg(msg, "With Gap:"); 2184 msg_dbg(msg, "With Gap:");
2187 l_ptr->stats.recv_nacks++; 2185 l_ptr->stats.recv_nacks++;
2188 link_retransmit(l_ptr, l_ptr->first_out, 2186 tipc_link_retransmit(l_ptr, l_ptr->first_out,
2189 msg_seq_gap(msg)); 2187 msg_seq_gap(msg));
2190 } 2188 }
2191 break; 2189 break;
2192 default: 2190 default:
@@ -2198,20 +2196,20 @@ exit:
2198 2196
2199 2197
2200/* 2198/*
2201 * link_tunnel(): Send one message via a link belonging to 2199 * tipc_link_tunnel(): Send one message via a link belonging to
2202 * another bearer. Owner node is locked. 2200 * another bearer. Owner node is locked.
2203 */ 2201 */
2204void link_tunnel(struct link *l_ptr, 2202void tipc_link_tunnel(struct link *l_ptr,
2205 struct tipc_msg *tunnel_hdr, 2203 struct tipc_msg *tunnel_hdr,
2206 struct tipc_msg *msg, 2204 struct tipc_msg *msg,
2207 u32 selector) 2205 u32 selector)
2208{ 2206{
2209 struct link *tunnel; 2207 struct link *tunnel;
2210 struct sk_buff *buf; 2208 struct sk_buff *buf;
2211 u32 length = msg_size(msg); 2209 u32 length = msg_size(msg);
2212 2210
2213 tunnel = l_ptr->owner->active_links[selector & 1]; 2211 tunnel = l_ptr->owner->active_links[selector & 1];
2214 if (!link_is_up(tunnel)) 2212 if (!tipc_link_is_up(tunnel))
2215 return; 2213 return;
2216 msg_set_size(tunnel_hdr, length + INT_H_SIZE); 2214 msg_set_size(tunnel_hdr, length + INT_H_SIZE);
2217 buf = buf_acquire(length + INT_H_SIZE); 2215 buf = buf_acquire(length + INT_H_SIZE);
@@ -2222,7 +2220,7 @@ void link_tunnel(struct link *l_ptr,
2222 dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); 2220 dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane);
2223 msg_dbg(buf_msg(buf), ">SEND>"); 2221 msg_dbg(buf_msg(buf), ">SEND>");
2224 assert(tunnel); 2222 assert(tunnel);
2225 link_send_buf(tunnel, buf); 2223 tipc_link_send_buf(tunnel, buf);
2226} 2224}
2227 2225
2228 2226
@@ -2232,12 +2230,12 @@ void link_tunnel(struct link *l_ptr,
2232 * Owner node is locked. 2230 * Owner node is locked.
2233 */ 2231 */
2234 2232
2235void link_changeover(struct link *l_ptr) 2233void tipc_link_changeover(struct link *l_ptr)
2236{ 2234{
2237 u32 msgcount = l_ptr->out_queue_size; 2235 u32 msgcount = l_ptr->out_queue_size;
2238 struct sk_buff *crs = l_ptr->first_out; 2236 struct sk_buff *crs = l_ptr->first_out;
2239 struct link *tunnel = l_ptr->owner->active_links[0]; 2237 struct link *tunnel = l_ptr->owner->active_links[0];
2240 int split_bundles = node_has_redundant_links(l_ptr->owner); 2238 int split_bundles = tipc_node_has_redundant_links(l_ptr->owner);
2241 struct tipc_msg tunnel_hdr; 2239 struct tipc_msg tunnel_hdr;
2242 2240
2243 if (!tunnel) 2241 if (!tunnel)
@@ -2261,7 +2259,7 @@ void link_changeover(struct link *l_ptr)
2261 dbg("%c->%c:", l_ptr->b_ptr->net_plane, 2259 dbg("%c->%c:", l_ptr->b_ptr->net_plane,
2262 tunnel->b_ptr->net_plane); 2260 tunnel->b_ptr->net_plane);
2263 msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); 2261 msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
2264 link_send_buf(tunnel, buf); 2262 tipc_link_send_buf(tunnel, buf);
2265 } else { 2263 } else {
2266 warn("Memory squeeze; link changeover failed\n"); 2264 warn("Memory squeeze; link changeover failed\n");
2267 } 2265 }
@@ -2277,20 +2275,20 @@ void link_changeover(struct link *l_ptr)
2277 2275
2278 while (msgcount--) { 2276 while (msgcount--) {
2279 msg_set_seqno(m,msg_seqno(msg)); 2277 msg_set_seqno(m,msg_seqno(msg));
2280 link_tunnel(l_ptr, &tunnel_hdr, m, 2278 tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
2281 msg_link_selector(m)); 2279 msg_link_selector(m));
2282 pos += align(msg_size(m)); 2280 pos += align(msg_size(m));
2283 m = (struct tipc_msg *)pos; 2281 m = (struct tipc_msg *)pos;
2284 } 2282 }
2285 } else { 2283 } else {
2286 link_tunnel(l_ptr, &tunnel_hdr, msg, 2284 tipc_link_tunnel(l_ptr, &tunnel_hdr, msg,
2287 msg_link_selector(msg)); 2285 msg_link_selector(msg));
2288 } 2286 }
2289 crs = crs->next; 2287 crs = crs->next;
2290 } 2288 }
2291} 2289}
2292 2290
2293void link_send_duplicate(struct link *l_ptr, struct link *tunnel) 2291void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2294{ 2292{
2295 struct sk_buff *iter; 2293 struct sk_buff *iter;
2296 struct tipc_msg tunnel_hdr; 2294 struct tipc_msg tunnel_hdr;
@@ -2320,8 +2318,8 @@ void link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2320 dbg("%c->%c:", l_ptr->b_ptr->net_plane, 2318 dbg("%c->%c:", l_ptr->b_ptr->net_plane,
2321 tunnel->b_ptr->net_plane); 2319 tunnel->b_ptr->net_plane);
2322 msg_dbg(buf_msg(outbuf), ">SEND>"); 2320 msg_dbg(buf_msg(outbuf), ">SEND>");
2323 link_send_buf(tunnel, outbuf); 2321 tipc_link_send_buf(tunnel, outbuf);
2324 if (!link_is_up(l_ptr)) 2322 if (!tipc_link_is_up(l_ptr))
2325 return; 2323 return;
2326 iter = iter->next; 2324 iter = iter->next;
2327 } 2325 }
@@ -2393,9 +2391,9 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2393 2391
2394 /* First original message ?: */ 2392 /* First original message ?: */
2395 2393
2396 if (link_is_up(dest_link)) { 2394 if (tipc_link_is_up(dest_link)) {
2397 msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); 2395 msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
2398 link_reset(dest_link); 2396 tipc_link_reset(dest_link);
2399 dest_link->exp_msg_count = msg_count; 2397 dest_link->exp_msg_count = msg_count;
2400 if (!msg_count) 2398 if (!msg_count)
2401 goto exit; 2399 goto exit;
@@ -2436,7 +2434,7 @@ exit:
2436/* 2434/*
2437 * Bundler functionality: 2435 * Bundler functionality:
2438 */ 2436 */
2439void link_recv_bundle(struct sk_buff *buf) 2437void tipc_link_recv_bundle(struct sk_buff *buf)
2440{ 2438{
2441 u32 msgcount = msg_msgcnt(buf_msg(buf)); 2439 u32 msgcount = msg_msgcnt(buf_msg(buf));
2442 u32 pos = INT_H_SIZE; 2440 u32 pos = INT_H_SIZE;
@@ -2456,7 +2454,7 @@ void link_recv_bundle(struct sk_buff *buf)
2456 }; 2454 };
2457 pos += align(msg_size(buf_msg(obuf))); 2455 pos += align(msg_size(buf_msg(obuf)));
2458 msg_dbg(buf_msg(obuf), " /"); 2456 msg_dbg(buf_msg(obuf), " /");
2459 net_route_msg(obuf); 2457 tipc_net_route_msg(obuf);
2460 } 2458 }
2461 buf_discard(buf); 2459 buf_discard(buf);
2462} 2460}
@@ -2467,11 +2465,11 @@ void link_recv_bundle(struct sk_buff *buf)
2467 2465
2468 2466
2469/* 2467/*
2470 * link_send_long_buf: Entry for buffers needing fragmentation. 2468 * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
2471 * The buffer is complete, inclusive total message length. 2469 * The buffer is complete, inclusive total message length.
2472 * Returns user data length. 2470 * Returns user data length.
2473 */ 2471 */
2474int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) 2472int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2475{ 2473{
2476 struct tipc_msg *inmsg = buf_msg(buf); 2474 struct tipc_msg *inmsg = buf_msg(buf);
2477 struct tipc_msg fragm_hdr; 2475 struct tipc_msg fragm_hdr;
@@ -2521,8 +2519,8 @@ int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2521 /* Send queued messages first, if any: */ 2519 /* Send queued messages first, if any: */
2522 2520
2523 l_ptr->stats.sent_fragments++; 2521 l_ptr->stats.sent_fragments++;
2524 link_send_buf(l_ptr, fragm); 2522 tipc_link_send_buf(l_ptr, fragm);
2525 if (!link_is_up(l_ptr)) 2523 if (!tipc_link_is_up(l_ptr))
2526 return dsz; 2524 return dsz;
2527 msg_set_fragm_no(&fragm_hdr, ++fragm_no); 2525 msg_set_fragm_no(&fragm_hdr, ++fragm_no);
2528 rest -= fragm_sz; 2526 rest -= fragm_sz;
@@ -2582,11 +2580,11 @@ static inline void incr_timer_cnt(struct sk_buff *buf)
2582} 2580}
2583 2581
2584/* 2582/*
2585 * link_recv_fragment(): Called with node lock on. Returns 2583 * tipc_link_recv_fragment(): Called with node lock on. Returns
2586 * the reassembled buffer if message is complete. 2584 * the reassembled buffer if message is complete.
2587 */ 2585 */
2588int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, 2586int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2589 struct tipc_msg **m) 2587 struct tipc_msg **m)
2590{ 2588{
2591 struct sk_buff *prev = 0; 2589 struct sk_buff *prev = 0;
2592 struct sk_buff *fbuf = *fb; 2590 struct sk_buff *fbuf = *fb;
@@ -2714,7 +2712,7 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
2714} 2712}
2715 2713
2716 2714
2717void link_set_queue_limits(struct link *l_ptr, u32 window) 2715void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
2718{ 2716{
2719 /* Data messages from this node, inclusive FIRST_FRAGM */ 2717 /* Data messages from this node, inclusive FIRST_FRAGM */
2720 l_ptr->queue_limit[DATA_LOW] = window; 2718 l_ptr->queue_limit[DATA_LOW] = window;
@@ -2739,7 +2737,7 @@ void link_set_queue_limits(struct link *l_ptr, u32 window)
2739 * @name - ptr to link name string 2737 * @name - ptr to link name string
2740 * @node - ptr to area to be filled with ptr to associated node 2738 * @node - ptr to area to be filled with ptr to associated node
2741 * 2739 *
2742 * Caller must hold 'net_lock' to ensure node and bearer are not deleted; 2740 * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
2743 * this also prevents link deletion. 2741 * this also prevents link deletion.
2744 * 2742 *
2745 * Returns pointer to link (or 0 if invalid link name). 2743 * Returns pointer to link (or 0 if invalid link name).
@@ -2754,11 +2752,11 @@ static struct link *link_find_link(const char *name, struct node **node)
2754 if (!link_name_validate(name, &link_name_parts)) 2752 if (!link_name_validate(name, &link_name_parts))
2755 return 0; 2753 return 0;
2756 2754
2757 b_ptr = bearer_find_interface(link_name_parts.if_local); 2755 b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
2758 if (!b_ptr) 2756 if (!b_ptr)
2759 return 0; 2757 return 0;
2760 2758
2761 *node = node_find(link_name_parts.addr_peer); 2759 *node = tipc_node_find(link_name_parts.addr_peer);
2762 if (!*node) 2760 if (!*node)
2763 return 0; 2761 return 0;
2764 2762
@@ -2769,8 +2767,8 @@ static struct link *link_find_link(const char *name, struct node **node)
2769 return l_ptr; 2767 return l_ptr;
2770} 2768}
2771 2769
2772struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, 2770struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space,
2773 u16 cmd) 2771 u16 cmd)
2774{ 2772{
2775 struct tipc_link_config *args; 2773 struct tipc_link_config *args;
2776 u32 new_value; 2774 u32 new_value;
@@ -2779,61 +2777,62 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space,
2779 int res; 2777 int res;
2780 2778
2781 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) 2779 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
2782 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2780 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2783 2781
2784 args = (struct tipc_link_config *)TLV_DATA(req_tlv_area); 2782 args = (struct tipc_link_config *)TLV_DATA(req_tlv_area);
2785 new_value = ntohl(args->value); 2783 new_value = ntohl(args->value);
2786 2784
2787 if (!strcmp(args->name, bc_link_name)) { 2785 if (!strcmp(args->name, tipc_bclink_name)) {
2788 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && 2786 if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
2789 (bclink_set_queue_limits(new_value) == 0)) 2787 (tipc_bclink_set_queue_limits(new_value) == 0))
2790 return cfg_reply_none(); 2788 return tipc_cfg_reply_none();
2791 return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 2789 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
2792 " (cannot change setting on broadcast link)"); 2790 " (cannot change setting on broadcast link)");
2793 } 2791 }
2794 2792
2795 read_lock_bh(&net_lock); 2793 read_lock_bh(&tipc_net_lock);
2796 l_ptr = link_find_link(args->name, &node); 2794 l_ptr = link_find_link(args->name, &node);
2797 if (!l_ptr) { 2795 if (!l_ptr) {
2798 read_unlock_bh(&net_lock); 2796 read_unlock_bh(&tipc_net_lock);
2799 return cfg_reply_error_string("link not found"); 2797 return tipc_cfg_reply_error_string("link not found");
2800 } 2798 }
2801 2799
2802 node_lock(node); 2800 tipc_node_lock(node);
2803 res = -EINVAL; 2801 res = -EINVAL;
2804 switch (cmd) { 2802 switch (cmd) {
2805 case TIPC_CMD_SET_LINK_TOL: 2803 case TIPC_CMD_SET_LINK_TOL:
2806 if ((new_value >= TIPC_MIN_LINK_TOL) && 2804 if ((new_value >= TIPC_MIN_LINK_TOL) &&
2807 (new_value <= TIPC_MAX_LINK_TOL)) { 2805 (new_value <= TIPC_MAX_LINK_TOL)) {
2808 link_set_supervision_props(l_ptr, new_value); 2806 link_set_supervision_props(l_ptr, new_value);
2809 link_send_proto_msg(l_ptr, STATE_MSG, 2807 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2810 0, 0, new_value, 0, 0); 2808 0, 0, new_value, 0, 0);
2811 res = TIPC_OK; 2809 res = TIPC_OK;
2812 } 2810 }
2813 break; 2811 break;
2814 case TIPC_CMD_SET_LINK_PRI: 2812 case TIPC_CMD_SET_LINK_PRI:
2815 if (new_value < TIPC_NUM_LINK_PRI) { 2813 if ((new_value >= TIPC_MIN_LINK_PRI) &&
2814 (new_value <= TIPC_MAX_LINK_PRI)) {
2816 l_ptr->priority = new_value; 2815 l_ptr->priority = new_value;
2817 link_send_proto_msg(l_ptr, STATE_MSG, 2816 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
2818 0, 0, 0, new_value, 0); 2817 0, 0, 0, new_value, 0);
2819 res = TIPC_OK; 2818 res = TIPC_OK;
2820 } 2819 }
2821 break; 2820 break;
2822 case TIPC_CMD_SET_LINK_WINDOW: 2821 case TIPC_CMD_SET_LINK_WINDOW:
2823 if ((new_value >= TIPC_MIN_LINK_WIN) && 2822 if ((new_value >= TIPC_MIN_LINK_WIN) &&
2824 (new_value <= TIPC_MAX_LINK_WIN)) { 2823 (new_value <= TIPC_MAX_LINK_WIN)) {
2825 link_set_queue_limits(l_ptr, new_value); 2824 tipc_link_set_queue_limits(l_ptr, new_value);
2826 res = TIPC_OK; 2825 res = TIPC_OK;
2827 } 2826 }
2828 break; 2827 break;
2829 } 2828 }
2830 node_unlock(node); 2829 tipc_node_unlock(node);
2831 2830
2832 read_unlock_bh(&net_lock); 2831 read_unlock_bh(&tipc_net_lock);
2833 if (res) 2832 if (res)
2834 return cfg_reply_error_string("cannot change link setting"); 2833 return tipc_cfg_reply_error_string("cannot change link setting");
2835 2834
2836 return cfg_reply_none(); 2835 return tipc_cfg_reply_none();
2837} 2836}
2838 2837
2839/** 2838/**
@@ -2848,34 +2847,34 @@ static void link_reset_statistics(struct link *l_ptr)
2848 l_ptr->stats.recv_info = l_ptr->next_in_no; 2847 l_ptr->stats.recv_info = l_ptr->next_in_no;
2849} 2848}
2850 2849
2851struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) 2850struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
2852{ 2851{
2853 char *link_name; 2852 char *link_name;
2854 struct link *l_ptr; 2853 struct link *l_ptr;
2855 struct node *node; 2854 struct node *node;
2856 2855
2857 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2856 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
2858 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2857 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2859 2858
2860 link_name = (char *)TLV_DATA(req_tlv_area); 2859 link_name = (char *)TLV_DATA(req_tlv_area);
2861 if (!strcmp(link_name, bc_link_name)) { 2860 if (!strcmp(link_name, tipc_bclink_name)) {
2862 if (bclink_reset_stats()) 2861 if (tipc_bclink_reset_stats())
2863 return cfg_reply_error_string("link not found"); 2862 return tipc_cfg_reply_error_string("link not found");
2864 return cfg_reply_none(); 2863 return tipc_cfg_reply_none();
2865 } 2864 }
2866 2865
2867 read_lock_bh(&net_lock); 2866 read_lock_bh(&tipc_net_lock);
2868 l_ptr = link_find_link(link_name, &node); 2867 l_ptr = link_find_link(link_name, &node);
2869 if (!l_ptr) { 2868 if (!l_ptr) {
2870 read_unlock_bh(&net_lock); 2869 read_unlock_bh(&tipc_net_lock);
2871 return cfg_reply_error_string("link not found"); 2870 return tipc_cfg_reply_error_string("link not found");
2872 } 2871 }
2873 2872
2874 node_lock(node); 2873 tipc_node_lock(node);
2875 link_reset_statistics(l_ptr); 2874 link_reset_statistics(l_ptr);
2876 node_unlock(node); 2875 tipc_node_unlock(node);
2877 read_unlock_bh(&net_lock); 2876 read_unlock_bh(&tipc_net_lock);
2878 return cfg_reply_none(); 2877 return tipc_cfg_reply_none();
2879} 2878}
2880 2879
2881/** 2880/**
@@ -2888,7 +2887,7 @@ static u32 percent(u32 count, u32 total)
2888} 2887}
2889 2888
2890/** 2889/**
2891 * link_stats - print link statistics 2890 * tipc_link_stats - print link statistics
2892 * @name: link name 2891 * @name: link name
2893 * @buf: print buffer area 2892 * @buf: print buffer area
2894 * @buf_size: size of print buffer area 2893 * @buf_size: size of print buffer area
@@ -2896,7 +2895,7 @@ static u32 percent(u32 count, u32 total)
2896 * Returns length of print buffer data string (or 0 if error) 2895 * Returns length of print buffer data string (or 0 if error)
2897 */ 2896 */
2898 2897
2899static int link_stats(const char *name, char *buf, const u32 buf_size) 2898static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2900{ 2899{
2901 struct print_buf pb; 2900 struct print_buf pb;
2902 struct link *l_ptr; 2901 struct link *l_ptr;
@@ -2904,22 +2903,22 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
2904 char *status; 2903 char *status;
2905 u32 profile_total = 0; 2904 u32 profile_total = 0;
2906 2905
2907 if (!strcmp(name, bc_link_name)) 2906 if (!strcmp(name, tipc_bclink_name))
2908 return bclink_stats(buf, buf_size); 2907 return tipc_bclink_stats(buf, buf_size);
2909 2908
2910 printbuf_init(&pb, buf, buf_size); 2909 tipc_printbuf_init(&pb, buf, buf_size);
2911 2910
2912 read_lock_bh(&net_lock); 2911 read_lock_bh(&tipc_net_lock);
2913 l_ptr = link_find_link(name, &node); 2912 l_ptr = link_find_link(name, &node);
2914 if (!l_ptr) { 2913 if (!l_ptr) {
2915 read_unlock_bh(&net_lock); 2914 read_unlock_bh(&tipc_net_lock);
2916 return 0; 2915 return 0;
2917 } 2916 }
2918 node_lock(node); 2917 tipc_node_lock(node);
2919 2918
2920 if (link_is_active(l_ptr)) 2919 if (tipc_link_is_active(l_ptr))
2921 status = "ACTIVE"; 2920 status = "ACTIVE";
2922 else if (link_is_up(l_ptr)) 2921 else if (tipc_link_is_up(l_ptr))
2923 status = "STANDBY"; 2922 status = "STANDBY";
2924 else 2923 else
2925 status = "DEFUNCT"; 2924 status = "DEFUNCT";
@@ -2975,33 +2974,33 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
2975 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) 2974 ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
2976 : 0); 2975 : 0);
2977 2976
2978 node_unlock(node); 2977 tipc_node_unlock(node);
2979 read_unlock_bh(&net_lock); 2978 read_unlock_bh(&tipc_net_lock);
2980 return printbuf_validate(&pb); 2979 return tipc_printbuf_validate(&pb);
2981} 2980}
2982 2981
2983#define MAX_LINK_STATS_INFO 2000 2982#define MAX_LINK_STATS_INFO 2000
2984 2983
2985struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) 2984struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
2986{ 2985{
2987 struct sk_buff *buf; 2986 struct sk_buff *buf;
2988 struct tlv_desc *rep_tlv; 2987 struct tlv_desc *rep_tlv;
2989 int str_len; 2988 int str_len;
2990 2989
2991 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) 2990 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
2992 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 2991 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
2993 2992
2994 buf = cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO)); 2993 buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
2995 if (!buf) 2994 if (!buf)
2996 return NULL; 2995 return NULL;
2997 2996
2998 rep_tlv = (struct tlv_desc *)buf->data; 2997 rep_tlv = (struct tlv_desc *)buf->data;
2999 2998
3000 str_len = link_stats((char *)TLV_DATA(req_tlv_area), 2999 str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
3001 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); 3000 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
3002 if (!str_len) { 3001 if (!str_len) {
3003 buf_discard(buf); 3002 buf_discard(buf);
3004 return cfg_reply_error_string("link not found"); 3003 return tipc_cfg_reply_error_string("link not found");
3005 } 3004 }
3006 3005
3007 skb_put(buf, TLV_SPACE(str_len)); 3006 skb_put(buf, TLV_SPACE(str_len));
@@ -3020,20 +3019,20 @@ int link_control(const char *name, u32 op, u32 val)
3020 u32 a; 3019 u32 a;
3021 3020
3022 a = link_name2addr(name, &bearer_id); 3021 a = link_name2addr(name, &bearer_id);
3023 read_lock_bh(&net_lock); 3022 read_lock_bh(&tipc_net_lock);
3024 node = node_find(a); 3023 node = tipc_node_find(a);
3025 if (node) { 3024 if (node) {
3026 node_lock(node); 3025 tipc_node_lock(node);
3027 l_ptr = node->links[bearer_id]; 3026 l_ptr = node->links[bearer_id];
3028 if (l_ptr) { 3027 if (l_ptr) {
3029 if (op == TIPC_REMOVE_LINK) { 3028 if (op == TIPC_REMOVE_LINK) {
3030 struct bearer *b_ptr = l_ptr->b_ptr; 3029 struct bearer *b_ptr = l_ptr->b_ptr;
3031 spin_lock_bh(&b_ptr->publ.lock); 3030 spin_lock_bh(&b_ptr->publ.lock);
3032 link_delete(l_ptr); 3031 tipc_link_delete(l_ptr);
3033 spin_unlock_bh(&b_ptr->publ.lock); 3032 spin_unlock_bh(&b_ptr->publ.lock);
3034 } 3033 }
3035 if (op == TIPC_CMD_BLOCK_LINK) { 3034 if (op == TIPC_CMD_BLOCK_LINK) {
3036 link_reset(l_ptr); 3035 tipc_link_reset(l_ptr);
3037 l_ptr->blocked = 1; 3036 l_ptr->blocked = 1;
3038 } 3037 }
3039 if (op == TIPC_CMD_UNBLOCK_LINK) { 3038 if (op == TIPC_CMD_UNBLOCK_LINK) {
@@ -3041,22 +3040,22 @@ int link_control(const char *name, u32 op, u32 val)
3041 } 3040 }
3042 res = TIPC_OK; 3041 res = TIPC_OK;
3043 } 3042 }
3044 node_unlock(node); 3043 tipc_node_unlock(node);
3045 } 3044 }
3046 read_unlock_bh(&net_lock); 3045 read_unlock_bh(&tipc_net_lock);
3047 return res; 3046 return res;
3048} 3047}
3049#endif 3048#endif
3050 3049
3051/** 3050/**
3052 * link_get_max_pkt - get maximum packet size to use when sending to destination 3051 * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
3053 * @dest: network address of destination node 3052 * @dest: network address of destination node
3054 * @selector: used to select from set of active links 3053 * @selector: used to select from set of active links
3055 * 3054 *
3056 * If no active link can be found, uses default maximum packet size. 3055 * If no active link can be found, uses default maximum packet size.
3057 */ 3056 */
3058 3057
3059u32 link_get_max_pkt(u32 dest, u32 selector) 3058u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3060{ 3059{
3061 struct node *n_ptr; 3060 struct node *n_ptr;
3062 struct link *l_ptr; 3061 struct link *l_ptr;
@@ -3065,16 +3064,16 @@ u32 link_get_max_pkt(u32 dest, u32 selector)
3065 if (dest == tipc_own_addr) 3064 if (dest == tipc_own_addr)
3066 return MAX_MSG_SIZE; 3065 return MAX_MSG_SIZE;
3067 3066
3068 read_lock_bh(&net_lock); 3067 read_lock_bh(&tipc_net_lock);
3069 n_ptr = node_select(dest, selector); 3068 n_ptr = tipc_node_select(dest, selector);
3070 if (n_ptr) { 3069 if (n_ptr) {
3071 node_lock(n_ptr); 3070 tipc_node_lock(n_ptr);
3072 l_ptr = n_ptr->active_links[selector & 1]; 3071 l_ptr = n_ptr->active_links[selector & 1];
3073 if (l_ptr) 3072 if (l_ptr)
3074 res = link_max_pkt(l_ptr); 3073 res = link_max_pkt(l_ptr);
3075 node_unlock(n_ptr); 3074 tipc_node_unlock(n_ptr);
3076 } 3075 }
3077 read_unlock_bh(&net_lock); 3076 read_unlock_bh(&tipc_net_lock);
3078 return res; 3077 return res;
3079} 3078}
3080 3079
diff --git a/net/tipc/link.h b/net/tipc/link.h
index c2553f073757..2d3c157f707d 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -221,44 +221,43 @@ struct link {
221 221
222struct port; 222struct port;
223 223
224struct link *link_create(struct bearer *b_ptr, const u32 peer, 224struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
225 const struct tipc_media_addr *media_addr); 225 const struct tipc_media_addr *media_addr);
226void link_delete(struct link *l_ptr); 226void tipc_link_delete(struct link *l_ptr);
227void link_changeover(struct link *l_ptr); 227void tipc_link_changeover(struct link *l_ptr);
228void link_send_duplicate(struct link *l_ptr, struct link *dest); 228void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest);
229void link_reset_fragments(struct link *l_ptr); 229void tipc_link_reset_fragments(struct link *l_ptr);
230int link_is_up(struct link *l_ptr); 230int tipc_link_is_up(struct link *l_ptr);
231int link_is_active(struct link *l_ptr); 231int tipc_link_is_active(struct link *l_ptr);
232void link_start(struct link *l_ptr); 232void tipc_link_start(struct link *l_ptr);
233u32 link_push_packet(struct link *l_ptr); 233u32 tipc_link_push_packet(struct link *l_ptr);
234void link_stop(struct link *l_ptr); 234void tipc_link_stop(struct link *l_ptr);
235struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); 235struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
236struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); 236struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space);
237struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); 237struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space);
238void link_reset(struct link *l_ptr); 238void tipc_link_reset(struct link *l_ptr);
239int link_send(struct sk_buff *buf, u32 dest, u32 selector); 239int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
240int link_send_buf(struct link *l_ptr, struct sk_buff *buf); 240int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf);
241u32 link_get_max_pkt(u32 dest,u32 selector); 241u32 tipc_link_get_max_pkt(u32 dest,u32 selector);
242int link_send_sections_fast(struct port* sender, 242int tipc_link_send_sections_fast(struct port* sender,
243 struct iovec const *msg_sect, 243 struct iovec const *msg_sect,
244 const u32 num_sect, 244 const u32 num_sect,
245 u32 destnode); 245 u32 destnode);
246 246int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
247int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); 247void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
248void link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, 248 struct tipc_msg *msg, u32 selector);
249 struct tipc_msg *msg, u32 selector); 249void tipc_link_recv_bundle(struct sk_buff *buf);
250void link_recv_bundle(struct sk_buff *buf); 250int tipc_link_recv_fragment(struct sk_buff **pending,
251int link_recv_fragment(struct sk_buff **pending, 251 struct sk_buff **fb,
252 struct sk_buff **fb, 252 struct tipc_msg **msg);
253 struct tipc_msg **msg); 253void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap,
254void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, 254 u32 tolerance, u32 priority, u32 acked_mtu);
255 u32 tolerance, u32 priority, u32 acked_mtu); 255void tipc_link_push_queue(struct link *l_ptr);
256void link_push_queue(struct link *l_ptr); 256u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
257u32 link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
258 struct sk_buff *buf); 257 struct sk_buff *buf);
259void link_wakeup_ports(struct link *l_ptr, int all); 258void tipc_link_wakeup_ports(struct link *l_ptr, int all);
260void link_set_queue_limits(struct link *l_ptr, u32 window); 259void tipc_link_set_queue_limits(struct link *l_ptr, u32 window);
261void link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); 260void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits);
262 261
263/* 262/*
264 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) 263 * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 03dbc55cb04c..3bd345a344e5 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -41,18 +41,7 @@
41#include "bearer.h" 41#include "bearer.h"
42 42
43 43
44void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) 44void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
45{
46 memcpy(&((int *)m)[5], a, sizeof(*a));
47}
48
49void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
50{
51 memcpy(a, &((int*)m)[5], sizeof(*a));
52}
53
54
55void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
56{ 45{
57 u32 usr = msg_user(msg); 46 u32 usr = msg_user(msg);
58 tipc_printf(buf, str); 47 tipc_printf(buf, str);
@@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
318 tipc_printf(buf, ":REQL(%u):", msg_req_links(msg)); 307 tipc_printf(buf, ":REQL(%u):", msg_req_links(msg));
319 tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg)); 308 tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
320 tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg)); 309 tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
321 media_addr_printf(buf, orig); 310 tipc_media_addr_printf(buf, orig);
322 } 311 }
323 if (msg_user(msg) == BCAST_PROTOCOL) { 312 if (msg_user(msg) == BCAST_PROTOCOL) {
324 tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg)); 313 tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg));
@@ -326,9 +315,9 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
326 } 315 }
327 tipc_printf(buf, "\n"); 316 tipc_printf(buf, "\n");
328 if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { 317 if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) {
329 msg_print(buf,msg_get_wrapped(msg)," /"); 318 tipc_msg_print(buf,msg_get_wrapped(msg)," /");
330 } 319 }
331 if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { 320 if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) {
332 msg_print(buf,msg_get_wrapped(msg)," /"); 321 tipc_msg_print(buf,msg_get_wrapped(msg)," /");
333 } 322 }
334} 323}
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 662c81862a0c..6699aaf7bd4c 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -37,7 +37,7 @@
37#ifndef _TIPC_MSG_H 37#ifndef _TIPC_MSG_H
38#define _TIPC_MSG_H 38#define _TIPC_MSG_H
39 39
40#include <net/tipc/tipc_msg.h> 40#include "core.h"
41 41
42#define TIPC_VERSION 2 42#define TIPC_VERSION 2
43#define DATA_LOW TIPC_LOW_IMPORTANCE 43#define DATA_LOW TIPC_LOW_IMPORTANCE
@@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr,
805 return -EFAULT; 805 return -EFAULT;
806} 806}
807 807
808static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
809{
810 memcpy(&((int *)m)[5], a, sizeof(*a));
811}
808 812
809struct tipc_media_addr; 813static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
810 814{
811extern void msg_set_media_addr(struct tipc_msg *m, 815 memcpy(a, &((int*)m)[5], sizeof(*a));
812 struct tipc_media_addr *a); 816}
813
814extern void msg_get_media_addr(struct tipc_msg *m,
815 struct tipc_media_addr *a);
816
817 817
818#endif 818#endif
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 41cbaf1a4a73..830f90999041 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
114} 114}
115 115
116/** 116/**
117 * named_publish - tell other nodes about a new publication by this node 117 * tipc_named_publish - tell other nodes about a new publication by this node
118 */ 118 */
119 119
120void named_publish(struct publication *publ) 120void tipc_named_publish(struct publication *publ)
121{ 121{
122 struct sk_buff *buf; 122 struct sk_buff *buf;
123 struct distr_item *item; 123 struct distr_item *item;
@@ -133,15 +133,15 @@ void named_publish(struct publication *publ)
133 133
134 item = (struct distr_item *)msg_data(buf_msg(buf)); 134 item = (struct distr_item *)msg_data(buf_msg(buf));
135 publ_to_item(item, publ); 135 publ_to_item(item, publ);
136 dbg("named_withdraw: broadcasting publish msg\n"); 136 dbg("tipc_named_withdraw: broadcasting publish msg\n");
137 cluster_broadcast(buf); 137 tipc_cltr_broadcast(buf);
138} 138}
139 139
140/** 140/**
141 * named_withdraw - tell other nodes about a withdrawn publication by this node 141 * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
142 */ 142 */
143 143
144void named_withdraw(struct publication *publ) 144void tipc_named_withdraw(struct publication *publ)
145{ 145{
146 struct sk_buff *buf; 146 struct sk_buff *buf;
147 struct distr_item *item; 147 struct distr_item *item;
@@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ)
157 157
158 item = (struct distr_item *)msg_data(buf_msg(buf)); 158 item = (struct distr_item *)msg_data(buf_msg(buf));
159 publ_to_item(item, publ); 159 publ_to_item(item, publ);
160 dbg("named_withdraw: broadcasting withdraw msg\n"); 160 dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
161 cluster_broadcast(buf); 161 tipc_cltr_broadcast(buf);
162} 162}
163 163
164/** 164/**
165 * named_node_up - tell specified node about all publications by this node 165 * tipc_named_node_up - tell specified node about all publications by this node
166 */ 166 */
167 167
168void named_node_up(unsigned long node) 168void tipc_named_node_up(unsigned long node)
169{ 169{
170 struct publication *publ; 170 struct publication *publ;
171 struct distr_item *item = 0; 171 struct distr_item *item = 0;
@@ -175,7 +175,7 @@ void named_node_up(unsigned long node)
175 u32 max_item_buf; 175 u32 max_item_buf;
176 176
177 assert(in_own_cluster(node)); 177 assert(in_own_cluster(node));
178 read_lock_bh(&nametbl_lock); 178 read_lock_bh(&tipc_nametbl_lock);
179 max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; 179 max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
180 max_item_buf *= ITEM_SIZE; 180 max_item_buf *= ITEM_SIZE;
181 rest = publ_cnt * ITEM_SIZE; 181 rest = publ_cnt * ITEM_SIZE;
@@ -196,15 +196,15 @@ void named_node_up(unsigned long node)
196 left -= ITEM_SIZE; 196 left -= ITEM_SIZE;
197 if (!left) { 197 if (!left) {
198 msg_set_link_selector(buf_msg(buf), node); 198 msg_set_link_selector(buf_msg(buf), node);
199 dbg("named_node_up: sending publish msg to " 199 dbg("tipc_named_node_up: sending publish msg to "
200 "<%u.%u.%u>\n", tipc_zone(node), 200 "<%u.%u.%u>\n", tipc_zone(node),
201 tipc_cluster(node), tipc_node(node)); 201 tipc_cluster(node), tipc_node(node));
202 link_send(buf, node, node); 202 tipc_link_send(buf, node, node);
203 buf = 0; 203 buf = 0;
204 } 204 }
205 } 205 }
206exit: 206exit:
207 read_unlock_bh(&nametbl_lock); 207 read_unlock_bh(&tipc_nametbl_lock);
208} 208}
209 209
210/** 210/**
@@ -221,73 +221,73 @@ exit:
221static void node_is_down(struct publication *publ) 221static void node_is_down(struct publication *publ)
222{ 222{
223 struct publication *p; 223 struct publication *p;
224 write_lock_bh(&nametbl_lock); 224 write_lock_bh(&tipc_nametbl_lock);
225 dbg("node_is_down: withdrawing %u, %u, %u\n", 225 dbg("node_is_down: withdrawing %u, %u, %u\n",
226 publ->type, publ->lower, publ->upper); 226 publ->type, publ->lower, publ->upper);
227 publ->key += 1222345; 227 publ->key += 1222345;
228 p = nametbl_remove_publ(publ->type, publ->lower, 228 p = tipc_nametbl_remove_publ(publ->type, publ->lower,
229 publ->node, publ->ref, publ->key); 229 publ->node, publ->ref, publ->key);
230 assert(p == publ); 230 assert(p == publ);
231 write_unlock_bh(&nametbl_lock); 231 write_unlock_bh(&tipc_nametbl_lock);
232 if (publ) 232 if (publ)
233 kfree(publ); 233 kfree(publ);
234} 234}
235 235
236/** 236/**
237 * named_recv - process name table update message sent by another node 237 * tipc_named_recv - process name table update message sent by another node
238 */ 238 */
239 239
240void named_recv(struct sk_buff *buf) 240void tipc_named_recv(struct sk_buff *buf)
241{ 241{
242 struct publication *publ; 242 struct publication *publ;
243 struct tipc_msg *msg = buf_msg(buf); 243 struct tipc_msg *msg = buf_msg(buf);
244 struct distr_item *item = (struct distr_item *)msg_data(msg); 244 struct distr_item *item = (struct distr_item *)msg_data(msg);
245 u32 count = msg_data_sz(msg) / ITEM_SIZE; 245 u32 count = msg_data_sz(msg) / ITEM_SIZE;
246 246
247 write_lock_bh(&nametbl_lock); 247 write_lock_bh(&tipc_nametbl_lock);
248 while (count--) { 248 while (count--) {
249 if (msg_type(msg) == PUBLICATION) { 249 if (msg_type(msg) == PUBLICATION) {
250 dbg("named_recv: got publication for %u, %u, %u\n", 250 dbg("tipc_named_recv: got publication for %u, %u, %u\n",
251 ntohl(item->type), ntohl(item->lower), 251 ntohl(item->type), ntohl(item->lower),
252 ntohl(item->upper)); 252 ntohl(item->upper));
253 publ = nametbl_insert_publ(ntohl(item->type), 253 publ = tipc_nametbl_insert_publ(ntohl(item->type),
254 ntohl(item->lower), 254 ntohl(item->lower),
255 ntohl(item->upper), 255 ntohl(item->upper),
256 TIPC_CLUSTER_SCOPE, 256 TIPC_CLUSTER_SCOPE,
257 msg_orignode(msg), 257 msg_orignode(msg),
258 ntohl(item->ref), 258 ntohl(item->ref),
259 ntohl(item->key)); 259 ntohl(item->key));
260 if (publ) { 260 if (publ) {
261 nodesub_subscribe(&publ->subscr, 261 tipc_nodesub_subscribe(&publ->subscr,
262 msg_orignode(msg), 262 msg_orignode(msg),
263 publ, 263 publ,
264 (net_ev_handler)node_is_down); 264 (net_ev_handler)node_is_down);
265 } 265 }
266 } else if (msg_type(msg) == WITHDRAWAL) { 266 } else if (msg_type(msg) == WITHDRAWAL) {
267 dbg("named_recv: got withdrawl for %u, %u, %u\n", 267 dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n",
268 ntohl(item->type), ntohl(item->lower), 268 ntohl(item->type), ntohl(item->lower),
269 ntohl(item->upper)); 269 ntohl(item->upper));
270 publ = nametbl_remove_publ(ntohl(item->type), 270 publ = tipc_nametbl_remove_publ(ntohl(item->type),
271 ntohl(item->lower), 271 ntohl(item->lower),
272 msg_orignode(msg), 272 msg_orignode(msg),
273 ntohl(item->ref), 273 ntohl(item->ref),
274 ntohl(item->key)); 274 ntohl(item->key));
275 275
276 if (publ) { 276 if (publ) {
277 nodesub_unsubscribe(&publ->subscr); 277 tipc_nodesub_unsubscribe(&publ->subscr);
278 kfree(publ); 278 kfree(publ);
279 } 279 }
280 } else { 280 } else {
281 warn("named_recv: unknown msg\n"); 281 warn("tipc_named_recv: unknown msg\n");
282 } 282 }
283 item++; 283 item++;
284 } 284 }
285 write_unlock_bh(&nametbl_lock); 285 write_unlock_bh(&tipc_nametbl_lock);
286 buf_discard(buf); 286 buf_discard(buf);
287} 287}
288 288
289/** 289/**
290 * named_reinit - re-initialize local publication list 290 * tipc_named_reinit - re-initialize local publication list
291 * 291 *
292 * This routine is called whenever TIPC networking is (re)enabled. 292 * This routine is called whenever TIPC networking is (re)enabled.
293 * All existing publications by this node that have "cluster" or "zone" scope 293 * All existing publications by this node that have "cluster" or "zone" scope
@@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf)
295 * (If the node's address is unchanged, the update loop terminates immediately.) 295 * (If the node's address is unchanged, the update loop terminates immediately.)
296 */ 296 */
297 297
298void named_reinit(void) 298void tipc_named_reinit(void)
299{ 299{
300 struct publication *publ; 300 struct publication *publ;
301 301
302 write_lock_bh(&nametbl_lock); 302 write_lock_bh(&tipc_nametbl_lock);
303 list_for_each_entry(publ, &publ_root, local_list) { 303 list_for_each_entry(publ, &publ_root, local_list) {
304 if (publ->node == tipc_own_addr) 304 if (publ->node == tipc_own_addr)
305 break; 305 break;
306 publ->node = tipc_own_addr; 306 publ->node = tipc_own_addr;
307 } 307 }
308 write_unlock_bh(&nametbl_lock); 308 write_unlock_bh(&tipc_nametbl_lock);
309} 309}
diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h
index a04bdeac84ea..843da0172f4e 100644
--- a/net/tipc/name_distr.h
+++ b/net/tipc/name_distr.h
@@ -39,10 +39,10 @@
39 39
40#include "name_table.h" 40#include "name_table.h"
41 41
42void named_publish(struct publication *publ); 42void tipc_named_publish(struct publication *publ);
43void named_withdraw(struct publication *publ); 43void tipc_named_withdraw(struct publication *publ);
44void named_node_up(unsigned long node); 44void tipc_named_node_up(unsigned long node);
45void named_recv(struct sk_buff *buf); 45void tipc_named_recv(struct sk_buff *buf);
46void named_reinit(void); 46void tipc_named_reinit(void);
47 47
48#endif 48#endif
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 972c83eb83b4..3f4b23bd08f7 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -99,9 +99,9 @@ struct name_table {
99 u32 local_publ_count; 99 u32 local_publ_count;
100}; 100};
101 101
102struct name_table table = { NULL } ; 102static struct name_table table = { NULL } ;
103static atomic_t rsv_publ_ok = ATOMIC_INIT(0); 103static atomic_t rsv_publ_ok = ATOMIC_INIT(0);
104rwlock_t nametbl_lock = RW_LOCK_UNLOCKED; 104rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED;
105 105
106 106
107static inline int hash(int x) 107static inline int hash(int x)
@@ -139,10 +139,10 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
139} 139}
140 140
141/** 141/**
142 * subseq_alloc - allocate a specified number of sub-sequence structures 142 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
143 */ 143 */
144 144
145struct sub_seq *subseq_alloc(u32 cnt) 145struct sub_seq *tipc_subseq_alloc(u32 cnt)
146{ 146{
147 u32 sz = cnt * sizeof(struct sub_seq); 147 u32 sz = cnt * sizeof(struct sub_seq);
148 struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); 148 struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
@@ -153,16 +153,16 @@ struct sub_seq *subseq_alloc(u32 cnt)
153} 153}
154 154
155/** 155/**
156 * nameseq_create - create a name sequence structure for the specified 'type' 156 * tipc_nameseq_create - create a name sequence structure for the specified 'type'
157 * 157 *
158 * Allocates a single sub-sequence structure and sets it to all 0's. 158 * Allocates a single sub-sequence structure and sets it to all 0's.
159 */ 159 */
160 160
161struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) 161struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
162{ 162{
163 struct name_seq *nseq = 163 struct name_seq *nseq =
164 (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); 164 (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
165 struct sub_seq *sseq = subseq_alloc(1); 165 struct sub_seq *sseq = tipc_subseq_alloc(1);
166 166
167 if (!nseq || !sseq) { 167 if (!nseq || !sseq) {
168 warn("Memory squeeze; failed to create name sequence\n"); 168 warn("Memory squeeze; failed to create name sequence\n");
@@ -175,7 +175,7 @@ struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head)
175 nseq->lock = SPIN_LOCK_UNLOCKED; 175 nseq->lock = SPIN_LOCK_UNLOCKED;
176 nseq->type = type; 176 nseq->type = type;
177 nseq->sseqs = sseq; 177 nseq->sseqs = sseq;
178 dbg("nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", 178 dbg("tipc_nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n",
179 nseq, type, nseq->sseqs, nseq->first_free); 179 nseq, type, nseq->sseqs, nseq->first_free);
180 nseq->alloc = 1; 180 nseq->alloc = 1;
181 INIT_HLIST_NODE(&nseq->ns_list); 181 INIT_HLIST_NODE(&nseq->ns_list);
@@ -240,10 +240,10 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
240} 240}
241 241
242/** 242/**
243 * nameseq_insert_publ - 243 * tipc_nameseq_insert_publ -
244 */ 244 */
245 245
246struct publication *nameseq_insert_publ(struct name_seq *nseq, 246struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
247 u32 type, u32 lower, u32 upper, 247 u32 type, u32 lower, u32 upper,
248 u32 scope, u32 node, u32 port, u32 key) 248 u32 scope, u32 node, u32 port, u32 key)
249{ 249{
@@ -285,7 +285,7 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq,
285 285
286 if (nseq->first_free == nseq->alloc) { 286 if (nseq->first_free == nseq->alloc) {
287 struct sub_seq *sseqs = nseq->sseqs; 287 struct sub_seq *sseqs = nseq->sseqs;
288 nseq->sseqs = subseq_alloc(nseq->alloc * 2); 288 nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2);
289 if (nseq->sseqs != NULL) { 289 if (nseq->sseqs != NULL) {
290 memcpy(nseq->sseqs, sseqs, 290 memcpy(nseq->sseqs, sseqs,
291 nseq->alloc * sizeof (struct sub_seq)); 291 nseq->alloc * sizeof (struct sub_seq));
@@ -354,23 +354,23 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq,
354 */ 354 */
355 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 355 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
356 dbg("calling report_overlap()\n"); 356 dbg("calling report_overlap()\n");
357 subscr_report_overlap(s, 357 tipc_subscr_report_overlap(s,
358 publ->lower, 358 publ->lower,
359 publ->upper, 359 publ->upper,
360 TIPC_PUBLISHED, 360 TIPC_PUBLISHED,
361 publ->ref, 361 publ->ref,
362 publ->node, 362 publ->node,
363 created_subseq); 363 created_subseq);
364 } 364 }
365 return publ; 365 return publ;
366} 366}
367 367
368/** 368/**
369 * nameseq_remove_publ - 369 * tipc_nameseq_remove_publ -
370 */ 370 */
371 371
372struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, 372struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
373 u32 node, u32 ref, u32 key) 373 u32 node, u32 ref, u32 key)
374{ 374{
375 struct publication *publ; 375 struct publication *publ;
376 struct publication *prev; 376 struct publication *prev;
@@ -470,24 +470,24 @@ struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst,
470 * Any subscriptions waiting ? 470 * Any subscriptions waiting ?
471 */ 471 */
472 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 472 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
473 subscr_report_overlap(s, 473 tipc_subscr_report_overlap(s,
474 publ->lower, 474 publ->lower,
475 publ->upper, 475 publ->upper,
476 TIPC_WITHDRAWN, 476 TIPC_WITHDRAWN,
477 publ->ref, 477 publ->ref,
478 publ->node, 478 publ->node,
479 removed_subseq); 479 removed_subseq);
480 } 480 }
481 return publ; 481 return publ;
482} 482}
483 483
484/** 484/**
485 * nameseq_subscribe: attach a subscription, and issue 485 * tipc_nameseq_subscribe: attach a subscription, and issue
486 * the prescribed number of events if there is any sub- 486 * the prescribed number of events if there is any sub-
487 * sequence overlapping with the requested sequence 487 * sequence overlapping with the requested sequence
488 */ 488 */
489 489
490void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) 490void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
491{ 491{
492 struct sub_seq *sseq = nseq->sseqs; 492 struct sub_seq *sseq = nseq->sseqs;
493 493
@@ -498,18 +498,18 @@ void nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
498 498
499 while (sseq != &nseq->sseqs[nseq->first_free]) { 499 while (sseq != &nseq->sseqs[nseq->first_free]) {
500 struct publication *zl = sseq->zone_list; 500 struct publication *zl = sseq->zone_list;
501 if (zl && subscr_overlap(s,sseq->lower,sseq->upper)) { 501 if (zl && tipc_subscr_overlap(s,sseq->lower,sseq->upper)) {
502 struct publication *crs = zl; 502 struct publication *crs = zl;
503 int must_report = 1; 503 int must_report = 1;
504 504
505 do { 505 do {
506 subscr_report_overlap(s, 506 tipc_subscr_report_overlap(s,
507 sseq->lower, 507 sseq->lower,
508 sseq->upper, 508 sseq->upper,
509 TIPC_PUBLISHED, 509 TIPC_PUBLISHED,
510 crs->ref, 510 crs->ref,
511 crs->node, 511 crs->node,
512 must_report); 512 must_report);
513 must_report = 0; 513 must_report = 0;
514 crs = crs->zone_list_next; 514 crs = crs->zone_list_next;
515 } while (crs != zl); 515 } while (crs != zl);
@@ -538,8 +538,8 @@ static struct name_seq *nametbl_find_seq(u32 type)
538 return 0; 538 return 0;
539}; 539};
540 540
541struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, 541struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
542 u32 scope, u32 node, u32 port, u32 key) 542 u32 scope, u32 node, u32 port, u32 key)
543{ 543{
544 struct name_seq *seq = nametbl_find_seq(type); 544 struct name_seq *seq = nametbl_find_seq(type);
545 545
@@ -552,19 +552,19 @@ struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper,
552 552
553 dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); 553 dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node);
554 if (!seq) { 554 if (!seq) {
555 seq = nameseq_create(type, &table.types[hash(type)]); 555 seq = tipc_nameseq_create(type, &table.types[hash(type)]);
556 dbg("nametbl_insert_publ: created %x\n", seq); 556 dbg("tipc_nametbl_insert_publ: created %x\n", seq);
557 } 557 }
558 if (!seq) 558 if (!seq)
559 return 0; 559 return 0;
560 560
561 assert(seq->type == type); 561 assert(seq->type == type);
562 return nameseq_insert_publ(seq, type, lower, upper, 562 return tipc_nameseq_insert_publ(seq, type, lower, upper,
563 scope, node, port, key); 563 scope, node, port, key);
564} 564}
565 565
566struct publication *nametbl_remove_publ(u32 type, u32 lower, 566struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
567 u32 node, u32 ref, u32 key) 567 u32 node, u32 ref, u32 key)
568{ 568{
569 struct publication *publ; 569 struct publication *publ;
570 struct name_seq *seq = nametbl_find_seq(type); 570 struct name_seq *seq = nametbl_find_seq(type);
@@ -573,7 +573,7 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower,
573 return 0; 573 return 0;
574 574
575 dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); 575 dbg("Withdrawing <%u,%u> from %x\n", type, lower, node);
576 publ = nameseq_remove_publ(seq, lower, node, ref, key); 576 publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key);
577 577
578 if (!seq->first_free && list_empty(&seq->subscriptions)) { 578 if (!seq->first_free && list_empty(&seq->subscriptions)) {
579 hlist_del_init(&seq->ns_list); 579 hlist_del_init(&seq->ns_list);
@@ -584,14 +584,14 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower,
584} 584}
585 585
586/* 586/*
587 * nametbl_translate(): Translate tipc_name -> tipc_portid. 587 * tipc_nametbl_translate(): Translate tipc_name -> tipc_portid.
588 * Very time-critical. 588 * Very time-critical.
589 * 589 *
590 * Note: on entry 'destnode' is the search domain used during translation; 590 * Note: on entry 'destnode' is the search domain used during translation;
591 * on exit it passes back the node address of the matching port (if any) 591 * on exit it passes back the node address of the matching port (if any)
592 */ 592 */
593 593
594u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) 594u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
595{ 595{
596 struct sub_seq *sseq; 596 struct sub_seq *sseq;
597 struct publication *publ = 0; 597 struct publication *publ = 0;
@@ -601,7 +601,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode)
601 if (!in_scope(*destnode, tipc_own_addr)) 601 if (!in_scope(*destnode, tipc_own_addr))
602 return 0; 602 return 0;
603 603
604 read_lock_bh(&nametbl_lock); 604 read_lock_bh(&tipc_nametbl_lock);
605 seq = nametbl_find_seq(type); 605 seq = nametbl_find_seq(type);
606 if (unlikely(!seq)) 606 if (unlikely(!seq))
607 goto not_found; 607 goto not_found;
@@ -619,7 +619,7 @@ found:
619 ref = publ->ref; 619 ref = publ->ref;
620 *destnode = publ->node; 620 *destnode = publ->node;
621 spin_unlock_bh(&seq->lock); 621 spin_unlock_bh(&seq->lock);
622 read_unlock_bh(&nametbl_lock); 622 read_unlock_bh(&tipc_nametbl_lock);
623 return ref; 623 return ref;
624 } 624 }
625 publ = sseq->cluster_list; 625 publ = sseq->cluster_list;
@@ -657,12 +657,12 @@ found:
657 spin_unlock_bh(&seq->lock); 657 spin_unlock_bh(&seq->lock);
658not_found: 658not_found:
659 *destnode = 0; 659 *destnode = 0;
660 read_unlock_bh(&nametbl_lock); 660 read_unlock_bh(&tipc_nametbl_lock);
661 return 0; 661 return 0;
662} 662}
663 663
664/** 664/**
665 * nametbl_mc_translate - find multicast destinations 665 * tipc_nametbl_mc_translate - find multicast destinations
666 * 666 *
667 * Creates list of all local ports that overlap the given multicast address; 667 * Creates list of all local ports that overlap the given multicast address;
668 * also determines if any off-node ports overlap. 668 * also determines if any off-node ports overlap.
@@ -674,15 +674,15 @@ not_found:
674 * Returns non-zero if any off-node ports overlap 674 * Returns non-zero if any off-node ports overlap
675 */ 675 */
676 676
677int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, 677int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
678 struct port_list *dports) 678 struct port_list *dports)
679{ 679{
680 struct name_seq *seq; 680 struct name_seq *seq;
681 struct sub_seq *sseq; 681 struct sub_seq *sseq;
682 struct sub_seq *sseq_stop; 682 struct sub_seq *sseq_stop;
683 int res = 0; 683 int res = 0;
684 684
685 read_lock_bh(&nametbl_lock); 685 read_lock_bh(&tipc_nametbl_lock);
686 seq = nametbl_find_seq(type); 686 seq = nametbl_find_seq(type);
687 if (!seq) 687 if (!seq)
688 goto exit; 688 goto exit;
@@ -700,7 +700,7 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
700 if (publ && (publ->scope <= limit)) 700 if (publ && (publ->scope <= limit))
701 do { 701 do {
702 if (publ->node == tipc_own_addr) 702 if (publ->node == tipc_own_addr)
703 port_list_add(dports, publ->ref); 703 tipc_port_list_add(dports, publ->ref);
704 else 704 else
705 res = 1; 705 res = 1;
706 publ = publ->cluster_list_next; 706 publ = publ->cluster_list_next;
@@ -709,15 +709,15 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
709 709
710 spin_unlock_bh(&seq->lock); 710 spin_unlock_bh(&seq->lock);
711exit: 711exit:
712 read_unlock_bh(&nametbl_lock); 712 read_unlock_bh(&tipc_nametbl_lock);
713 return res; 713 return res;
714} 714}
715 715
716/** 716/**
717 * nametbl_publish_rsv - publish port name using a reserved name type 717 * tipc_nametbl_publish_rsv - publish port name using a reserved name type
718 */ 718 */
719 719
720int nametbl_publish_rsv(u32 ref, unsigned int scope, 720int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
721 struct tipc_name_seq const *seq) 721 struct tipc_name_seq const *seq)
722{ 722{
723 int res; 723 int res;
@@ -729,10 +729,10 @@ int nametbl_publish_rsv(u32 ref, unsigned int scope,
729} 729}
730 730
731/** 731/**
732 * nametbl_publish - add name publication to network name tables 732 * tipc_nametbl_publish - add name publication to network name tables
733 */ 733 */
734 734
735struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, 735struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
736 u32 scope, u32 port_ref, u32 key) 736 u32 scope, u32 port_ref, u32 key)
737{ 737{
738 struct publication *publ; 738 struct publication *publ;
@@ -748,77 +748,77 @@ struct publication *nametbl_publish(u32 type, u32 lower, u32 upper,
748 return 0; 748 return 0;
749 } 749 }
750 750
751 write_lock_bh(&nametbl_lock); 751 write_lock_bh(&tipc_nametbl_lock);
752 table.local_publ_count++; 752 table.local_publ_count++;
753 publ = nametbl_insert_publ(type, lower, upper, scope, 753 publ = tipc_nametbl_insert_publ(type, lower, upper, scope,
754 tipc_own_addr, port_ref, key); 754 tipc_own_addr, port_ref, key);
755 if (publ && (scope != TIPC_NODE_SCOPE)) { 755 if (publ && (scope != TIPC_NODE_SCOPE)) {
756 named_publish(publ); 756 tipc_named_publish(publ);
757 } 757 }
758 write_unlock_bh(&nametbl_lock); 758 write_unlock_bh(&tipc_nametbl_lock);
759 return publ; 759 return publ;
760} 760}
761 761
762/** 762/**
763 * nametbl_withdraw - withdraw name publication from network name tables 763 * tipc_nametbl_withdraw - withdraw name publication from network name tables
764 */ 764 */
765 765
766int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) 766int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
767{ 767{
768 struct publication *publ; 768 struct publication *publ;
769 769
770 dbg("nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); 770 dbg("tipc_nametbl_withdraw:<%d,%d,%d>\n", type, lower, key);
771 write_lock_bh(&nametbl_lock); 771 write_lock_bh(&tipc_nametbl_lock);
772 publ = nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); 772 publ = tipc_nametbl_remove_publ(type, lower, tipc_own_addr, ref, key);
773 if (publ) { 773 if (publ) {
774 table.local_publ_count--; 774 table.local_publ_count--;
775 if (publ->scope != TIPC_NODE_SCOPE) 775 if (publ->scope != TIPC_NODE_SCOPE)
776 named_withdraw(publ); 776 tipc_named_withdraw(publ);
777 write_unlock_bh(&nametbl_lock); 777 write_unlock_bh(&tipc_nametbl_lock);
778 list_del_init(&publ->pport_list); 778 list_del_init(&publ->pport_list);
779 kfree(publ); 779 kfree(publ);
780 return 1; 780 return 1;
781 } 781 }
782 write_unlock_bh(&nametbl_lock); 782 write_unlock_bh(&tipc_nametbl_lock);
783 return 0; 783 return 0;
784} 784}
785 785
786/** 786/**
787 * nametbl_subscribe - add a subscription object to the name table 787 * tipc_nametbl_subscribe - add a subscription object to the name table
788 */ 788 */
789 789
790void 790void
791nametbl_subscribe(struct subscription *s) 791tipc_nametbl_subscribe(struct subscription *s)
792{ 792{
793 u32 type = s->seq.type; 793 u32 type = s->seq.type;
794 struct name_seq *seq; 794 struct name_seq *seq;
795 795
796 write_lock_bh(&nametbl_lock); 796 write_lock_bh(&tipc_nametbl_lock);
797 seq = nametbl_find_seq(type); 797 seq = nametbl_find_seq(type);
798 if (!seq) { 798 if (!seq) {
799 seq = nameseq_create(type, &table.types[hash(type)]); 799 seq = tipc_nameseq_create(type, &table.types[hash(type)]);
800 } 800 }
801 if (seq){ 801 if (seq){
802 spin_lock_bh(&seq->lock); 802 spin_lock_bh(&seq->lock);
803 dbg("nametbl_subscribe:found %x for <%u,%u,%u>\n", 803 dbg("tipc_nametbl_subscribe:found %x for <%u,%u,%u>\n",
804 seq, type, s->seq.lower, s->seq.upper); 804 seq, type, s->seq.lower, s->seq.upper);
805 assert(seq->type == type); 805 assert(seq->type == type);
806 nameseq_subscribe(seq, s); 806 tipc_nameseq_subscribe(seq, s);
807 spin_unlock_bh(&seq->lock); 807 spin_unlock_bh(&seq->lock);
808 } 808 }
809 write_unlock_bh(&nametbl_lock); 809 write_unlock_bh(&tipc_nametbl_lock);
810} 810}
811 811
812/** 812/**
813 * nametbl_unsubscribe - remove a subscription object from name table 813 * tipc_nametbl_unsubscribe - remove a subscription object from name table
814 */ 814 */
815 815
816void 816void
817nametbl_unsubscribe(struct subscription *s) 817tipc_nametbl_unsubscribe(struct subscription *s)
818{ 818{
819 struct name_seq *seq; 819 struct name_seq *seq;
820 820
821 write_lock_bh(&nametbl_lock); 821 write_lock_bh(&tipc_nametbl_lock);
822 seq = nametbl_find_seq(s->seq.type); 822 seq = nametbl_find_seq(s->seq.type);
823 if (seq != NULL){ 823 if (seq != NULL){
824 spin_lock_bh(&seq->lock); 824 spin_lock_bh(&seq->lock);
@@ -830,7 +830,7 @@ nametbl_unsubscribe(struct subscription *s)
830 kfree(seq); 830 kfree(seq);
831 } 831 }
832 } 832 }
833 write_unlock_bh(&nametbl_lock); 833 write_unlock_bh(&tipc_nametbl_lock);
834} 834}
835 835
836 836
@@ -983,17 +983,17 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
983 } 983 }
984} 984}
985 985
986void nametbl_print(struct print_buf *buf, const char *str) 986void tipc_nametbl_print(struct print_buf *buf, const char *str)
987{ 987{
988 tipc_printf(buf, str); 988 tipc_printf(buf, str);
989 read_lock_bh(&nametbl_lock); 989 read_lock_bh(&tipc_nametbl_lock);
990 nametbl_list(buf, 0, 0, 0, 0); 990 nametbl_list(buf, 0, 0, 0, 0);
991 read_unlock_bh(&nametbl_lock); 991 read_unlock_bh(&tipc_nametbl_lock);
992} 992}
993 993
994#define MAX_NAME_TBL_QUERY 32768 994#define MAX_NAME_TBL_QUERY 32768
995 995
996struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) 996struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
997{ 997{
998 struct sk_buff *buf; 998 struct sk_buff *buf;
999 struct tipc_name_table_query *argv; 999 struct tipc_name_table_query *argv;
@@ -1002,20 +1002,20 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space)
1002 int str_len; 1002 int str_len;
1003 1003
1004 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY)) 1004 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY))
1005 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 1005 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
1006 1006
1007 buf = cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); 1007 buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY));
1008 if (!buf) 1008 if (!buf)
1009 return NULL; 1009 return NULL;
1010 1010
1011 rep_tlv = (struct tlv_desc *)buf->data; 1011 rep_tlv = (struct tlv_desc *)buf->data;
1012 printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); 1012 tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY);
1013 argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); 1013 argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area);
1014 read_lock_bh(&nametbl_lock); 1014 read_lock_bh(&tipc_nametbl_lock);
1015 nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), 1015 nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type),
1016 ntohl(argv->lowbound), ntohl(argv->upbound)); 1016 ntohl(argv->lowbound), ntohl(argv->upbound));
1017 read_unlock_bh(&nametbl_lock); 1017 read_unlock_bh(&tipc_nametbl_lock);
1018 str_len = printbuf_validate(&b); 1018 str_len = tipc_printbuf_validate(&b);
1019 1019
1020 skb_put(buf, TLV_SPACE(str_len)); 1020 skb_put(buf, TLV_SPACE(str_len));
1021 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 1021 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -1023,12 +1023,12 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space)
1023 return buf; 1023 return buf;
1024} 1024}
1025 1025
1026void nametbl_dump(void) 1026void tipc_nametbl_dump(void)
1027{ 1027{
1028 nametbl_list(CONS, 0, 0, 0, 0); 1028 nametbl_list(TIPC_CONS, 0, 0, 0, 0);
1029} 1029}
1030 1030
1031int nametbl_init(void) 1031int tipc_nametbl_init(void)
1032{ 1032{
1033 int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; 1033 int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
1034 1034
@@ -1036,14 +1036,14 @@ int nametbl_init(void)
1036 if (!table.types) 1036 if (!table.types)
1037 return -ENOMEM; 1037 return -ENOMEM;
1038 1038
1039 write_lock_bh(&nametbl_lock); 1039 write_lock_bh(&tipc_nametbl_lock);
1040 memset(table.types, 0, array_size); 1040 memset(table.types, 0, array_size);
1041 table.local_publ_count = 0; 1041 table.local_publ_count = 0;
1042 write_unlock_bh(&nametbl_lock); 1042 write_unlock_bh(&tipc_nametbl_lock);
1043 return 0; 1043 return 0;
1044} 1044}
1045 1045
1046void nametbl_stop(void) 1046void tipc_nametbl_stop(void)
1047{ 1047{
1048 struct hlist_head *seq_head; 1048 struct hlist_head *seq_head;
1049 struct hlist_node *seq_node; 1049 struct hlist_node *seq_node;
@@ -1054,7 +1054,7 @@ void nametbl_stop(void)
1054 if (!table.types) 1054 if (!table.types)
1055 return; 1055 return;
1056 1056
1057 write_lock_bh(&nametbl_lock); 1057 write_lock_bh(&tipc_nametbl_lock);
1058 for (i = 0; i < tipc_nametbl_size; i++) { 1058 for (i = 0; i < tipc_nametbl_size; i++) {
1059 seq_head = &table.types[i]; 1059 seq_head = &table.types[i];
1060 hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) { 1060 hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) {
@@ -1075,5 +1075,5 @@ void nametbl_stop(void)
1075 } 1075 }
1076 kfree(table.types); 1076 kfree(table.types);
1077 table.types = NULL; 1077 table.types = NULL;
1078 write_unlock_bh(&nametbl_lock); 1078 write_unlock_bh(&tipc_nametbl_lock);
1079} 1079}
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index f82693384f60..e8a3d71763ce 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -85,24 +85,24 @@ struct publication {
85}; 85};
86 86
87 87
88extern rwlock_t nametbl_lock; 88extern rwlock_t tipc_nametbl_lock;
89 89
90struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space); 90struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
91u32 nametbl_translate(u32 type, u32 instance, u32 *node); 91u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
92int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, 92int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
93 struct port_list *dports); 93 struct port_list *dports);
94int nametbl_publish_rsv(u32 ref, unsigned int scope, 94int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
95 struct tipc_name_seq const *seq); 95 struct tipc_name_seq const *seq);
96struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, 96struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
97 u32 scope, u32 port_ref, u32 key); 97 u32 scope, u32 port_ref, u32 key);
98int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); 98int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
99struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, 99struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
100 u32 scope, u32 node, u32 ref, u32 key); 100 u32 scope, u32 node, u32 ref, u32 key);
101struct publication *nametbl_remove_publ(u32 type, u32 lower, 101struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
102 u32 node, u32 ref, u32 key); 102 u32 node, u32 ref, u32 key);
103void nametbl_subscribe(struct subscription *s); 103void tipc_nametbl_subscribe(struct subscription *s);
104void nametbl_unsubscribe(struct subscription *s); 104void tipc_nametbl_unsubscribe(struct subscription *s);
105int nametbl_init(void); 105int tipc_nametbl_init(void);
106void nametbl_stop(void); 106void tipc_nametbl_stop(void);
107 107
108#endif 108#endif
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 6826b493c1d6..074891ad4f09 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -58,25 +58,25 @@
58 * 1: The routing hierarchy. 58 * 1: The routing hierarchy.
59 * Comprises the structures 'zone', 'cluster', 'node', 'link' 59 * Comprises the structures 'zone', 'cluster', 'node', 'link'
60 * and 'bearer'. The whole hierarchy is protected by a big 60 * and 'bearer'. The whole hierarchy is protected by a big
61 * read/write lock, net_lock, to enssure that nothing is added 61 * read/write lock, tipc_net_lock, to enssure that nothing is added
62 * or removed while code is accessing any of these structures. 62 * or removed while code is accessing any of these structures.
63 * This layer must not be called from the two others while they 63 * This layer must not be called from the two others while they
64 * hold any of their own locks. 64 * hold any of their own locks.
65 * Neither must it itself do any upcalls to the other two before 65 * Neither must it itself do any upcalls to the other two before
66 * it has released net_lock and other protective locks. 66 * it has released tipc_net_lock and other protective locks.
67 * 67 *
68 * Within the net_lock domain there are two sub-domains;'node' and 68 * Within the tipc_net_lock domain there are two sub-domains;'node' and
69 * 'bearer', where local write operations are permitted, 69 * 'bearer', where local write operations are permitted,
70 * provided that those are protected by individual spin_locks 70 * provided that those are protected by individual spin_locks
71 * per instance. Code holding net_lock(read) and a node spin_lock 71 * per instance. Code holding tipc_net_lock(read) and a node spin_lock
72 * is permitted to poke around in both the node itself and its 72 * is permitted to poke around in both the node itself and its
73 * subordinate links. I.e, it can update link counters and queues, 73 * subordinate links. I.e, it can update link counters and queues,
74 * change link state, send protocol messages, and alter the 74 * change link state, send protocol messages, and alter the
75 * "active_links" array in the node; but it can _not_ remove a link 75 * "active_links" array in the node; but it can _not_ remove a link
76 * or a node from the overall structure. 76 * or a node from the overall structure.
77 * Correspondingly, individual bearers may change status within a 77 * Correspondingly, individual bearers may change status within a
78 * net_lock(read), protected by an individual spin_lock ber bearer 78 * tipc_net_lock(read), protected by an individual spin_lock ber bearer
79 * instance, but it needs net_lock(write) to remove/add any bearers. 79 * instance, but it needs tipc_net_lock(write) to remove/add any bearers.
80 * 80 *
81 * 81 *
82 * 2: The transport level of the protocol. 82 * 2: The transport level of the protocol.
@@ -97,91 +97,91 @@
97 * (Nobody is using read-only access to this, so it can just as 97 * (Nobody is using read-only access to this, so it can just as
98 * well be changed to a spin_lock) 98 * well be changed to a spin_lock)
99 * - A spin lock to protect the registry of kernel/driver users (reg.c) 99 * - A spin lock to protect the registry of kernel/driver users (reg.c)
100 * - A global spin_lock (port_lock), which only task is to ensure 100 * - A global spin_lock (tipc_port_lock), which only task is to ensure
101 * consistency where more than one port is involved in an operation, 101 * consistency where more than one port is involved in an operation,
102 * i.e., whe a port is part of a linked list of ports. 102 * i.e., whe a port is part of a linked list of ports.
103 * There are two such lists; 'port_list', which is used for management, 103 * There are two such lists; 'port_list', which is used for management,
104 * and 'wait_list', which is used to queue ports during congestion. 104 * and 'wait_list', which is used to queue ports during congestion.
105 * 105 *
106 * 3: The name table (name_table.c, name_distr.c, subscription.c) 106 * 3: The name table (name_table.c, name_distr.c, subscription.c)
107 * - There is one big read/write-lock (nametbl_lock) protecting the 107 * - There is one big read/write-lock (tipc_nametbl_lock) protecting the
108 * overall name table structure. Nothing must be added/removed to 108 * overall name table structure. Nothing must be added/removed to
109 * this structure without holding write access to it. 109 * this structure without holding write access to it.
110 * - There is one local spin_lock per sub_sequence, which can be seen 110 * - There is one local spin_lock per sub_sequence, which can be seen
111 * as a sub-domain to the nametbl_lock domain. It is used only 111 * as a sub-domain to the tipc_nametbl_lock domain. It is used only
112 * for translation operations, and is needed because a translation 112 * for translation operations, and is needed because a translation
113 * steps the root of the 'publication' linked list between each lookup. 113 * steps the root of the 'publication' linked list between each lookup.
114 * This is always used within the scope of a nametbl_lock(read). 114 * This is always used within the scope of a tipc_nametbl_lock(read).
115 * - A local spin_lock protecting the queue of subscriber events. 115 * - A local spin_lock protecting the queue of subscriber events.
116*/ 116*/
117 117
118rwlock_t net_lock = RW_LOCK_UNLOCKED; 118rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED;
119struct network net = { 0 }; 119struct network tipc_net = { 0 };
120 120
121struct node *net_select_remote_node(u32 addr, u32 ref) 121struct node *tipc_net_select_remote_node(u32 addr, u32 ref)
122{ 122{
123 return zone_select_remote_node(net.zones[tipc_zone(addr)], addr, ref); 123 return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref);
124} 124}
125 125
126u32 net_select_router(u32 addr, u32 ref) 126u32 tipc_net_select_router(u32 addr, u32 ref)
127{ 127{
128 return zone_select_router(net.zones[tipc_zone(addr)], addr, ref); 128 return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref);
129} 129}
130 130
131 131
132u32 net_next_node(u32 a) 132u32 tipc_net_next_node(u32 a)
133{ 133{
134 if (net.zones[tipc_zone(a)]) 134 if (tipc_net.zones[tipc_zone(a)])
135 return zone_next_node(a); 135 return tipc_zone_next_node(a);
136 return 0; 136 return 0;
137} 137}
138 138
139void net_remove_as_router(u32 router) 139void tipc_net_remove_as_router(u32 router)
140{ 140{
141 u32 z_num; 141 u32 z_num;
142 142
143 for (z_num = 1; z_num <= tipc_max_zones; z_num++) { 143 for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
144 if (!net.zones[z_num]) 144 if (!tipc_net.zones[z_num])
145 continue; 145 continue;
146 zone_remove_as_router(net.zones[z_num], router); 146 tipc_zone_remove_as_router(tipc_net.zones[z_num], router);
147 } 147 }
148} 148}
149 149
150void net_send_external_routes(u32 dest) 150void tipc_net_send_external_routes(u32 dest)
151{ 151{
152 u32 z_num; 152 u32 z_num;
153 153
154 for (z_num = 1; z_num <= tipc_max_zones; z_num++) { 154 for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
155 if (net.zones[z_num]) 155 if (tipc_net.zones[z_num])
156 zone_send_external_routes(net.zones[z_num], dest); 156 tipc_zone_send_external_routes(tipc_net.zones[z_num], dest);
157 } 157 }
158} 158}
159 159
160int net_init(void) 160static int net_init(void)
161{ 161{
162 u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1); 162 u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1);
163 163
164 memset(&net, 0, sizeof(net)); 164 memset(&tipc_net, 0, sizeof(tipc_net));
165 net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC); 165 tipc_net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC);
166 if (!net.zones) { 166 if (!tipc_net.zones) {
167 return -ENOMEM; 167 return -ENOMEM;
168 } 168 }
169 memset(net.zones, 0, sz); 169 memset(tipc_net.zones, 0, sz);
170 return TIPC_OK; 170 return TIPC_OK;
171} 171}
172 172
173void net_stop(void) 173static void net_stop(void)
174{ 174{
175 u32 z_num; 175 u32 z_num;
176 176
177 if (!net.zones) 177 if (!tipc_net.zones)
178 return; 178 return;
179 179
180 for (z_num = 1; z_num <= tipc_max_zones; z_num++) { 180 for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
181 zone_delete(net.zones[z_num]); 181 tipc_zone_delete(tipc_net.zones[z_num]);
182 } 182 }
183 kfree(net.zones); 183 kfree(tipc_net.zones);
184 net.zones = 0; 184 tipc_net.zones = 0;
185} 185}
186 186
187static void net_route_named_msg(struct sk_buff *buf) 187static void net_route_named_msg(struct sk_buff *buf)
@@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf)
191 u32 dport; 191 u32 dport;
192 192
193 if (!msg_named(msg)) { 193 if (!msg_named(msg)) {
194 msg_dbg(msg, "net->drop_nam:"); 194 msg_dbg(msg, "tipc_net->drop_nam:");
195 buf_discard(buf); 195 buf_discard(buf);
196 return; 196 return;
197 } 197 }
198 198
199 dnode = addr_domain(msg_lookup_scope(msg)); 199 dnode = addr_domain(msg_lookup_scope(msg));
200 dport = nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode); 200 dport = tipc_nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode);
201 dbg("net->lookup<%u,%u>-><%u,%x>\n", 201 dbg("tipc_net->lookup<%u,%u>-><%u,%x>\n",
202 msg_nametype(msg), msg_nameinst(msg), dport, dnode); 202 msg_nametype(msg), msg_nameinst(msg), dport, dnode);
203 if (dport) { 203 if (dport) {
204 msg_set_destnode(msg, dnode); 204 msg_set_destnode(msg, dnode);
205 msg_set_destport(msg, dport); 205 msg_set_destport(msg, dport);
206 net_route_msg(buf); 206 tipc_net_route_msg(buf);
207 return; 207 return;
208 } 208 }
209 msg_dbg(msg, "net->rej:NO NAME: "); 209 msg_dbg(msg, "tipc_net->rej:NO NAME: ");
210 tipc_reject_msg(buf, TIPC_ERR_NO_NAME); 210 tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
211} 211}
212 212
213void net_route_msg(struct sk_buff *buf) 213void tipc_net_route_msg(struct sk_buff *buf)
214{ 214{
215 struct tipc_msg *msg; 215 struct tipc_msg *msg;
216 u32 dnode; 216 u32 dnode;
@@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf)
232 return; 232 return;
233 } 233 }
234 234
235 msg_dbg(msg, "net->rout: "); 235 msg_dbg(msg, "tipc_net->rout: ");
236 236
237 /* Handle message for this node */ 237 /* Handle message for this node */
238 dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); 238 dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg);
239 if (in_scope(dnode, tipc_own_addr)) { 239 if (in_scope(dnode, tipc_own_addr)) {
240 if (msg_isdata(msg)) { 240 if (msg_isdata(msg)) {
241 if (msg_mcast(msg)) 241 if (msg_mcast(msg))
242 port_recv_mcast(buf, NULL); 242 tipc_port_recv_mcast(buf, NULL);
243 else if (msg_destport(msg)) 243 else if (msg_destport(msg))
244 port_recv_msg(buf); 244 tipc_port_recv_msg(buf);
245 else 245 else
246 net_route_named_msg(buf); 246 net_route_named_msg(buf);
247 return; 247 return;
248 } 248 }
249 switch (msg_user(msg)) { 249 switch (msg_user(msg)) {
250 case ROUTE_DISTRIBUTOR: 250 case ROUTE_DISTRIBUTOR:
251 cluster_recv_routing_table(buf); 251 tipc_cltr_recv_routing_table(buf);
252 break; 252 break;
253 case NAME_DISTRIBUTOR: 253 case NAME_DISTRIBUTOR:
254 named_recv(buf); 254 tipc_named_recv(buf);
255 break; 255 break;
256 case CONN_MANAGER: 256 case CONN_MANAGER:
257 port_recv_proto_msg(buf); 257 tipc_port_recv_proto_msg(buf);
258 break; 258 break;
259 default: 259 default:
260 msg_dbg(msg,"DROP/NET/<REC<"); 260 msg_dbg(msg,"DROP/NET/<REC<");
@@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf)
265 265
266 /* Handle message for another node */ 266 /* Handle message for another node */
267 msg_dbg(msg, "NET>SEND>: "); 267 msg_dbg(msg, "NET>SEND>: ");
268 link_send(buf, dnode, msg_link_selector(msg)); 268 tipc_link_send(buf, dnode, msg_link_selector(msg));
269} 269}
270 270
271int tipc_start_net(void) 271int tipc_net_start(void)
272{ 272{
273 char addr_string[16]; 273 char addr_string[16];
274 int res; 274 int res;
@@ -277,35 +277,35 @@ int tipc_start_net(void)
277 return -ENOPROTOOPT; 277 return -ENOPROTOOPT;
278 278
279 tipc_mode = TIPC_NET_MODE; 279 tipc_mode = TIPC_NET_MODE;
280 named_reinit(); 280 tipc_named_reinit();
281 port_reinit(); 281 tipc_port_reinit();
282 282
283 if ((res = bearer_init()) || 283 if ((res = tipc_bearer_init()) ||
284 (res = net_init()) || 284 (res = net_init()) ||
285 (res = cluster_init()) || 285 (res = tipc_cltr_init()) ||
286 (res = bclink_init())) { 286 (res = tipc_bclink_init())) {
287 return res; 287 return res;
288 } 288 }
289 subscr_stop(); 289 tipc_subscr_stop();
290 cfg_stop(); 290 tipc_cfg_stop();
291 k_signal((Handler)subscr_start, 0); 291 tipc_k_signal((Handler)tipc_subscr_start, 0);
292 k_signal((Handler)cfg_init, 0); 292 tipc_k_signal((Handler)tipc_cfg_init, 0);
293 info("Started in network mode\n"); 293 info("Started in network mode\n");
294 info("Own node address %s, network identity %u\n", 294 info("Own node address %s, network identity %u\n",
295 addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); 295 addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
296 return TIPC_OK; 296 return TIPC_OK;
297} 297}
298 298
299void tipc_stop_net(void) 299void tipc_net_stop(void)
300{ 300{
301 if (tipc_mode != TIPC_NET_MODE) 301 if (tipc_mode != TIPC_NET_MODE)
302 return; 302 return;
303 write_lock_bh(&net_lock); 303 write_lock_bh(&tipc_net_lock);
304 bearer_stop(); 304 tipc_bearer_stop();
305 tipc_mode = TIPC_NODE_MODE; 305 tipc_mode = TIPC_NODE_MODE;
306 bclink_stop(); 306 tipc_bclink_stop();
307 net_stop(); 307 net_stop();
308 write_unlock_bh(&net_lock); 308 write_unlock_bh(&tipc_net_lock);
309 info("Left network mode \n"); 309 info("Left network mode \n");
310} 310}
311 311
diff --git a/net/tipc/net.h b/net/tipc/net.h
index 948c6d42102c..f3e0b85e6475 100644
--- a/net/tipc/net.h
+++ b/net/tipc/net.h
@@ -49,18 +49,16 @@ struct network {
49}; 49};
50 50
51 51
52extern struct network net; 52extern struct network tipc_net;
53extern rwlock_t net_lock; 53extern rwlock_t tipc_net_lock;
54 54
55int net_init(void); 55void tipc_net_remove_as_router(u32 router);
56void net_stop(void); 56void tipc_net_send_external_routes(u32 dest);
57void net_remove_as_router(u32 router); 57void tipc_net_route_msg(struct sk_buff *buf);
58void net_send_external_routes(u32 dest); 58struct node *tipc_net_select_remote_node(u32 addr, u32 ref);
59void net_route_msg(struct sk_buff *buf); 59u32 tipc_net_select_router(u32 addr, u32 ref);
60struct node *net_select_remote_node(u32 addr, u32 ref);
61u32 net_select_router(u32 addr, u32 ref);
62 60
63int tipc_start_net(void); 61int tipc_net_start(void);
64void tipc_stop_net(void); 62void tipc_net_stop(void);
65 63
66#endif 64#endif
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 19b3f4022532..eb1bb4dce7af 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -47,13 +47,13 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
47 int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN); 47 int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN);
48 48
49 if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) 49 if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN)))
50 rep_buf = cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); 50 rep_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN);
51 else 51 else
52 rep_buf = cfg_do_cmd(req_userhdr->dest, 52 rep_buf = tipc_cfg_do_cmd(req_userhdr->dest,
53 req_userhdr->cmd, 53 req_userhdr->cmd,
54 NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, 54 NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN,
55 NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), 55 NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN),
56 hdr_space); 56 hdr_space);
57 57
58 if (rep_buf) { 58 if (rep_buf) {
59 skb_push(rep_buf, hdr_space); 59 skb_push(rep_buf, hdr_space);
@@ -81,7 +81,7 @@ static struct genl_ops ops = {
81 81
82static int family_registered = 0; 82static int family_registered = 0;
83 83
84int netlink_start(void) 84int tipc_netlink_start(void)
85{ 85{
86 86
87 87
@@ -103,7 +103,7 @@ int netlink_start(void)
103 return -EFAULT; 103 return -EFAULT;
104} 104}
105 105
106void netlink_stop(void) 106void tipc_netlink_stop(void)
107{ 107{
108 if (family_registered) { 108 if (family_registered) {
109 genl_unregister_family(&family); 109 genl_unregister_family(&family);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 05688d01138b..6d65010e5fa1 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -45,17 +45,16 @@
45#include "port.h" 45#include "port.h"
46#include "bearer.h" 46#include "bearer.h"
47#include "name_distr.h" 47#include "name_distr.h"
48#include "net.h"
49 48
50void node_print(struct print_buf *buf, struct node *n_ptr, char *str); 49void node_print(struct print_buf *buf, struct node *n_ptr, char *str);
51static void node_lost_contact(struct node *n_ptr); 50static void node_lost_contact(struct node *n_ptr);
52static void node_established_contact(struct node *n_ptr); 51static void node_established_contact(struct node *n_ptr);
53 52
54struct node *nodes = NULL; /* sorted list of nodes within cluster */ 53struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
55 54
56u32 tipc_own_tag = 0; 55u32 tipc_own_tag = 0;
57 56
58struct node *node_create(u32 addr) 57struct node *tipc_node_create(u32 addr)
59{ 58{
60 struct cluster *c_ptr; 59 struct cluster *c_ptr;
61 struct node *n_ptr; 60 struct node *n_ptr;
@@ -68,16 +67,16 @@ struct node *node_create(u32 addr)
68 n_ptr->lock = SPIN_LOCK_UNLOCKED; 67 n_ptr->lock = SPIN_LOCK_UNLOCKED;
69 INIT_LIST_HEAD(&n_ptr->nsub); 68 INIT_LIST_HEAD(&n_ptr->nsub);
70 69
71 c_ptr = cluster_find(addr); 70 c_ptr = tipc_cltr_find(addr);
72 if (c_ptr == NULL) 71 if (c_ptr == NULL)
73 c_ptr = cluster_create(addr); 72 c_ptr = tipc_cltr_create(addr);
74 if (c_ptr != NULL) { 73 if (c_ptr != NULL) {
75 n_ptr->owner = c_ptr; 74 n_ptr->owner = c_ptr;
76 cluster_attach_node(c_ptr, n_ptr); 75 tipc_cltr_attach_node(c_ptr, n_ptr);
77 n_ptr->last_router = -1; 76 n_ptr->last_router = -1;
78 77
79 /* Insert node into ordered list */ 78 /* Insert node into ordered list */
80 for (curr_node = &nodes; *curr_node; 79 for (curr_node = &tipc_nodes; *curr_node;
81 curr_node = &(*curr_node)->next) { 80 curr_node = &(*curr_node)->next) {
82 if (addr < (*curr_node)->addr) { 81 if (addr < (*curr_node)->addr) {
83 n_ptr->next = *curr_node; 82 n_ptr->next = *curr_node;
@@ -93,13 +92,13 @@ struct node *node_create(u32 addr)
93 return n_ptr; 92 return n_ptr;
94} 93}
95 94
96void node_delete(struct node *n_ptr) 95void tipc_node_delete(struct node *n_ptr)
97{ 96{
98 if (!n_ptr) 97 if (!n_ptr)
99 return; 98 return;
100 99
101#if 0 100#if 0
102 /* Not needed because links are already deleted via bearer_stop() */ 101 /* Not needed because links are already deleted via tipc_bearer_stop() */
103 102
104 u32 l_num; 103 u32 l_num;
105 104
@@ -114,12 +113,12 @@ void node_delete(struct node *n_ptr)
114 113
115 114
116/** 115/**
117 * node_link_up - handle addition of link 116 * tipc_node_link_up - handle addition of link
118 * 117 *
119 * Link becomes active (alone or shared) or standby, depending on its priority. 118 * Link becomes active (alone or shared) or standby, depending on its priority.
120 */ 119 */
121 120
122void node_link_up(struct node *n_ptr, struct link *l_ptr) 121void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
123{ 122{
124 struct link **active = &n_ptr->active_links[0]; 123 struct link **active = &n_ptr->active_links[0];
125 124
@@ -136,7 +135,7 @@ void node_link_up(struct node *n_ptr, struct link *l_ptr)
136 info("Link is standby\n"); 135 info("Link is standby\n");
137 return; 136 return;
138 } 137 }
139 link_send_duplicate(active[0], l_ptr); 138 tipc_link_send_duplicate(active[0], l_ptr);
140 if (l_ptr->priority == active[0]->priority) { 139 if (l_ptr->priority == active[0]->priority) {
141 active[0] = l_ptr; 140 active[0] = l_ptr;
142 return; 141 return;
@@ -161,7 +160,7 @@ static void node_select_active_links(struct node *n_ptr)
161 for (i = 0; i < MAX_BEARERS; i++) { 160 for (i = 0; i < MAX_BEARERS; i++) {
162 struct link *l_ptr = n_ptr->links[i]; 161 struct link *l_ptr = n_ptr->links[i];
163 162
164 if (!l_ptr || !link_is_up(l_ptr) || 163 if (!l_ptr || !tipc_link_is_up(l_ptr) ||
165 (l_ptr->priority < highest_prio)) 164 (l_ptr->priority < highest_prio))
166 continue; 165 continue;
167 166
@@ -175,14 +174,14 @@ static void node_select_active_links(struct node *n_ptr)
175} 174}
176 175
177/** 176/**
178 * node_link_down - handle loss of link 177 * tipc_node_link_down - handle loss of link
179 */ 178 */
180 179
181void node_link_down(struct node *n_ptr, struct link *l_ptr) 180void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr)
182{ 181{
183 struct link **active; 182 struct link **active;
184 183
185 if (!link_is_active(l_ptr)) { 184 if (!tipc_link_is_active(l_ptr)) {
186 info("Lost standby link <%s> on network plane %c\n", 185 info("Lost standby link <%s> on network plane %c\n",
187 l_ptr->name, l_ptr->b_ptr->net_plane); 186 l_ptr->name, l_ptr->b_ptr->net_plane);
188 return; 187 return;
@@ -197,40 +196,40 @@ void node_link_down(struct node *n_ptr, struct link *l_ptr)
197 active[1] = active[0]; 196 active[1] = active[0];
198 if (active[0] == l_ptr) 197 if (active[0] == l_ptr)
199 node_select_active_links(n_ptr); 198 node_select_active_links(n_ptr);
200 if (node_is_up(n_ptr)) 199 if (tipc_node_is_up(n_ptr))
201 link_changeover(l_ptr); 200 tipc_link_changeover(l_ptr);
202 else 201 else
203 node_lost_contact(n_ptr); 202 node_lost_contact(n_ptr);
204} 203}
205 204
206int node_has_active_links(struct node *n_ptr) 205int tipc_node_has_active_links(struct node *n_ptr)
207{ 206{
208 return (n_ptr && 207 return (n_ptr &&
209 ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); 208 ((n_ptr->active_links[0]) || (n_ptr->active_links[1])));
210} 209}
211 210
212int node_has_redundant_links(struct node *n_ptr) 211int tipc_node_has_redundant_links(struct node *n_ptr)
213{ 212{
214 return (node_has_active_links(n_ptr) && 213 return (tipc_node_has_active_links(n_ptr) &&
215 (n_ptr->active_links[0] != n_ptr->active_links[1])); 214 (n_ptr->active_links[0] != n_ptr->active_links[1]));
216} 215}
217 216
218int node_has_active_routes(struct node *n_ptr) 217int tipc_node_has_active_routes(struct node *n_ptr)
219{ 218{
220 return (n_ptr && (n_ptr->last_router >= 0)); 219 return (n_ptr && (n_ptr->last_router >= 0));
221} 220}
222 221
223int node_is_up(struct node *n_ptr) 222int tipc_node_is_up(struct node *n_ptr)
224{ 223{
225 return (node_has_active_links(n_ptr) || node_has_active_routes(n_ptr)); 224 return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr));
226} 225}
227 226
228struct node *node_attach_link(struct link *l_ptr) 227struct node *tipc_node_attach_link(struct link *l_ptr)
229{ 228{
230 struct node *n_ptr = node_find(l_ptr->addr); 229 struct node *n_ptr = tipc_node_find(l_ptr->addr);
231 230
232 if (!n_ptr) 231 if (!n_ptr)
233 n_ptr = node_create(l_ptr->addr); 232 n_ptr = tipc_node_create(l_ptr->addr);
234 if (n_ptr) { 233 if (n_ptr) {
235 u32 bearer_id = l_ptr->b_ptr->identity; 234 u32 bearer_id = l_ptr->b_ptr->identity;
236 char addr_string[16]; 235 char addr_string[16];
@@ -246,7 +245,7 @@ struct node *node_attach_link(struct link *l_ptr)
246 245
247 if (!n_ptr->links[bearer_id]) { 246 if (!n_ptr->links[bearer_id]) {
248 n_ptr->links[bearer_id] = l_ptr; 247 n_ptr->links[bearer_id] = l_ptr;
249 net.zones[tipc_zone(l_ptr->addr)]->links++; 248 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
250 n_ptr->link_cnt++; 249 n_ptr->link_cnt++;
251 return n_ptr; 250 return n_ptr;
252 } 251 }
@@ -257,10 +256,10 @@ struct node *node_attach_link(struct link *l_ptr)
257 return 0; 256 return 0;
258} 257}
259 258
260void node_detach_link(struct node *n_ptr, struct link *l_ptr) 259void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
261{ 260{
262 n_ptr->links[l_ptr->b_ptr->identity] = 0; 261 n_ptr->links[l_ptr->b_ptr->identity] = 0;
263 net.zones[tipc_zone(l_ptr->addr)]->links--; 262 tipc_net.zones[tipc_zone(l_ptr->addr)]->links--;
264 n_ptr->link_cnt--; 263 n_ptr->link_cnt--;
265} 264}
266 265
@@ -315,45 +314,45 @@ static void node_established_contact(struct node *n_ptr)
315 struct cluster *c_ptr; 314 struct cluster *c_ptr;
316 315
317 dbg("node_established_contact:-> %x\n", n_ptr->addr); 316 dbg("node_established_contact:-> %x\n", n_ptr->addr);
318 if (!node_has_active_routes(n_ptr)) { 317 if (!tipc_node_has_active_routes(n_ptr)) {
319 k_signal((Handler)named_node_up, n_ptr->addr); 318 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr);
320 } 319 }
321 320
322 /* Syncronize broadcast acks */ 321 /* Syncronize broadcast acks */
323 n_ptr->bclink.acked = bclink_get_last_sent(); 322 n_ptr->bclink.acked = tipc_bclink_get_last_sent();
324 323
325 if (is_slave(tipc_own_addr)) 324 if (is_slave(tipc_own_addr))
326 return; 325 return;
327 if (!in_own_cluster(n_ptr->addr)) { 326 if (!in_own_cluster(n_ptr->addr)) {
328 /* Usage case 1 (see above) */ 327 /* Usage case 1 (see above) */
329 c_ptr = cluster_find(tipc_own_addr); 328 c_ptr = tipc_cltr_find(tipc_own_addr);
330 if (!c_ptr) 329 if (!c_ptr)
331 c_ptr = cluster_create(tipc_own_addr); 330 c_ptr = tipc_cltr_create(tipc_own_addr);
332 if (c_ptr) 331 if (c_ptr)
333 cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, 332 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
334 tipc_max_nodes); 333 tipc_max_nodes);
335 return; 334 return;
336 } 335 }
337 336
338 c_ptr = n_ptr->owner; 337 c_ptr = n_ptr->owner;
339 if (is_slave(n_ptr->addr)) { 338 if (is_slave(n_ptr->addr)) {
340 /* Usage case 2 (see above) */ 339 /* Usage case 2 (see above) */
341 cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); 340 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes);
342 cluster_send_local_routes(c_ptr, n_ptr->addr); 341 tipc_cltr_send_local_routes(c_ptr, n_ptr->addr);
343 return; 342 return;
344 } 343 }
345 344
346 if (n_ptr->bclink.supported) { 345 if (n_ptr->bclink.supported) {
347 nmap_add(&cluster_bcast_nodes, n_ptr->addr); 346 tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr);
348 if (n_ptr->addr < tipc_own_addr) 347 if (n_ptr->addr < tipc_own_addr)
349 tipc_own_tag++; 348 tipc_own_tag++;
350 } 349 }
351 350
352 /* Case 3 (see above) */ 351 /* Case 3 (see above) */
353 net_send_external_routes(n_ptr->addr); 352 tipc_net_send_external_routes(n_ptr->addr);
354 cluster_send_slave_routes(c_ptr, n_ptr->addr); 353 tipc_cltr_send_slave_routes(c_ptr, n_ptr->addr);
355 cluster_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, 354 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE,
356 highest_allowed_slave); 355 tipc_highest_allowed_slave);
357} 356}
358 357
359static void node_lost_contact(struct node *n_ptr) 358static void node_lost_contact(struct node *n_ptr)
@@ -375,39 +374,39 @@ static void node_lost_contact(struct node *n_ptr)
375 n_ptr->bclink.defragm = NULL; 374 n_ptr->bclink.defragm = NULL;
376 } 375 }
377 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { 376 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
378 bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); 377 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
379 } 378 }
380 379
381 /* Update routing tables */ 380 /* Update routing tables */
382 if (is_slave(tipc_own_addr)) { 381 if (is_slave(tipc_own_addr)) {
383 net_remove_as_router(n_ptr->addr); 382 tipc_net_remove_as_router(n_ptr->addr);
384 } else { 383 } else {
385 if (!in_own_cluster(n_ptr->addr)) { 384 if (!in_own_cluster(n_ptr->addr)) {
386 /* Case 4 (see above) */ 385 /* Case 4 (see above) */
387 c_ptr = cluster_find(tipc_own_addr); 386 c_ptr = tipc_cltr_find(tipc_own_addr);
388 cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, 387 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
389 tipc_max_nodes); 388 tipc_max_nodes);
390 } else { 389 } else {
391 /* Case 5 (see above) */ 390 /* Case 5 (see above) */
392 c_ptr = cluster_find(n_ptr->addr); 391 c_ptr = tipc_cltr_find(n_ptr->addr);
393 if (is_slave(n_ptr->addr)) { 392 if (is_slave(n_ptr->addr)) {
394 cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, 393 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
395 tipc_max_nodes); 394 tipc_max_nodes);
396 } else { 395 } else {
397 if (n_ptr->bclink.supported) { 396 if (n_ptr->bclink.supported) {
398 nmap_remove(&cluster_bcast_nodes, 397 tipc_nmap_remove(&tipc_cltr_bcast_nodes,
399 n_ptr->addr); 398 n_ptr->addr);
400 if (n_ptr->addr < tipc_own_addr) 399 if (n_ptr->addr < tipc_own_addr)
401 tipc_own_tag--; 400 tipc_own_tag--;
402 } 401 }
403 net_remove_as_router(n_ptr->addr); 402 tipc_net_remove_as_router(n_ptr->addr);
404 cluster_bcast_lost_route(c_ptr, n_ptr->addr, 403 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr,
405 LOWEST_SLAVE, 404 LOWEST_SLAVE,
406 highest_allowed_slave); 405 tipc_highest_allowed_slave);
407 } 406 }
408 } 407 }
409 } 408 }
410 if (node_has_active_routes(n_ptr)) 409 if (tipc_node_has_active_routes(n_ptr))
411 return; 410 return;
412 411
413 info("Lost contact with %s\n", 412 info("Lost contact with %s\n",
@@ -420,35 +419,35 @@ static void node_lost_contact(struct node *n_ptr)
420 continue; 419 continue;
421 l_ptr->reset_checkpoint = l_ptr->next_in_no; 420 l_ptr->reset_checkpoint = l_ptr->next_in_no;
422 l_ptr->exp_msg_count = 0; 421 l_ptr->exp_msg_count = 0;
423 link_reset_fragments(l_ptr); 422 tipc_link_reset_fragments(l_ptr);
424 } 423 }
425 424
426 /* Notify subscribers */ 425 /* Notify subscribers */
427 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { 426 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
428 ns->node = 0; 427 ns->node = 0;
429 list_del_init(&ns->nodesub_list); 428 list_del_init(&ns->nodesub_list);
430 k_signal((Handler)ns->handle_node_down, 429 tipc_k_signal((Handler)ns->handle_node_down,
431 (unsigned long)ns->usr_handle); 430 (unsigned long)ns->usr_handle);
432 } 431 }
433} 432}
434 433
435/** 434/**
436 * node_select_next_hop - find the next-hop node for a message 435 * tipc_node_select_next_hop - find the next-hop node for a message
437 * 436 *
438 * Called by when cluster local lookup has failed. 437 * Called by when cluster local lookup has failed.
439 */ 438 */
440 439
441struct node *node_select_next_hop(u32 addr, u32 selector) 440struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
442{ 441{
443 struct node *n_ptr; 442 struct node *n_ptr;
444 u32 router_addr; 443 u32 router_addr;
445 444
446 if (!addr_domain_valid(addr)) 445 if (!tipc_addr_domain_valid(addr))
447 return 0; 446 return 0;
448 447
449 /* Look for direct link to destination processsor */ 448 /* Look for direct link to destination processsor */
450 n_ptr = node_find(addr); 449 n_ptr = tipc_node_find(addr);
451 if (n_ptr && node_has_active_links(n_ptr)) 450 if (n_ptr && tipc_node_has_active_links(n_ptr))
452 return n_ptr; 451 return n_ptr;
453 452
454 /* Cluster local system nodes *must* have direct links */ 453 /* Cluster local system nodes *must* have direct links */
@@ -456,9 +455,9 @@ struct node *node_select_next_hop(u32 addr, u32 selector)
456 return 0; 455 return 0;
457 456
458 /* Look for cluster local router with direct link to node */ 457 /* Look for cluster local router with direct link to node */
459 router_addr = node_select_router(n_ptr, selector); 458 router_addr = tipc_node_select_router(n_ptr, selector);
460 if (router_addr) 459 if (router_addr)
461 return node_select(router_addr, selector); 460 return tipc_node_select(router_addr, selector);
462 461
463 /* Slave nodes can only be accessed within own cluster via a 462 /* Slave nodes can only be accessed within own cluster via a
464 known router with direct link -- if no router was found,give up */ 463 known router with direct link -- if no router was found,give up */
@@ -467,25 +466,25 @@ struct node *node_select_next_hop(u32 addr, u32 selector)
467 466
468 /* Inter zone/cluster -- find any direct link to remote cluster */ 467 /* Inter zone/cluster -- find any direct link to remote cluster */
469 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 468 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
470 n_ptr = net_select_remote_node(addr, selector); 469 n_ptr = tipc_net_select_remote_node(addr, selector);
471 if (n_ptr && node_has_active_links(n_ptr)) 470 if (n_ptr && tipc_node_has_active_links(n_ptr))
472 return n_ptr; 471 return n_ptr;
473 472
474 /* Last resort -- look for any router to anywhere in remote zone */ 473 /* Last resort -- look for any router to anywhere in remote zone */
475 router_addr = net_select_router(addr, selector); 474 router_addr = tipc_net_select_router(addr, selector);
476 if (router_addr) 475 if (router_addr)
477 return node_select(router_addr, selector); 476 return tipc_node_select(router_addr, selector);
478 477
479 return 0; 478 return 0;
480} 479}
481 480
482/** 481/**
483 * node_select_router - select router to reach specified node 482 * tipc_node_select_router - select router to reach specified node
484 * 483 *
485 * Uses a deterministic and fair algorithm for selecting router node. 484 * Uses a deterministic and fair algorithm for selecting router node.
486 */ 485 */
487 486
488u32 node_select_router(struct node *n_ptr, u32 ref) 487u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
489{ 488{
490 u32 ulim; 489 u32 ulim;
491 u32 mask; 490 u32 mask;
@@ -523,7 +522,7 @@ u32 node_select_router(struct node *n_ptr, u32 ref)
523 return tipc_addr(own_zone(), own_cluster(), r); 522 return tipc_addr(own_zone(), own_cluster(), r);
524} 523}
525 524
526void node_add_router(struct node *n_ptr, u32 router) 525void tipc_node_add_router(struct node *n_ptr, u32 router)
527{ 526{
528 u32 r_num = tipc_node(router); 527 u32 r_num = tipc_node(router);
529 528
@@ -534,7 +533,7 @@ void node_add_router(struct node *n_ptr, u32 router)
534 !n_ptr->routers[n_ptr->last_router]); 533 !n_ptr->routers[n_ptr->last_router]);
535} 534}
536 535
537void node_remove_router(struct node *n_ptr, u32 router) 536void tipc_node_remove_router(struct node *n_ptr, u32 router)
538{ 537{
539 u32 r_num = tipc_node(router); 538 u32 r_num = tipc_node(router);
540 539
@@ -547,7 +546,7 @@ void node_remove_router(struct node *n_ptr, u32 router)
547 while ((--n_ptr->last_router >= 0) && 546 while ((--n_ptr->last_router >= 0) &&
548 !n_ptr->routers[n_ptr->last_router]); 547 !n_ptr->routers[n_ptr->last_router]);
549 548
550 if (!node_is_up(n_ptr)) 549 if (!tipc_node_is_up(n_ptr))
551 node_lost_contact(n_ptr); 550 node_lost_contact(n_ptr);
552} 551}
553 552
@@ -572,16 +571,16 @@ u32 tipc_available_nodes(const u32 domain)
572 struct node *n_ptr; 571 struct node *n_ptr;
573 u32 cnt = 0; 572 u32 cnt = 0;
574 573
575 for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { 574 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
576 if (!in_scope(domain, n_ptr->addr)) 575 if (!in_scope(domain, n_ptr->addr))
577 continue; 576 continue;
578 if (node_is_up(n_ptr)) 577 if (tipc_node_is_up(n_ptr))
579 cnt++; 578 cnt++;
580 } 579 }
581 return cnt; 580 return cnt;
582} 581}
583 582
584struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) 583struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
585{ 584{
586 u32 domain; 585 u32 domain;
587 struct sk_buff *buf; 586 struct sk_buff *buf;
@@ -589,40 +588,40 @@ struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space)
589 struct tipc_node_info node_info; 588 struct tipc_node_info node_info;
590 589
591 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 590 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
592 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 591 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
593 592
594 domain = *(u32 *)TLV_DATA(req_tlv_area); 593 domain = *(u32 *)TLV_DATA(req_tlv_area);
595 domain = ntohl(domain); 594 domain = ntohl(domain);
596 if (!addr_domain_valid(domain)) 595 if (!tipc_addr_domain_valid(domain))
597 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 596 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
598 " (network address)"); 597 " (network address)");
599 598
600 if (!nodes) 599 if (!tipc_nodes)
601 return cfg_reply_none(); 600 return tipc_cfg_reply_none();
602 601
603 /* For now, get space for all other nodes 602 /* For now, get space for all other nodes
604 (will need to modify this when slave nodes are supported */ 603 (will need to modify this when slave nodes are supported */
605 604
606 buf = cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * 605 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) *
607 (tipc_max_nodes - 1)); 606 (tipc_max_nodes - 1));
608 if (!buf) 607 if (!buf)
609 return NULL; 608 return NULL;
610 609
611 /* Add TLVs for all nodes in scope */ 610 /* Add TLVs for all nodes in scope */
612 611
613 for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { 612 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
614 if (!in_scope(domain, n_ptr->addr)) 613 if (!in_scope(domain, n_ptr->addr))
615 continue; 614 continue;
616 node_info.addr = htonl(n_ptr->addr); 615 node_info.addr = htonl(n_ptr->addr);
617 node_info.up = htonl(node_is_up(n_ptr)); 616 node_info.up = htonl(tipc_node_is_up(n_ptr));
618 cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, 617 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
619 &node_info, sizeof(node_info)); 618 &node_info, sizeof(node_info));
620 } 619 }
621 620
622 return buf; 621 return buf;
623} 622}
624 623
625struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) 624struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
626{ 625{
627 u32 domain; 626 u32 domain;
628 struct sk_buff *buf; 627 struct sk_buff *buf;
@@ -630,22 +629,22 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
630 struct tipc_link_info link_info; 629 struct tipc_link_info link_info;
631 630
632 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 631 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
633 return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 632 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
634 633
635 domain = *(u32 *)TLV_DATA(req_tlv_area); 634 domain = *(u32 *)TLV_DATA(req_tlv_area);
636 domain = ntohl(domain); 635 domain = ntohl(domain);
637 if (!addr_domain_valid(domain)) 636 if (!tipc_addr_domain_valid(domain))
638 return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 637 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
639 " (network address)"); 638 " (network address)");
640 639
641 if (!nodes) 640 if (!tipc_nodes)
642 return cfg_reply_none(); 641 return tipc_cfg_reply_none();
643 642
644 /* For now, get space for 2 links to all other nodes + bcast link 643 /* For now, get space for 2 links to all other nodes + bcast link
645 (will need to modify this when slave nodes are supported */ 644 (will need to modify this when slave nodes are supported */
646 645
647 buf = cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * 646 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) *
648 (2 * (tipc_max_nodes - 1) + 1)); 647 (2 * (tipc_max_nodes - 1) + 1));
649 if (!buf) 648 if (!buf)
650 return NULL; 649 return NULL;
651 650
@@ -654,12 +653,12 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
654 link_info.dest = tipc_own_addr & 0xfffff00; 653 link_info.dest = tipc_own_addr & 0xfffff00;
655 link_info.dest = htonl(link_info.dest); 654 link_info.dest = htonl(link_info.dest);
656 link_info.up = htonl(1); 655 link_info.up = htonl(1);
657 sprintf(link_info.str, bc_link_name); 656 sprintf(link_info.str, tipc_bclink_name);
658 cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 657 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
659 658
660 /* Add TLVs for any other links in scope */ 659 /* Add TLVs for any other links in scope */
661 660
662 for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { 661 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
663 u32 i; 662 u32 i;
664 663
665 if (!in_scope(domain, n_ptr->addr)) 664 if (!in_scope(domain, n_ptr->addr))
@@ -668,10 +667,10 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
668 if (!n_ptr->links[i]) 667 if (!n_ptr->links[i])
669 continue; 668 continue;
670 link_info.dest = htonl(n_ptr->addr); 669 link_info.dest = htonl(n_ptr->addr);
671 link_info.up = htonl(link_is_up(n_ptr->links[i])); 670 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
672 strcpy(link_info.str, n_ptr->links[i]->name); 671 strcpy(link_info.str, n_ptr->links[i]->name);
673 cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, 672 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
674 &link_info, sizeof(link_info)); 673 &link_info, sizeof(link_info));
675 } 674 }
676 } 675 }
677 676
diff --git a/net/tipc/node.h b/net/tipc/node.h
index b39442badccf..29f7ae6992d4 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -92,31 +92,31 @@ struct node {
92 } bclink; 92 } bclink;
93}; 93};
94 94
95extern struct node *nodes; 95extern struct node *tipc_nodes;
96extern u32 tipc_own_tag; 96extern u32 tipc_own_tag;
97 97
98struct node *node_create(u32 addr); 98struct node *tipc_node_create(u32 addr);
99void node_delete(struct node *n_ptr); 99void tipc_node_delete(struct node *n_ptr);
100struct node *node_attach_link(struct link *l_ptr); 100struct node *tipc_node_attach_link(struct link *l_ptr);
101void node_detach_link(struct node *n_ptr, struct link *l_ptr); 101void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr);
102void node_link_down(struct node *n_ptr, struct link *l_ptr); 102void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr);
103void node_link_up(struct node *n_ptr, struct link *l_ptr); 103void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr);
104int node_has_active_links(struct node *n_ptr); 104int tipc_node_has_active_links(struct node *n_ptr);
105int node_has_redundant_links(struct node *n_ptr); 105int tipc_node_has_redundant_links(struct node *n_ptr);
106u32 node_select_router(struct node *n_ptr, u32 ref); 106u32 tipc_node_select_router(struct node *n_ptr, u32 ref);
107struct node *node_select_next_hop(u32 addr, u32 selector); 107struct node *tipc_node_select_next_hop(u32 addr, u32 selector);
108int node_is_up(struct node *n_ptr); 108int tipc_node_is_up(struct node *n_ptr);
109void node_add_router(struct node *n_ptr, u32 router); 109void tipc_node_add_router(struct node *n_ptr, u32 router);
110void node_remove_router(struct node *n_ptr, u32 router); 110void tipc_node_remove_router(struct node *n_ptr, u32 router);
111struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space); 111struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space);
112struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space); 112struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space);
113 113
114static inline struct node *node_find(u32 addr) 114static inline struct node *tipc_node_find(u32 addr)
115{ 115{
116 if (likely(in_own_cluster(addr))) 116 if (likely(in_own_cluster(addr)))
117 return local_nodes[tipc_node(addr)]; 117 return tipc_local_nodes[tipc_node(addr)];
118 else if (addr_domain_valid(addr)) { 118 else if (tipc_addr_domain_valid(addr)) {
119 struct cluster *c_ptr = cluster_find(addr); 119 struct cluster *c_ptr = tipc_cltr_find(addr);
120 120
121 if (c_ptr) 121 if (c_ptr)
122 return c_ptr->nodes[tipc_node(addr)]; 122 return c_ptr->nodes[tipc_node(addr)];
@@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr)
124 return 0; 124 return 0;
125} 125}
126 126
127static inline struct node *node_select(u32 addr, u32 selector) 127static inline struct node *tipc_node_select(u32 addr, u32 selector)
128{ 128{
129 if (likely(in_own_cluster(addr))) 129 if (likely(in_own_cluster(addr)))
130 return local_nodes[tipc_node(addr)]; 130 return tipc_local_nodes[tipc_node(addr)];
131 return node_select_next_hop(addr, selector); 131 return tipc_node_select_next_hop(addr, selector);
132} 132}
133 133
134static inline void node_lock(struct node *n_ptr) 134static inline void tipc_node_lock(struct node *n_ptr)
135{ 135{
136 spin_lock_bh(&n_ptr->lock); 136 spin_lock_bh(&n_ptr->lock);
137} 137}
138 138
139static inline void node_unlock(struct node *n_ptr) 139static inline void tipc_node_unlock(struct node *n_ptr)
140{ 140{
141 spin_unlock_bh(&n_ptr->lock); 141 spin_unlock_bh(&n_ptr->lock);
142} 142}
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index 79375927916f..afeea121d8be 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -41,39 +41,39 @@
41#include "addr.h" 41#include "addr.h"
42 42
43/** 43/**
44 * nodesub_subscribe - create "node down" subscription for specified node 44 * tipc_nodesub_subscribe - create "node down" subscription for specified node
45 */ 45 */
46 46
47void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, 47void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
48 void *usr_handle, net_ev_handler handle_down) 48 void *usr_handle, net_ev_handler handle_down)
49{ 49{
50 node_sub->node = 0; 50 node_sub->node = 0;
51 if (addr == tipc_own_addr) 51 if (addr == tipc_own_addr)
52 return; 52 return;
53 if (!addr_node_valid(addr)) { 53 if (!tipc_addr_node_valid(addr)) {
54 warn("node_subscr with illegal %x\n", addr); 54 warn("node_subscr with illegal %x\n", addr);
55 return; 55 return;
56 } 56 }
57 57
58 node_sub->handle_node_down = handle_down; 58 node_sub->handle_node_down = handle_down;
59 node_sub->usr_handle = usr_handle; 59 node_sub->usr_handle = usr_handle;
60 node_sub->node = node_find(addr); 60 node_sub->node = tipc_node_find(addr);
61 assert(node_sub->node); 61 assert(node_sub->node);
62 node_lock(node_sub->node); 62 tipc_node_lock(node_sub->node);
63 list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub); 63 list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub);
64 node_unlock(node_sub->node); 64 tipc_node_unlock(node_sub->node);
65} 65}
66 66
67/** 67/**
68 * nodesub_unsubscribe - cancel "node down" subscription (if any) 68 * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any)
69 */ 69 */
70 70
71void nodesub_unsubscribe(struct node_subscr *node_sub) 71void tipc_nodesub_unsubscribe(struct node_subscr *node_sub)
72{ 72{
73 if (!node_sub->node) 73 if (!node_sub->node)
74 return; 74 return;
75 75
76 node_lock(node_sub->node); 76 tipc_node_lock(node_sub->node);
77 list_del_init(&node_sub->nodesub_list); 77 list_del_init(&node_sub->nodesub_list);
78 node_unlock(node_sub->node); 78 tipc_node_unlock(node_sub->node);
79} 79}
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h
index a3b87ac4859b..01751c4fbb43 100644
--- a/net/tipc/node_subscr.h
+++ b/net/tipc/node_subscr.h
@@ -56,8 +56,8 @@ struct node_subscr {
56 struct list_head nodesub_list; 56 struct list_head nodesub_list;
57}; 57};
58 58
59void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, 59void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
60 void *usr_handle, net_ev_handler handle_down); 60 void *usr_handle, net_ev_handler handle_down);
61void nodesub_unsubscribe(struct node_subscr *node_sub); 61void tipc_nodesub_unsubscribe(struct node_subscr *node_sub);
62 62
63#endif 63#endif
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 66caca7abe92..72aae52bfec1 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -57,10 +57,10 @@
57static struct sk_buff *msg_queue_head = 0; 57static struct sk_buff *msg_queue_head = 0;
58static struct sk_buff *msg_queue_tail = 0; 58static struct sk_buff *msg_queue_tail = 0;
59 59
60spinlock_t port_list_lock = SPIN_LOCK_UNLOCKED; 60spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED;
61static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; 61static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED;
62 62
63LIST_HEAD(ports); 63static LIST_HEAD(ports);
64static void port_handle_node_down(unsigned long ref); 64static void port_handle_node_down(unsigned long ref);
65static struct sk_buff* port_build_self_abort_msg(struct port *,u32 err); 65static struct sk_buff* port_build_self_abort_msg(struct port *,u32 err);
66static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err); 66static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err);
@@ -107,7 +107,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
107 struct sk_buff *buf; 107 struct sk_buff *buf;
108 struct sk_buff *ibuf = NULL; 108 struct sk_buff *ibuf = NULL;
109 struct port_list dports = {0, NULL, }; 109 struct port_list dports = {0, NULL, };
110 struct port *oport = port_deref(ref); 110 struct port *oport = tipc_port_deref(ref);
111 int ext_targets; 111 int ext_targets;
112 int res; 112 int res;
113 113
@@ -129,8 +129,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
129 129
130 /* Figure out where to send multicast message */ 130 /* Figure out where to send multicast message */
131 131
132 ext_targets = nametbl_mc_translate(seq->type, seq->lower, seq->upper, 132 ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper,
133 TIPC_NODE_SCOPE, &dports); 133 TIPC_NODE_SCOPE, &dports);
134 134
135 /* Send message to destinations (duplicate it only if necessary) */ 135 /* Send message to destinations (duplicate it only if necessary) */
136 136
@@ -138,12 +138,12 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
138 if (dports.count != 0) { 138 if (dports.count != 0) {
139 ibuf = skb_copy(buf, GFP_ATOMIC); 139 ibuf = skb_copy(buf, GFP_ATOMIC);
140 if (ibuf == NULL) { 140 if (ibuf == NULL) {
141 port_list_free(&dports); 141 tipc_port_list_free(&dports);
142 buf_discard(buf); 142 buf_discard(buf);
143 return -ENOMEM; 143 return -ENOMEM;
144 } 144 }
145 } 145 }
146 res = bclink_send_msg(buf); 146 res = tipc_bclink_send_msg(buf);
147 if ((res < 0) && (dports.count != 0)) { 147 if ((res < 0) && (dports.count != 0)) {
148 buf_discard(ibuf); 148 buf_discard(ibuf);
149 } 149 }
@@ -153,20 +153,20 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
153 153
154 if (res >= 0) { 154 if (res >= 0) {
155 if (ibuf) 155 if (ibuf)
156 port_recv_mcast(ibuf, &dports); 156 tipc_port_recv_mcast(ibuf, &dports);
157 } else { 157 } else {
158 port_list_free(&dports); 158 tipc_port_list_free(&dports);
159 } 159 }
160 return res; 160 return res;
161} 161}
162 162
163/** 163/**
164 * port_recv_mcast - deliver multicast message to all destination ports 164 * tipc_port_recv_mcast - deliver multicast message to all destination ports
165 * 165 *
166 * If there is no port list, perform a lookup to create one 166 * If there is no port list, perform a lookup to create one
167 */ 167 */
168 168
169void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) 169void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
170{ 170{
171 struct tipc_msg* msg; 171 struct tipc_msg* msg;
172 struct port_list dports = {0, NULL, }; 172 struct port_list dports = {0, NULL, };
@@ -179,7 +179,7 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
179 /* Create destination port list, if one wasn't supplied */ 179 /* Create destination port list, if one wasn't supplied */
180 180
181 if (dp == NULL) { 181 if (dp == NULL) {
182 nametbl_mc_translate(msg_nametype(msg), 182 tipc_nametbl_mc_translate(msg_nametype(msg),
183 msg_namelower(msg), 183 msg_namelower(msg),
184 msg_nameupper(msg), 184 msg_nameupper(msg),
185 TIPC_CLUSTER_SCOPE, 185 TIPC_CLUSTER_SCOPE,
@@ -192,8 +192,8 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
192 if (dp->count != 0) { 192 if (dp->count != 0) {
193 if (dp->count == 1) { 193 if (dp->count == 1) {
194 msg_set_destport(msg, dp->ports[0]); 194 msg_set_destport(msg, dp->ports[0]);
195 port_recv_msg(buf); 195 tipc_port_recv_msg(buf);
196 port_list_free(dp); 196 tipc_port_list_free(dp);
197 return; 197 return;
198 } 198 }
199 for (; cnt < dp->count; cnt++) { 199 for (; cnt < dp->count; cnt++) {
@@ -209,12 +209,12 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
209 item = item->next; 209 item = item->next;
210 } 210 }
211 msg_set_destport(buf_msg(b),item->ports[index]); 211 msg_set_destport(buf_msg(b),item->ports[index]);
212 port_recv_msg(b); 212 tipc_port_recv_msg(b);
213 } 213 }
214 } 214 }
215exit: 215exit:
216 buf_discard(buf); 216 buf_discard(buf);
217 port_list_free(dp); 217 tipc_port_list_free(dp);
218} 218}
219 219
220/** 220/**
@@ -238,14 +238,14 @@ u32 tipc_createport_raw(void *usr_handle,
238 return 0; 238 return 0;
239 } 239 }
240 memset(p_ptr, 0, sizeof(*p_ptr)); 240 memset(p_ptr, 0, sizeof(*p_ptr));
241 ref = ref_acquire(p_ptr, &p_ptr->publ.lock); 241 ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
242 if (!ref) { 242 if (!ref) {
243 warn("Reference Table Exhausted\n"); 243 warn("Reference Table Exhausted\n");
244 kfree(p_ptr); 244 kfree(p_ptr);
245 return 0; 245 return 0;
246 } 246 }
247 247
248 port_lock(ref); 248 tipc_port_lock(ref);
249 p_ptr->publ.ref = ref; 249 p_ptr->publ.ref = ref;
250 msg = &p_ptr->publ.phdr; 250 msg = &p_ptr->publ.phdr;
251 msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0); 251 msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0);
@@ -264,12 +264,12 @@ u32 tipc_createport_raw(void *usr_handle,
264 p_ptr->wakeup = wakeup; 264 p_ptr->wakeup = wakeup;
265 p_ptr->user_port = 0; 265 p_ptr->user_port = 0;
266 k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); 266 k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
267 spin_lock_bh(&port_list_lock); 267 spin_lock_bh(&tipc_port_list_lock);
268 INIT_LIST_HEAD(&p_ptr->publications); 268 INIT_LIST_HEAD(&p_ptr->publications);
269 INIT_LIST_HEAD(&p_ptr->port_list); 269 INIT_LIST_HEAD(&p_ptr->port_list);
270 list_add_tail(&p_ptr->port_list, &ports); 270 list_add_tail(&p_ptr->port_list, &ports);
271 spin_unlock_bh(&port_list_lock); 271 spin_unlock_bh(&tipc_port_list_lock);
272 port_unlock(p_ptr); 272 tipc_port_unlock(p_ptr);
273 return ref; 273 return ref;
274} 274}
275 275
@@ -279,31 +279,31 @@ int tipc_deleteport(u32 ref)
279 struct sk_buff *buf = 0; 279 struct sk_buff *buf = 0;
280 280
281 tipc_withdraw(ref, 0, 0); 281 tipc_withdraw(ref, 0, 0);
282 p_ptr = port_lock(ref); 282 p_ptr = tipc_port_lock(ref);
283 if (!p_ptr) 283 if (!p_ptr)
284 return -EINVAL; 284 return -EINVAL;
285 285
286 ref_discard(ref); 286 tipc_ref_discard(ref);
287 port_unlock(p_ptr); 287 tipc_port_unlock(p_ptr);
288 288
289 k_cancel_timer(&p_ptr->timer); 289 k_cancel_timer(&p_ptr->timer);
290 if (p_ptr->publ.connected) { 290 if (p_ptr->publ.connected) {
291 buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); 291 buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
292 nodesub_unsubscribe(&p_ptr->subscription); 292 tipc_nodesub_unsubscribe(&p_ptr->subscription);
293 } 293 }
294 if (p_ptr->user_port) { 294 if (p_ptr->user_port) {
295 reg_remove_port(p_ptr->user_port); 295 tipc_reg_remove_port(p_ptr->user_port);
296 kfree(p_ptr->user_port); 296 kfree(p_ptr->user_port);
297 } 297 }
298 298
299 spin_lock_bh(&port_list_lock); 299 spin_lock_bh(&tipc_port_list_lock);
300 list_del(&p_ptr->port_list); 300 list_del(&p_ptr->port_list);
301 list_del(&p_ptr->wait_list); 301 list_del(&p_ptr->wait_list);
302 spin_unlock_bh(&port_list_lock); 302 spin_unlock_bh(&tipc_port_list_lock);
303 k_term_timer(&p_ptr->timer); 303 k_term_timer(&p_ptr->timer);
304 kfree(p_ptr); 304 kfree(p_ptr);
305 dbg("Deleted port %u\n", ref); 305 dbg("Deleted port %u\n", ref);
306 net_route_msg(buf); 306 tipc_net_route_msg(buf);
307 return TIPC_OK; 307 return TIPC_OK;
308} 308}
309 309
@@ -315,7 +315,7 @@ int tipc_deleteport(u32 ref)
315 315
316struct tipc_port *tipc_get_port(const u32 ref) 316struct tipc_port *tipc_get_port(const u32 ref)
317{ 317{
318 return (struct tipc_port *)ref_deref(ref); 318 return (struct tipc_port *)tipc_ref_deref(ref);
319} 319}
320 320
321/** 321/**
@@ -327,11 +327,11 @@ void *tipc_get_handle(const u32 ref)
327 struct port *p_ptr; 327 struct port *p_ptr;
328 void * handle; 328 void * handle;
329 329
330 p_ptr = port_lock(ref); 330 p_ptr = tipc_port_lock(ref);
331 if (!p_ptr) 331 if (!p_ptr)
332 return 0; 332 return 0;
333 handle = p_ptr->publ.usr_handle; 333 handle = p_ptr->publ.usr_handle;
334 port_unlock(p_ptr); 334 tipc_port_unlock(p_ptr);
335 return handle; 335 return handle;
336} 336}
337 337
@@ -344,7 +344,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
344{ 344{
345 struct port *p_ptr; 345 struct port *p_ptr;
346 346
347 p_ptr = port_lock(ref); 347 p_ptr = tipc_port_lock(ref);
348 if (!p_ptr) 348 if (!p_ptr)
349 return -EINVAL; 349 return -EINVAL;
350 *isunreliable = port_unreliable(p_ptr); 350 *isunreliable = port_unreliable(p_ptr);
@@ -356,11 +356,11 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable)
356{ 356{
357 struct port *p_ptr; 357 struct port *p_ptr;
358 358
359 p_ptr = port_lock(ref); 359 p_ptr = tipc_port_lock(ref);
360 if (!p_ptr) 360 if (!p_ptr)
361 return -EINVAL; 361 return -EINVAL;
362 msg_set_src_droppable(&p_ptr->publ.phdr, (isunreliable != 0)); 362 msg_set_src_droppable(&p_ptr->publ.phdr, (isunreliable != 0));
363 port_unlock(p_ptr); 363 tipc_port_unlock(p_ptr);
364 return TIPC_OK; 364 return TIPC_OK;
365} 365}
366 366
@@ -373,7 +373,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
373{ 373{
374 struct port *p_ptr; 374 struct port *p_ptr;
375 375
376 p_ptr = port_lock(ref); 376 p_ptr = tipc_port_lock(ref);
377 if (!p_ptr) 377 if (!p_ptr)
378 return -EINVAL; 378 return -EINVAL;
379 *isunrejectable = port_unreturnable(p_ptr); 379 *isunrejectable = port_unreturnable(p_ptr);
@@ -385,11 +385,11 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
385{ 385{
386 struct port *p_ptr; 386 struct port *p_ptr;
387 387
388 p_ptr = port_lock(ref); 388 p_ptr = tipc_port_lock(ref);
389 if (!p_ptr) 389 if (!p_ptr)
390 return -EINVAL; 390 return -EINVAL;
391 msg_set_dest_droppable(&p_ptr->publ.phdr, (isunrejectable != 0)); 391 msg_set_dest_droppable(&p_ptr->publ.phdr, (isunrejectable != 0));
392 port_unlock(p_ptr); 392 tipc_port_unlock(p_ptr);
393 return TIPC_OK; 393 return TIPC_OK;
394} 394}
395 395
@@ -476,25 +476,25 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
476 /* send self-abort message when rejecting on a connected port */ 476 /* send self-abort message when rejecting on a connected port */
477 if (msg_connected(msg)) { 477 if (msg_connected(msg)) {
478 struct sk_buff *abuf = 0; 478 struct sk_buff *abuf = 0;
479 struct port *p_ptr = port_lock(msg_destport(msg)); 479 struct port *p_ptr = tipc_port_lock(msg_destport(msg));
480 480
481 if (p_ptr) { 481 if (p_ptr) {
482 if (p_ptr->publ.connected) 482 if (p_ptr->publ.connected)
483 abuf = port_build_self_abort_msg(p_ptr, err); 483 abuf = port_build_self_abort_msg(p_ptr, err);
484 port_unlock(p_ptr); 484 tipc_port_unlock(p_ptr);
485 } 485 }
486 net_route_msg(abuf); 486 tipc_net_route_msg(abuf);
487 } 487 }
488 488
489 /* send rejected message */ 489 /* send rejected message */
490 buf_discard(buf); 490 buf_discard(buf);
491 net_route_msg(rbuf); 491 tipc_net_route_msg(rbuf);
492 return data_sz; 492 return data_sz;
493} 493}
494 494
495int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, 495int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
496 struct iovec const *msg_sect, u32 num_sect, 496 struct iovec const *msg_sect, u32 num_sect,
497 int err) 497 int err)
498{ 498{
499 struct sk_buff *buf; 499 struct sk_buff *buf;
500 int res; 500 int res;
@@ -509,7 +509,7 @@ int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
509 509
510static void port_timeout(unsigned long ref) 510static void port_timeout(unsigned long ref)
511{ 511{
512 struct port *p_ptr = port_lock(ref); 512 struct port *p_ptr = tipc_port_lock(ref);
513 struct sk_buff *buf = 0; 513 struct sk_buff *buf = 0;
514 514
515 if (!p_ptr || !p_ptr->publ.connected) 515 if (!p_ptr || !p_ptr->publ.connected)
@@ -532,21 +532,21 @@ static void port_timeout(unsigned long ref)
532 p_ptr->probing_state = PROBING; 532 p_ptr->probing_state = PROBING;
533 k_start_timer(&p_ptr->timer, p_ptr->probing_interval); 533 k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
534 } 534 }
535 port_unlock(p_ptr); 535 tipc_port_unlock(p_ptr);
536 net_route_msg(buf); 536 tipc_net_route_msg(buf);
537} 537}
538 538
539 539
540static void port_handle_node_down(unsigned long ref) 540static void port_handle_node_down(unsigned long ref)
541{ 541{
542 struct port *p_ptr = port_lock(ref); 542 struct port *p_ptr = tipc_port_lock(ref);
543 struct sk_buff* buf = 0; 543 struct sk_buff* buf = 0;
544 544
545 if (!p_ptr) 545 if (!p_ptr)
546 return; 546 return;
547 buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); 547 buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE);
548 port_unlock(p_ptr); 548 tipc_port_unlock(p_ptr);
549 net_route_msg(buf); 549 tipc_net_route_msg(buf);
550} 550}
551 551
552 552
@@ -589,10 +589,10 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err)
589 0); 589 0);
590} 590}
591 591
592void port_recv_proto_msg(struct sk_buff *buf) 592void tipc_port_recv_proto_msg(struct sk_buff *buf)
593{ 593{
594 struct tipc_msg *msg = buf_msg(buf); 594 struct tipc_msg *msg = buf_msg(buf);
595 struct port *p_ptr = port_lock(msg_destport(msg)); 595 struct port *p_ptr = tipc_port_lock(msg_destport(msg));
596 u32 err = TIPC_OK; 596 u32 err = TIPC_OK;
597 struct sk_buff *r_buf = 0; 597 struct sk_buff *r_buf = 0;
598 struct sk_buff *abort_buf = 0; 598 struct sk_buff *abort_buf = 0;
@@ -615,11 +615,11 @@ void port_recv_proto_msg(struct sk_buff *buf)
615 } 615 }
616 } 616 }
617 if (msg_type(msg) == CONN_ACK) { 617 if (msg_type(msg) == CONN_ACK) {
618 int wakeup = port_congested(p_ptr) && 618 int wakeup = tipc_port_congested(p_ptr) &&
619 p_ptr->publ.congested && 619 p_ptr->publ.congested &&
620 p_ptr->wakeup; 620 p_ptr->wakeup;
621 p_ptr->acked += msg_msgcnt(msg); 621 p_ptr->acked += msg_msgcnt(msg);
622 if (port_congested(p_ptr)) 622 if (tipc_port_congested(p_ptr))
623 goto exit; 623 goto exit;
624 p_ptr->publ.congested = 0; 624 p_ptr->publ.congested = 0;
625 if (!wakeup) 625 if (!wakeup)
@@ -659,9 +659,9 @@ void port_recv_proto_msg(struct sk_buff *buf)
659 port_incr_out_seqno(p_ptr); 659 port_incr_out_seqno(p_ptr);
660exit: 660exit:
661 if (p_ptr) 661 if (p_ptr)
662 port_unlock(p_ptr); 662 tipc_port_unlock(p_ptr);
663 net_route_msg(r_buf); 663 tipc_net_route_msg(r_buf);
664 net_route_msg(abort_buf); 664 tipc_net_route_msg(abort_buf);
665 buf_discard(buf); 665 buf_discard(buf);
666} 666}
667 667
@@ -704,7 +704,7 @@ static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id)
704 704
705#define MAX_PORT_QUERY 32768 705#define MAX_PORT_QUERY 32768
706 706
707struct sk_buff *port_get_ports(void) 707struct sk_buff *tipc_port_get_ports(void)
708{ 708{
709 struct sk_buff *buf; 709 struct sk_buff *buf;
710 struct tlv_desc *rep_tlv; 710 struct tlv_desc *rep_tlv;
@@ -712,20 +712,20 @@ struct sk_buff *port_get_ports(void)
712 struct port *p_ptr; 712 struct port *p_ptr;
713 int str_len; 713 int str_len;
714 714
715 buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY)); 715 buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY));
716 if (!buf) 716 if (!buf)
717 return NULL; 717 return NULL;
718 rep_tlv = (struct tlv_desc *)buf->data; 718 rep_tlv = (struct tlv_desc *)buf->data;
719 719
720 printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY); 720 tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY);
721 spin_lock_bh(&port_list_lock); 721 spin_lock_bh(&tipc_port_list_lock);
722 list_for_each_entry(p_ptr, &ports, port_list) { 722 list_for_each_entry(p_ptr, &ports, port_list) {
723 spin_lock_bh(p_ptr->publ.lock); 723 spin_lock_bh(p_ptr->publ.lock);
724 port_print(p_ptr, &pb, 0); 724 port_print(p_ptr, &pb, 0);
725 spin_unlock_bh(p_ptr->publ.lock); 725 spin_unlock_bh(p_ptr->publ.lock);
726 } 726 }
727 spin_unlock_bh(&port_list_lock); 727 spin_unlock_bh(&tipc_port_list_lock);
728 str_len = printbuf_validate(&pb); 728 str_len = tipc_printbuf_validate(&pb);
729 729
730 skb_put(buf, TLV_SPACE(str_len)); 730 skb_put(buf, TLV_SPACE(str_len));
731 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 731 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -752,22 +752,22 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space)
752 ref = *(u32 *)TLV_DATA(req_tlv_area); 752 ref = *(u32 *)TLV_DATA(req_tlv_area);
753 ref = ntohl(ref); 753 ref = ntohl(ref);
754 754
755 p_ptr = port_lock(ref); 755 p_ptr = tipc_port_lock(ref);
756 if (!p_ptr) 756 if (!p_ptr)
757 return cfg_reply_error_string("port not found"); 757 return cfg_reply_error_string("port not found");
758 758
759 buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS)); 759 buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS));
760 if (!buf) { 760 if (!buf) {
761 port_unlock(p_ptr); 761 tipc_port_unlock(p_ptr);
762 return NULL; 762 return NULL;
763 } 763 }
764 rep_tlv = (struct tlv_desc *)buf->data; 764 rep_tlv = (struct tlv_desc *)buf->data;
765 765
766 printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS); 766 tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS);
767 port_print(p_ptr, &pb, 1); 767 port_print(p_ptr, &pb, 1);
768 /* NEED TO FILL IN ADDITIONAL PORT STATISTICS HERE */ 768 /* NEED TO FILL IN ADDITIONAL PORT STATISTICS HERE */
769 port_unlock(p_ptr); 769 tipc_port_unlock(p_ptr);
770 str_len = printbuf_validate(&pb); 770 str_len = tipc_printbuf_validate(&pb);
771 771
772 skb_put(buf, TLV_SPACE(str_len)); 772 skb_put(buf, TLV_SPACE(str_len));
773 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 773 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -777,19 +777,19 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space)
777 777
778#endif 778#endif
779 779
780void port_reinit(void) 780void tipc_port_reinit(void)
781{ 781{
782 struct port *p_ptr; 782 struct port *p_ptr;
783 struct tipc_msg *msg; 783 struct tipc_msg *msg;
784 784
785 spin_lock_bh(&port_list_lock); 785 spin_lock_bh(&tipc_port_list_lock);
786 list_for_each_entry(p_ptr, &ports, port_list) { 786 list_for_each_entry(p_ptr, &ports, port_list) {
787 msg = &p_ptr->publ.phdr; 787 msg = &p_ptr->publ.phdr;
788 if (msg_orignode(msg) == tipc_own_addr) 788 if (msg_orignode(msg) == tipc_own_addr)
789 break; 789 break;
790 msg_set_orignode(msg, tipc_own_addr); 790 msg_set_orignode(msg, tipc_own_addr);
791 } 791 }
792 spin_unlock_bh(&port_list_lock); 792 spin_unlock_bh(&tipc_port_list_lock);
793} 793}
794 794
795 795
@@ -820,7 +820,7 @@ static void port_dispatcher_sigh(void *dummy)
820 struct tipc_msg *msg = buf_msg(buf); 820 struct tipc_msg *msg = buf_msg(buf);
821 u32 dref = msg_destport(msg); 821 u32 dref = msg_destport(msg);
822 822
823 p_ptr = port_lock(dref); 823 p_ptr = tipc_port_lock(dref);
824 if (!p_ptr) { 824 if (!p_ptr) {
825 /* Port deleted while msg in queue */ 825 /* Port deleted while msg in queue */
826 tipc_reject_msg(buf, TIPC_ERR_NO_PORT); 826 tipc_reject_msg(buf, TIPC_ERR_NO_PORT);
@@ -976,7 +976,7 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
976 msg_queue_tail = buf; 976 msg_queue_tail = buf;
977 } else { 977 } else {
978 msg_queue_tail = msg_queue_head = buf; 978 msg_queue_tail = msg_queue_head = buf;
979 k_signal((Handler)port_dispatcher_sigh, 0); 979 tipc_k_signal((Handler)port_dispatcher_sigh, 0);
980 } 980 }
981 spin_unlock_bh(&queue_lock); 981 spin_unlock_bh(&queue_lock);
982 return TIPC_OK; 982 return TIPC_OK;
@@ -994,14 +994,14 @@ static void port_wakeup_sh(unsigned long ref)
994 tipc_continue_event cb = 0; 994 tipc_continue_event cb = 0;
995 void *uh = 0; 995 void *uh = 0;
996 996
997 p_ptr = port_lock(ref); 997 p_ptr = tipc_port_lock(ref);
998 if (p_ptr) { 998 if (p_ptr) {
999 up_ptr = p_ptr->user_port; 999 up_ptr = p_ptr->user_port;
1000 if (up_ptr) { 1000 if (up_ptr) {
1001 cb = up_ptr->continue_event_cb; 1001 cb = up_ptr->continue_event_cb;
1002 uh = up_ptr->usr_handle; 1002 uh = up_ptr->usr_handle;
1003 } 1003 }
1004 port_unlock(p_ptr); 1004 tipc_port_unlock(p_ptr);
1005 } 1005 }
1006 if (cb) 1006 if (cb)
1007 cb(uh, ref); 1007 cb(uh, ref);
@@ -1010,7 +1010,7 @@ static void port_wakeup_sh(unsigned long ref)
1010 1010
1011static void port_wakeup(struct tipc_port *p_ptr) 1011static void port_wakeup(struct tipc_port *p_ptr)
1012{ 1012{
1013 k_signal((Handler)port_wakeup_sh, p_ptr->ref); 1013 tipc_k_signal((Handler)port_wakeup_sh, p_ptr->ref);
1014} 1014}
1015 1015
1016void tipc_acknowledge(u32 ref, u32 ack) 1016void tipc_acknowledge(u32 ref, u32 ack)
@@ -1018,7 +1018,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
1018 struct port *p_ptr; 1018 struct port *p_ptr;
1019 struct sk_buff *buf = 0; 1019 struct sk_buff *buf = 0;
1020 1020
1021 p_ptr = port_lock(ref); 1021 p_ptr = tipc_port_lock(ref);
1022 if (!p_ptr) 1022 if (!p_ptr)
1023 return; 1023 return;
1024 if (p_ptr->publ.connected) { 1024 if (p_ptr->publ.connected) {
@@ -1033,8 +1033,8 @@ void tipc_acknowledge(u32 ref, u32 ack)
1033 port_out_seqno(p_ptr), 1033 port_out_seqno(p_ptr),
1034 ack); 1034 ack);
1035 } 1035 }
1036 port_unlock(p_ptr); 1036 tipc_port_unlock(p_ptr);
1037 net_route_msg(buf); 1037 tipc_net_route_msg(buf);
1038} 1038}
1039 1039
1040/* 1040/*
@@ -1063,7 +1063,7 @@ int tipc_createport(u32 user_ref,
1063 return -ENOMEM; 1063 return -ENOMEM;
1064 } 1064 }
1065 ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance); 1065 ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance);
1066 p_ptr = port_lock(ref); 1066 p_ptr = tipc_port_lock(ref);
1067 if (!p_ptr) { 1067 if (!p_ptr) {
1068 kfree(up_ptr); 1068 kfree(up_ptr);
1069 return -ENOMEM; 1069 return -ENOMEM;
@@ -1081,10 +1081,10 @@ int tipc_createport(u32 user_ref,
1081 up_ptr->conn_msg_cb = conn_msg_cb; 1081 up_ptr->conn_msg_cb = conn_msg_cb;
1082 up_ptr->continue_event_cb = continue_event_cb; 1082 up_ptr->continue_event_cb = continue_event_cb;
1083 INIT_LIST_HEAD(&up_ptr->uport_list); 1083 INIT_LIST_HEAD(&up_ptr->uport_list);
1084 reg_add_port(up_ptr); 1084 tipc_reg_add_port(up_ptr);
1085 *portref = p_ptr->publ.ref; 1085 *portref = p_ptr->publ.ref;
1086 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); 1086 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref);
1087 port_unlock(p_ptr); 1087 tipc_port_unlock(p_ptr);
1088 return TIPC_OK; 1088 return TIPC_OK;
1089} 1089}
1090 1090
@@ -1099,7 +1099,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance)
1099{ 1099{
1100 struct port *p_ptr; 1100 struct port *p_ptr;
1101 1101
1102 p_ptr = port_lock(ref); 1102 p_ptr = tipc_port_lock(ref);
1103 if (!p_ptr) 1103 if (!p_ptr)
1104 return -EINVAL; 1104 return -EINVAL;
1105 *importance = (unsigned int)msg_importance(&p_ptr->publ.phdr); 1105 *importance = (unsigned int)msg_importance(&p_ptr->publ.phdr);
@@ -1114,7 +1114,7 @@ int tipc_set_portimportance(u32 ref, unsigned int imp)
1114 if (imp > TIPC_CRITICAL_IMPORTANCE) 1114 if (imp > TIPC_CRITICAL_IMPORTANCE)
1115 return -EINVAL; 1115 return -EINVAL;
1116 1116
1117 p_ptr = port_lock(ref); 1117 p_ptr = tipc_port_lock(ref);
1118 if (!p_ptr) 1118 if (!p_ptr)
1119 return -EINVAL; 1119 return -EINVAL;
1120 msg_set_importance(&p_ptr->publ.phdr, (u32)imp); 1120 msg_set_importance(&p_ptr->publ.phdr, (u32)imp);
@@ -1130,7 +1130,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1130 u32 key; 1130 u32 key;
1131 int res = -EINVAL; 1131 int res = -EINVAL;
1132 1132
1133 p_ptr = port_lock(ref); 1133 p_ptr = tipc_port_lock(ref);
1134 dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, " 1134 dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, "
1135 "lower = %u, upper = %u\n", 1135 "lower = %u, upper = %u\n",
1136 ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper); 1136 ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper);
@@ -1147,8 +1147,8 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1147 res = -EADDRINUSE; 1147 res = -EADDRINUSE;
1148 goto exit; 1148 goto exit;
1149 } 1149 }
1150 publ = nametbl_publish(seq->type, seq->lower, seq->upper, 1150 publ = tipc_nametbl_publish(seq->type, seq->lower, seq->upper,
1151 scope, p_ptr->publ.ref, key); 1151 scope, p_ptr->publ.ref, key);
1152 if (publ) { 1152 if (publ) {
1153 list_add(&publ->pport_list, &p_ptr->publications); 1153 list_add(&publ->pport_list, &p_ptr->publications);
1154 p_ptr->pub_count++; 1154 p_ptr->pub_count++;
@@ -1156,7 +1156,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1156 res = TIPC_OK; 1156 res = TIPC_OK;
1157 } 1157 }
1158exit: 1158exit:
1159 port_unlock(p_ptr); 1159 tipc_port_unlock(p_ptr);
1160 return res; 1160 return res;
1161} 1161}
1162 1162
@@ -1167,7 +1167,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1167 struct publication *tpubl; 1167 struct publication *tpubl;
1168 int res = -EINVAL; 1168 int res = -EINVAL;
1169 1169
1170 p_ptr = port_lock(ref); 1170 p_ptr = tipc_port_lock(ref);
1171 if (!p_ptr) 1171 if (!p_ptr)
1172 return -EINVAL; 1172 return -EINVAL;
1173 if (!p_ptr->publ.published) 1173 if (!p_ptr->publ.published)
@@ -1175,8 +1175,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1175 if (!seq) { 1175 if (!seq) {
1176 list_for_each_entry_safe(publ, tpubl, 1176 list_for_each_entry_safe(publ, tpubl,
1177 &p_ptr->publications, pport_list) { 1177 &p_ptr->publications, pport_list) {
1178 nametbl_withdraw(publ->type, publ->lower, 1178 tipc_nametbl_withdraw(publ->type, publ->lower,
1179 publ->ref, publ->key); 1179 publ->ref, publ->key);
1180 } 1180 }
1181 res = TIPC_OK; 1181 res = TIPC_OK;
1182 } else { 1182 } else {
@@ -1190,8 +1190,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1190 continue; 1190 continue;
1191 if (publ->upper != seq->upper) 1191 if (publ->upper != seq->upper)
1192 break; 1192 break;
1193 nametbl_withdraw(publ->type, publ->lower, 1193 tipc_nametbl_withdraw(publ->type, publ->lower,
1194 publ->ref, publ->key); 1194 publ->ref, publ->key);
1195 res = TIPC_OK; 1195 res = TIPC_OK;
1196 break; 1196 break;
1197 } 1197 }
@@ -1199,7 +1199,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
1199 if (list_empty(&p_ptr->publications)) 1199 if (list_empty(&p_ptr->publications))
1200 p_ptr->publ.published = 0; 1200 p_ptr->publ.published = 0;
1201exit: 1201exit:
1202 port_unlock(p_ptr); 1202 tipc_port_unlock(p_ptr);
1203 return res; 1203 return res;
1204} 1204}
1205 1205
@@ -1209,7 +1209,7 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
1209 struct tipc_msg *msg; 1209 struct tipc_msg *msg;
1210 int res = -EINVAL; 1210 int res = -EINVAL;
1211 1211
1212 p_ptr = port_lock(ref); 1212 p_ptr = tipc_port_lock(ref);
1213 if (!p_ptr) 1213 if (!p_ptr)
1214 return -EINVAL; 1214 return -EINVAL;
1215 if (p_ptr->publ.published || p_ptr->publ.connected) 1215 if (p_ptr->publ.published || p_ptr->publ.connected)
@@ -1234,13 +1234,13 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
1234 p_ptr->publ.connected = 1; 1234 p_ptr->publ.connected = 1;
1235 k_start_timer(&p_ptr->timer, p_ptr->probing_interval); 1235 k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
1236 1236
1237 nodesub_subscribe(&p_ptr->subscription,peer->node, 1237 tipc_nodesub_subscribe(&p_ptr->subscription,peer->node,
1238 (void *)(unsigned long)ref, 1238 (void *)(unsigned long)ref,
1239 (net_ev_handler)port_handle_node_down); 1239 (net_ev_handler)port_handle_node_down);
1240 res = TIPC_OK; 1240 res = TIPC_OK;
1241exit: 1241exit:
1242 port_unlock(p_ptr); 1242 tipc_port_unlock(p_ptr);
1243 p_ptr->max_pkt = link_get_max_pkt(peer->node, ref); 1243 p_ptr->max_pkt = tipc_link_get_max_pkt(peer->node, ref);
1244 return res; 1244 return res;
1245} 1245}
1246 1246
@@ -1254,16 +1254,16 @@ int tipc_disconnect(u32 ref)
1254 struct port *p_ptr; 1254 struct port *p_ptr;
1255 int res = -ENOTCONN; 1255 int res = -ENOTCONN;
1256 1256
1257 p_ptr = port_lock(ref); 1257 p_ptr = tipc_port_lock(ref);
1258 if (!p_ptr) 1258 if (!p_ptr)
1259 return -EINVAL; 1259 return -EINVAL;
1260 if (p_ptr->publ.connected) { 1260 if (p_ptr->publ.connected) {
1261 p_ptr->publ.connected = 0; 1261 p_ptr->publ.connected = 0;
1262 /* let timer expire on it's own to avoid deadlock! */ 1262 /* let timer expire on it's own to avoid deadlock! */
1263 nodesub_unsubscribe(&p_ptr->subscription); 1263 tipc_nodesub_unsubscribe(&p_ptr->subscription);
1264 res = TIPC_OK; 1264 res = TIPC_OK;
1265 } 1265 }
1266 port_unlock(p_ptr); 1266 tipc_port_unlock(p_ptr);
1267 return res; 1267 return res;
1268} 1268}
1269 1269
@@ -1275,7 +1275,7 @@ int tipc_shutdown(u32 ref)
1275 struct port *p_ptr; 1275 struct port *p_ptr;
1276 struct sk_buff *buf = 0; 1276 struct sk_buff *buf = 0;
1277 1277
1278 p_ptr = port_lock(ref); 1278 p_ptr = tipc_port_lock(ref);
1279 if (!p_ptr) 1279 if (!p_ptr)
1280 return -EINVAL; 1280 return -EINVAL;
1281 1281
@@ -1293,8 +1293,8 @@ int tipc_shutdown(u32 ref)
1293 port_out_seqno(p_ptr), 1293 port_out_seqno(p_ptr),
1294 0); 1294 0);
1295 } 1295 }
1296 port_unlock(p_ptr); 1296 tipc_port_unlock(p_ptr);
1297 net_route_msg(buf); 1297 tipc_net_route_msg(buf);
1298 return tipc_disconnect(ref); 1298 return tipc_disconnect(ref);
1299} 1299}
1300 1300
@@ -1302,11 +1302,11 @@ int tipc_isconnected(u32 ref, int *isconnected)
1302{ 1302{
1303 struct port *p_ptr; 1303 struct port *p_ptr;
1304 1304
1305 p_ptr = port_lock(ref); 1305 p_ptr = tipc_port_lock(ref);
1306 if (!p_ptr) 1306 if (!p_ptr)
1307 return -EINVAL; 1307 return -EINVAL;
1308 *isconnected = p_ptr->publ.connected; 1308 *isconnected = p_ptr->publ.connected;
1309 port_unlock(p_ptr); 1309 tipc_port_unlock(p_ptr);
1310 return TIPC_OK; 1310 return TIPC_OK;
1311} 1311}
1312 1312
@@ -1315,7 +1315,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
1315 struct port *p_ptr; 1315 struct port *p_ptr;
1316 int res; 1316 int res;
1317 1317
1318 p_ptr = port_lock(ref); 1318 p_ptr = tipc_port_lock(ref);
1319 if (!p_ptr) 1319 if (!p_ptr)
1320 return -EINVAL; 1320 return -EINVAL;
1321 if (p_ptr->publ.connected) { 1321 if (p_ptr->publ.connected) {
@@ -1324,23 +1324,23 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
1324 res = TIPC_OK; 1324 res = TIPC_OK;
1325 } else 1325 } else
1326 res = -ENOTCONN; 1326 res = -ENOTCONN;
1327 port_unlock(p_ptr); 1327 tipc_port_unlock(p_ptr);
1328 return res; 1328 return res;
1329} 1329}
1330 1330
1331int tipc_ref_valid(u32 ref) 1331int tipc_ref_valid(u32 ref)
1332{ 1332{
1333 /* Works irrespective of type */ 1333 /* Works irrespective of type */
1334 return !!ref_deref(ref); 1334 return !!tipc_ref_deref(ref);
1335} 1335}
1336 1336
1337 1337
1338/* 1338/*
1339 * port_recv_sections(): Concatenate and deliver sectioned 1339 * tipc_port_recv_sections(): Concatenate and deliver sectioned
1340 * message for this node. 1340 * message for this node.
1341 */ 1341 */
1342 1342
1343int port_recv_sections(struct port *sender, unsigned int num_sect, 1343int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
1344 struct iovec const *msg_sect) 1344 struct iovec const *msg_sect)
1345{ 1345{
1346 struct sk_buff *buf; 1346 struct sk_buff *buf;
@@ -1349,7 +1349,7 @@ int port_recv_sections(struct port *sender, unsigned int num_sect,
1349 res = msg_build(&sender->publ.phdr, msg_sect, num_sect, 1349 res = msg_build(&sender->publ.phdr, msg_sect, num_sect,
1350 MAX_MSG_SIZE, !sender->user_port, &buf); 1350 MAX_MSG_SIZE, !sender->user_port, &buf);
1351 if (likely(buf)) 1351 if (likely(buf))
1352 port_recv_msg(buf); 1352 tipc_port_recv_msg(buf);
1353 return res; 1353 return res;
1354} 1354}
1355 1355
@@ -1363,18 +1363,18 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1363 u32 destnode; 1363 u32 destnode;
1364 int res; 1364 int res;
1365 1365
1366 p_ptr = port_deref(ref); 1366 p_ptr = tipc_port_deref(ref);
1367 if (!p_ptr || !p_ptr->publ.connected) 1367 if (!p_ptr || !p_ptr->publ.connected)
1368 return -EINVAL; 1368 return -EINVAL;
1369 1369
1370 p_ptr->publ.congested = 1; 1370 p_ptr->publ.congested = 1;
1371 if (!port_congested(p_ptr)) { 1371 if (!tipc_port_congested(p_ptr)) {
1372 destnode = port_peernode(p_ptr); 1372 destnode = port_peernode(p_ptr);
1373 if (likely(destnode != tipc_own_addr)) 1373 if (likely(destnode != tipc_own_addr))
1374 res = link_send_sections_fast(p_ptr, msg_sect, num_sect, 1374 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1375 destnode); 1375 destnode);
1376 else 1376 else
1377 res = port_recv_sections(p_ptr, num_sect, msg_sect); 1377 res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
1378 1378
1379 if (likely(res != -ELINKCONG)) { 1379 if (likely(res != -ELINKCONG)) {
1380 port_incr_out_seqno(p_ptr); 1380 port_incr_out_seqno(p_ptr);
@@ -1404,7 +1404,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1404 u32 sz; 1404 u32 sz;
1405 u32 res; 1405 u32 res;
1406 1406
1407 p_ptr = port_deref(ref); 1407 p_ptr = tipc_port_deref(ref);
1408 if (!p_ptr || !p_ptr->publ.connected) 1408 if (!p_ptr || !p_ptr->publ.connected)
1409 return -EINVAL; 1409 return -EINVAL;
1410 1410
@@ -1419,11 +1419,11 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1419 memcpy(buf->data, (unchar *)msg, hsz); 1419 memcpy(buf->data, (unchar *)msg, hsz);
1420 destnode = msg_destnode(msg); 1420 destnode = msg_destnode(msg);
1421 p_ptr->publ.congested = 1; 1421 p_ptr->publ.congested = 1;
1422 if (!port_congested(p_ptr)) { 1422 if (!tipc_port_congested(p_ptr)) {
1423 if (likely(destnode != tipc_own_addr)) 1423 if (likely(destnode != tipc_own_addr))
1424 res = tipc_send_buf_fast(buf, destnode); 1424 res = tipc_send_buf_fast(buf, destnode);
1425 else { 1425 else {
1426 port_recv_msg(buf); 1426 tipc_port_recv_msg(buf);
1427 res = sz; 1427 res = sz;
1428 } 1428 }
1429 if (likely(res != -ELINKCONG)) { 1429 if (likely(res != -ELINKCONG)) {
@@ -1458,7 +1458,7 @@ int tipc_forward2name(u32 ref,
1458 u32 destport = 0; 1458 u32 destport = 0;
1459 int res; 1459 int res;
1460 1460
1461 p_ptr = port_deref(ref); 1461 p_ptr = tipc_port_deref(ref);
1462 if (!p_ptr || p_ptr->publ.connected) 1462 if (!p_ptr || p_ptr->publ.connected)
1463 return -EINVAL; 1463 return -EINVAL;
1464 1464
@@ -1472,16 +1472,16 @@ int tipc_forward2name(u32 ref,
1472 msg_set_lookup_scope(msg, addr_scope(domain)); 1472 msg_set_lookup_scope(msg, addr_scope(domain));
1473 if (importance <= TIPC_CRITICAL_IMPORTANCE) 1473 if (importance <= TIPC_CRITICAL_IMPORTANCE)
1474 msg_set_importance(msg,importance); 1474 msg_set_importance(msg,importance);
1475 destport = nametbl_translate(name->type, name->instance, &destnode); 1475 destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
1476 msg_set_destnode(msg, destnode); 1476 msg_set_destnode(msg, destnode);
1477 msg_set_destport(msg, destport); 1477 msg_set_destport(msg, destport);
1478 1478
1479 if (likely(destport || destnode)) { 1479 if (likely(destport || destnode)) {
1480 p_ptr->sent++; 1480 p_ptr->sent++;
1481 if (likely(destnode == tipc_own_addr)) 1481 if (likely(destnode == tipc_own_addr))
1482 return port_recv_sections(p_ptr, num_sect, msg_sect); 1482 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
1483 res = link_send_sections_fast(p_ptr, msg_sect, num_sect, 1483 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1484 destnode); 1484 destnode);
1485 if (likely(res != -ELINKCONG)) 1485 if (likely(res != -ELINKCONG))
1486 return res; 1486 return res;
1487 if (port_unreliable(p_ptr)) { 1487 if (port_unreliable(p_ptr)) {
@@ -1490,8 +1490,8 @@ int tipc_forward2name(u32 ref,
1490 } 1490 }
1491 return -ELINKCONG; 1491 return -ELINKCONG;
1492 } 1492 }
1493 return port_reject_sections(p_ptr, msg, msg_sect, num_sect, 1493 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
1494 TIPC_ERR_NO_NAME); 1494 TIPC_ERR_NO_NAME);
1495} 1495}
1496 1496
1497/** 1497/**
@@ -1530,7 +1530,7 @@ int tipc_forward_buf2name(u32 ref,
1530 u32 destport = 0; 1530 u32 destport = 0;
1531 int res; 1531 int res;
1532 1532
1533 p_ptr = (struct port *)ref_deref(ref); 1533 p_ptr = (struct port *)tipc_ref_deref(ref);
1534 if (!p_ptr || p_ptr->publ.connected) 1534 if (!p_ptr || p_ptr->publ.connected)
1535 return -EINVAL; 1535 return -EINVAL;
1536 1536
@@ -1545,7 +1545,7 @@ int tipc_forward_buf2name(u32 ref,
1545 msg_set_lookup_scope(msg, addr_scope(domain)); 1545 msg_set_lookup_scope(msg, addr_scope(domain));
1546 msg_set_hdr_sz(msg, LONG_H_SIZE); 1546 msg_set_hdr_sz(msg, LONG_H_SIZE);
1547 msg_set_size(msg, LONG_H_SIZE + dsz); 1547 msg_set_size(msg, LONG_H_SIZE + dsz);
1548 destport = nametbl_translate(name->type, name->instance, &destnode); 1548 destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
1549 msg_set_destnode(msg, destnode); 1549 msg_set_destnode(msg, destnode);
1550 msg_set_destport(msg, destport); 1550 msg_set_destport(msg, destport);
1551 msg_dbg(msg, "forw2name ==> "); 1551 msg_dbg(msg, "forw2name ==> ");
@@ -1557,7 +1557,7 @@ int tipc_forward_buf2name(u32 ref,
1557 if (likely(destport || destnode)) { 1557 if (likely(destport || destnode)) {
1558 p_ptr->sent++; 1558 p_ptr->sent++;
1559 if (destnode == tipc_own_addr) 1559 if (destnode == tipc_own_addr)
1560 return port_recv_msg(buf); 1560 return tipc_port_recv_msg(buf);
1561 res = tipc_send_buf_fast(buf, destnode); 1561 res = tipc_send_buf_fast(buf, destnode);
1562 if (likely(res != -ELINKCONG)) 1562 if (likely(res != -ELINKCONG))
1563 return res; 1563 return res;
@@ -1601,7 +1601,7 @@ int tipc_forward2port(u32 ref,
1601 struct tipc_msg *msg; 1601 struct tipc_msg *msg;
1602 int res; 1602 int res;
1603 1603
1604 p_ptr = port_deref(ref); 1604 p_ptr = tipc_port_deref(ref);
1605 if (!p_ptr || p_ptr->publ.connected) 1605 if (!p_ptr || p_ptr->publ.connected)
1606 return -EINVAL; 1606 return -EINVAL;
1607 1607
@@ -1616,8 +1616,8 @@ int tipc_forward2port(u32 ref,
1616 msg_set_importance(msg, importance); 1616 msg_set_importance(msg, importance);
1617 p_ptr->sent++; 1617 p_ptr->sent++;
1618 if (dest->node == tipc_own_addr) 1618 if (dest->node == tipc_own_addr)
1619 return port_recv_sections(p_ptr, num_sect, msg_sect); 1619 return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
1620 res = link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node); 1620 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node);
1621 if (likely(res != -ELINKCONG)) 1621 if (likely(res != -ELINKCONG))
1622 return res; 1622 return res;
1623 if (port_unreliable(p_ptr)) { 1623 if (port_unreliable(p_ptr)) {
@@ -1658,7 +1658,7 @@ int tipc_forward_buf2port(u32 ref,
1658 struct tipc_msg *msg; 1658 struct tipc_msg *msg;
1659 int res; 1659 int res;
1660 1660
1661 p_ptr = (struct port *)ref_deref(ref); 1661 p_ptr = (struct port *)tipc_ref_deref(ref);
1662 if (!p_ptr || p_ptr->publ.connected) 1662 if (!p_ptr || p_ptr->publ.connected)
1663 return -EINVAL; 1663 return -EINVAL;
1664 1664
@@ -1680,7 +1680,7 @@ int tipc_forward_buf2port(u32 ref,
1680 msg_dbg(msg, "buf2port: "); 1680 msg_dbg(msg, "buf2port: ");
1681 p_ptr->sent++; 1681 p_ptr->sent++;
1682 if (dest->node == tipc_own_addr) 1682 if (dest->node == tipc_own_addr)
1683 return port_recv_msg(buf); 1683 return tipc_port_recv_msg(buf);
1684 res = tipc_send_buf_fast(buf, dest->node); 1684 res = tipc_send_buf_fast(buf, dest->node);
1685 if (likely(res != -ELINKCONG)) 1685 if (likely(res != -ELINKCONG))
1686 return res; 1686 return res;
diff --git a/net/tipc/port.h b/net/tipc/port.h
index e829a99d3b7f..839f100da646 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -37,7 +37,7 @@
37#ifndef _TIPC_PORT_H 37#ifndef _TIPC_PORT_H
38#define _TIPC_PORT_H 38#define _TIPC_PORT_H
39 39
40#include <net/tipc/tipc_port.h> 40#include "core.h"
41#include "ref.h" 41#include "ref.h"
42#include "net.h" 42#include "net.h"
43#include "msg.h" 43#include "msg.h"
@@ -110,65 +110,65 @@ struct port {
110 struct node_subscr subscription; 110 struct node_subscr subscription;
111}; 111};
112 112
113extern spinlock_t port_list_lock; 113extern spinlock_t tipc_port_list_lock;
114struct port_list; 114struct port_list;
115 115
116int port_recv_sections(struct port *p_ptr, u32 num_sect, 116int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
117 struct iovec const *msg_sect); 117 struct iovec const *msg_sect);
118int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, 118int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
119 struct iovec const *msg_sect, u32 num_sect, 119 struct iovec const *msg_sect, u32 num_sect,
120 int err); 120 int err);
121struct sk_buff *port_get_ports(void); 121struct sk_buff *tipc_port_get_ports(void);
122struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space); 122struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space);
123void port_recv_proto_msg(struct sk_buff *buf); 123void tipc_port_recv_proto_msg(struct sk_buff *buf);
124void port_recv_mcast(struct sk_buff *buf, struct port_list *dp); 124void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
125void port_reinit(void); 125void tipc_port_reinit(void);
126 126
127/** 127/**
128 * port_lock - lock port instance referred to and return its pointer 128 * tipc_port_lock - lock port instance referred to and return its pointer
129 */ 129 */
130 130
131static inline struct port *port_lock(u32 ref) 131static inline struct port *tipc_port_lock(u32 ref)
132{ 132{
133 return (struct port *)ref_lock(ref); 133 return (struct port *)tipc_ref_lock(ref);
134} 134}
135 135
136/** 136/**
137 * port_unlock - unlock a port instance 137 * tipc_port_unlock - unlock a port instance
138 * 138 *
139 * Can use pointer instead of ref_unlock() since port is already locked. 139 * Can use pointer instead of tipc_ref_unlock() since port is already locked.
140 */ 140 */
141 141
142static inline void port_unlock(struct port *p_ptr) 142static inline void tipc_port_unlock(struct port *p_ptr)
143{ 143{
144 spin_unlock_bh(p_ptr->publ.lock); 144 spin_unlock_bh(p_ptr->publ.lock);
145} 145}
146 146
147static inline struct port* port_deref(u32 ref) 147static inline struct port* tipc_port_deref(u32 ref)
148{ 148{
149 return (struct port *)ref_deref(ref); 149 return (struct port *)tipc_ref_deref(ref);
150} 150}
151 151
152static inline u32 peer_port(struct port *p_ptr) 152static inline u32 tipc_peer_port(struct port *p_ptr)
153{ 153{
154 return msg_destport(&p_ptr->publ.phdr); 154 return msg_destport(&p_ptr->publ.phdr);
155} 155}
156 156
157static inline u32 peer_node(struct port *p_ptr) 157static inline u32 tipc_peer_node(struct port *p_ptr)
158{ 158{
159 return msg_destnode(&p_ptr->publ.phdr); 159 return msg_destnode(&p_ptr->publ.phdr);
160} 160}
161 161
162static inline int port_congested(struct port *p_ptr) 162static inline int tipc_port_congested(struct port *p_ptr)
163{ 163{
164 return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); 164 return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2));
165} 165}
166 166
167/** 167/**
168 * port_recv_msg - receive message from lower layer and deliver to port user 168 * tipc_port_recv_msg - receive message from lower layer and deliver to port user
169 */ 169 */
170 170
171static inline int port_recv_msg(struct sk_buff *buf) 171static inline int tipc_port_recv_msg(struct sk_buff *buf)
172{ 172{
173 struct port *p_ptr; 173 struct port *p_ptr;
174 struct tipc_msg *msg = buf_msg(buf); 174 struct tipc_msg *msg = buf_msg(buf);
@@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf)
178 178
179 /* forward unresolved named message */ 179 /* forward unresolved named message */
180 if (unlikely(!destport)) { 180 if (unlikely(!destport)) {
181 net_route_msg(buf); 181 tipc_net_route_msg(buf);
182 return dsz; 182 return dsz;
183 } 183 }
184 184
185 /* validate destination & pass to port, otherwise reject message */ 185 /* validate destination & pass to port, otherwise reject message */
186 p_ptr = port_lock(destport); 186 p_ptr = tipc_port_lock(destport);
187 if (likely(p_ptr)) { 187 if (likely(p_ptr)) {
188 if (likely(p_ptr->publ.connected)) { 188 if (likely(p_ptr->publ.connected)) {
189 if ((unlikely(msg_origport(msg) != peer_port(p_ptr))) || 189 if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) ||
190 (unlikely(msg_orignode(msg) != peer_node(p_ptr))) || 190 (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) ||
191 (unlikely(!msg_connected(msg)))) { 191 (unlikely(!msg_connected(msg)))) {
192 err = TIPC_ERR_NO_PORT; 192 err = TIPC_ERR_NO_PORT;
193 port_unlock(p_ptr); 193 tipc_port_unlock(p_ptr);
194 goto reject; 194 goto reject;
195 } 195 }
196 } 196 }
197 err = p_ptr->dispatcher(&p_ptr->publ, buf); 197 err = p_ptr->dispatcher(&p_ptr->publ, buf);
198 port_unlock(p_ptr); 198 tipc_port_unlock(p_ptr);
199 if (likely(!err)) 199 if (likely(!err))
200 return dsz; 200 return dsz;
201 } else { 201 } else {
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 944093fe246f..5a13c2defe4a 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -61,15 +61,15 @@
61 * because entry 0's reference field has the form XXXX|1--1. 61 * because entry 0's reference field has the form XXXX|1--1.
62 */ 62 */
63 63
64struct ref_table ref_table = { 0 }; 64struct ref_table tipc_ref_table = { 0 };
65 65
66rwlock_t reftbl_lock = RW_LOCK_UNLOCKED; 66static rwlock_t ref_table_lock = RW_LOCK_UNLOCKED;
67 67
68/** 68/**
69 * ref_table_init - create reference table for objects 69 * tipc_ref_table_init - create reference table for objects
70 */ 70 */
71 71
72int ref_table_init(u32 requested_size, u32 start) 72int tipc_ref_table_init(u32 requested_size, u32 start)
73{ 73{
74 struct reference *table; 74 struct reference *table;
75 u32 sz = 1 << 4; 75 u32 sz = 1 << 4;
@@ -83,43 +83,43 @@ int ref_table_init(u32 requested_size, u32 start)
83 if (table == NULL) 83 if (table == NULL)
84 return -ENOMEM; 84 return -ENOMEM;
85 85
86 write_lock_bh(&reftbl_lock); 86 write_lock_bh(&ref_table_lock);
87 index_mask = sz - 1; 87 index_mask = sz - 1;
88 for (i = sz - 1; i >= 0; i--) { 88 for (i = sz - 1; i >= 0; i--) {
89 table[i].object = 0; 89 table[i].object = 0;
90 table[i].lock = SPIN_LOCK_UNLOCKED; 90 table[i].lock = SPIN_LOCK_UNLOCKED;
91 table[i].data.next_plus_upper = (start & ~index_mask) + i - 1; 91 table[i].data.next_plus_upper = (start & ~index_mask) + i - 1;
92 } 92 }
93 ref_table.entries = table; 93 tipc_ref_table.entries = table;
94 ref_table.index_mask = index_mask; 94 tipc_ref_table.index_mask = index_mask;
95 ref_table.first_free = sz - 1; 95 tipc_ref_table.first_free = sz - 1;
96 ref_table.last_free = 1; 96 tipc_ref_table.last_free = 1;
97 write_unlock_bh(&reftbl_lock); 97 write_unlock_bh(&ref_table_lock);
98 return TIPC_OK; 98 return TIPC_OK;
99} 99}
100 100
101/** 101/**
102 * ref_table_stop - destroy reference table for objects 102 * tipc_ref_table_stop - destroy reference table for objects
103 */ 103 */
104 104
105void ref_table_stop(void) 105void tipc_ref_table_stop(void)
106{ 106{
107 if (!ref_table.entries) 107 if (!tipc_ref_table.entries)
108 return; 108 return;
109 109
110 vfree(ref_table.entries); 110 vfree(tipc_ref_table.entries);
111 ref_table.entries = 0; 111 tipc_ref_table.entries = 0;
112} 112}
113 113
114/** 114/**
115 * ref_acquire - create reference to an object 115 * tipc_ref_acquire - create reference to an object
116 * 116 *
117 * Return a unique reference value which can be translated back to the pointer 117 * Return a unique reference value which can be translated back to the pointer
118 * 'object' at a later time. Also, pass back a pointer to the lock protecting 118 * 'object' at a later time. Also, pass back a pointer to the lock protecting
119 * the object, but without locking it. 119 * the object, but without locking it.
120 */ 120 */
121 121
122u32 ref_acquire(void *object, spinlock_t **lock) 122u32 tipc_ref_acquire(void *object, spinlock_t **lock)
123{ 123{
124 struct reference *entry; 124 struct reference *entry;
125 u32 index; 125 u32 index;
@@ -127,17 +127,17 @@ u32 ref_acquire(void *object, spinlock_t **lock)
127 u32 next_plus_upper; 127 u32 next_plus_upper;
128 u32 reference = 0; 128 u32 reference = 0;
129 129
130 assert(ref_table.entries && object); 130 assert(tipc_ref_table.entries && object);
131 131
132 write_lock_bh(&reftbl_lock); 132 write_lock_bh(&ref_table_lock);
133 if (ref_table.first_free) { 133 if (tipc_ref_table.first_free) {
134 index = ref_table.first_free; 134 index = tipc_ref_table.first_free;
135 entry = &(ref_table.entries[index]); 135 entry = &(tipc_ref_table.entries[index]);
136 index_mask = ref_table.index_mask; 136 index_mask = tipc_ref_table.index_mask;
137 /* take lock in case a previous user of entry still holds it */ 137 /* take lock in case a previous user of entry still holds it */
138 spin_lock_bh(&entry->lock); 138 spin_lock_bh(&entry->lock);
139 next_plus_upper = entry->data.next_plus_upper; 139 next_plus_upper = entry->data.next_plus_upper;
140 ref_table.first_free = next_plus_upper & index_mask; 140 tipc_ref_table.first_free = next_plus_upper & index_mask;
141 reference = (next_plus_upper & ~index_mask) + index; 141 reference = (next_plus_upper & ~index_mask) + index;
142 entry->data.reference = reference; 142 entry->data.reference = reference;
143 entry->object = object; 143 entry->object = object;
@@ -145,45 +145,45 @@ u32 ref_acquire(void *object, spinlock_t **lock)
145 *lock = &entry->lock; 145 *lock = &entry->lock;
146 spin_unlock_bh(&entry->lock); 146 spin_unlock_bh(&entry->lock);
147 } 147 }
148 write_unlock_bh(&reftbl_lock); 148 write_unlock_bh(&ref_table_lock);
149 return reference; 149 return reference;
150} 150}
151 151
152/** 152/**
153 * ref_discard - invalidate references to an object 153 * tipc_ref_discard - invalidate references to an object
154 * 154 *
155 * Disallow future references to an object and free up the entry for re-use. 155 * Disallow future references to an object and free up the entry for re-use.
156 * Note: The entry's spin_lock may still be busy after discard 156 * Note: The entry's spin_lock may still be busy after discard
157 */ 157 */
158 158
159void ref_discard(u32 ref) 159void tipc_ref_discard(u32 ref)
160{ 160{
161 struct reference *entry; 161 struct reference *entry;
162 u32 index; 162 u32 index;
163 u32 index_mask; 163 u32 index_mask;
164 164
165 assert(ref_table.entries); 165 assert(tipc_ref_table.entries);
166 assert(ref != 0); 166 assert(ref != 0);
167 167
168 write_lock_bh(&reftbl_lock); 168 write_lock_bh(&ref_table_lock);
169 index_mask = ref_table.index_mask; 169 index_mask = tipc_ref_table.index_mask;
170 index = ref & index_mask; 170 index = ref & index_mask;
171 entry = &(ref_table.entries[index]); 171 entry = &(tipc_ref_table.entries[index]);
172 assert(entry->object != 0); 172 assert(entry->object != 0);
173 assert(entry->data.reference == ref); 173 assert(entry->data.reference == ref);
174 174
175 /* mark entry as unused */ 175 /* mark entry as unused */
176 entry->object = 0; 176 entry->object = 0;
177 if (ref_table.first_free == 0) 177 if (tipc_ref_table.first_free == 0)
178 ref_table.first_free = index; 178 tipc_ref_table.first_free = index;
179 else 179 else
180 /* next_plus_upper is always XXXX|0--0 for last free entry */ 180 /* next_plus_upper is always XXXX|0--0 for last free entry */
181 ref_table.entries[ref_table.last_free].data.next_plus_upper 181 tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper
182 |= index; 182 |= index;
183 ref_table.last_free = index; 183 tipc_ref_table.last_free = index;
184 184
185 /* increment upper bits of entry to invalidate subsequent references */ 185 /* increment upper bits of entry to invalidate subsequent references */
186 entry->data.next_plus_upper = (ref & ~index_mask) + (index_mask + 1); 186 entry->data.next_plus_upper = (ref & ~index_mask) + (index_mask + 1);
187 write_unlock_bh(&reftbl_lock); 187 write_unlock_bh(&ref_table_lock);
188} 188}
189 189
diff --git a/net/tipc/ref.h b/net/tipc/ref.h
index 429cde57228a..4f8f9f40dcac 100644
--- a/net/tipc/ref.h
+++ b/net/tipc/ref.h
@@ -54,7 +54,7 @@ struct reference {
54}; 54};
55 55
56/** 56/**
57 * struct ref_table - table of TIPC object reference entries 57 * struct tipc_ref_table - table of TIPC object reference entries
58 * @entries: pointer to array of reference entries 58 * @entries: pointer to array of reference entries
59 * @index_mask: bitmask for array index portion of reference values 59 * @index_mask: bitmask for array index portion of reference values
60 * @first_free: array index of first unused object reference entry 60 * @first_free: array index of first unused object reference entry
@@ -68,24 +68,24 @@ struct ref_table {
68 u32 last_free; 68 u32 last_free;
69}; 69};
70 70
71extern struct ref_table ref_table; 71extern struct ref_table tipc_ref_table;
72 72
73int ref_table_init(u32 requested_size, u32 start); 73int tipc_ref_table_init(u32 requested_size, u32 start);
74void ref_table_stop(void); 74void tipc_ref_table_stop(void);
75 75
76u32 ref_acquire(void *object, spinlock_t **lock); 76u32 tipc_ref_acquire(void *object, spinlock_t **lock);
77void ref_discard(u32 ref); 77void tipc_ref_discard(u32 ref);
78 78
79 79
80/** 80/**
81 * ref_lock - lock referenced object and return pointer to it 81 * tipc_ref_lock - lock referenced object and return pointer to it
82 */ 82 */
83 83
84static inline void *ref_lock(u32 ref) 84static inline void *tipc_ref_lock(u32 ref)
85{ 85{
86 if (likely(ref_table.entries)) { 86 if (likely(tipc_ref_table.entries)) {
87 struct reference *r = 87 struct reference *r =
88 &ref_table.entries[ref & ref_table.index_mask]; 88 &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
89 89
90 spin_lock_bh(&r->lock); 90 spin_lock_bh(&r->lock);
91 if (likely(r->data.reference == ref)) 91 if (likely(r->data.reference == ref))
@@ -96,31 +96,31 @@ static inline void *ref_lock(u32 ref)
96} 96}
97 97
98/** 98/**
99 * ref_unlock - unlock referenced object 99 * tipc_ref_unlock - unlock referenced object
100 */ 100 */
101 101
102static inline void ref_unlock(u32 ref) 102static inline void tipc_ref_unlock(u32 ref)
103{ 103{
104 if (likely(ref_table.entries)) { 104 if (likely(tipc_ref_table.entries)) {
105 struct reference *r = 105 struct reference *r =
106 &ref_table.entries[ref & ref_table.index_mask]; 106 &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
107 107
108 if (likely(r->data.reference == ref)) 108 if (likely(r->data.reference == ref))
109 spin_unlock_bh(&r->lock); 109 spin_unlock_bh(&r->lock);
110 else 110 else
111 err("ref_unlock() invoked using obsolete reference\n"); 111 err("tipc_ref_unlock() invoked using obsolete reference\n");
112 } 112 }
113} 113}
114 114
115/** 115/**
116 * ref_deref - return pointer referenced object (without locking it) 116 * tipc_ref_deref - return pointer referenced object (without locking it)
117 */ 117 */
118 118
119static inline void *ref_deref(u32 ref) 119static inline void *tipc_ref_deref(u32 ref)
120{ 120{
121 if (likely(ref_table.entries)) { 121 if (likely(tipc_ref_table.entries)) {
122 struct reference *r = 122 struct reference *r =
123 &ref_table.entries[ref & ref_table.index_mask]; 123 &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
124 124
125 if (likely(r->data.reference == ref)) 125 if (likely(r->data.reference == ref))
126 return r->object; 126 return r->object;
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d21f8c0cd25a..67253bfcd702 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -42,9 +42,7 @@
42#include <linux/mm.h> 42#include <linux/mm.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/poll.h> 44#include <linux/poll.h>
45#include <linux/version.h>
46#include <linux/fcntl.h> 45#include <linux/fcntl.h>
47#include <linux/version.h>
48#include <asm/semaphore.h> 46#include <asm/semaphore.h>
49#include <asm/string.h> 47#include <asm/string.h>
50#include <asm/atomic.h> 48#include <asm/atomic.h>
@@ -1185,7 +1183,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1185 if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) { 1183 if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) {
1186 sock->state = SS_DISCONNECTING; 1184 sock->state = SS_DISCONNECTING;
1187 /* Note: Use signal since port lock is already taken! */ 1185 /* Note: Use signal since port lock is already taken! */
1188 k_signal((Handler)async_disconnect, tport->ref); 1186 tipc_k_signal((Handler)async_disconnect, tport->ref);
1189 } 1187 }
1190 1188
1191 /* Enqueue message (finally!) */ 1189 /* Enqueue message (finally!) */
@@ -1685,11 +1683,11 @@ static struct proto tipc_proto = {
1685}; 1683};
1686 1684
1687/** 1685/**
1688 * socket_init - initialize TIPC socket interface 1686 * tipc_socket_init - initialize TIPC socket interface
1689 * 1687 *
1690 * Returns 0 on success, errno otherwise 1688 * Returns 0 on success, errno otherwise
1691 */ 1689 */
1692int socket_init(void) 1690int tipc_socket_init(void)
1693{ 1691{
1694 int res; 1692 int res;
1695 1693
@@ -1712,9 +1710,9 @@ int socket_init(void)
1712} 1710}
1713 1711
1714/** 1712/**
1715 * sock_stop - stop TIPC socket interface 1713 * tipc_socket_stop - stop TIPC socket interface
1716 */ 1714 */
1717void socket_stop(void) 1715void tipc_socket_stop(void)
1718{ 1716{
1719 if (!sockets_enabled) 1717 if (!sockets_enabled)
1720 return; 1718 return;
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 80e219ba527d..5ff38b9f3194 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -118,14 +118,14 @@ static void subscr_send_event(struct subscription *sub,
118} 118}
119 119
120/** 120/**
121 * subscr_overlap - test for subscription overlap with the given values 121 * tipc_subscr_overlap - test for subscription overlap with the given values
122 * 122 *
123 * Returns 1 if there is overlap, otherwise 0. 123 * Returns 1 if there is overlap, otherwise 0.
124 */ 124 */
125 125
126int subscr_overlap(struct subscription *sub, 126int tipc_subscr_overlap(struct subscription *sub,
127 u32 found_lower, 127 u32 found_lower,
128 u32 found_upper) 128 u32 found_upper)
129 129
130{ 130{
131 if (found_lower < sub->seq.lower) 131 if (found_lower < sub->seq.lower)
@@ -138,22 +138,22 @@ int subscr_overlap(struct subscription *sub,
138} 138}
139 139
140/** 140/**
141 * subscr_report_overlap - issue event if there is subscription overlap 141 * tipc_subscr_report_overlap - issue event if there is subscription overlap
142 * 142 *
143 * Protected by nameseq.lock in name_table.c 143 * Protected by nameseq.lock in name_table.c
144 */ 144 */
145 145
146void subscr_report_overlap(struct subscription *sub, 146void tipc_subscr_report_overlap(struct subscription *sub,
147 u32 found_lower, 147 u32 found_lower,
148 u32 found_upper, 148 u32 found_upper,
149 u32 event, 149 u32 event,
150 u32 port_ref, 150 u32 port_ref,
151 u32 node, 151 u32 node,
152 int must) 152 int must)
153{ 153{
154 dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower, 154 dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower,
155 sub->seq.upper, found_lower, found_upper); 155 sub->seq.upper, found_lower, found_upper);
156 if (!subscr_overlap(sub, found_lower, found_upper)) 156 if (!tipc_subscr_overlap(sub, found_lower, found_upper))
157 return; 157 return;
158 if (!must && (sub->filter != TIPC_SUB_PORTS)) 158 if (!must && (sub->filter != TIPC_SUB_PORTS))
159 return; 159 return;
@@ -172,13 +172,13 @@ static void subscr_timeout(struct subscription *sub)
172 /* Validate subscriber reference (in case subscriber is terminating) */ 172 /* Validate subscriber reference (in case subscriber is terminating) */
173 173
174 subscriber_ref = sub->owner->ref; 174 subscriber_ref = sub->owner->ref;
175 subscriber = (struct subscriber *)ref_lock(subscriber_ref); 175 subscriber = (struct subscriber *)tipc_ref_lock(subscriber_ref);
176 if (subscriber == NULL) 176 if (subscriber == NULL)
177 return; 177 return;
178 178
179 /* Unlink subscription from name table */ 179 /* Unlink subscription from name table */
180 180
181 nametbl_unsubscribe(sub); 181 tipc_nametbl_unsubscribe(sub);
182 182
183 /* Notify subscriber of timeout, then unlink subscription */ 183 /* Notify subscriber of timeout, then unlink subscription */
184 184
@@ -192,7 +192,7 @@ static void subscr_timeout(struct subscription *sub)
192 192
193 /* Now destroy subscription */ 193 /* Now destroy subscription */
194 194
195 ref_unlock(subscriber_ref); 195 tipc_ref_unlock(subscriber_ref);
196 k_term_timer(&sub->timer); 196 k_term_timer(&sub->timer);
197 kfree(sub); 197 kfree(sub);
198 atomic_dec(&topsrv.subscription_count); 198 atomic_dec(&topsrv.subscription_count);
@@ -216,7 +216,7 @@ static void subscr_terminate(struct subscriber *subscriber)
216 216
217 /* Invalidate subscriber reference */ 217 /* Invalidate subscriber reference */
218 218
219 ref_discard(subscriber->ref); 219 tipc_ref_discard(subscriber->ref);
220 spin_unlock_bh(subscriber->lock); 220 spin_unlock_bh(subscriber->lock);
221 221
222 /* Destroy any existing subscriptions for subscriber */ 222 /* Destroy any existing subscriptions for subscriber */
@@ -227,7 +227,7 @@ static void subscr_terminate(struct subscriber *subscriber)
227 k_cancel_timer(&sub->timer); 227 k_cancel_timer(&sub->timer);
228 k_term_timer(&sub->timer); 228 k_term_timer(&sub->timer);
229 } 229 }
230 nametbl_unsubscribe(sub); 230 tipc_nametbl_unsubscribe(sub);
231 list_del(&sub->subscription_list); 231 list_del(&sub->subscription_list);
232 dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n", 232 dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n",
233 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); 233 sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
@@ -315,7 +315,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
315 k_start_timer(&sub->timer, sub->timeout); 315 k_start_timer(&sub->timer, sub->timeout);
316 } 316 }
317 sub->owner = subscriber; 317 sub->owner = subscriber;
318 nametbl_subscribe(sub); 318 tipc_nametbl_subscribe(sub);
319} 319}
320 320
321/** 321/**
@@ -332,7 +332,7 @@ static void subscr_conn_shutdown_event(void *usr_handle,
332 struct subscriber *subscriber; 332 struct subscriber *subscriber;
333 spinlock_t *subscriber_lock; 333 spinlock_t *subscriber_lock;
334 334
335 subscriber = ref_lock((u32)(unsigned long)usr_handle); 335 subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
336 if (subscriber == NULL) 336 if (subscriber == NULL)
337 return; 337 return;
338 338
@@ -354,7 +354,7 @@ static void subscr_conn_msg_event(void *usr_handle,
354 struct subscriber *subscriber; 354 struct subscriber *subscriber;
355 spinlock_t *subscriber_lock; 355 spinlock_t *subscriber_lock;
356 356
357 subscriber = ref_lock((u32)(unsigned long)usr_handle); 357 subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
358 if (subscriber == NULL) 358 if (subscriber == NULL)
359 return; 359 return;
360 360
@@ -401,7 +401,7 @@ static void subscr_named_msg_event(void *usr_handle,
401 memset(subscriber, 0, sizeof(struct subscriber)); 401 memset(subscriber, 0, sizeof(struct subscriber));
402 INIT_LIST_HEAD(&subscriber->subscription_list); 402 INIT_LIST_HEAD(&subscriber->subscription_list);
403 INIT_LIST_HEAD(&subscriber->subscriber_list); 403 INIT_LIST_HEAD(&subscriber->subscriber_list);
404 subscriber->ref = ref_acquire(subscriber, &subscriber->lock); 404 subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
405 if (subscriber->ref == 0) { 405 if (subscriber->ref == 0) {
406 warn("Failed to acquire subscriber reference\n"); 406 warn("Failed to acquire subscriber reference\n");
407 kfree(subscriber); 407 kfree(subscriber);
@@ -423,7 +423,7 @@ static void subscr_named_msg_event(void *usr_handle,
423 &subscriber->port_ref); 423 &subscriber->port_ref);
424 if (subscriber->port_ref == 0) { 424 if (subscriber->port_ref == 0) {
425 warn("Memory squeeze; failed to create subscription port\n"); 425 warn("Memory squeeze; failed to create subscription port\n");
426 ref_discard(subscriber->ref); 426 tipc_ref_discard(subscriber->ref);
427 kfree(subscriber); 427 kfree(subscriber);
428 return; 428 return;
429 } 429 }
@@ -432,7 +432,7 @@ static void subscr_named_msg_event(void *usr_handle,
432 432
433 /* Add subscriber to topology server's subscriber list */ 433 /* Add subscriber to topology server's subscriber list */
434 434
435 ref_lock(subscriber->ref); 435 tipc_ref_lock(subscriber->ref);
436 spin_lock_bh(&topsrv.lock); 436 spin_lock_bh(&topsrv.lock);
437 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list); 437 list_add(&subscriber->subscriber_list, &topsrv.subscriber_list);
438 spin_unlock_bh(&topsrv.lock); 438 spin_unlock_bh(&topsrv.lock);
@@ -451,7 +451,7 @@ static void subscr_named_msg_event(void *usr_handle,
451 spin_unlock_bh(subscriber_lock); 451 spin_unlock_bh(subscriber_lock);
452} 452}
453 453
454int subscr_start(void) 454int tipc_subscr_start(void)
455{ 455{
456 struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV}; 456 struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV};
457 int res = -1; 457 int res = -1;
@@ -481,7 +481,7 @@ int subscr_start(void)
481 if (res) 481 if (res)
482 goto failed; 482 goto failed;
483 483
484 res = nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); 484 res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
485 if (res) 485 if (res)
486 goto failed; 486 goto failed;
487 487
@@ -496,7 +496,7 @@ failed:
496 return res; 496 return res;
497} 497}
498 498
499void subscr_stop(void) 499void tipc_subscr_stop(void)
500{ 500{
501 struct subscriber *subscriber; 501 struct subscriber *subscriber;
502 struct subscriber *subscriber_temp; 502 struct subscriber *subscriber_temp;
@@ -507,7 +507,7 @@ void subscr_stop(void)
507 list_for_each_entry_safe(subscriber, subscriber_temp, 507 list_for_each_entry_safe(subscriber, subscriber_temp,
508 &topsrv.subscriber_list, 508 &topsrv.subscriber_list,
509 subscriber_list) { 509 subscriber_list) {
510 ref_lock(subscriber->ref); 510 tipc_ref_lock(subscriber->ref);
511 subscriber_lock = subscriber->lock; 511 subscriber_lock = subscriber->lock;
512 subscr_terminate(subscriber); 512 subscr_terminate(subscriber);
513 spin_unlock_bh(subscriber_lock); 513 spin_unlock_bh(subscriber_lock);
@@ -522,6 +522,6 @@ int tipc_ispublished(struct tipc_name const *name)
522{ 522{
523 u32 domain = 0; 523 u32 domain = 0;
524 524
525 return(nametbl_translate(name->type, name->instance,&domain) != 0); 525 return(tipc_nametbl_translate(name->type, name->instance,&domain) != 0);
526} 526}
527 527
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index ccff4efcb755..1e5090465d2e 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -60,21 +60,21 @@ struct subscription {
60 struct subscriber *owner; 60 struct subscriber *owner;
61}; 61};
62 62
63int subscr_overlap(struct subscription * sub, 63int tipc_subscr_overlap(struct subscription * sub,
64 u32 found_lower, 64 u32 found_lower,
65 u32 found_upper); 65 u32 found_upper);
66 66
67void subscr_report_overlap(struct subscription * sub, 67void tipc_subscr_report_overlap(struct subscription * sub,
68 u32 found_lower, 68 u32 found_lower,
69 u32 found_upper, 69 u32 found_upper,
70 u32 event, 70 u32 event,
71 u32 port_ref, 71 u32 port_ref,
72 u32 node, 72 u32 node,
73 int must_report); 73 int must_report);
74 74
75int subscr_start(void); 75int tipc_subscr_start(void);
76 76
77void subscr_stop(void); 77void tipc_subscr_stop(void);
78 78
79 79
80#endif 80#endif
diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c
index 35ec7dc8211d..106200d76587 100644
--- a/net/tipc/user_reg.c
+++ b/net/tipc/user_reg.c
@@ -114,10 +114,10 @@ static void reg_callback(struct tipc_user *user_ptr)
114} 114}
115 115
116/** 116/**
117 * reg_start - activate TIPC user registry 117 * tipc_reg_start - activate TIPC user registry
118 */ 118 */
119 119
120int reg_start(void) 120int tipc_reg_start(void)
121{ 121{
122 u32 u; 122 u32 u;
123 int res; 123 int res;
@@ -127,17 +127,17 @@ int reg_start(void)
127 127
128 for (u = 1; u <= MAX_USERID; u++) { 128 for (u = 1; u <= MAX_USERID; u++) {
129 if (users[u].callback) 129 if (users[u].callback)
130 k_signal((Handler)reg_callback, 130 tipc_k_signal((Handler)reg_callback,
131 (unsigned long)&users[u]); 131 (unsigned long)&users[u]);
132 } 132 }
133 return TIPC_OK; 133 return TIPC_OK;
134} 134}
135 135
136/** 136/**
137 * reg_stop - shut down & delete TIPC user registry 137 * tipc_reg_stop - shut down & delete TIPC user registry
138 */ 138 */
139 139
140void reg_stop(void) 140void tipc_reg_stop(void)
141{ 141{
142 int id; 142 int id;
143 143
@@ -184,7 +184,7 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
184 atomic_inc(&tipc_user_count); 184 atomic_inc(&tipc_user_count);
185 185
186 if (cb && (tipc_mode != TIPC_NOT_RUNNING)) 186 if (cb && (tipc_mode != TIPC_NOT_RUNNING))
187 k_signal((Handler)reg_callback, (unsigned long)user_ptr); 187 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
188 return TIPC_OK; 188 return TIPC_OK;
189} 189}
190 190
@@ -223,10 +223,10 @@ void tipc_detach(u32 userid)
223} 223}
224 224
225/** 225/**
226 * reg_add_port - register a user's driver port 226 * tipc_reg_add_port - register a user's driver port
227 */ 227 */
228 228
229int reg_add_port(struct user_port *up_ptr) 229int tipc_reg_add_port(struct user_port *up_ptr)
230{ 230{
231 struct tipc_user *user_ptr; 231 struct tipc_user *user_ptr;
232 232
@@ -245,10 +245,10 @@ int reg_add_port(struct user_port *up_ptr)
245} 245}
246 246
247/** 247/**
248 * reg_remove_port - deregister a user's driver port 248 * tipc_reg_remove_port - deregister a user's driver port
249 */ 249 */
250 250
251int reg_remove_port(struct user_port *up_ptr) 251int tipc_reg_remove_port(struct user_port *up_ptr)
252{ 252{
253 if (up_ptr->user_ref == 0) 253 if (up_ptr->user_ref == 0)
254 return TIPC_OK; 254 return TIPC_OK;
diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h
index 122ca9be3671..d0e88794ed1b 100644
--- a/net/tipc/user_reg.h
+++ b/net/tipc/user_reg.h
@@ -39,10 +39,10 @@
39 39
40#include "port.h" 40#include "port.h"
41 41
42int reg_start(void); 42int tipc_reg_start(void);
43void reg_stop(void); 43void tipc_reg_stop(void);
44 44
45int reg_add_port(struct user_port *up_ptr); 45int tipc_reg_add_port(struct user_port *up_ptr);
46int reg_remove_port(struct user_port *up_ptr); 46int tipc_reg_remove_port(struct user_port *up_ptr);
47 47
48#endif 48#endif
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index 4eaef662d568..7c11f7f83a21 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -42,12 +42,12 @@
42#include "cluster.h" 42#include "cluster.h"
43#include "node.h" 43#include "node.h"
44 44
45struct _zone *zone_create(u32 addr) 45struct _zone *tipc_zone_create(u32 addr)
46{ 46{
47 struct _zone *z_ptr = 0; 47 struct _zone *z_ptr = 0;
48 u32 z_num; 48 u32 z_num;
49 49
50 if (!addr_domain_valid(addr)) 50 if (!tipc_addr_domain_valid(addr))
51 return 0; 51 return 0;
52 52
53 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); 53 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
@@ -55,24 +55,24 @@ struct _zone *zone_create(u32 addr)
55 memset(z_ptr, 0, sizeof(*z_ptr)); 55 memset(z_ptr, 0, sizeof(*z_ptr));
56 z_num = tipc_zone(addr); 56 z_num = tipc_zone(addr);
57 z_ptr->addr = tipc_addr(z_num, 0, 0); 57 z_ptr->addr = tipc_addr(z_num, 0, 0);
58 net.zones[z_num] = z_ptr; 58 tipc_net.zones[z_num] = z_ptr;
59 } 59 }
60 return z_ptr; 60 return z_ptr;
61} 61}
62 62
63void zone_delete(struct _zone *z_ptr) 63void tipc_zone_delete(struct _zone *z_ptr)
64{ 64{
65 u32 c_num; 65 u32 c_num;
66 66
67 if (!z_ptr) 67 if (!z_ptr)
68 return; 68 return;
69 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { 69 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
70 cluster_delete(z_ptr->clusters[c_num]); 70 tipc_cltr_delete(z_ptr->clusters[c_num]);
71 } 71 }
72 kfree(z_ptr); 72 kfree(z_ptr);
73} 73}
74 74
75void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) 75void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
76{ 76{
77 u32 c_num = tipc_cluster(c_ptr->addr); 77 u32 c_num = tipc_cluster(c_ptr->addr);
78 78
@@ -82,19 +82,19 @@ void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
82 z_ptr->clusters[c_num] = c_ptr; 82 z_ptr->clusters[c_num] = c_ptr;
83} 83}
84 84
85void zone_remove_as_router(struct _zone *z_ptr, u32 router) 85void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router)
86{ 86{
87 u32 c_num; 87 u32 c_num;
88 88
89 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { 89 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
90 if (z_ptr->clusters[c_num]) { 90 if (z_ptr->clusters[c_num]) {
91 cluster_remove_as_router(z_ptr->clusters[c_num], 91 tipc_cltr_remove_as_router(z_ptr->clusters[c_num],
92 router); 92 router);
93 } 93 }
94 } 94 }
95} 95}
96 96
97void zone_send_external_routes(struct _zone *z_ptr, u32 dest) 97void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest)
98{ 98{
99 u32 c_num; 99 u32 c_num;
100 100
@@ -102,12 +102,12 @@ void zone_send_external_routes(struct _zone *z_ptr, u32 dest)
102 if (z_ptr->clusters[c_num]) { 102 if (z_ptr->clusters[c_num]) {
103 if (in_own_cluster(z_ptr->addr)) 103 if (in_own_cluster(z_ptr->addr))
104 continue; 104 continue;
105 cluster_send_ext_routes(z_ptr->clusters[c_num], dest); 105 tipc_cltr_send_ext_routes(z_ptr->clusters[c_num], dest);
106 } 106 }
107 } 107 }
108} 108}
109 109
110struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) 110struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
111{ 111{
112 struct cluster *c_ptr; 112 struct cluster *c_ptr;
113 struct node *n_ptr; 113 struct node *n_ptr;
@@ -118,7 +118,7 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
118 c_ptr = z_ptr->clusters[tipc_cluster(addr)]; 118 c_ptr = z_ptr->clusters[tipc_cluster(addr)];
119 if (!c_ptr) 119 if (!c_ptr)
120 return 0; 120 return 0;
121 n_ptr = cluster_select_node(c_ptr, ref); 121 n_ptr = tipc_cltr_select_node(c_ptr, ref);
122 if (n_ptr) 122 if (n_ptr)
123 return n_ptr; 123 return n_ptr;
124 124
@@ -127,14 +127,14 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
127 c_ptr = z_ptr->clusters[c_num]; 127 c_ptr = z_ptr->clusters[c_num];
128 if (!c_ptr) 128 if (!c_ptr)
129 return 0; 129 return 0;
130 n_ptr = cluster_select_node(c_ptr, ref); 130 n_ptr = tipc_cltr_select_node(c_ptr, ref);
131 if (n_ptr) 131 if (n_ptr)
132 return n_ptr; 132 return n_ptr;
133 } 133 }
134 return 0; 134 return 0;
135} 135}
136 136
137u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) 137u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
138{ 138{
139 struct cluster *c_ptr; 139 struct cluster *c_ptr;
140 u32 c_num; 140 u32 c_num;
@@ -143,14 +143,14 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
143 if (!z_ptr) 143 if (!z_ptr)
144 return 0; 144 return 0;
145 c_ptr = z_ptr->clusters[tipc_cluster(addr)]; 145 c_ptr = z_ptr->clusters[tipc_cluster(addr)];
146 router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; 146 router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
147 if (router) 147 if (router)
148 return router; 148 return router;
149 149
150 /* Links to any other clusters within the zone? */ 150 /* Links to any other clusters within the zone? */
151 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { 151 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
152 c_ptr = z_ptr->clusters[c_num]; 152 c_ptr = z_ptr->clusters[c_num];
153 router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; 153 router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
154 if (router) 154 if (router)
155 return router; 155 return router;
156 } 156 }
@@ -158,12 +158,12 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
158} 158}
159 159
160 160
161u32 zone_next_node(u32 addr) 161u32 tipc_zone_next_node(u32 addr)
162{ 162{
163 struct cluster *c_ptr = cluster_find(addr); 163 struct cluster *c_ptr = tipc_cltr_find(addr);
164 164
165 if (c_ptr) 165 if (c_ptr)
166 return cluster_next_node(c_ptr, addr); 166 return tipc_cltr_next_node(c_ptr, addr);
167 return 0; 167 return 0;
168} 168}
169 169
diff --git a/net/tipc/zone.h b/net/tipc/zone.h
index 4326f78d8292..267999c5a240 100644
--- a/net/tipc/zone.h
+++ b/net/tipc/zone.h
@@ -54,18 +54,18 @@ struct _zone {
54 u32 links; 54 u32 links;
55}; 55};
56 56
57struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); 57struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref);
58u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); 58u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref);
59void zone_remove_as_router(struct _zone *z_ptr, u32 router); 59void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router);
60void zone_send_external_routes(struct _zone *z_ptr, u32 dest); 60void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest);
61struct _zone *zone_create(u32 addr); 61struct _zone *tipc_zone_create(u32 addr);
62void zone_delete(struct _zone *z_ptr); 62void tipc_zone_delete(struct _zone *z_ptr);
63void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr); 63void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
64u32 zone_next_node(u32 addr); 64u32 tipc_zone_next_node(u32 addr);
65 65
66static inline struct _zone *zone_find(u32 addr) 66static inline struct _zone *tipc_zone_find(u32 addr)
67{ 67{
68 return net.zones[tipc_zone(addr)]; 68 return tipc_net.zones[tipc_zone(addr)];
69} 69}
70 70
71#endif 71#endif