diff options
110 files changed, 2842 insertions, 2480 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index ff16eac8cf5..e6dbb21a8e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1398,7 +1398,7 @@ IRDA SUBSYSTEM P: Jean Tourrilhes L: irda-users@lists.sourceforge.net (subscribers-only) W: http://irda.sourceforge.net/ -S: Maintained +S: Odd Fixes ISAPNP P: Jaroslav Kysela @@ -1843,7 +1843,14 @@ M: yoshfuji@linux-ipv6.org P: Patrick McHardy M: kaber@coreworks.de L: netdev@vger.kernel.org -T: git kernel.org:/pub/scm/linux/kernel/davem/net-2.6.git +T: git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git +S: Maintained + +NETWORKING [WIRELESS] +P: John W. Linville +M: linville@tuxdriver.com +L: netdev@vger.kernel.org +T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git S: Maintained IPVS @@ -2536,11 +2543,11 @@ S: Maintained TIPC NETWORK LAYER P: Per Liden -M: per.liden@nospam.ericsson.com +M: per.liden@ericsson.com P: Jon Maloy -M: jon.maloy@nospam.ericsson.com +M: jon.maloy@ericsson.com P: Allan Stephens -M: allan.stephens@nospam.windriver.com +M: allan.stephens@windriver.com L: tipc-discussion@lists.sourceforge.net W: http://tipc.sourceforge.net/ W: http://tipc.cslab.ericsson.net/ diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index aaa47400eb9..db3389d8e02 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -334,7 +334,7 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size mov r1, #0x12 orr r1, r1, #3 << 10 add r2, r3, #16384 -1: cmp r1, r8 @ if virt > start of RAM +1: cmp r1, r9 @ if virt > start of RAM orrhs r1, r1, #0x0c @ set cacheable, bufferable cmp r1, r10 @ if virt > end of RAM bichs r1, r1, #0x0c @ clear cacheable, bufferable diff --git a/arch/arm/configs/ep80219_defconfig b/arch/arm/configs/ep80219_defconfig index fbe312e757c..3c73b707c2f 100644 --- a/arch/arm/configs/ep80219_defconfig +++ b/arch/arm/configs/ep80219_defconfig @@ -522,6 +522,7 @@ CONFIG_E100=y # CONFIG_DL2K is not set CONFIG_E1000=y CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/arm/configs/iq31244_defconfig b/arch/arm/configs/iq31244_defconfig index c07628ceaf0..32467160a6d 100644 --- a/arch/arm/configs/iq31244_defconfig +++ b/arch/arm/configs/iq31244_defconfig @@ -493,6 +493,7 @@ CONFIG_NETDEVICES=y # CONFIG_DL2K is not set CONFIG_E1000=y CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/arm/configs/iq80321_defconfig b/arch/arm/configs/iq80321_defconfig index 18fa1615fdf..b000da753c4 100644 --- a/arch/arm/configs/iq80321_defconfig +++ b/arch/arm/configs/iq80321_defconfig @@ -415,6 +415,7 @@ CONFIG_NETDEVICES=y # CONFIG_DL2K is not set CONFIG_E1000=y CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/arm/configs/iq80331_defconfig b/arch/arm/configs/iq80331_defconfig index f50035de1ff..46c79e1efe0 100644 --- a/arch/arm/configs/iq80331_defconfig +++ b/arch/arm/configs/iq80331_defconfig @@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y # CONFIG_DL2K is not set CONFIG_E1000=y CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/arm/configs/iq80332_defconfig b/arch/arm/configs/iq80332_defconfig index 18b3f372ed6..11959b705d8 100644 --- a/arch/arm/configs/iq80332_defconfig +++ b/arch/arm/configs/iq80332_defconfig @@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y # CONFIG_DL2K is not set CONFIG_E1000=y CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 874e6bb7940..d401d908c46 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -735,8 +735,11 @@ __kuser_cmpxchg: @ 0xffff0fc0 * The kernel itself must perform the operation. * A special ghost syscall is used for that (see traps.c). */ + stmfd sp!, {r7, lr} + mov r7, #0xff00 @ 0xfff0 into r7 for EABI + orr r7, r7, #0xf0 swi #0x9ffff0 - mov pc, lr + ldmfd sp!, {r7, pc} #elif __LINUX_ARM_ARCH__ < 6 diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 765922bcf9e..a0cd0a90a10 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -30,15 +30,21 @@ #define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)) /* + * With EABI, the syscall number has to be loaded into r7. + */ +#define MOV_R7_NR_SIGRETURN (0xe3a07000 | (__NR_sigreturn - __NR_SYSCALL_BASE)) +#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) + +/* * For Thumb syscalls, we pass the syscall number via r7. We therefore * need two 16-bit instructions. */ #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE)) #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) -const unsigned long sigreturn_codes[4] = { - SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, - SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN +const unsigned long sigreturn_codes[7] = { + MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, + MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, }; static int do_signal(sigset_t *oldset, struct pt_regs * regs, int syscall); @@ -189,7 +195,7 @@ struct aux_sigframe { struct sigframe { struct sigcontext sc; unsigned long extramask[_NSIG_WORDS-1]; - unsigned long retcode; + unsigned long retcode[2]; struct aux_sigframe aux __attribute__((aligned(8))); }; @@ -198,7 +204,7 @@ struct rt_sigframe { void __user *puc; struct siginfo info; struct ucontext uc; - unsigned long retcode; + unsigned long retcode[2]; struct aux_sigframe aux __attribute__((aligned(8))); }; @@ -436,12 +442,13 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka, if (ka->sa.sa_flags & SA_RESTORER) { retcode = (unsigned long)ka->sa.sa_restorer; } else { - unsigned int idx = thumb; + unsigned int idx = thumb << 1; if (ka->sa.sa_flags & SA_SIGINFO) - idx += 2; + idx += 3; - if (__put_user(sigreturn_codes[idx], rc)) + if (__put_user(sigreturn_codes[idx], rc) || + __put_user(sigreturn_codes[idx+1], rc+1)) return 1; if (cpsr & MODE32_BIT) { @@ -456,7 +463,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka, * the return code written onto the stack. */ flush_icache_range((unsigned long)rc, - (unsigned long)(rc + 1)); + (unsigned long)(rc + 2)); retcode = ((unsigned long)rc) + thumb; } @@ -488,7 +495,7 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg } if (err == 0) - err = setup_return(regs, ka, &frame->retcode, frame, usig); + err = setup_return(regs, ka, frame->retcode, frame, usig); return err; } @@ -522,7 +529,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); if (err == 0) - err = setup_return(regs, ka, &frame->retcode, frame, usig); + err = setup_return(regs, ka, frame->retcode, frame, usig); if (err == 0) { /* diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h index 91d26faca62..9991049c522 100644 --- a/arch/arm/kernel/signal.h +++ b/arch/arm/kernel/signal.h @@ -9,4 +9,4 @@ */ #define KERN_SIGRETURN_CODE 0xffff0500 -extern const unsigned long sigreturn_codes[4]; +extern const unsigned long sigreturn_codes[7]; diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 6b393691d0e..4bdc9d4526c 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -333,6 +333,7 @@ static struct platform_device *ixp46x_devices[] __initdata = { }; unsigned long ixp4xx_exp_bus_size; +EXPORT_SYMBOL(ixp4xx_exp_bus_size); void __init ixp4xx_sys_init(void) { @@ -352,7 +353,7 @@ void __init ixp4xx_sys_init(void) } } - printk("IXP4xx: Using %uMiB expansion bus window size\n", + printk("IXP4xx: Using %luMiB expansion bus window size\n", ixp4xx_exp_bus_size >> 20); } diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 9d862f86bba..75110ba1042 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c @@ -50,10 +50,10 @@ static int omap1_clk_enable_dsp_domain(struct clk *clk) { int retval; - retval = omap1_clk_use(&api_ck.clk); + retval = omap1_clk_enable(&api_ck.clk); if (!retval) { - retval = omap1_clk_enable(clk); - omap1_clk_unuse(&api_ck.clk); + retval = omap1_clk_enable_generic(clk); + omap1_clk_disable(&api_ck.clk); } return retval; @@ -61,9 +61,9 @@ static int omap1_clk_enable_dsp_domain(struct clk *clk) static void omap1_clk_disable_dsp_domain(struct clk *clk) { - if (omap1_clk_use(&api_ck.clk) == 0) { - omap1_clk_disable(clk); - omap1_clk_unuse(&api_ck.clk); + if (omap1_clk_enable(&api_ck.clk) == 0) { + omap1_clk_disable_generic(clk); + omap1_clk_disable(&api_ck.clk); } } @@ -72,7 +72,7 @@ static int omap1_clk_enable_uart_functional(struct clk *clk) int ret; struct uart_clk *uclk; - ret = omap1_clk_enable(clk); + ret = omap1_clk_enable_generic(clk); if (ret == 0) { /* Set smart idle acknowledgement mode */ uclk = (struct uart_clk *)clk; @@ -91,7 +91,7 @@ static void omap1_clk_disable_uart_functional(struct clk *clk) uclk = (struct uart_clk *)clk; omap_writeb((omap_readb(uclk->sysc_addr) & ~0x18), uclk->sysc_addr); - omap1_clk_disable(clk); + omap1_clk_disable_generic(clk); } static void omap1_clk_allow_idle(struct clk *clk) @@ -230,9 +230,9 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk) * Note that DSP_CKCTL virt addr = phys addr, so * we must use __raw_readw() instead of omap_readw(). */ - omap1_clk_use(&api_ck.clk); + omap1_clk_enable(&api_ck.clk); dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); - omap1_clk_unuse(&api_ck.clk); + omap1_clk_disable(&api_ck.clk); if (unlikely(clk->rate == clk->parent->rate / dsor)) return; /* No change, quick exit */ @@ -412,12 +412,12 @@ static void omap1_init_ext_clk(struct clk * clk) clk-> rate = 96000000 / dsor; } -static int omap1_clk_use(struct clk *clk) +static int omap1_clk_enable(struct clk *clk) { int ret = 0; if (clk->usecount++ == 0) { if (likely(clk->parent)) { - ret = omap1_clk_use(clk->parent); + ret = omap1_clk_enable(clk->parent); if (unlikely(ret != 0)) { clk->usecount--; @@ -432,7 +432,7 @@ static int omap1_clk_use(struct clk *clk) ret = clk->enable(clk); if (unlikely(ret != 0) && clk->parent) { - omap1_clk_unuse(clk->parent); + omap1_clk_disable(clk->parent); clk->usecount--; } } @@ -440,12 +440,12 @@ static int omap1_clk_use(struct clk *clk) return ret; } -static void omap1_clk_unuse(struct clk *clk) +static void omap1_clk_disable(struct clk *clk) { if (clk->usecount > 0 && !(--clk->usecount)) { clk->disable(clk); if (likely(clk->parent)) { - omap1_clk_unuse(clk->parent); + omap1_clk_disable(clk->parent); if (clk->flags & CLOCK_NO_IDLE_PARENT) if (!cpu_is_omap24xx()) omap1_clk_allow_idle(clk->parent); @@ -453,7 +453,7 @@ static void omap1_clk_unuse(struct clk *clk) } } -static int omap1_clk_enable(struct clk *clk) +static int omap1_clk_enable_generic(struct clk *clk) { __u16 regval16; __u32 regval32; @@ -492,7 +492,7 @@ static int omap1_clk_enable(struct clk *clk) return 0; } -static void omap1_clk_disable(struct clk *clk) +static void omap1_clk_disable_generic(struct clk *clk) { __u16 regval16; __u32 regval32; @@ -654,8 +654,8 @@ late_initcall(omap1_late_clk_reset); #endif static struct clk_functions omap1_clk_functions = { - .clk_use = omap1_clk_use, - .clk_unuse = omap1_clk_unuse, + .clk_enable = omap1_clk_enable, + .clk_disable = omap1_clk_disable, .clk_round_rate = omap1_clk_round_rate, .clk_set_rate = omap1_clk_set_rate, }; @@ -780,9 +780,9 @@ int __init omap1_clk_init(void) * Only enable those clocks we will need, let the drivers * enable other clocks as necessary */ - clk_use(&armper_ck.clk); - clk_use(&armxor_ck.clk); - clk_use(&armtim_ck.clk); /* This should be done by timer code */ + clk_enable(&armper_ck.clk); + clk_enable(&armxor_ck.clk); + clk_enable(&armtim_ck.clk); /* This should be done by timer code */ if (cpu_is_omap1510()) clk_enable(&arm_gpio_ck); diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index f3bdfb50e01..4f18d1b9444 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h @@ -13,8 +13,8 @@ #ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H #define __ARCH_ARM_MACH_OMAP1_CLOCK_H -static int omap1_clk_enable(struct clk * clk); -static void omap1_clk_disable(struct clk * clk); +static int omap1_clk_enable_generic(struct clk * clk); +static void omap1_clk_disable_generic(struct clk * clk); static void omap1_ckctl_recalc(struct clk * clk); static void omap1_watchdog_recalc(struct clk * clk); static void omap1_ckctl_recalc_dsp_domain(struct clk * clk); @@ -30,8 +30,8 @@ static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate); static void omap1_init_ext_clk(struct clk * clk); static int omap1_select_table_rate(struct clk * clk, unsigned long rate); static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate); -static int omap1_clk_use(struct clk *clk); -static void omap1_clk_unuse(struct clk *clk); +static int omap1_clk_enable(struct clk *clk); +static void omap1_clk_disable(struct clk *clk); struct mpu_rate { unsigned long rate; @@ -152,8 +152,8 @@ static struct clk ck_ref = { .rate = 12000000, .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk ck_dpll1 = { @@ -161,8 +161,8 @@ static struct clk ck_dpll1 = { .parent = &ck_ref, .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | RATE_PROPAGATES | ALWAYS_ENABLED, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct arm_idlect1_clk ck_dpll1out = { @@ -173,8 +173,8 @@ static struct arm_idlect1_clk ck_dpll1out = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_CKOUT_ARM, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 12, }; @@ -186,8 +186,8 @@ static struct clk arm_ck = { RATE_CKCTL | RATE_PROPAGATES | ALWAYS_ENABLED, .rate_offset = CKCTL_ARMDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct arm_idlect1_clk armper_ck = { @@ -200,8 +200,8 @@ static struct arm_idlect1_clk armper_ck = { .enable_bit = EN_PERCK, .rate_offset = CKCTL_PERDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 2, }; @@ -213,8 +213,8 @@ static struct clk arm_gpio_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_GPIOCK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct arm_idlect1_clk armxor_ck = { @@ -226,8 +226,8 @@ static struct arm_idlect1_clk armxor_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_XORPCK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 1, }; @@ -241,8 +241,8 @@ static struct arm_idlect1_clk armtim_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_TIMCK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 9, }; @@ -256,8 +256,8 @@ static struct arm_idlect1_clk armwdt_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_WDTCK, .recalc = &omap1_watchdog_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 0, }; @@ -272,8 +272,8 @@ static struct clk arminth_ck16xx = { * * 1510 version is in TC clocks. */ - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk dsp_ck = { @@ -285,8 +285,8 @@ static struct clk dsp_ck = { .enable_bit = EN_DSPCK, .rate_offset = CKCTL_DSPDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk dspmmu_ck = { @@ -296,8 +296,8 @@ static struct clk dspmmu_ck = { RATE_CKCTL | ALWAYS_ENABLED, .rate_offset = CKCTL_DSPMMUDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk dspper_ck = { @@ -349,8 +349,8 @@ static struct arm_idlect1_clk tc_ck = { CLOCK_IDLE_CONTROL, .rate_offset = CKCTL_TCDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 6, }; @@ -364,8 +364,8 @@ static struct clk arminth_ck1510 = { * * 16xx version is in MPU clocks. */ - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk tipb_ck = { @@ -374,8 +374,8 @@ static struct clk tipb_ck = { .parent = &tc_ck.clk, .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk l3_ocpi_ck = { @@ -386,8 +386,8 @@ static struct clk l3_ocpi_ck = { .enable_reg = (void __iomem *)ARM_IDLECT3, .enable_bit = EN_OCPI_CK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk tc1_ck = { @@ -397,8 +397,8 @@ static struct clk tc1_ck = { .enable_reg = (void __iomem *)ARM_IDLECT3, .enable_bit = EN_TC1_CK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk tc2_ck = { @@ -408,8 +408,8 @@ static struct clk tc2_ck = { .enable_reg = (void __iomem *)ARM_IDLECT3, .enable_bit = EN_TC2_CK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk dma_ck = { @@ -419,8 +419,8 @@ static struct clk dma_ck = { .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk dma_lcdfree_ck = { @@ -428,8 +428,8 @@ static struct clk dma_lcdfree_ck = { .parent = &tc_ck.clk, .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct arm_idlect1_clk api_ck = { @@ -441,8 +441,8 @@ static struct arm_idlect1_clk api_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_APICK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 8, }; @@ -455,8 +455,8 @@ static struct arm_idlect1_clk lb_ck = { .enable_reg = (void __iomem *)ARM_IDLECT2, .enable_bit = EN_LBCK, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 4, }; @@ -466,8 +466,8 @@ static struct clk rhea1_ck = { .parent = &tc_ck.clk, .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk rhea2_ck = { @@ -475,8 +475,8 @@ static struct clk rhea2_ck = { .parent = &tc_ck.clk, .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, .recalc = &followparent_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk lcd_ck_16xx = { @@ -487,8 +487,8 @@ static struct clk lcd_ck_16xx = { .enable_bit = EN_LCDCK, .rate_offset = CKCTL_LCDDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct arm_idlect1_clk lcd_ck_1510 = { @@ -501,8 +501,8 @@ static struct arm_idlect1_clk lcd_ck_1510 = { .enable_bit = EN_LCDCK, .rate_offset = CKCTL_LCDDIV_OFFSET, .recalc = &omap1_ckctl_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }, .idlect_shift = 3, }; @@ -518,8 +518,8 @@ static struct clk uart1_1510 = { .enable_bit = 29, /* Chooses between 12MHz and 48MHz */ .set_rate = &omap1_set_uart_rate, .recalc = &omap1_uart_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct uart_clk uart1_16xx = { @@ -550,8 +550,8 @@ static struct clk uart2_ck = { .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ .set_rate = &omap1_set_uart_rate, .recalc = &omap1_uart_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk uart3_1510 = { @@ -565,8 +565,8 @@ static struct clk uart3_1510 = { .enable_bit = 31, /* Chooses between 12MHz and 48MHz */ .set_rate = &omap1_set_uart_rate, .recalc = &omap1_uart_recalc, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct uart_clk uart3_16xx = { @@ -593,8 +593,8 @@ static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ RATE_FIXED | ENABLE_REG_32BIT, .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL, .enable_bit = USB_MCLK_EN_BIT, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk usb_hhc_ck1510 = { @@ -605,8 +605,8 @@ static struct clk usb_hhc_ck1510 = { RATE_FIXED | ENABLE_REG_32BIT, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, .enable_bit = USB_HOST_HHC_UHOST_EN, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk usb_hhc_ck16xx = { @@ -618,8 +618,8 @@ static struct clk usb_hhc_ck16xx = { RATE_FIXED | ENABLE_REG_32BIT, .enable_reg = (void __iomem *)OTG_BASE + 0x08 /* OTG_SYSCON_2 */, .enable_bit = 8 /* UHOST_EN */, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk usb_dc_ck = { @@ -629,8 +629,8 @@ static struct clk usb_dc_ck = { .flags = CLOCK_IN_OMAP16XX | RATE_FIXED, .enable_reg = (void __iomem *)SOFT_REQ_REG, .enable_bit = 4, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk mclk_1510 = { @@ -638,8 +638,8 @@ static struct clk mclk_1510 = { /* Direct from ULPD, no parent. May be enabled by ext hardware. */ .rate = 12000000, .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk mclk_16xx = { @@ -651,8 +651,8 @@ static struct clk mclk_16xx = { .set_rate = &omap1_set_ext_clk_rate, .round_rate = &omap1_round_ext_clk_rate, .init = &omap1_init_ext_clk, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk bclk_1510 = { @@ -660,8 +660,8 @@ static struct clk bclk_1510 = { /* Direct from ULPD, no parent. May be enabled by ext hardware. */ .rate = 12000000, .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk bclk_16xx = { @@ -673,8 +673,8 @@ static struct clk bclk_16xx = { .set_rate = &omap1_set_ext_clk_rate, .round_rate = &omap1_round_ext_clk_rate, .init = &omap1_init_ext_clk, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk mmc1_ck = { @@ -686,8 +686,8 @@ static struct clk mmc1_ck = { RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, .enable_bit = 23, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk mmc2_ck = { @@ -699,8 +699,8 @@ static struct clk mmc2_ck = { RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, .enable_bit = 20, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk virtual_ck_mpu = { @@ -711,8 +711,8 @@ static struct clk virtual_ck_mpu = { .recalc = &followparent_recalc, .set_rate = &omap1_select_table_rate, .round_rate = &omap1_round_to_table_rate, - .enable = &omap1_clk_enable, - .disable = &omap1_clk_disable, + .enable = &omap1_clk_enable_generic, + .disable = &omap1_clk_disable_generic, }; static struct clk * onchip_clks[] = { diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c index 7a68f098a02..e924e0c6a4c 100644 --- a/arch/arm/mach-omap1/serial.c +++ b/arch/arm/mach-omap1/serial.c @@ -146,7 +146,7 @@ void __init omap_serial_init(void) if (IS_ERR(uart1_ck)) printk("Could not get uart1_ck\n"); else { - clk_use(uart1_ck); + clk_enable(uart1_ck); if (cpu_is_omap1510()) clk_set_rate(uart1_ck, 12000000); } @@ -166,7 +166,7 @@ void __init omap_serial_init(void) if (IS_ERR(uart2_ck)) printk("Could not get uart2_ck\n"); else { - clk_use(uart2_ck); + clk_enable(uart2_ck); if (cpu_is_omap1510()) clk_set_rate(uart2_ck, 12000000); else @@ -188,7 +188,7 @@ void __init omap_serial_init(void) if (IS_ERR(uart3_ck)) printk("Could not get uart3_ck\n"); else { - clk_use(uart3_ck); + clk_enable(uart3_ck); if (cpu_is_omap1510()) clk_set_rate(uart3_ck, 12000000); } diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 5407b954915..180f675c906 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -111,7 +111,7 @@ static void omap2_clk_fixed_enable(struct clk *clk) /* Enables clock without considering parent dependencies or use count * REVISIT: Maybe change this to use clk->enable like on omap1? */ -static int omap2_clk_enable(struct clk * clk) +static int _omap2_clk_enable(struct clk * clk) { u32 regval32; @@ -150,7 +150,7 @@ static void omap2_clk_fixed_disable(struct clk *clk) } /* Disables clock without considering parent dependencies or use count */ -static void omap2_clk_disable(struct clk *clk) +static void _omap2_clk_disable(struct clk *clk) { u32 regval32; @@ -167,23 +167,23 @@ static void omap2_clk_disable(struct clk *clk) __raw_writel(regval32, clk->enable_reg); } -static int omap2_clk_use(struct clk *clk) +static int omap2_clk_enable(struct clk *clk) { int ret = 0; if (clk->usecount++ == 0) { if (likely((u32)clk->parent)) - ret = omap2_clk_use(clk->parent); + ret = omap2_clk_enable(clk->parent); if (unlikely(ret != 0)) { clk->usecount--; return ret; } - ret = omap2_clk_enable(clk); + ret = _omap2_clk_enable(clk); if (unlikely(ret != 0) && clk->parent) { - omap2_clk_unuse(clk->parent); + omap2_clk_disable(clk->parent); clk->usecount--; } } @@ -191,12 +191,12 @@ static int omap2_clk_use(struct clk *clk) return ret; } -static void omap2_clk_unuse(struct clk *clk) +static void omap2_clk_disable(struct clk *clk) { if (clk->usecount > 0 && !(--clk->usecount)) { - omap2_clk_disable(clk); + _omap2_clk_disable(clk); if (likely((u32)clk->parent)) - omap2_clk_unuse(clk->parent); + omap2_clk_disable(clk->parent); } } @@ -873,7 +873,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) reg = (void __iomem *)src_sel; if (clk->usecount > 0) - omap2_clk_disable(clk); + _omap2_clk_disable(clk); /* Set new source value (previous dividers if any in effect) */ reg_val = __raw_readl(reg) & ~(field_mask << src_off); @@ -884,7 +884,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL); if (clk->usecount > 0) - omap2_clk_enable(clk); + _omap2_clk_enable(clk); clk->parent = new_parent; @@ -999,8 +999,6 @@ static int omap2_select_table_rate(struct clk * clk, unsigned long rate) static struct clk_functions omap2_clk_functions = { .clk_enable = omap2_clk_enable, .clk_disable = omap2_clk_disable, - .clk_use = omap2_clk_use, - .clk_unuse = omap2_clk_unuse, .clk_round_rate = omap2_clk_round_rate, .clk_set_rate = omap2_clk_set_rate, .clk_set_parent = omap2_clk_set_parent, @@ -1045,7 +1043,7 @@ static void __init omap2_disable_unused_clocks(void) continue; printk(KERN_INFO "Disabling unused clock \"%s\"\n", ck->name); - omap2_clk_disable(ck); + _omap2_clk_disable(ck); } } late_initcall(omap2_disable_unused_clocks); @@ -1120,10 +1118,10 @@ int __init omap2_clk_init(void) * Only enable those clocks we will need, let the drivers * enable other clocks as necessary */ - clk_use(&sync_32k_ick); - clk_use(&omapctrl_ick); + clk_enable(&sync_32k_ick); + clk_enable(&omapctrl_ick); if (cpu_is_omap2430()) - clk_use(&sdrc_ick); + clk_enable(&sdrc_ick); return 0; } diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 4aeab5591bd..6cab20b1d3c 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -24,7 +24,7 @@ static void omap2_propagate_rate(struct clk * clk); static void omap2_mpu_recalc(struct clk * clk); static int omap2_select_table_rate(struct clk * clk, unsigned long rate); static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate); -static void omap2_clk_unuse(struct clk *clk); +static void omap2_clk_disable(struct clk *clk); static void omap2_sys_clk_recalc(struct clk * clk); static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val); static u32 omap2_clksel_get_divisor(struct clk *clk); @@ -859,7 +859,7 @@ static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ static struct clk usb_l4_ick = { /* FS-USB interface clock */ .name = "usb_l4_ick", - .parent = &core_ck, + .parent = &core_l3_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP | CONFIG_PARTICIPANT, @@ -1045,7 +1045,7 @@ static struct clk gpt1_ick = { .name = "gpt1_ick", .parent = &l4_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, - .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit4 */ + .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit0 */ .enable_bit = 0, .recalc = &omap2_followparent_recalc, }; @@ -1055,7 +1055,7 @@ static struct clk gpt1_fck = { .parent = &func_32k_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | CM_WKUP_SEL1, - .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, + .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, /* Bit0 */ .enable_bit = 0, .src_offset = 0, .recalc = &omap2_followparent_recalc, @@ -1065,7 +1065,7 @@ static struct clk gpt2_ick = { .name = "gpt2_ick", .parent = &l4_ck, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, - .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit4 */ + .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit4 */ .enable_bit = 0, .recalc = &omap2_followparent_recalc, }; @@ -1839,7 +1839,7 @@ static struct clk usb_fck = { static struct clk usbhs_ick = { .name = "usbhs_ick", - .parent = &l4_ck, + .parent = &core_l3_ck, .flags = CLOCK_IN_OMAP243X, .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, .enable_bit = 6, diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index e1bd46a96e1..24dd374224a 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -119,14 +119,14 @@ void __init omap_serial_init() if (IS_ERR(uart1_ick)) printk("Could not get uart1_ick\n"); else { - clk_use(uart1_ick); + clk_enable(uart1_ick); } uart1_fck = clk_get(NULL, "uart1_fck"); if (IS_ERR(uart1_fck)) printk("Could not get uart1_fck\n"); else { - clk_use(uart1_fck); + clk_enable(uart1_fck); } break; case 1: @@ -134,14 +134,14 @@ void __init omap_serial_init() if (IS_ERR(uart2_ick)) printk("Could not get uart2_ick\n"); else { - clk_use(uart2_ick); + clk_enable(uart2_ick); } uart2_fck = clk_get(NULL, "uart2_fck"); if (IS_ERR(uart2_fck)) printk("Could not get uart2_fck\n"); else { - clk_use(uart2_fck); + clk_enable(uart2_fck); } break; case 2: @@ -149,14 +149,14 @@ void __init omap_serial_init() if (IS_ERR(uart3_ick)) printk("Could not get uart3_ick\n"); else { - clk_use(uart3_ick); + clk_enable(uart3_ick); } uart3_fck = clk_get(NULL, "uart3_fck"); if (IS_ERR(uart3_fck)) printk("Could not get uart3_fck\n"); else { - clk_use(uart3_fck); + clk_enable(uart3_fck); } break; } diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 23d36b1c40f..1d2f5ac2f69 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c @@ -104,7 +104,7 @@ static void __init omap2_gp_timer_init(void) if (IS_ERR(sys_ck)) printk(KERN_ERR "Could not get sys_ck\n"); else { - clk_use(sys_ck); + clk_enable(sys_ck); tick_period = clk_get_rate(sys_ck) / 100; clk_put(sys_ck); } diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 7ebc5a29db8..3c2bfc0efda 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c @@ -34,7 +34,7 @@ DEFINE_SPINLOCK(clockfw_lock); static struct clk_functions *arch_clock; /*------------------------------------------------------------------------- - * Standard clock functions defined in asm/hardware/clock.h + * Standard clock functions defined in include/linux/clk.h *-------------------------------------------------------------------------*/ struct clk * clk_get(struct device *dev, const char *id) @@ -60,12 +60,8 @@ int clk_enable(struct clk *clk) int ret = 0; spin_lock_irqsave(&clockfw_lock, flags); - if (clk->enable) - ret = clk->enable(clk); - else if (arch_clock->clk_enable) + if (arch_clock->clk_enable) ret = arch_clock->clk_enable(clk); - else - printk(KERN_ERR "Could not enable clock %s\n", clk->name); spin_unlock_irqrestore(&clockfw_lock, flags); return ret; @@ -77,41 +73,12 @@ void clk_disable(struct clk *clk) unsigned long flags; spin_lock_irqsave(&clockfw_lock, flags); - if (clk->disable) - clk->disable(clk); - else if (arch_clock->clk_disable) + if (arch_clock->clk_disable) arch_clock->clk_disable(clk); - else - printk(KERN_ERR "Could not disable clock %s\n", clk->name); spin_unlock_irqrestore(&clockfw_lock, flags); } EXPORT_SYMBOL(clk_disable); -int clk_use(struct clk *clk) -{ - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&clockfw_lock, flags); - if (arch_clock->clk_use) - ret = arch_clock->clk_use(clk); - spin_unlock_irqrestore(&clockfw_lock, flags); - - return ret; -} -EXPORT_SYMBOL(clk_use); - -void clk_unuse(struct clk *clk) -{ - unsigned long flags; - - spin_lock_irqsave(&clockfw_lock, flags); - if (arch_clock->clk_unuse) - arch_clock->clk_unuse(clk); - spin_unlock_irqrestore(&clockfw_lock, flags); -} -EXPORT_SYMBOL(clk_unuse); - int clk_get_usecount(struct clk *clk) { unsigned long flags; @@ -146,7 +113,7 @@ void clk_put(struct clk *clk) EXPORT_SYMBOL(clk_put); /*------------------------------------------------------------------------- - * Optional clock functions defined in asm/hardware/clock.h + * Optional clock functions defined in include/linux/clk.h *-------------------------------------------------------------------------*/ long clk_round_rate(struct clk *clk, unsigned long rate) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index ca3681a824a..b4d5b9e4bfc 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -853,19 +853,19 @@ static int __init _omap_gpio_init(void) if (IS_ERR(gpio_ick)) printk("Could not get arm_gpio_ck\n"); else - clk_use(gpio_ick); + clk_enable(gpio_ick); } if (cpu_is_omap24xx()) { gpio_ick = clk_get(NULL, "gpios_ick"); if (IS_ERR(gpio_ick)) printk("Could not get gpios_ick\n"); else - clk_use(gpio_ick); + clk_enable(gpio_ick); gpio_fck = clk_get(NULL, "gpios_fck"); if (IS_ERR(gpio_ick)) printk("Could not get gpios_fck\n"); else - clk_use(gpio_fck); + clk_enable(gpio_fck); } #ifdef CONFIG_ARCH_OMAP15XX diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index be0e0f32a59..1cd2cace7e1 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c @@ -190,11 +190,11 @@ static int omap_mcbsp_check(unsigned int id) static void omap_mcbsp_dsp_request(void) { if (cpu_is_omap1510() || cpu_is_omap16xx()) { - clk_use(mcbsp_dsp_ck); - clk_use(mcbsp_api_ck); + clk_enable(mcbsp_dsp_ck); + clk_enable(mcbsp_api_ck); /* enable 12MHz clock to mcbsp 1 & 3 */ - clk_use(mcbsp_dspxor_ck); + clk_enable(mcbsp_dspxor_ck); /* * DSP external peripheral reset @@ -208,9 +208,9 @@ static void omap_mcbsp_dsp_request(void) static void omap_mcbsp_dsp_free(void) { if (cpu_is_omap1510() || cpu_is_omap16xx()) { - clk_unuse(mcbsp_dspxor_ck); - clk_unuse(mcbsp_dsp_ck); - clk_unuse(mcbsp_api_ck); + clk_disable(mcbsp_dspxor_ck); + clk_disable(mcbsp_dsp_ck); + clk_disable(mcbsp_api_ck); } } diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c index e40fcc8b43d..5cc6775c789 100644 --- a/arch/arm/plat-omap/ocpi.c +++ b/arch/arm/plat-omap/ocpi.c @@ -88,7 +88,7 @@ static int __init omap_ocpi_init(void) if (IS_ERR(ocpi_ck)) return PTR_ERR(ocpi_ck); - clk_use(ocpi_ck); + clk_enable(ocpi_ck); ocpi_enable(); printk("OMAP OCPI interconnect driver loaded\n"); @@ -102,7 +102,7 @@ static void __exit omap_ocpi_exit(void) if (!cpu_is_omap16xx()) return; - clk_unuse(ocpi_ck); + clk_disable(ocpi_ck); clk_put(ocpi_ck); } diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 6a431b92601..3cbe6e9cb9f 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -644,6 +644,8 @@ CONFIG_8139TOO_PIO=y # CONFIG_ACENIC is not set # CONFIG_DL2K is not set # CONFIG_E1000 is not set +# CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig index 1d07d8072ec..991c07b57c2 100644 --- a/arch/ia64/configs/gensparse_defconfig +++ b/arch/ia64/configs/gensparse_defconfig @@ -557,6 +557,7 @@ CONFIG_E100=m # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index b1e8f09e9fd..6859119bc9d 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -565,6 +565,7 @@ CONFIG_E100=m # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 0856ca67dd5..53899dc8eb5 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -548,6 +548,7 @@ CONFIG_E100=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index 275a26c6e5a..dcbc78a4cfa 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -565,6 +565,7 @@ CONFIG_E100=m # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig index 955ef5084f3..959ad3c4e37 100644 --- a/arch/parisc/configs/a500_defconfig +++ b/arch/parisc/configs/a500_defconfig @@ -602,6 +602,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y # CONFIG_DL2K is not set CONFIG_E1000=m CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig index 9d86b6b1ebd..0b1c8c1fa8a 100644 --- a/arch/parisc/configs/c3000_defconfig +++ b/arch/parisc/configs/c3000_defconfig @@ -626,6 +626,7 @@ CONFIG_ACENIC=m # CONFIG_DL2K is not set CONFIG_E1000=m # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig index b657f7e4476..063b84f2cbe 100644 --- a/arch/powerpc/configs/cell_defconfig +++ b/arch/powerpc/configs/cell_defconfig @@ -533,6 +533,7 @@ CONFIG_MII=y # CONFIG_DL2K is not set CONFIG_E1000=m # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 3c22ccb1851..d6fed3f5658 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig @@ -675,6 +675,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig index 751a622fb7a..c775027947f 100644 --- a/arch/powerpc/configs/iseries_defconfig +++ b/arch/powerpc/configs/iseries_defconfig @@ -567,6 +567,7 @@ CONFIG_ACENIC=m # CONFIG_DL2K is not set CONFIG_E1000=m # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 07b6d3d2336..68194c03f6d 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig @@ -454,6 +454,7 @@ CONFIG_AMD8111_ETH=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index 0b2b55a79c3..6f6c6bed1aa 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig @@ -724,6 +724,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index a50ce0fa924..aa9893a1f6e 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -671,6 +671,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ppc/configs/bamboo_defconfig b/arch/ppc/configs/bamboo_defconfig index 0ba4e70d50b..41fd3938fa5 100644 --- a/arch/ppc/configs/bamboo_defconfig +++ b/arch/ppc/configs/bamboo_defconfig @@ -499,6 +499,7 @@ CONFIG_NATSEMI=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ppc/configs/katana_defconfig b/arch/ppc/configs/katana_defconfig index 0f3bb9af9c2..7311fe6b42d 100644 --- a/arch/ppc/configs/katana_defconfig +++ b/arch/ppc/configs/katana_defconfig @@ -488,6 +488,7 @@ CONFIG_E100=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig index 673dc64ebcb..b96a6d6dad0 100644 --- a/arch/ppc/configs/mpc834x_sys_defconfig +++ b/arch/ppc/configs/mpc834x_sys_defconfig @@ -402,6 +402,7 @@ CONFIG_E100=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig index 93da595a473..a1ef929bca5 100644 --- a/arch/ppc/configs/power3_defconfig +++ b/arch/ppc/configs/power3_defconfig @@ -442,6 +442,7 @@ CONFIG_E100=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index a3fb3376ffa..9ceddad0fb4 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15 -# Mon Jan 9 14:36:29 2006 +# Linux kernel version: 2.6.16-rc1 +# Wed Jan 18 13:41:02 2006 # CONFIG_SPARC=y CONFIG_SPARC64=y @@ -233,6 +233,11 @@ CONFIG_VLAN_8021Q=m # CONFIG_ATALK is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set + +# +# TIPC Configuration (EXPERIMENTAL) +# +# CONFIG_TIPC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -420,8 +425,7 @@ CONFIG_ISCSI_TCP=m # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set # CONFIG_SCSI_QLOGICPTI is not set -CONFIG_SCSI_QLA2XXX=y -# CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set +# CONFIG_SCSI_QLA_FC is not set # CONFIG_SCSI_LPFC is not set # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set @@ -529,6 +533,7 @@ CONFIG_NET_PCI=y # CONFIG_DL2K is not set CONFIG_E1000=m CONFIG_E1000_NAPI=y +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_MYRI_SBUS is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set @@ -652,7 +657,6 @@ CONFIG_SERIAL_SUNSU_CONSOLE=y CONFIG_SERIAL_SUNSAB=m CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set CONFIG_UNIX98_PTYS=y # CONFIG_LEGACY_PTYS is not set @@ -738,6 +742,12 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_DEBUG_CHIP is not set # +# SPI support +# +# CONFIG_SPI is not set +# CONFIG_SPI_MASTER is not set + +# # Dallas's 1-wire bus # # CONFIG_W1 is not set @@ -1014,6 +1024,7 @@ CONFIG_USB_UHCI_HCD=m # CONFIG_USB_HID=y CONFIG_USB_HIDINPUT=y +# CONFIG_USB_HIDINPUT_POWERBOOK is not set # CONFIG_HID_FF is not set CONFIG_USB_HIDDEV=y # CONFIG_USB_AIPTEK is not set @@ -1268,12 +1279,13 @@ CONFIG_KPROBES=y # Kernel hacking # CONFIG_PRINTK_TIME=y -CONFIG_DEBUG_KERNEL=y CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_KERNEL=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_DETECT_SOFTLOCKUP=y CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_SPINLOCK is not set # CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_KOBJECT is not set @@ -1281,6 +1293,7 @@ CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_INFO is not set CONFIG_DEBUG_FS=y # CONFIG_DEBUG_VM is not set +CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_DEBUG_STACK_USAGE is not set # CONFIG_DEBUG_DCFLUSH is not set diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 1dc3650c5ca..059b0d02522 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -164,6 +164,7 @@ void machine_restart(char * cmd) panic("Reboot failed!"); } +#ifdef CONFIG_COMPAT static void show_regwindow32(struct pt_regs *regs) { struct reg_window32 __user *rw; @@ -189,6 +190,9 @@ static void show_regwindow32(struct pt_regs *regs) r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3], r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]); } +#else +#define show_regwindow32(regs) do { } while (0) +#endif static void show_regwindow(struct pt_regs *regs) { diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 250745896ae..054461e6946 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c @@ -561,6 +561,8 @@ static int __init set_preferred_console(void) serial_console = 1; } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { serial_console = 2; + } else if (idev == PROMDEV_IRSC && odev == PROMDEV_ORSC) { + serial_console = 3; } else { prom_printf("Inconsistent console: " "input %d, output %d\n", diff --git a/arch/sparc64/prom/console.c b/arch/sparc64/prom/console.c index eae5db8dda5..ac6d035dd15 100644 --- a/arch/sparc64/prom/console.c +++ b/arch/sparc64/prom/console.c @@ -99,8 +99,12 @@ prom_query_input_device(void) if (!strncmp(propb, "keyboard", 8)) return PROMDEV_ITTYA; + if (!strncmp (propb, "rsc", 3)) + return PROMDEV_IRSC; + if (strncmp (propb, "tty", 3) || !propb[3]) return PROMDEV_I_UNK; + switch (propb[3]) { case 'a': return PROMDEV_ITTYA; case 'b': return PROMDEV_ITTYB; @@ -136,8 +140,12 @@ prom_query_output_device(void) if (!strncmp(propb, "screen", 6)) return PROMDEV_OTTYA; + if (!strncmp (propb, "rsc", 3)) + return PROMDEV_ORSC; + if (strncmp (propb, "tty", 3) || !propb[3]) return PROMDEV_O_UNK; + switch (propb[3]) { case 'a': return PROMDEV_OTTYA; case 'b': return PROMDEV_OTTYB; diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 5231fe83ea4..09a3eb74331 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -646,6 +646,7 @@ CONFIG_8139TOO=y # CONFIG_DL2K is not set CONFIG_E1000=y # CONFIG_E1000_NAPI is not set +# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1421941487c..0c69918671c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -1914,6 +1914,15 @@ config E1000_NAPI If in doubt, say N. +config E1000_DISABLE_PACKET_SPLIT + bool "Disable Packet Split for PCI express adapters" + depends on E1000 + help + Say Y here if you want to use the legacy receive path for PCI express + hadware. + + If in doubt, say N. + source "drivers/net/ixp2000/Kconfig" config MYRI_SBUS diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index dde631f8f68..6e295fce5c6 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -335,6 +335,30 @@ static inline void cas_mask_intr(struct cas *cp) cas_disable_irq(cp, i); } +static inline void cas_buffer_init(cas_page_t *cp) +{ + struct page *page = cp->buffer; + atomic_set((atomic_t *)&page->lru.next, 1); +} + +static inline int cas_buffer_count(cas_page_t *cp) +{ + struct page *page = cp->buffer; + return atomic_read((atomic_t *)&page->lru.next); +} + +static inline void cas_buffer_inc(cas_page_t *cp) +{ + struct page *page = cp->buffer; + atomic_inc((atomic_t *)&page->lru.next); +} + +static inline void cas_buffer_dec(cas_page_t *cp) +{ + struct page *page = cp->buffer; + atomic_dec((atomic_t *)&page->lru.next); +} + static void cas_enable_irq(struct cas *cp, const int ring) { if (ring == 0) { /* all but TX_DONE */ @@ -472,6 +496,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) { pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, PCI_DMA_FROMDEVICE); + cas_buffer_dec(page); __free_pages(page->buffer, cp->page_order); kfree(page); return 0; @@ -501,6 +526,7 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags) page->buffer = alloc_pages(flags, cp->page_order); if (!page->buffer) goto page_err; + cas_buffer_init(page); page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, cp->page_size, PCI_DMA_FROMDEVICE); return page; @@ -579,7 +605,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) list_for_each_safe(elem, tmp, &list) { cas_page_t *page = list_entry(elem, cas_page_t, list); - if (page_count(page->buffer) > 1) + if (cas_buffer_count(page) > 1) continue; list_del(elem); @@ -1347,7 +1373,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) cas_page_t *page = cp->rx_pages[1][index]; cas_page_t *new; - if (page_count(page->buffer) == 1) + if (cas_buffer_count(page) == 1) return page; new = cas_page_dequeue(cp); @@ -1367,7 +1393,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring, cas_page_t **page1 = cp->rx_pages[1]; /* swap if buffer is in use */ - if (page_count(page0[index]->buffer) > 1) { + if (cas_buffer_count(page0[index]) > 1) { cas_page_t *new = cas_page_spare(cp, index); if (new) { page1[index] = page0[index]; @@ -2039,6 +2065,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, skb->len += hlen - swivel; get_page(page->buffer); + cas_buffer_inc(page); frag->page = page->buffer; frag->page_offset = off; frag->size = hlen - swivel; @@ -2063,6 +2090,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, frag++; get_page(page->buffer); + cas_buffer_inc(page); frag->page = page->buffer; frag->page_offset = 0; frag->size = hlen; @@ -2225,7 +2253,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) released = 0; while (entry != last) { /* make a new buffer if it's still in use */ - if (page_count(page[entry]->buffer) > 1) { + if (cas_buffer_count(page[entry]) > 1) { cas_page_t *new = cas_page_dequeue(cp); if (!new) { /* 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 d252297e4db..5cedc81786e 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) struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - if(hw->media_type == e1000_media_type_copper) { + if (hw->media_type == e1000_media_type_copper) { ecmd->supported = (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | @@ -133,7 +133,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->advertising = ADVERTISED_TP; - if(hw->autoneg == 1) { + if (hw->autoneg == 1) { ecmd->advertising |= ADVERTISED_Autoneg; /* the e1000 autoneg seems to match ethtool nicely */ @@ -144,7 +144,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->port = PORT_TP; ecmd->phy_address = hw->phy_addr; - if(hw->mac_type == e1000_82543) + if (hw->mac_type == e1000_82543) ecmd->transceiver = XCVR_EXTERNAL; else ecmd->transceiver = XCVR_INTERNAL; @@ -160,13 +160,13 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ecmd->port = PORT_FIBRE; - if(hw->mac_type >= e1000_82545) + if (hw->mac_type >= e1000_82545) ecmd->transceiver = XCVR_INTERNAL; else ecmd->transceiver = XCVR_EXTERNAL; } - if(netif_carrier_ok(adapter->netdev)) { + if (netif_carrier_ok(adapter->netdev)) { e1000_get_speed_and_duplex(hw, &adapter->link_speed, &adapter->link_duplex); @@ -175,7 +175,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) /* unfortunatly FULL_DUPLEX != DUPLEX_FULL * and HALF_DUPLEX != DUPLEX_HALF */ - if(adapter->link_duplex == FULL_DUPLEX) + if (adapter->link_duplex == FULL_DUPLEX) ecmd->duplex = DUPLEX_FULL; else ecmd->duplex = DUPLEX_HALF; @@ -205,11 +205,11 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) if (ecmd->autoneg == AUTONEG_ENABLE) { hw->autoneg = 1; - if(hw->media_type == e1000_media_type_fiber) + if (hw->media_type == e1000_media_type_fiber) hw->autoneg_advertised = ADVERTISED_1000baseT_Full | ADVERTISED_FIBRE | ADVERTISED_Autoneg; - else + else hw->autoneg_advertised = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Half | @@ -219,12 +219,12 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ADVERTISED_TP; ecmd->advertising = hw->autoneg_advertised; } else - if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) + if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) return -EINVAL; /* reset the link */ - if(netif_running(adapter->netdev)) { + if (netif_running(adapter->netdev)) { e1000_down(adapter); e1000_reset(adapter); e1000_up(adapter); @@ -241,14 +241,14 @@ e1000_get_pauseparam(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - pause->autoneg = + pause->autoneg = (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); - - if(hw->fc == e1000_fc_rx_pause) + + if (hw->fc == e1000_fc_rx_pause) pause->rx_pause = 1; - else if(hw->fc == e1000_fc_tx_pause) + else if (hw->fc == e1000_fc_tx_pause) pause->tx_pause = 1; - else if(hw->fc == e1000_fc_full) { + else if (hw->fc == e1000_fc_full) { pause->rx_pause = 1; pause->tx_pause = 1; } @@ -260,31 +260,30 @@ e1000_set_pauseparam(struct net_device *netdev, { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - + adapter->fc_autoneg = pause->autoneg; - if(pause->rx_pause && pause->tx_pause) + if (pause->rx_pause && pause->tx_pause) hw->fc = e1000_fc_full; - else if(pause->rx_pause && !pause->tx_pause) + else if (pause->rx_pause && !pause->tx_pause) hw->fc = e1000_fc_rx_pause; - else if(!pause->rx_pause && pause->tx_pause) + else if (!pause->rx_pause && pause->tx_pause) hw->fc = e1000_fc_tx_pause; - else if(!pause->rx_pause && !pause->tx_pause) + else if (!pause->rx_pause && !pause->tx_pause) hw->fc = e1000_fc_none; hw->original_fc = hw->fc; - if(adapter->fc_autoneg == AUTONEG_ENABLE) { - if(netif_running(adapter->netdev)) { + if (adapter->fc_autoneg == AUTONEG_ENABLE) { + if (netif_running(adapter->netdev)) { e1000_down(adapter); e1000_up(adapter); } else e1000_reset(adapter); - } - else + } else return ((hw->media_type == e1000_media_type_fiber) ? e1000_setup_link(hw) : e1000_force_mac_fc(hw)); - + return 0; } @@ -301,14 +300,14 @@ e1000_set_rx_csum(struct net_device *netdev, uint32_t data) struct e1000_adapter *adapter = netdev_priv(netdev); adapter->rx_csum = data; - if(netif_running(netdev)) { + if (netif_running(netdev)) { e1000_down(adapter); e1000_up(adapter); } else e1000_reset(adapter); return 0; } - + static uint32_t e1000_get_tx_csum(struct net_device *netdev) { @@ -320,7 +319,7 @@ e1000_set_tx_csum(struct net_device *netdev, uint32_t data) { struct e1000_adapter *adapter = netdev_priv(netdev); - if(adapter->hw.mac_type < e1000_82543) { + if (adapter->hw.mac_type < e1000_82543) { if (!data) return -EINVAL; return 0; @@ -339,8 +338,8 @@ static int e1000_set_tso(struct net_device *netdev, uint32_t data) { struct e1000_adapter *adapter = netdev_priv(netdev); - if((adapter->hw.mac_type < e1000_82544) || - (adapter->hw.mac_type == e1000_82547)) + if ((adapter->hw.mac_type < e1000_82544) || + (adapter->hw.mac_type == e1000_82547)) return data ? -EINVAL : 0; if (data) @@ -348,7 +347,7 @@ e1000_set_tso(struct net_device *netdev, uint32_t data) else netdev->features &= ~NETIF_F_TSO; return 0; -} +} #endif /* NETIF_F_TSO */ static uint32_t @@ -365,7 +364,7 @@ e1000_set_msglevel(struct net_device *netdev, uint32_t data) adapter->msg_enable = data; } -static int +static int e1000_get_regs_len(struct net_device *netdev) { #define E1000_REGS_LEN 32 @@ -401,7 +400,7 @@ e1000_get_regs(struct net_device *netdev, regs_buff[11] = E1000_READ_REG(hw, TIDV); regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */ - if(hw->phy_type == e1000_phy_igp) { + if (hw->phy_type == e1000_phy_igp) { e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, IGP01E1000_PHY_AGC_A); e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A & @@ -455,7 +454,7 @@ e1000_get_regs(struct net_device *netdev, e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */ regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ - if(hw->mac_type >= e1000_82540 && + if (hw->mac_type >= e1000_82540 && hw->media_type == e1000_media_type_copper) { regs_buff[26] = E1000_READ_REG(hw, MANC); } @@ -479,7 +478,7 @@ e1000_get_eeprom(struct net_device *netdev, int ret_val = 0; uint16_t i; - if(eeprom->len == 0) + if (eeprom->len == 0) return -EINVAL; eeprom->magic = hw->vendor_id | (hw->device_id << 16); @@ -489,16 +488,16 @@ e1000_get_eeprom(struct net_device *netdev, eeprom_buff = kmalloc(sizeof(uint16_t) * (last_word - first_word + 1), GFP_KERNEL); - if(!eeprom_buff) + if (!eeprom_buff) return -ENOMEM; - if(hw->eeprom.type == e1000_eeprom_spi) + if (hw->eeprom.type == e1000_eeprom_spi) ret_val = e1000_read_eeprom(hw, first_word, last_word - first_word + 1, eeprom_buff); else { for (i = 0; i < last_word - first_word + 1; i++) - if((ret_val = e1000_read_eeprom(hw, first_word + i, 1, + if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1, &eeprom_buff[i]))) break; } @@ -525,10 +524,10 @@ e1000_set_eeprom(struct net_device *netdev, int max_len, first_word, last_word, ret_val = 0; uint16_t i; - if(eeprom->len == 0) + if (eeprom->len == 0) return -EOPNOTSUPP; - if(eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) + if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) return -EFAULT; max_len = hw->eeprom.word_size * 2; @@ -536,19 +535,19 @@ e1000_set_eeprom(struct net_device *netdev, first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; eeprom_buff = kmalloc(max_len, GFP_KERNEL); - if(!eeprom_buff) + if (!eeprom_buff) return -ENOMEM; ptr = (void *)eeprom_buff; - if(eeprom->offset & 1) { + if (eeprom->offset & 1) { /* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ ret_val = e1000_read_eeprom(hw, first_word, 1, &eeprom_buff[0]); ptr++; } - if(((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { + if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { /* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ ret_val = e1000_read_eeprom(hw, last_word, 1, @@ -567,9 +566,9 @@ e1000_set_eeprom(struct net_device *netdev, ret_val = e1000_write_eeprom(hw, first_word, last_word - first_word + 1, eeprom_buff); - /* Update the checksum over the first part of the EEPROM if needed + /* Update the checksum over the first part of the EEPROM if needed * and flush shadow RAM for 82573 conrollers */ - if((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || + if ((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || (hw->mac_type == e1000_82573))) e1000_update_eeprom_checksum(hw); @@ -633,7 +632,7 @@ e1000_get_ringparam(struct net_device *netdev, ring->rx_jumbo_pending = 0; } -static int +static int e1000_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { @@ -670,25 +669,25 @@ e1000_set_ringparam(struct net_device *netdev, txdr = adapter->tx_ring; rxdr = adapter->rx_ring; - if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) + if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) return -EINVAL; rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD)); - E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); + E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD); txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD)); - E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); + E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); for (i = 0; i < adapter->num_tx_queues; i++) txdr[i].count = txdr->count; for (i = 0; i < adapter->num_rx_queues; i++) rxdr[i].count = rxdr->count; - if(netif_running(adapter->netdev)) { + if (netif_running(adapter->netdev)) { /* Try to get new resources before deleting old */ if ((err = e1000_setup_all_rx_resources(adapter))) goto err_setup_rx; @@ -708,7 +707,7 @@ e1000_set_ringparam(struct net_device *netdev, kfree(rx_old); adapter->rx_ring = rx_new; adapter->tx_ring = tx_new; - if((err = e1000_up(adapter))) + if ((err = e1000_up(adapter))) return err; } @@ -727,10 +726,10 @@ err_setup_rx: uint32_t pat, value; \ uint32_t test[] = \ {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ - for(pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \ + for (pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \ E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ value = E1000_READ_REG(&adapter->hw, R); \ - if(value != (test[pat] & W & M)) { \ + if (value != (test[pat] & W & M)) { \ DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ "0x%08X expected 0x%08X\n", \ E1000_##R, value, (test[pat] & W & M)); \ @@ -746,7 +745,7 @@ err_setup_rx: uint32_t value; \ E1000_WRITE_REG(&adapter->hw, R, W & M); \ value = E1000_READ_REG(&adapter->hw, R); \ - if((W & M) != (value & M)) { \ + if ((W & M) != (value & M)) { \ DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ *data = (adapter->hw.mac_type < e1000_82543) ? \ @@ -782,7 +781,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); E1000_WRITE_REG(&adapter->hw, STATUS, toggle); after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; - if(value != after) { + if (value != after) { DPRINTK(DRV, ERR, "failed STATUS register test got: " "0x%08X expected: 0x%08X\n", after, value); *data = 1; @@ -810,7 +809,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB); REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); - if(adapter->hw.mac_type >= e1000_82543) { + if (adapter->hw.mac_type >= e1000_82543) { REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF); REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); @@ -818,7 +817,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); - for(i = 0; i < E1000_RAR_ENTRIES; i++) { + for (i = 0; i < E1000_RAR_ENTRIES; i++) { REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF, 0xFFFFFFFF); REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, @@ -834,7 +833,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) } - for(i = 0; i < E1000_MC_TBL_SIZE; i++) + for (i = 0; i < E1000_MC_TBL_SIZE; i++) REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); *data = 0; @@ -850,8 +849,8 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data) *data = 0; /* Read and add up the contents of the EEPROM */ - for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { - if((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { + for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { + if ((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { *data = 1; break; } @@ -859,7 +858,7 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data) } /* If Checksum is not Correct return error else test passed */ - if((checksum != (uint16_t) EEPROM_SUM) && !(*data)) + if ((checksum != (uint16_t) EEPROM_SUM) && !(*data)) *data = 2; return *data; @@ -888,9 +887,9 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) *data = 0; /* Hook up test interrupt handler just for this test */ - if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { + if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { shared_int = FALSE; - } else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ, + } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, netdev->name, netdev)){ *data = 1; return -1; @@ -901,12 +900,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) msec_delay(10); /* Test each interrupt */ - for(; i < 10; i++) { + for (; i < 10; i++) { /* Interrupt to test */ mask = 1 << i; - if(!shared_int) { + if (!shared_int) { /* Disable the interrupt to be reported in * the cause register and then force the same * interrupt and see if one gets posted. If @@ -917,8 +916,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) E1000_WRITE_REG(&adapter->hw, IMC, mask); E1000_WRITE_REG(&adapter->hw, ICS, mask); msec_delay(10); - - if(adapter->test_icr & mask) { + + if (adapter->test_icr & mask) { *data = 3; break; } @@ -935,12 +934,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) E1000_WRITE_REG(&adapter->hw, ICS, mask); msec_delay(10); - if(!(adapter->test_icr & mask)) { + if (!(adapter->test_icr & mask)) { *data = 4; break; } - if(!shared_int) { + if (!shared_int) { /* Disable the other interrupts to be reported in * the cause register and then force the other * interrupts and see if any get posted. If @@ -952,7 +951,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF); msec_delay(10); - if(adapter->test_icr) { + if (adapter->test_icr) { *data = 5; break; } @@ -977,24 +976,24 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) struct pci_dev *pdev = adapter->pdev; int i; - if(txdr->desc && txdr->buffer_info) { - for(i = 0; i < txdr->count; i++) { - if(txdr->buffer_info[i].dma) + if (txdr->desc && txdr->buffer_info) { + for (i = 0; i < txdr->count; i++) { + if (txdr->buffer_info[i].dma) pci_unmap_single(pdev, txdr->buffer_info[i].dma, txdr->buffer_info[i].length, PCI_DMA_TODEVICE); - if(txdr->buffer_info[i].skb) + if (txdr->buffer_info[i].skb) dev_kfree_skb(txdr->buffer_info[i].skb); } } - if(rxdr->desc && rxdr->buffer_info) { - for(i = 0; i < rxdr->count; i++) { - if(rxdr->buffer_info[i].dma) + if (rxdr->desc && rxdr->buffer_info) { + for (i = 0; i < rxdr->count; i++) { + if (rxdr->buffer_info[i].dma) pci_unmap_single(pdev, rxdr->buffer_info[i].dma, rxdr->buffer_info[i].length, PCI_DMA_FROMDEVICE); - if(rxdr->buffer_info[i].skb) + if (rxdr->buffer_info[i].skb) dev_kfree_skb(rxdr->buffer_info[i].skb); } } @@ -1027,11 +1026,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) /* Setup Tx descriptor ring and Tx buffers */ - if(!txdr->count) - txdr->count = E1000_DEFAULT_TXD; + if (!txdr->count) + txdr->count = E1000_DEFAULT_TXD; size = txdr->count * sizeof(struct e1000_buffer); - if(!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) { + if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) { ret_val = 1; goto err_nomem; } @@ -1039,7 +1038,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) txdr->size = txdr->count * sizeof(struct e1000_tx_desc); E1000_ROUNDUP(txdr->size, 4096); - if(!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) { + if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) { ret_val = 2; goto err_nomem; } @@ -1058,12 +1057,12 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); - for(i = 0; i < txdr->count; i++) { + for (i = 0; i < txdr->count; i++) { struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); struct sk_buff *skb; unsigned int size = 1024; - if(!(skb = alloc_skb(size, GFP_KERNEL))) { + if (!(skb = alloc_skb(size, GFP_KERNEL))) { ret_val = 3; goto err_nomem; } @@ -1083,18 +1082,18 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) /* Setup Rx descriptor ring and Rx buffers */ - if(!rxdr->count) - rxdr->count = E1000_DEFAULT_RXD; + if (!rxdr->count) + rxdr->count = E1000_DEFAULT_RXD; size = rxdr->count * sizeof(struct e1000_buffer); - if(!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) { + if (!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) { ret_val = 4; goto err_nomem; } memset(rxdr->buffer_info, 0, size); rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); - if(!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { + if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { ret_val = 5; goto err_nomem; } @@ -1114,11 +1113,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); E1000_WRITE_REG(&adapter->hw, RCTL, rctl); - for(i = 0; i < rxdr->count; i++) { + for (i = 0; i < rxdr->count; i++) { struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); struct sk_buff *skb; - if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, + if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL))) { ret_val = 6; goto err_nomem; @@ -1227,15 +1226,15 @@ e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter) /* Check Phy Configuration */ e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); - if(phy_reg != 0x4100) + if (phy_reg != 0x4100) return 9; e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); - if(phy_reg != 0x0070) + if (phy_reg != 0x0070) return 10; e1000_read_phy_reg(&adapter->hw, 29, &phy_reg); - if(phy_reg != 0x001A) + if (phy_reg != 0x001A) return 11; return 0; @@ -1249,7 +1248,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) adapter->hw.autoneg = FALSE; - if(adapter->hw.phy_type == e1000_phy_m88) { + if (adapter->hw.phy_type == e1000_phy_m88) { /* Auto-MDI/MDIX Off */ e1000_write_phy_reg(&adapter->hw, M88E1000_PHY_SPEC_CTRL, 0x0808); @@ -1269,14 +1268,14 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ E1000_CTRL_FD); /* Force Duplex to FULL */ - if(adapter->hw.media_type == e1000_media_type_copper && + if (adapter->hw.media_type == e1000_media_type_copper && adapter->hw.phy_type == e1000_phy_m88) { ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ } else { /* Set the ILOS bit on the fiber Nic is half * duplex link is detected. */ stat_reg = E1000_READ_REG(&adapter->hw, STATUS); - if((stat_reg & E1000_STATUS_FD) == 0) + if ((stat_reg & E1000_STATUS_FD) == 0) ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); } @@ -1285,7 +1284,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) /* Disable the receiver on the PHY so when a cable is plugged in, the * PHY does not begin to autoneg when a cable is reconnected to the NIC. */ - if(adapter->hw.phy_type == e1000_phy_m88) + if (adapter->hw.phy_type == e1000_phy_m88) e1000_phy_disable_receiver(adapter); udelay(500); @@ -1301,14 +1300,14 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) switch (adapter->hw.mac_type) { case e1000_82543: - if(adapter->hw.media_type == e1000_media_type_copper) { + if (adapter->hw.media_type == e1000_media_type_copper) { /* Attempt to setup Loopback mode on Non-integrated PHY. * Some PHY registers get corrupted at random, so * attempt this 10 times. */ - while(e1000_nonintegrated_phy_loopback(adapter) && + while (e1000_nonintegrated_phy_loopback(adapter) && count++ < 10); - if(count < 11) + if (count < 11) return 0; } break; @@ -1430,8 +1429,8 @@ static int e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) { frame_size &= ~1; - if(*(skb->data + 3) == 0xFF) { - if((*(skb->data + frame_size / 2 + 10) == 0xBE) && + if (*(skb->data + 3) == 0xFF) { + if ((*(skb->data + frame_size / 2 + 10) == 0xBE) && (*(skb->data + frame_size / 2 + 12) == 0xAF)) { return 0; } @@ -1450,53 +1449,53 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); - /* Calculate the loop count based on the largest descriptor ring + /* Calculate the loop count based on the largest descriptor ring * The idea is to wrap the largest ring a number of times using 64 * send/receive pairs during each loop */ - if(rxdr->count <= txdr->count) + if (rxdr->count <= txdr->count) lc = ((txdr->count / 64) * 2) + 1; else lc = ((rxdr->count / 64) * 2) + 1; k = l = 0; - for(j = 0; j <= lc; j++) { /* loop count loop */ - for(i = 0; i < 64; i++) { /* send the packets */ - e1000_create_lbtest_frame(txdr->buffer_info[i].skb, + for (j = 0; j <= lc; j++) { /* loop count loop */ + for (i = 0; i < 64; i++) { /* send the packets */ + e1000_create_lbtest_frame(txdr->buffer_info[i].skb, 1024); - pci_dma_sync_single_for_device(pdev, + pci_dma_sync_single_for_device(pdev, txdr->buffer_info[k].dma, txdr->buffer_info[k].length, PCI_DMA_TODEVICE); - if(unlikely(++k == txdr->count)) k = 0; + if (unlikely(++k == txdr->count)) k = 0; } E1000_WRITE_REG(&adapter->hw, TDT, k); msec_delay(200); time = jiffies; /* set the start time for the receive */ good_cnt = 0; do { /* receive the sent packets */ - pci_dma_sync_single_for_cpu(pdev, + pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[l].dma, rxdr->buffer_info[l].length, PCI_DMA_FROMDEVICE); - + ret_val = e1000_check_lbtest_frame( rxdr->buffer_info[l].skb, 1024); - if(!ret_val) + if (!ret_val) good_cnt++; - if(unlikely(++l == rxdr->count)) l = 0; - /* time + 20 msecs (200 msecs on 2.4) is more than - * enough time to complete the receives, if it's + if (unlikely(++l == rxdr->count)) l = 0; + /* time + 20 msecs (200 msecs on 2.4) is more than + * enough time to complete the receives, if it's * exceeded, break and error off */ } while (good_cnt < 64 && jiffies < (time + 20)); - if(good_cnt != 64) { + if (good_cnt != 64) { ret_val = 13; /* ret_val is the same as mis-compare */ - break; + break; } - if(jiffies >= (time + 2)) { + if (jiffies >= (time + 2)) { ret_val = 14; /* error code for time out error */ break; } @@ -1549,17 +1548,17 @@ e1000_link_test(struct e1000_adapter *adapter, uint64_t *data) *data = 1; } else { e1000_check_for_link(&adapter->hw); - if(adapter->hw.autoneg) /* if auto_neg is set wait for it */ + if (adapter->hw.autoneg) /* if auto_neg is set wait for it */ msec_delay(4000); - if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { + if (!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { *data = 1; } } return *data; } -static int +static int e1000_diag_test_count(struct net_device *netdev) { return E1000_TEST_LEN; @@ -1572,7 +1571,7 @@ e1000_diag_test(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); boolean_t if_running = netif_running(netdev); - if(eth_test->flags == ETH_TEST_FL_OFFLINE) { + if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* Offline tests */ /* save speed, duplex, autoneg settings */ @@ -1582,27 +1581,27 @@ e1000_diag_test(struct net_device *netdev, /* Link test performed before hardware reset so autoneg doesn't * interfere with test result */ - if(e1000_link_test(adapter, &data[4])) + if (e1000_link_test(adapter, &data[4])) eth_test->flags |= ETH_TEST_FL_FAILED; - if(if_running) + if (if_running) e1000_down(adapter); else e1000_reset(adapter); - if(e1000_reg_test(adapter, &data[0])) + if (e1000_reg_test(adapter, &data[0])) eth_test->flags |= ETH_TEST_FL_FAILED; e1000_reset(adapter); - if(e1000_eeprom_test(adapter, &data[1])) + if (e1000_eeprom_test(adapter, &data[1])) eth_test->flags |= ETH_TEST_FL_FAILED; e1000_reset(adapter); - if(e1000_intr_test(adapter, &data[2])) + if (e1000_intr_test(adapter, &data[2])) eth_test->flags |= ETH_TEST_FL_FAILED; e1000_reset(adapter); - if(e1000_loopback_test(adapter, &data[3])) + if (e1000_loopback_test(adapter, &data[3])) eth_test->flags |= ETH_TEST_FL_FAILED; /* restore speed, duplex, autoneg settings */ @@ -1611,11 +1610,11 @@ e1000_diag_test(struct net_device *netdev, adapter->hw.autoneg = autoneg; e1000_reset(adapter); - if(if_running) + if (if_running) e1000_up(adapter); } else { /* Online tests */ - if(e1000_link_test(adapter, &data[4])) + if (e1000_link_test(adapter, &data[4])) eth_test->flags |= ETH_TEST_FL_FAILED; /* Offline tests aren't run; pass by default */ @@ -1633,7 +1632,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - switch(adapter->hw.device_id) { + switch (adapter->hw.device_id) { case E1000_DEV_ID_82542: case E1000_DEV_ID_82543GC_FIBER: case E1000_DEV_ID_82543GC_COPPER: @@ -1649,7 +1648,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) case E1000_DEV_ID_82546GB_FIBER: case E1000_DEV_ID_82571EB_FIBER: /* Wake events only supported on port A for dual fiber */ - if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { + if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { wol->supported = 0; wol->wolopts = 0; return; @@ -1661,13 +1660,13 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) WAKE_BCAST | WAKE_MAGIC; wol->wolopts = 0; - if(adapter->wol & E1000_WUFC_EX) + if (adapter->wol & E1000_WUFC_EX) wol->wolopts |= WAKE_UCAST; - if(adapter->wol & E1000_WUFC_MC) + if (adapter->wol & E1000_WUFC_MC) wol->wolopts |= WAKE_MCAST; - if(adapter->wol & E1000_WUFC_BC) + if (adapter->wol & E1000_WUFC_BC) wol->wolopts |= WAKE_BCAST; - if(adapter->wol & E1000_WUFC_MAG) + if (adapter->wol & E1000_WUFC_MAG) wol->wolopts |= WAKE_MAGIC; return; } @@ -1679,7 +1678,7 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - switch(adapter->hw.device_id) { + switch (adapter->hw.device_id) { case E1000_DEV_ID_82542: case E1000_DEV_ID_82543GC_FIBER: case E1000_DEV_ID_82543GC_COPPER: @@ -1693,23 +1692,23 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) case E1000_DEV_ID_82546GB_FIBER: case E1000_DEV_ID_82571EB_FIBER: /* Wake events only supported on port A for dual fiber */ - if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) + if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) return wol->wolopts ? -EOPNOTSUPP : 0; /* Fall Through */ default: - if(wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) + if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) return -EOPNOTSUPP; adapter->wol = 0; - if(wol->wolopts & WAKE_UCAST) + if (wol->wolopts & WAKE_UCAST) adapter->wol |= E1000_WUFC_EX; - if(wol->wolopts & WAKE_MCAST) + if (wol->wolopts & WAKE_MCAST) adapter->wol |= E1000_WUFC_MC; - if(wol->wolopts & WAKE_BCAST) + if (wol->wolopts & WAKE_BCAST) adapter->wol |= E1000_WUFC_BC; - if(wol->wolopts & WAKE_MAGIC) + if (wol->wolopts & WAKE_MAGIC) adapter->wol |= E1000_WUFC_MAG; } @@ -1727,7 +1726,7 @@ e1000_led_blink_callback(unsigned long data) { struct e1000_adapter *adapter = (struct e1000_adapter *) data; - if(test_and_change_bit(E1000_LED_ON, &adapter->led_status)) + if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) e1000_led_off(&adapter->hw); else e1000_led_on(&adapter->hw); @@ -1740,11 +1739,11 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) { struct e1000_adapter *adapter = netdev_priv(netdev); - if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) + if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); - if(adapter->hw.mac_type < e1000_82571) { - if(!adapter->blink_timer.function) { + if (adapter->hw.mac_type < e1000_82571) { + if (!adapter->blink_timer.function) { init_timer(&adapter->blink_timer); adapter->blink_timer.function = e1000_led_blink_callback; adapter->blink_timer.data = (unsigned long) adapter; @@ -1782,21 +1781,21 @@ static int e1000_nway_reset(struct net_device *netdev) { struct e1000_adapter *adapter = netdev_priv(netdev); - if(netif_running(netdev)) { + if (netif_running(netdev)) { e1000_down(adapter); e1000_up(adapter); } return 0; } -static int +static int e1000_get_stats_count(struct net_device *netdev) { return E1000_STATS_LEN; } -static void -e1000_get_ethtool_stats(struct net_device *netdev, +static void +e1000_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, uint64_t *data) { struct e1000_adapter *adapter = netdev_priv(netdev); @@ -1830,7 +1829,7 @@ e1000_get_ethtool_stats(struct net_device *netdev, /* BUG_ON(i != E1000_STATS_LEN); */ } -static void +static void e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) { #ifdef CONFIG_E1000_MQ @@ -1839,9 +1838,9 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) uint8_t *p = data; int i; - switch(stringset) { + switch (stringset) { case ETH_SS_TEST: - memcpy(data, *e1000_gstrings_test, + memcpy(data, *e1000_gstrings_test, E1000_TEST_LEN*ETH_GSTRING_LEN); break; case ETH_SS_STATS: diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 2437d362ff6..beeec0fbbea 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) if(ret_val) return ret_val; - /* Read the MII 1000Base-T Control Register (Address 9). */ - ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); - if(ret_val) - return ret_val; + /* Read the MII 1000Base-T Control Register (Address 9). */ + ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); + if(ret_val) + return ret_val; /* Need to parse both autoneg_advertised and fc and set up * the appropriate PHY registers. First we will parse for @@ -3916,7 +3916,7 @@ e1000_read_eeprom(struct e1000_hw *hw, } } - if(eeprom->use_eerd == TRUE) { + if (eeprom->use_eerd == TRUE) { ret_val = e1000_read_eeprom_eerd(hw, offset, words, data); if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) || (hw->mac_type != e1000_82573)) @@ -4423,7 +4423,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw) return -E1000_ERR_EEPROM; } - /* If STM opcode located in bits 15:8 of flop, reset firmware */ + /* If STM opcode located in bits 15:8 of flop, reset firmware */ if ((flop & 0xFF00) == E1000_STM_OPCODE) { E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET); } @@ -4431,7 +4431,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw) /* Perform the flash update */ E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD); - for (i=0; i < attempts; i++) { + for (i=0; i < attempts; i++) { eecd = E1000_READ_REG(hw, EECD); if ((eecd & E1000_EECD_FLUPD) == 0) { break; @@ -4504,6 +4504,7 @@ e1000_read_mac_addr(struct e1000_hw * hw) hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); } + switch (hw->mac_type) { default: break; @@ -6840,7 +6841,8 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw) { uint32_t manc = 0; - if(hw->mac_type > e1000_82547_rev_2) + + if (hw->mac_type > e1000_82547_rev_2) manc = E1000_READ_REG(hw, MANC); return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? E1000_BLK_PHY_RESET : E1000_SUCCESS; diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 0b8f6f2b774..f1219dd9dba 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); void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); /* Filters (multicast, vlan, receive) */ +void 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); uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr); void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value); void 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); void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); /* Port I/O is only supported on 82544 and newer */ uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port); +uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset); void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); +void e1000_enable_pciex_master(struct e1000_hw *hw); int32_t e1000_disable_pciex_master(struct e1000_hw *hw); int32_t e1000_get_software_semaphore(struct e1000_hw *hw); void e1000_release_software_semaphore(struct e1000_hw *hw); @@ -899,14 +902,14 @@ struct e1000_ffvt_entry { #define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */ #define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */ #define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ -#define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */ -#define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */ -#define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */ -#define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */ -#define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */ -#define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */ -#define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */ -#define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */ +#define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */ +#define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */ +#define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */ +#define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */ +#define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */ +#define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */ +#define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */ +#define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */ #define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ #define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ #define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ @@ -1761,7 +1764,6 @@ struct e1000_hw { #define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ #define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc. still to be processed. */ - /* Transmit Configuration Word */ #define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ #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 d0a5d1656c5..31e332935e5 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -29,11 +29,71 @@ #include "e1000.h" /* Change Log - * 6.0.58 4/20/05 - * o Accepted ethtool cleanup patch from Stephen Hemminger - * 6.0.44+ 2/15/05 - * o applied Anton's patch to resolve tx hang in hardware - * o Applied Andrew Mortons patch - e1000 stops working after resume + * 6.3.9 12/16/2005 + * o incorporate fix for recycled skbs from IBM LTC + * 6.3.7 11/18/2005 + * o Honor eeprom setting for enabling/disabling Wake On Lan + * 6.3.5 11/17/2005 + * o Fix memory leak in rx ring handling for PCI Express adapters + * 6.3.4 11/8/05 + * o Patch from Jesper Juhl to remove redundant NULL checks for kfree + * 6.3.2 9/20/05 + * o Render logic that sets/resets DRV_LOAD as inline functions to + * avoid code replication. If f/w is AMT then set DRV_LOAD only when + * network interface is open. + * o Handle DRV_LOAD set/reset in cases where AMT uses VLANs. + * o Adjust PBA partioning for Jumbo frames using MTU size and not + * rx_buffer_len + * 6.3.1 9/19/05 + * o Use adapter->tx_timeout_factor in Tx Hung Detect logic + (e1000_clean_tx_irq) + * o Support for 8086:10B5 device (Quad Port) + * 6.2.14 9/15/05 + * o In AMT enabled configurations, set/reset DRV_LOAD bit on interface + * open/close + * 6.2.13 9/14/05 + * o Invoke e1000_check_mng_mode only for 8257x controllers since it + * accesses the FWSM that is not supported in other controllers + * 6.2.12 9/9/05 + * o Add support for device id E1000_DEV_ID_82546GB_QUAD_COPPER + * o set RCTL:SECRC only for controllers newer than 82543. + * o When the n/w interface comes down reset DRV_LOAD bit to notify f/w. + * This code was moved from e1000_remove to e1000_close + * 6.2.10 9/6/05 + * o Fix error in updating RDT in el1000_alloc_rx_buffers[_ps] -- one off. + * o Enable fc by default on 82573 controllers (do not read eeprom) + * o Fix rx_errors statistic not to include missed_packet_count + * o Fix rx_dropped statistic not to include missed_packet_count + (Padraig Brady) + * 6.2.9 8/30/05 + * o Remove call to update statistics from the controller ib e1000_get_stats + * 6.2.8 8/30/05 + * o Improved algorithm for rx buffer allocation/rdt update + * o Flow control watermarks relative to rx PBA size + * o Simplified 'Tx Hung' detect logic + * 6.2.7 8/17/05 + * o Report rx buffer allocation failures and tx timeout counts in stats + * 6.2.6 8/16/05 + * o Implement workaround for controller erratum -- linear non-tso packet + * following a TSO gets written back prematurely + * 6.2.5 8/15/05 + * o Set netdev->tx_queue_len based on link speed/duplex settings. + * o Fix net_stats.rx_fifo_errors <p@draigBrady.com> + * o Do not power off PHY if SoL/IDER session is active + * 6.2.4 8/10/05 + * o Fix loopback test setup/cleanup for 82571/3 controllers + * o Fix parsing of outgoing packets (e1000_transfer_dhcp_info) to treat + * all packets as raw + * o Prevent operations that will cause the PHY to be reset if SoL/IDER + * sessions are active and log a message + * 6.2.2 7/21/05 + * o used fixed size descriptors for all MTU sizes, reduces memory load + * 6.1.2 4/13/05 + * o Fixed ethtool diagnostics + * o Enabled flow control to take default eeprom settings + * o Added stats_lock around e1000_read_phy_reg commands to avoid concurrent + * calls, one from mii_ioctl and other from within update_stats while + * processing MIIREG ioctl. */ char e1000_driver_name[] = "e1000"; @@ -295,7 +355,7 @@ e1000_irq_disable(struct e1000_adapter *adapter) static inline void e1000_irq_enable(struct e1000_adapter *adapter) { - if(likely(atomic_dec_and_test(&adapter->irq_sem))) { + if (likely(atomic_dec_and_test(&adapter->irq_sem))) { E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK); E1000_WRITE_FLUSH(&adapter->hw); } @@ -307,17 +367,17 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter) struct net_device *netdev = adapter->netdev; uint16_t vid = adapter->hw.mng_cookie.vlan_id; uint16_t old_vid = adapter->mng_vlan_id; - if(adapter->vlgrp) { - if(!adapter->vlgrp->vlan_devices[vid]) { - if(adapter->hw.mng_cookie.status & + if (adapter->vlgrp) { + if (!adapter->vlgrp->vlan_devices[vid]) { + if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { e1000_vlan_rx_add_vid(netdev, vid); adapter->mng_vlan_id = vid; } else adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; - - if((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && - (vid != old_vid) && + + if ((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && + (vid != old_vid) && !adapter->vlgrp->vlan_devices[old_vid]) e1000_vlan_rx_kill_vid(netdev, old_vid); } @@ -401,10 +461,10 @@ e1000_up(struct e1000_adapter *adapter) /* hardware has been reset, we need to reload some things */ /* Reset the PHY if it was previously powered down */ - if(adapter->hw.media_type == e1000_media_type_copper) { + if (adapter->hw.media_type == e1000_media_type_copper) { uint16_t mii_reg; e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); - if(mii_reg & MII_CR_POWER_DOWN) + if (mii_reg & MII_CR_POWER_DOWN) e1000_phy_reset(&adapter->hw); } @@ -425,16 +485,16 @@ e1000_up(struct e1000_adapter *adapter) } #ifdef CONFIG_PCI_MSI - if(adapter->hw.mac_type > e1000_82547_rev_2) { + if (adapter->hw.mac_type > e1000_82547_rev_2) { adapter->have_msi = TRUE; - if((err = pci_enable_msi(adapter->pdev))) { + if ((err = pci_enable_msi(adapter->pdev))) { DPRINTK(PROBE, ERR, "Unable to allocate MSI interrupt Error: %d\n", err); adapter->have_msi = FALSE; } } #endif - if((err = request_irq(adapter->pdev->irq, &e1000_intr, + if ((err = request_irq(adapter->pdev->irq, &e1000_intr, SA_SHIRQ | SA_SAMPLE_RANDOM, netdev->name, netdev))) { DPRINTK(PROBE, ERR, @@ -471,7 +531,7 @@ e1000_down(struct e1000_adapter *adapter) #endif free_irq(adapter->pdev->irq, netdev); #ifdef CONFIG_PCI_MSI - if(adapter->hw.mac_type > e1000_82547_rev_2 && + if (adapter->hw.mac_type > e1000_82547_rev_2 && adapter->have_msi == TRUE) pci_disable_msi(adapter->pdev); #endif @@ -537,12 +597,12 @@ e1000_reset(struct e1000_adapter *adapter) break; } - if((adapter->hw.mac_type != e1000_82573) && + if ((adapter->hw.mac_type != e1000_82573) && (adapter->netdev->mtu > E1000_RXBUFFER_8192)) pba -= 8; /* allocate more FIFO for Tx */ - if(adapter->hw.mac_type == e1000_82547) { + if (adapter->hw.mac_type == e1000_82547) { adapter->tx_fifo_head = 0; adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT; adapter->tx_fifo_size = @@ -565,9 +625,9 @@ e1000_reset(struct e1000_adapter *adapter) /* Allow time for pending master requests to run */ e1000_reset_hw(&adapter->hw); - if(adapter->hw.mac_type >= e1000_82544) + if (adapter->hw.mac_type >= e1000_82544) E1000_WRITE_REG(&adapter->hw, WUC, 0); - if(e1000_init_hw(&adapter->hw)) + if (e1000_init_hw(&adapter->hw)) DPRINTK(PROBE, ERR, "Hardware Error\n"); e1000_update_mng_vlan(adapter); /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ @@ -606,26 +666,26 @@ e1000_probe(struct pci_dev *pdev, int i, err, pci_using_dac; uint16_t eeprom_data; uint16_t eeprom_apme_mask = E1000_EEPROM_APME; - if((err = pci_enable_device(pdev))) + if ((err = pci_enable_device(pdev))) return err; - if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { + if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { pci_using_dac = 1; } else { - if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { + if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { E1000_ERR("No usable DMA configuration, aborting\n"); return err; } pci_using_dac = 0; } - if((err = pci_request_regions(pdev, e1000_driver_name))) + if ((err = pci_request_regions(pdev, e1000_driver_name))) return err; pci_set_master(pdev); netdev = alloc_etherdev(sizeof(struct e1000_adapter)); - if(!netdev) { + if (!netdev) { err = -ENOMEM; goto err_alloc_etherdev; } @@ -644,15 +704,15 @@ e1000_probe(struct pci_dev *pdev, mmio_len = pci_resource_len(pdev, BAR_0); adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); - if(!adapter->hw.hw_addr) { + if (!adapter->hw.hw_addr) { err = -EIO; goto err_ioremap; } - for(i = BAR_1; i <= BAR_5; i++) { - if(pci_resource_len(pdev, i) == 0) + for (i = BAR_1; i <= BAR_5; i++) { + if (pci_resource_len(pdev, i) == 0) continue; - if(pci_resource_flags(pdev, i) & IORESOURCE_IO) { + if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { adapter->hw.io_base = pci_resource_start(pdev, i); break; } @@ -689,13 +749,13 @@ e1000_probe(struct pci_dev *pdev, /* setup the private structure */ - if((err = e1000_sw_init(adapter))) + if ((err = e1000_sw_init(adapter))) goto err_sw_init; - if((err = e1000_check_phy_reset_block(&adapter->hw))) + if ((err = e1000_check_phy_reset_block(&adapter->hw))) DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); - if(adapter->hw.mac_type >= e1000_82543) { + if (adapter->hw.mac_type >= e1000_82543) { netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX | @@ -704,16 +764,16 @@ e1000_probe(struct pci_dev *pdev, } #ifdef NETIF_F_TSO - if((adapter->hw.mac_type >= e1000_82544) && + if ((adapter->hw.mac_type >= e1000_82544) && (adapter->hw.mac_type != e1000_82547)) netdev->features |= NETIF_F_TSO; #ifdef NETIF_F_TSO_IPV6 - if(adapter->hw.mac_type > e1000_82547_rev_2) + if (adapter->hw.mac_type > e1000_82547_rev_2) netdev->features |= NETIF_F_TSO_IPV6; #endif #endif - if(pci_using_dac) + if (pci_using_dac) netdev->features |= NETIF_F_HIGHDMA; /* hard_start_xmit is safe against parallel locking */ @@ -721,14 +781,14 @@ e1000_probe(struct pci_dev *pdev, adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); - /* before reading the EEPROM, reset the controller to + /* before reading the EEPROM, reset the controller to * put the device in a known good starting state */ - + e1000_reset_hw(&adapter->hw); /* make sure the EEPROM is good */ - if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) { + if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) { DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); err = -EIO; goto err_eeprom; @@ -736,12 +796,12 @@ e1000_probe(struct pci_dev *pdev, /* copy the MAC address out of the EEPROM */ - if(e1000_read_mac_addr(&adapter->hw)) + if (e1000_read_mac_addr(&adapter->hw)) DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); - if(!is_valid_ether_addr(netdev->perm_addr)) { + if (!is_valid_ether_addr(netdev->perm_addr)) { DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); err = -EIO; goto err_eeprom; @@ -781,7 +841,7 @@ e1000_probe(struct pci_dev *pdev, * enable the ACPI Magic Packet filter */ - switch(adapter->hw.mac_type) { + switch (adapter->hw.mac_type) { case e1000_82542_rev2_0: case e1000_82542_rev2_1: case e1000_82543: @@ -794,7 +854,7 @@ e1000_probe(struct pci_dev *pdev, case e1000_82546: case e1000_82546_rev_3: case e1000_82571: - if(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1){ + if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1){ e1000_read_eeprom(&adapter->hw, EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); break; @@ -805,7 +865,7 @@ e1000_probe(struct pci_dev *pdev, EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); break; } - if(eeprom_data & eeprom_apme_mask) + if (eeprom_data & eeprom_apme_mask) adapter->wol |= E1000_WUFC_MAG; /* print bus type/speed/width info */ @@ -840,7 +900,7 @@ e1000_probe(struct pci_dev *pdev, e1000_get_hw_control(adapter); strcpy(netdev->name, "eth%d"); - if((err = register_netdev(netdev))) + if ((err = register_netdev(netdev))) goto err_register; DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); @@ -881,10 +941,10 @@ e1000_remove(struct pci_dev *pdev) flush_scheduled_work(); - if(adapter->hw.mac_type >= e1000_82540 && + if (adapter->hw.mac_type >= e1000_82540 && adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); - if(manc & E1000_MANC_SMBUS_EN) { + if (manc & E1000_MANC_SMBUS_EN) { manc |= E1000_MANC_ARP_EN; E1000_WRITE_REG(&adapter->hw, MANC, manc); } @@ -900,7 +960,7 @@ e1000_remove(struct pci_dev *pdev) __dev_put(&adapter->polling_netdev[i]); #endif - if(!e1000_check_phy_reset_block(&adapter->hw)) + if (!e1000_check_phy_reset_block(&adapter->hw)) e1000_phy_hw_reset(&adapter->hw); kfree(adapter->tx_ring); @@ -959,19 +1019,19 @@ e1000_sw_init(struct e1000_adapter *adapter) /* identify the MAC */ - if(e1000_set_mac_type(hw)) { + if (e1000_set_mac_type(hw)) { DPRINTK(PROBE, ERR, "Unknown MAC Type\n"); return -EIO; } /* initialize eeprom parameters */ - if(e1000_init_eeprom_params(hw)) { + if (e1000_init_eeprom_params(hw)) { E1000_ERR("EEPROM initialization failed\n"); return -EIO; } - switch(hw->mac_type) { + switch (hw->mac_type) { default: break; case e1000_82541: @@ -990,7 +1050,7 @@ e1000_sw_init(struct e1000_adapter *adapter) /* Copper options */ - if(hw->media_type == e1000_media_type_copper) { + if (hw->media_type == e1000_media_type_copper) { hw->mdix = AUTO_ALL_MODES; hw->disable_polarity_correction = FALSE; hw->master_slave = E1000_MASTER_SLAVE; @@ -1166,10 +1226,10 @@ e1000_open(struct net_device *netdev) if ((err = e1000_setup_all_rx_resources(adapter))) goto err_setup_rx; - if((err = e1000_up(adapter))) + if ((err = e1000_up(adapter))) goto err_up; adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; - if((adapter->hw.mng_cookie.status & + if ((adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { e1000_update_mng_vlan(adapter); } @@ -1214,7 +1274,7 @@ e1000_close(struct net_device *netdev) e1000_free_all_tx_resources(adapter); e1000_free_all_rx_resources(adapter); - if((adapter->hw.mng_cookie.status & + if ((adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); } @@ -1269,7 +1329,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter, size = sizeof(struct e1000_buffer) * txdr->count; txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); - if(!txdr->buffer_info) { + if (!txdr->buffer_info) { DPRINTK(PROBE, ERR, "Unable to allocate memory for the transmit descriptor ring\n"); return -ENOMEM; @@ -1282,7 +1342,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter, E1000_ROUNDUP(txdr->size, 4096); txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); - if(!txdr->desc) { + if (!txdr->desc) { setup_tx_desc_die: vfree(txdr->buffer_info); DPRINTK(PROBE, ERR, @@ -1298,8 +1358,8 @@ setup_tx_desc_die: "at %p\n", txdr->size, txdr->desc); /* Try again, without freeing the previous */ txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); - if(!txdr->desc) { /* Failed allocation, critical failure */ + if (!txdr->desc) { pci_free_consistent(pdev, txdr->size, olddesc, olddma); goto setup_tx_desc_die; } @@ -1499,7 +1559,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, size = sizeof(struct e1000_ps_page) * rxdr->count; rxdr->ps_page = kmalloc(size, GFP_KERNEL); - if(!rxdr->ps_page) { + if (!rxdr->ps_page) { vfree(rxdr->buffer_info); DPRINTK(PROBE, ERR, "Unable to allocate memory for the receive descriptor ring\n"); @@ -1509,7 +1569,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, size = sizeof(struct e1000_ps_page_dma) * rxdr->count; rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL); - if(!rxdr->ps_page_dma) { + if (!rxdr->ps_page_dma) { vfree(rxdr->buffer_info); kfree(rxdr->ps_page); DPRINTK(PROBE, ERR, @@ -1518,7 +1578,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, } memset(rxdr->ps_page_dma, 0, size); - if(adapter->hw.mac_type <= e1000_82547_rev_2) + if (adapter->hw.mac_type <= e1000_82547_rev_2) desc_len = sizeof(struct e1000_rx_desc); else desc_len = sizeof(union e1000_rx_desc_packet_split); @@ -1621,7 +1681,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) { uint32_t rctl, rfctl; uint32_t psrctl = 0; -#ifdef CONFIG_E1000_PACKET_SPLIT +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT uint32_t pages = 0; #endif @@ -1647,32 +1707,17 @@ e1000_setup_rctl(struct e1000_adapter *adapter) rctl |= E1000_RCTL_LPE; /* Setup buffer sizes */ - if(adapter->hw.mac_type >= e1000_82571) { + if (adapter->hw.mac_type >= e1000_82571) { /* We can now specify buffers in 1K increments. * BSIZE and BSEX are ignored in this case. */ rctl |= adapter->rx_buffer_len << 0x11; } else { rctl &= ~E1000_RCTL_SZ_4096; - rctl |= E1000_RCTL_BSEX; - switch (adapter->rx_buffer_len) { - case E1000_RXBUFFER_2048: - default: - rctl |= E1000_RCTL_SZ_2048; - rctl &= ~E1000_RCTL_BSEX; - break; - case E1000_RXBUFFER_4096: - rctl |= E1000_RCTL_SZ_4096; - break; - case E1000_RXBUFFER_8192: - rctl |= E1000_RCTL_SZ_8192; - break; - case E1000_RXBUFFER_16384: - rctl |= E1000_RCTL_SZ_16384; - break; - } + rctl &= ~E1000_RCTL_BSEX; + rctl |= E1000_RCTL_SZ_2048; } -#ifdef CONFIG_E1000_PACKET_SPLIT +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT /* 82571 and greater support packet-split where the protocol * header is placed in skb->data and the packet data is * placed in pages hanging off of skb_shinfo(skb)->nr_frags. @@ -1696,7 +1741,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC; - + psrctl |= adapter->rx_ps_bsize0 >> E1000_PSRCTL_BSIZE0_SHIFT; @@ -1758,7 +1803,7 @@ e1000_configure_rx(struct e1000_adapter *adapter) if (hw->mac_type >= e1000_82540) { E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay); - if(adapter->itr > 1) + if (adapter->itr > 1) E1000_WRITE_REG(hw, ITR, 1000000000 / (adapter->itr * 256)); } @@ -1847,13 +1892,13 @@ e1000_configure_rx(struct e1000_adapter *adapter) /* Enable 82543 Receive Checksum Offload for TCP and UDP */ if (hw->mac_type >= e1000_82543) { rxcsum = E1000_READ_REG(hw, RXCSUM); - if(adapter->rx_csum == TRUE) { + if (adapter->rx_csum == TRUE) { rxcsum |= E1000_RXCSUM_TUOFL; /* Enable 82571 IPv4 payload checksum for UDP fragments * Must be used in conjunction with packet-split. */ - if ((hw->mac_type >= e1000_82571) && - (adapter->rx_ps_pages)) { + if ((hw->mac_type >= e1000_82571) && + (adapter->rx_ps_pages)) { rxcsum |= E1000_RXCSUM_IPPCSE; } } else { @@ -1915,7 +1960,7 @@ static inline void e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, struct e1000_buffer *buffer_info) { - if(buffer_info->dma) { + if (buffer_info->dma) { pci_unmap_page(adapter->pdev, buffer_info->dma, buffer_info->length, @@ -1942,7 +1987,7 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter, /* Free all the Tx ring sk_buffs */ - for(i = 0; i < tx_ring->count; i++) { + for (i = 0; i < tx_ring->count; i++) { buffer_info = &tx_ring->buffer_info[i]; e1000_unmap_and_free_tx_resource(adapter, buffer_info); } @@ -2038,10 +2083,9 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter, unsigned int i, j; /* Free all the Rx ring sk_buffs */ - - for(i = 0; i < rx_ring->count; i++) { + for (i = 0; i < rx_ring->count; i++) { buffer_info = &rx_ring->buffer_info[i]; - if(buffer_info->skb) { + if (buffer_info->skb) { pci_unmap_single(pdev, buffer_info->dma, buffer_info->length, @@ -2122,7 +2166,7 @@ e1000_enter_82542_rst(struct e1000_adapter *adapter) E1000_WRITE_FLUSH(&adapter->hw); mdelay(5); - if(netif_running(netdev)) + if (netif_running(netdev)) e1000_clean_all_rx_rings(adapter); } @@ -2138,13 +2182,13 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter) E1000_WRITE_FLUSH(&adapter->hw); mdelay(5); - if(adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE) + if (adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE) e1000_pci_set_mwi(&adapter->hw); - if(netif_running(netdev)) { - e1000_configure_rx(adapter); + if (netif_running(netdev)) { /* No need to loop, because 82542 supports only 1 queue */ struct e1000_rx_ring *ring = &adapter->rx_ring[0]; + e1000_configure_rx(adapter); adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring)); } } @@ -2163,12 +2207,12 @@ e1000_set_mac(struct net_device *netdev, void *p) struct e1000_adapter *adapter = netdev_priv(netdev); struct sockaddr *addr = p; - if(!is_valid_ether_addr(addr->sa_data)) + if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; /* 82542 2.0 needs to be in reset to write receive address registers */ - if(adapter->hw.mac_type == e1000_82542_rev2_0) + if (adapter->hw.mac_type == e1000_82542_rev2_0) e1000_enter_82542_rst(adapter); memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); @@ -2182,17 +2226,17 @@ e1000_set_mac(struct net_device *netdev, void *p) /* activate the work around */ adapter->hw.laa_is_present = 1; - /* Hold a copy of the LAA in RAR[14] This is done so that - * between the time RAR[0] gets clobbered and the time it - * gets fixed (in e1000_watchdog), the actual LAA is in one + /* Hold a copy of the LAA in RAR[14] This is done so that + * between the time RAR[0] gets clobbered and the time it + * gets fixed (in e1000_watchdog), the actual LAA is in one * of the RARs and no incoming packets directed to this port - * are dropped. Eventaully the LAA will be in RAR[0] and + * are dropped. Eventaully the LAA will be in RAR[0] and * RAR[14] */ - e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, + e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, E1000_RAR_ENTRIES - 1); } - if(adapter->hw.mac_type == e1000_82542_rev2_0) + if (adapter->hw.mac_type == e1000_82542_rev2_0) e1000_leave_82542_rst(adapter); return 0; @@ -2226,9 +2270,9 @@ e1000_set_multi(struct net_device *netdev) rctl = E1000_READ_REG(hw, RCTL); - if(netdev->flags & IFF_PROMISC) { + if (netdev->flags & IFF_PROMISC) { rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); - } else if(netdev->flags & IFF_ALLMULTI) { + } else if (netdev->flags & IFF_ALLMULTI) { rctl |= E1000_RCTL_MPE; rctl &= ~E1000_RCTL_UPE; } else { @@ -2239,7 +2283,7 @@ e1000_set_multi(struct net_device *netdev) /* 82542 2.0 needs to be in reset to write receive address registers */ - if(hw->mac_type == e1000_82542_rev2_0) + if (hw->mac_type == e1000_82542_rev2_0) e1000_enter_82542_rst(adapter); /* load the first 14 multicast address into the exact filters 1-14 @@ -2249,7 +2293,7 @@ e1000_set_multi(struct net_device *netdev) */ mc_ptr = netdev->mc_list; - for(i = 1; i < rar_entries; i++) { + for (i = 1; i < rar_entries; i++) { if (mc_ptr) { e1000_rar_set(hw, mc_ptr->dmi_addr, i); mc_ptr = mc_ptr->next; @@ -2261,17 +2305,17 @@ e1000_set_multi(struct net_device *netdev) /* clear the old settings from the multicast hash table */ - for(i = 0; i < E1000_NUM_MTA_REGISTERS; i++) + for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++) E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); /* load any remaining addresses into the hash table */ - for(; mc_ptr; mc_ptr = mc_ptr->next) { + for (; mc_ptr; mc_ptr = mc_ptr->next) { hash_value = e1000_hash_mc_addr(hw, mc_ptr->dmi_addr); e1000_mta_set(hw, hash_value); } - if(hw->mac_type == e1000_82542_rev2_0) + if (hw->mac_type == e1000_82542_rev2_0) e1000_leave_82542_rst(adapter); } @@ -2297,8 +2341,8 @@ e1000_82547_tx_fifo_stall(unsigned long data) struct net_device *netdev = adapter->netdev; uint32_t tctl; - if(atomic_read(&adapter->tx_fifo_stall)) { - if((E1000_READ_REG(&adapter->hw, TDT) == + if (atomic_read(&adapter->tx_fifo_stall)) { + if ((E1000_READ_REG(&adapter->hw, TDT) == E1000_READ_REG(&adapter->hw, TDH)) && (E1000_READ_REG(&adapter->hw, TDFT) == E1000_READ_REG(&adapter->hw, TDFH)) && @@ -2350,18 +2394,18 @@ e1000_watchdog_task(struct e1000_adapter *adapter) e1000_check_for_link(&adapter->hw); if (adapter->hw.mac_type == e1000_82573) { e1000_enable_tx_pkt_filtering(&adapter->hw); - if(adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) + if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) e1000_update_mng_vlan(adapter); - } + } - if((adapter->hw.media_type == e1000_media_type_internal_serdes) && + if ((adapter->hw.media_type == e1000_media_type_internal_serdes) && !(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE)) link = !adapter->hw.serdes_link_down; else link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU; - if(link) { - if(!netif_carrier_ok(netdev)) { + if (link) { + if (!netif_carrier_ok(netdev)) { e1000_get_speed_and_duplex(&adapter->hw, &adapter->link_speed, &adapter->link_duplex); @@ -2392,7 +2436,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter) adapter->smartspeed = 0; } } else { - if(netif_carrier_ok(netdev)) { + if (netif_carrier_ok(netdev)) { adapter->link_speed = 0; adapter->link_duplex = 0; DPRINTK(LINK, INFO, "NIC Link is Down\n"); @@ -2432,12 +2476,12 @@ e1000_watchdog_task(struct e1000_adapter *adapter) } /* Dynamic mode for Interrupt Throttle Rate (ITR) */ - if(adapter->hw.mac_type >= e1000_82540 && adapter->itr == 1) { + if (adapter->hw.mac_type >= e1000_82540 && adapter->itr == 1) { /* Symmetric Tx/Rx gets a reduced ITR=2000; Total * asymmetrical Tx or Rx gets ITR=8000; everyone * else is between 2000-8000. */ uint32_t goc = (adapter->gotcl + adapter->gorcl) / 10000; - uint32_t dif = (adapter->gotcl > adapter->gorcl ? + uint32_t dif = (adapter->gotcl > adapter->gorcl ? adapter->gotcl - adapter->gorcl : adapter->gorcl - adapter->gotcl) / 10000; uint32_t itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000; @@ -2450,7 +2494,7 @@ e1000_watchdog_task(struct e1000_adapter *adapter) /* Force detection of hung controller every watchdog period */ adapter->detect_tx_hung = TRUE; - /* With 82571 controllers, LAA may be overwritten due to controller + /* With 82571 controllers, LAA may be overwritten due to controller * reset from the other port. Set the appropriate LAA in RAR[0] */ if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present) 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, uint8_t ipcss, ipcso, tucss, tucso, hdr_len; int err; - if(skb_shinfo(skb)->tso_size) { + if (skb_shinfo(skb)->tso_size) { if (skb_header_cloned(skb)) { err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); if (err) @@ -2488,7 +2532,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); mss = skb_shinfo(skb)->tso_size; - if(skb->protocol == ntohs(ETH_P_IP)) { + if (skb->protocol == ntohs(ETH_P_IP)) { skb->nh.iph->tot_len = 0; skb->nh.iph->check = 0; skb->h.th->check = @@ -2500,7 +2544,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, cmd_length = E1000_TXD_CMD_IP; ipcse = skb->h.raw - skb->data - 1; #ifdef NETIF_F_TSO_IPV6 - } else if(skb->protocol == ntohs(ETH_P_IPV6)) { + } else if (skb->protocol == ntohs(ETH_P_IPV6)) { skb->nh.ipv6h->payload_len = 0; skb->h.th->check = ~csum_ipv6_magic(&skb->nh.ipv6h->saddr, @@ -2555,7 +2599,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, unsigned int i; uint8_t css; - if(likely(skb->ip_summed == CHECKSUM_HW)) { + if (likely(skb->ip_summed == CHECKSUM_HW)) { css = skb->h.raw - skb->data; i = tx_ring->next_to_use; @@ -2595,7 +2639,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, i = tx_ring->next_to_use; - while(len) { + while (len) { buffer_info = &tx_ring->buffer_info[i]; size = min(len, max_per_txd); #ifdef NETIF_F_TSO @@ -2611,7 +2655,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, /* Workaround for premature desc write-backs * in TSO mode. Append 4-byte sentinel desc */ - if(unlikely(mss && !nr_frags && size == len && size > 8)) + if (unlikely(mss && !nr_frags && size == len && size > 8)) size -= 4; #endif /* 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, * The fix is to make sure that the first descriptor of a * packet is smaller than 2048 - 16 - 16 (or 2016) bytes */ - if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && + if (unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && (size > 2015) && count == 0)) size = 2015; - + /* Workaround for potential 82544 hang in PCI-X. Avoid * terminating buffers within evenly-aligned dwords. */ - if(unlikely(adapter->pcix_82544 && + if (unlikely(adapter->pcix_82544 && !((unsigned long)(skb->data + offset + size - 1) & 4) && size > 4)) size -= 4; @@ -2641,29 +2685,29 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, len -= size; offset += size; count++; - if(unlikely(++i == tx_ring->count)) i = 0; + if (unlikely(++i == tx_ring->count)) i = 0; } - for(f = 0; f < nr_frags; f++) { + for (f = 0; f < nr_frags; f++) { struct skb_frag_struct *frag; frag = &skb_shinfo(skb)->frags[f]; len = frag->size; offset = frag->page_offset; - while(len) { + while (len) { buffer_info = &tx_ring->buffer_info[i]; size = min(len, max_per_txd); #ifdef NETIF_F_TSO /* Workaround for premature desc write-backs * in TSO mode. Append 4-byte sentinel desc */ - if(unlikely(mss && f == (nr_frags-1) && size == len && size > 8)) + if (unlikely(mss && f == (nr_frags-1) && size == len && size > 8)) size -= 4; #endif /* Workaround for potential 82544 hang in PCI-X. * Avoid terminating buffers within evenly-aligned * dwords. */ - if(unlikely(adapter->pcix_82544 && + if (unlikely(adapter->pcix_82544 && !((unsigned long)(frag->page+offset+size-1) & 4) && size > 4)) size -= 4; @@ -2680,7 +2724,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, len -= size; offset += size; count++; - if(unlikely(++i == tx_ring->count)) i = 0; + if (unlikely(++i == tx_ring->count)) i = 0; } } @@ -2700,35 +2744,35 @@ e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; unsigned int i; - if(likely(tx_flags & E1000_TX_FLAGS_TSO)) { + if (likely(tx_flags & E1000_TX_FLAGS_TSO)) { txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D | E1000_TXD_CMD_TSE; txd_upper |= E1000_TXD_POPTS_TXSM << 8; - if(likely(tx_flags & E1000_TX_FLAGS_IPV4)) + if (likely(tx_flags & E1000_TX_FLAGS_IPV4)) txd_upper |= E1000_TXD_POPTS_IXSM << 8; } - if(likely(tx_flags & E1000_TX_FLAGS_CSUM)) { + if (likely(tx_flags & E1000_TX_FLAGS_CSUM)) { txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; txd_upper |= E1000_TXD_POPTS_TXSM << 8; } - if(unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) { + if (unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) { txd_lower |= E1000_TXD_CMD_VLE; txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK); } i = tx_ring->next_to_use; - while(count--) { + while (count--) { buffer_info = &tx_ring->buffer_info[i]; tx_desc = E1000_TX_DESC(*tx_ring, i); tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); tx_desc->lower.data = cpu_to_le32(txd_lower | buffer_info->length); tx_desc->upper.data = cpu_to_le32(txd_upper); - if(unlikely(++i == tx_ring->count)) i = 0; + if (unlikely(++i == tx_ring->count)) i = 0; } 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) E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR); - if(adapter->link_duplex != HALF_DUPLEX) + if (adapter->link_duplex != HALF_DUPLEX) goto no_fifo_stall_required; - if(atomic_read(&adapter->tx_fifo_stall)) + if (atomic_read(&adapter->tx_fifo_stall)) return 1; - if(skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) { + if (skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) { atomic_set(&adapter->tx_fifo_stall, 1); return 1; } no_fifo_stall_required: adapter->tx_fifo_head += skb_fifo_len; - if(adapter->tx_fifo_head >= adapter->tx_fifo_size) + if (adapter->tx_fifo_head >= adapter->tx_fifo_size) adapter->tx_fifo_head -= adapter->tx_fifo_size; return 0; } @@ -2787,27 +2831,27 @@ e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) { struct e1000_hw *hw = &adapter->hw; uint16_t length, offset; - if(vlan_tx_tag_present(skb)) { - if(!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && + if (vlan_tx_tag_present(skb)) { + if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && ( adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) ) return 0; } - if ((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) { + if ((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) { struct ethhdr *eth = (struct ethhdr *) skb->data; - if((htons(ETH_P_IP) == eth->h_proto)) { - const struct iphdr *ip = + if ((htons(ETH_P_IP) == eth->h_proto)) { + const struct iphdr *ip = (struct iphdr *)((uint8_t *)skb->data+14); - if(IPPROTO_UDP == ip->protocol) { - struct udphdr *udp = - (struct udphdr *)((uint8_t *)ip + + if (IPPROTO_UDP == ip->protocol) { + struct udphdr *udp = + (struct udphdr *)((uint8_t *)ip + (ip->ihl << 2)); - if(ntohs(udp->dest) == 67) { + if (ntohs(udp->dest) == 67) { offset = (uint8_t *)udp + 8 - skb->data; length = skb->len - offset; return e1000_mng_write_dhcp_info(hw, - (uint8_t *)udp + 8, + (uint8_t *)udp + 8, length); } } @@ -2830,7 +2874,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) unsigned int nr_frags = 0; unsigned int mss = 0; int count = 0; - int tso; + int tso; unsigned int f; len -= skb->data_len; @@ -2853,7 +2897,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) * 4 = ceil(buffer len/mss). To make sure we don't * overrun the FIFO, adjust the max buffer len if mss * drops. */ - if(mss) { + if (mss) { uint8_t hdr_len; max_per_txd = min(mss << 2, max_per_txd); max_txd_pwr = fls(max_per_txd) - 1; @@ -2876,12 +2920,12 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } } - if((mss) || (skb->ip_summed == CHECKSUM_HW)) /* reserve a descriptor for the offload context */ + if ((mss) || (skb->ip_summed == CHECKSUM_HW)) count++; count++; #else - if(skb->ip_summed == CHECKSUM_HW) + if (skb->ip_summed == CHECKSUM_HW) count++; #endif @@ -2894,24 +2938,24 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) count += TXD_USE_COUNT(len, max_txd_pwr); - if(adapter->pcix_82544) + if (adapter->pcix_82544) count++; - /* work-around for errata 10 and it applies to all controllers + /* work-around for errata 10 and it applies to all controllers * in PCI-X mode, so add one more descriptor to the count */ - if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && + if (unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && (len > 2015))) count++; nr_frags = skb_shinfo(skb)->nr_frags; - for(f = 0; f < nr_frags; f++) + for (f = 0; f < nr_frags; f++) count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size, max_txd_pwr); - if(adapter->pcix_82544) + if (adapter->pcix_82544) count += nr_frags; - if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) + if (adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) e1000_transfer_dhcp_info(adapter, skb); local_irq_save(flags); @@ -2929,8 +2973,8 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_BUSY; } - if(unlikely(adapter->hw.mac_type == e1000_82547)) { - if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { + if (unlikely(adapter->hw.mac_type == e1000_82547)) { + if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) { netif_stop_queue(netdev); mod_timer(&adapter->tx_fifo_stall_timer, jiffies); spin_unlock_irqrestore(&tx_ring->tx_lock, flags); @@ -2938,13 +2982,13 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } } - if(unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { + if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { tx_flags |= E1000_TX_FLAGS_VLAN; tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); } first = tx_ring->next_to_use; - + tso = e1000_tso(adapter, tx_ring, skb); if (tso < 0) { dev_kfree_skb_any(skb); @@ -3033,9 +3077,9 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) struct e1000_adapter *adapter = netdev_priv(netdev); int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; - if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || - (max_frame > MAX_JUMBO_FRAME_SIZE)) { - DPRINTK(PROBE, ERR, "Invalid MTU setting\n"); + if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || + (max_frame > MAX_JUMBO_FRAME_SIZE)) { + DPRINTK(PROBE, ERR, "Invalid MTU setting\n"); return -EINVAL; } @@ -3083,7 +3127,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) netdev->mtu = new_mtu; - if(netif_running(netdev)) { + if (netif_running(netdev)) { e1000_down(adapter); e1000_up(adapter); } @@ -3170,7 +3214,7 @@ e1000_update_stats(struct e1000_adapter *adapter) hw->collision_delta = E1000_READ_REG(hw, COLC); adapter->stats.colc += hw->collision_delta; - if(hw->mac_type >= e1000_82543) { + if (hw->mac_type >= e1000_82543) { adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC); adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC); adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS); @@ -3178,7 +3222,7 @@ e1000_update_stats(struct e1000_adapter *adapter) adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC); adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC); } - if(hw->mac_type > e1000_82547_rev_2) { + if (hw->mac_type > e1000_82547_rev_2) { adapter->stats.iac += E1000_READ_REG(hw, IAC); adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); @@ -3222,14 +3266,14 @@ e1000_update_stats(struct e1000_adapter *adapter) /* Phy Stats */ - if(hw->media_type == e1000_media_type_copper) { - if((adapter->link_speed == SPEED_1000) && + if (hw->media_type == e1000_media_type_copper) { + if ((adapter->link_speed == SPEED_1000) && (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) { phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; adapter->phy_stats.idle_errors += phy_tmp; } - if((hw->mac_type <= e1000_82546) && + if ((hw->mac_type <= e1000_82546) && (hw->phy_type == e1000_phy_m88) && !e1000_read_phy_reg(hw, M88E1000_RX_ERR_CNTR, &phy_tmp)) adapter->phy_stats.receive_errors += phy_tmp; @@ -3294,7 +3338,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) return IRQ_NONE; /* Not our interrupt */ } - if(unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { + if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { hw->get_link_status = 1; mod_timer(&adapter->watchdog_timer, jiffies); } @@ -3326,26 +3370,26 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) #else /* if !CONFIG_E1000_NAPI */ /* Writing IMC and IMS is needed for 82547. - Due to Hub Link bus being occupied, an interrupt - de-assertion message is not able to be sent. - When an interrupt assertion message is generated later, - two messages are re-ordered and sent out. - That causes APIC to think 82547 is in de-assertion - state, while 82547 is in assertion state, resulting - in dead lock. Writing IMC forces 82547 into - de-assertion state. - */ - if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2){ + * Due to Hub Link bus being occupied, an interrupt + * de-assertion message is not able to be sent. + * When an interrupt assertion message is generated later, + * two messages are re-ordered and sent out. + * That causes APIC to think 82547 is in de-assertion + * state, while 82547 is in assertion state, resulting + * in dead lock. Writing IMC forces 82547 into + * de-assertion state. + */ + if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) { atomic_inc(&adapter->irq_sem); E1000_WRITE_REG(hw, IMC, ~0); } - for(i = 0; i < E1000_MAX_INTR; i++) - if(unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & + for (i = 0; i < E1000_MAX_INTR; i++) + if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & !e1000_clean_tx_irq(adapter, adapter->tx_ring))) break; - if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) + if (hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) e1000_irq_enable(adapter); #endif /* CONFIG_E1000_NAPI */ @@ -3397,9 +3441,9 @@ e1000_clean(struct net_device *poll_dev, int *budget) *budget -= work_done; poll_dev->quota -= work_done; - + /* If no Tx and not enough Rx work done, exit the polling mode */ - if((!tx_cleaned && (work_done == 0)) || + if ((!tx_cleaned && (work_done == 0)) || !netif_running(adapter->netdev)) { quit_polling: netif_rx_complete(poll_dev); @@ -3431,7 +3475,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, eop_desc = E1000_TX_DESC(*tx_ring, eop); while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { - for(cleaned = FALSE; !cleaned; ) { + for (cleaned = FALSE; !cleaned; ) { tx_desc = E1000_TX_DESC(*tx_ring, i); buffer_info = &tx_ring->buffer_info[i]; cleaned = (i == eop); @@ -3442,7 +3486,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, e1000_unmap_and_free_tx_resource(adapter, buffer_info); memset(tx_desc, 0, sizeof(struct e1000_tx_desc)); - if(unlikely(++i == tx_ring->count)) i = 0; + if (unlikely(++i == tx_ring->count)) i = 0; } #ifdef CONFIG_E1000_MQ @@ -3457,7 +3501,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, spin_lock(&tx_ring->tx_lock); - if(unlikely(cleaned && netif_queue_stopped(netdev) && + if (unlikely(cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev))) netif_wake_queue(netdev); @@ -3519,21 +3563,21 @@ e1000_rx_checksum(struct e1000_adapter *adapter, skb->ip_summed = CHECKSUM_NONE; /* 82543 or newer only */ - if(unlikely(adapter->hw.mac_type < e1000_82543)) return; + if (unlikely(adapter->hw.mac_type < e1000_82543)) return; /* Ignore Checksum bit is set */ - if(unlikely(status & E1000_RXD_STAT_IXSM)) return; + if (unlikely(status & E1000_RXD_STAT_IXSM)) return; /* TCP/UDP checksum error bit is set */ - if(unlikely(errors & E1000_RXD_ERR_TCPE)) { + if (unlikely(errors & E1000_RXD_ERR_TCPE)) { /* let the stack verify checksum errors */ adapter->hw_csum_err++; return; } /* TCP/UDP Checksum has not been calculated */ - if(adapter->hw.mac_type <= e1000_82547_rev_2) { - if(!(status & E1000_RXD_STAT_TCPCS)) + if (adapter->hw.mac_type <= e1000_82547_rev_2) { + if (!(status & E1000_RXD_STAT_TCPCS)) return; } else { - if(!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) + if (!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) return; } /* It must be a TCP or UDP packet with a valid checksum */ @@ -3569,9 +3613,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, { struct net_device *netdev = adapter->netdev; struct pci_dev *pdev = adapter->pdev; - struct e1000_rx_desc *rx_desc; - struct e1000_buffer *buffer_info; - struct sk_buff *skb; + struct e1000_rx_desc *rx_desc, *next_rxd; + struct e1000_buffer *buffer_info, *next_buffer; unsigned long flags; uint32_t length; uint8_t last_byte; @@ -3581,16 +3624,25 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, i = rx_ring->next_to_clean; rx_desc = E1000_RX_DESC(*rx_ring, i); + buffer_info = &rx_ring->buffer_info[i]; - while(rx_desc->status & E1000_RXD_STAT_DD) { - buffer_info = &rx_ring->buffer_info[i]; + while (rx_desc->status & E1000_RXD_STAT_DD) { + struct sk_buff *skb, *next_skb; u8 status; #ifdef CONFIG_E1000_NAPI - if(*work_done >= work_to_do) + if (*work_done >= work_to_do) break; (*work_done)++; #endif status = rx_desc->status; + skb = buffer_info->skb; + buffer_info->skb = NULL; + + if (++i == rx_ring->count) i = 0; + next_rxd = E1000_RX_DESC(*rx_ring, i); + next_buffer = &rx_ring->buffer_info[i]; + next_skb = next_buffer->skb; + cleaned = TRUE; cleaned_count++; pci_unmap_single(pdev, @@ -3598,20 +3650,50 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, buffer_info->length, PCI_DMA_FROMDEVICE); - skb = buffer_info->skb; length = le16_to_cpu(rx_desc->length); - if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) { - /* All receives must fit into a single buffer */ - E1000_DBG("%s: Receive packet consumed multiple" - " buffers\n", netdev->name); - dev_kfree_skb_irq(skb); + skb_put(skb, length); + + if (!(status & E1000_RXD_STAT_EOP)) { + if (!rx_ring->rx_skb_top) { + rx_ring->rx_skb_top = skb; + rx_ring->rx_skb_top->len = length; + rx_ring->rx_skb_prev = skb; + } else { + if (skb_shinfo(rx_ring->rx_skb_top)->frag_list) { + rx_ring->rx_skb_prev->next = skb; + skb->prev = rx_ring->rx_skb_prev; + } else { + skb_shinfo(rx_ring->rx_skb_top)->frag_list = skb; + } + rx_ring->rx_skb_prev = skb; + rx_ring->rx_skb_top->data_len += length; + } goto next_desc; + } else { + if (rx_ring->rx_skb_top) { + if (skb_shinfo(rx_ring->rx_skb_top) + ->frag_list) { + rx_ring->rx_skb_prev->next = skb; + skb->prev = rx_ring->rx_skb_prev; + } else + skb_shinfo(rx_ring->rx_skb_top) + ->frag_list = skb; + + rx_ring->rx_skb_top->data_len += length; + rx_ring->rx_skb_top->len += + rx_ring->rx_skb_top->data_len; + + skb = rx_ring->rx_skb_top; + multi_descriptor = TRUE; + rx_ring->rx_skb_top = NULL; + rx_ring->rx_skb_prev = NULL; + } } - if(unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) { + if (unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) { last_byte = *(skb->data + length - 1); - if(TBI_ACCEPT(&adapter->hw, rx_desc->status, + if (TBI_ACCEPT(&adapter->hw, status, rx_desc->errors, length, last_byte)) { spin_lock_irqsave(&adapter->stats_lock, flags); e1000_tbi_adjust_stats(&adapter->hw, @@ -3656,9 +3738,10 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, (uint32_t)(status) | ((uint32_t)(rx_desc->errors) << 24), rx_desc->csum, skb); + skb->protocol = eth_type_trans(skb, netdev); #ifdef CONFIG_E1000_NAPI - if(unlikely(adapter->vlgrp && + if (unlikely(adapter->vlgrp && (status & E1000_RXD_STAT_VP))) { vlan_hwaccel_receive_skb(skb, adapter->vlgrp, le16_to_cpu(rx_desc->special) & @@ -3667,8 +3750,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, netif_receive_skb(skb); } #else /* CONFIG_E1000_NAPI */ - if(unlikely(adapter->vlgrp && - (rx_desc->status & E1000_RXD_STAT_VP))) { + if (unlikely(adapter->vlgrp && + (status & E1000_RXD_STAT_VP))) { vlan_hwaccel_rx(skb, adapter->vlgrp, le16_to_cpu(rx_desc->special) & E1000_RXD_SPC_VLAN_MASK); @@ -3691,6 +3774,8 @@ next_desc: cleaned_count = 0; } + rx_desc = next_rxd; + buffer_info = next_buffer; } rx_ring->next_to_clean = i; @@ -3716,13 +3801,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, struct e1000_rx_ring *rx_ring) #endif { - union e1000_rx_desc_packet_split *rx_desc; + union e1000_rx_desc_packet_split *rx_desc, *next_rxd; struct net_device *netdev = adapter->netdev; struct pci_dev *pdev = adapter->pdev; - struct e1000_buffer *buffer_info; + struct e1000_buffer *buffer_info, *next_buffer; struct e1000_ps_page *ps_page; struct e1000_ps_page_dma *ps_page_dma; - struct sk_buff *skb; + struct sk_buff *skb, *next_skb; unsigned int i, j; uint32_t length, staterr; int cleaned_count = 0; @@ -3731,39 +3816,44 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, i = rx_ring->next_to_clean; rx_desc = E1000_RX_DESC_PS(*rx_ring, i); staterr = le32_to_cpu(rx_desc->wb.middle.status_error); + buffer_info = &rx_ring->buffer_info[i]; - while(staterr & E1000_RXD_STAT_DD) { - buffer_info = &rx_ring->buffer_info[i]; + while (staterr & E1000_RXD_STAT_DD) { ps_page = &rx_ring->ps_page[i]; ps_page_dma = &rx_ring->ps_page_dma[i]; #ifdef CONFIG_E1000_NAPI - if(unlikely(*work_done >= work_to_do)) + if (unlikely(*work_done >= work_to_do)) break; (*work_done)++; #endif + skb = buffer_info->skb; + + if (++i == rx_ring->count) i = 0; + next_rxd = E1000_RX_DESC_PS(*rx_ring, i); + next_buffer = &rx_ring->buffer_info[i]; + next_skb = next_buffer->skb; + cleaned = TRUE; cleaned_count++; pci_unmap_single(pdev, buffer_info->dma, buffer_info->length, PCI_DMA_FROMDEVICE); - skb = buffer_info->skb; - - if(unlikely(!(staterr & E1000_RXD_STAT_EOP))) { + if (unlikely(!(staterr & E1000_RXD_STAT_EOP))) { E1000_DBG("%s: Packet Split buffers didn't pick up" " the full packet\n", netdev->name); dev_kfree_skb_irq(skb); goto next_desc; } - if(unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) { + if (unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) { dev_kfree_skb_irq(skb); goto next_desc; } length = le16_to_cpu(rx_desc->wb.middle.length0); - if(unlikely(!length)) { + if (unlikely(!length)) { E1000_DBG("%s: Last part of the packet spanning" " multiple descriptors\n", netdev->name); dev_kfree_skb_irq(skb); @@ -3773,8 +3863,8 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, /* Good Receive */ skb_put(skb, length); - for(j = 0; j < adapter->rx_ps_pages; j++) { - if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) + for (j = 0; j < adapter->rx_ps_pages; j++) { + if (!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) break; pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j], @@ -3794,15 +3884,11 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); skb->protocol = eth_type_trans(skb, netdev); - if(likely(rx_desc->wb.upper.header_status & - E1000_RXDPS_HDRSTAT_HDRSP)) { + if (likely(rx_desc->wb.upper.header_status & + E1000_RXDPS_HDRSTAT_HDRSP)) adapter->rx_hdr_split++; -#ifdef HAVE_RX_ZERO_COPY - skb_shinfo(skb)->zero_copy = TRUE; -#endif - } #ifdef CONFIG_E1000_NAPI - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { + if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { vlan_hwaccel_receive_skb(skb, adapter->vlgrp, le16_to_cpu(rx_desc->wb.middle.vlan) & E1000_RXD_SPC_VLAN_MASK); @@ -3810,7 +3896,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, netif_receive_skb(skb); } #else /* CONFIG_E1000_NAPI */ - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { + if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { vlan_hwaccel_rx(skb, adapter->vlgrp, le16_to_cpu(rx_desc->wb.middle.vlan) & E1000_RXD_SPC_VLAN_MASK); @@ -3834,6 +3920,9 @@ next_desc: cleaned_count = 0; } + rx_desc = next_rxd; + buffer_info = next_buffer; + staterr = le32_to_cpu(rx_desc->wb.middle.status_error); } rx_ring->next_to_clean = i; @@ -3875,7 +3964,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter, } - if(unlikely(!skb)) { + if (unlikely(!skb)) { /* Better luck next round */ adapter->alloc_rx_buff_failed++; break; @@ -3940,20 +4029,23 @@ map_skb: rx_desc = E1000_RX_DESC(*rx_ring, i); rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); - if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { - /* Force memory writes to complete before letting h/w - * know there are new descriptors to fetch. (Only - * applicable for weak-ordered memory model archs, - * such as IA-64). */ - wmb(); - writel(i, adapter->hw.hw_addr + rx_ring->rdt); - } - - if(unlikely(++i == rx_ring->count)) i = 0; + if (unlikely(++i == rx_ring->count)) + i = 0; buffer_info = &rx_ring->buffer_info[i]; } - rx_ring->next_to_use = i; + if (likely(rx_ring->next_to_use != i)) { + rx_ring->next_to_use = i; + if (unlikely(i-- == 0)) + i = (rx_ring->count - 1); + + /* Force memory writes to complete before letting h/w + * know there are new descriptors to fetch. (Only + * applicable for weak-ordered memory model archs, + * such as IA-64). */ + wmb(); + writel(i, adapter->hw.hw_addr + rx_ring->rdt); + } } /** @@ -3983,13 +4075,15 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, while (cleaned_count--) { rx_desc = E1000_RX_DESC_PS(*rx_ring, i); - for(j = 0; j < PS_PAGE_BUFFERS; j++) { + for (j = 0; j < PS_PAGE_BUFFERS; j++) { if (j < adapter->rx_ps_pages) { if (likely(!ps_page->ps_page[j])) { ps_page->ps_page[j] = alloc_page(GFP_ATOMIC); - if (unlikely(!ps_page->ps_page[j])) + if (unlikely(!ps_page->ps_page[j])) { + adapter->alloc_rx_buff_failed++; goto no_buffers; + } ps_page_dma->ps_page_dma[j] = pci_map_page(pdev, ps_page->ps_page[j], @@ -3997,7 +4091,7 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, PCI_DMA_FROMDEVICE); } /* Refresh the desc even if buffer_addrs didn't - * change because each write-back erases + * change because each write-back erases * this info. */ rx_desc->read.buffer_addr[j+1] = @@ -4008,8 +4102,10 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); - if(unlikely(!skb)) + if (unlikely(!skb)) { + adapter->alloc_rx_buff_failed++; break; + } /* Make buffer alignment 2 beyond a 16 byte boundary * this will result in a 16 byte aligned IP header after @@ -4027,27 +4123,28 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); - if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { - /* Force memory writes to complete before letting h/w - * know there are new descriptors to fetch. (Only - * applicable for weak-ordered memory model archs, - * such as IA-64). */ - wmb(); - /* Hardware increments by 16 bytes, but packet split - * descriptors are 32 bytes...so we increment tail - * twice as much. - */ - writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt); - } - - if(unlikely(++i == rx_ring->count)) i = 0; + if (unlikely(++i == rx_ring->count)) i = 0; buffer_info = &rx_ring->buffer_info[i]; ps_page = &rx_ring->ps_page[i]; ps_page_dma = &rx_ring->ps_page_dma[i]; } no_buffers: - rx_ring->next_to_use = i; + if (likely(rx_ring->next_to_use != i)) { + rx_ring->next_to_use = i; + if (unlikely(i-- == 0)) i = (rx_ring->count - 1); + + /* Force memory writes to complete before letting h/w + * know there are new descriptors to fetch. (Only + * applicable for weak-ordered memory model archs, + * such as IA-64). */ + wmb(); + /* Hardware increments by 16 bytes, but packet split + * descriptors are 32 bytes...so we increment tail + * twice as much. + */ + writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt); + } } /** @@ -4061,24 +4158,24 @@ e1000_smartspeed(struct e1000_adapter *adapter) uint16_t phy_status; uint16_t phy_ctrl; - if((adapter->hw.phy_type != e1000_phy_igp) || !adapter->hw.autoneg || + if ((adapter->hw.phy_type != e1000_phy_igp) || !adapter->hw.autoneg || !(adapter->hw.autoneg_advertised & ADVERTISE_1000_FULL)) return; - if(adapter->smartspeed == 0) { + if (adapter->smartspeed == 0) { /* If Master/Slave config fault is asserted twice, * we assume back-to-back */ e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); - if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; + if (!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); - if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; + if (!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); - if(phy_ctrl & CR_1000T_MS_ENABLE) { + if (phy_ctrl & CR_1000T_MS_ENABLE) { phy_ctrl &= ~CR_1000T_MS_ENABLE; e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl); adapter->smartspeed++; - if(!e1000_phy_setup_autoneg(&adapter->hw) && + if (!e1000_phy_setup_autoneg(&adapter->hw) && !e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) { phy_ctrl |= (MII_CR_AUTO_NEG_EN | @@ -4088,12 +4185,12 @@ e1000_smartspeed(struct e1000_adapter *adapter) } } return; - } else if(adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) { + } else if (adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) { /* If still no link, perhaps using 2/3 pair cable */ e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); phy_ctrl |= CR_1000T_MS_ENABLE; e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl); - if(!e1000_phy_setup_autoneg(&adapter->hw) && + if (!e1000_phy_setup_autoneg(&adapter->hw) && !e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) { phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); @@ -4101,7 +4198,7 @@ e1000_smartspeed(struct e1000_adapter *adapter) } } /* Restart process after E1000_SMARTSPEED_MAX iterations */ - if(adapter->smartspeed++ == E1000_SMARTSPEED_MAX) + if (adapter->smartspeed++ == E1000_SMARTSPEED_MAX) adapter->smartspeed = 0; } @@ -4142,7 +4239,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) uint16_t spddplx; unsigned long flags; - if(adapter->hw.media_type != e1000_media_type_copper) + if (adapter->hw.media_type != e1000_media_type_copper) return -EOPNOTSUPP; switch (cmd) { @@ -4150,10 +4247,10 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) data->phy_id = adapter->hw.phy_addr; break; case SIOCGMIIREG: - if(!capable(CAP_NET_ADMIN)) + if (!capable(CAP_NET_ADMIN)) return -EPERM; spin_lock_irqsave(&adapter->stats_lock, flags); - if(e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, + if (e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, &data->val_out)) { spin_unlock_irqrestore(&adapter->stats_lock, flags); return -EIO; @@ -4161,23 +4258,23 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) spin_unlock_irqrestore(&adapter->stats_lock, flags); break; case SIOCSMIIREG: - if(!capable(CAP_NET_ADMIN)) + if (!capable(CAP_NET_ADMIN)) return -EPERM; - if(data->reg_num & ~(0x1F)) + if (data->reg_num & ~(0x1F)) return -EFAULT; mii_reg = data->val_in; spin_lock_irqsave(&adapter->stats_lock, flags); - if(e1000_write_phy_reg(&adapter->hw, data->reg_num, + if (e1000_write_phy_reg(&adapter->hw, data->reg_num, mii_reg)) { spin_unlock_irqrestore(&adapter->stats_lock, flags); return -EIO; } - if(adapter->hw.phy_type == e1000_phy_m88) { + if (adapter->hw.phy_type == e1000_phy_m88) { switch (data->reg_num) { case PHY_CTRL: - if(mii_reg & MII_CR_POWER_DOWN) + if (mii_reg & MII_CR_POWER_DOWN) break; - if(mii_reg & MII_CR_AUTO_NEG_EN) { + if (mii_reg & MII_CR_AUTO_NEG_EN) { adapter->hw.autoneg = 1; adapter->hw.autoneg_advertised = 0x2F; } else { @@ -4192,14 +4289,14 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) HALF_DUPLEX; retval = e1000_set_spd_dplx(adapter, spddplx); - if(retval) { + if (retval) { spin_unlock_irqrestore( - &adapter->stats_lock, + &adapter->stats_lock, flags); return retval; } } - if(netif_running(adapter->netdev)) { + if (netif_running(adapter->netdev)) { e1000_down(adapter); e1000_up(adapter); } else @@ -4207,7 +4304,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) break; case M88E1000_PHY_SPEC_CTRL: case M88E1000_EXT_PHY_SPEC_CTRL: - if(e1000_phy_reset(&adapter->hw)) { + if (e1000_phy_reset(&adapter->hw)) { spin_unlock_irqrestore( &adapter->stats_lock, flags); return -EIO; @@ -4217,9 +4314,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) } else { switch (data->reg_num) { case PHY_CTRL: - if(mii_reg & MII_CR_POWER_DOWN) + if (mii_reg & MII_CR_POWER_DOWN) break; - if(netif_running(adapter->netdev)) { + if (netif_running(adapter->netdev)) { e1000_down(adapter); e1000_up(adapter); } else @@ -4241,7 +4338,7 @@ e1000_pci_set_mwi(struct e1000_hw *hw) struct e1000_adapter *adapter = hw->back; int ret_val = pci_set_mwi(adapter->pdev); - if(ret_val) + if (ret_val) DPRINTK(PROBE, ERR, "Error in setting MWI\n"); } @@ -4290,7 +4387,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) e1000_irq_disable(adapter); adapter->vlgrp = grp; - if(grp) { + if (grp) { /* enable VLAN tag insert/strip */ ctrl = E1000_READ_REG(&adapter->hw, CTRL); ctrl |= E1000_CTRL_VME; @@ -4312,7 +4409,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) rctl = E1000_READ_REG(&adapter->hw, RCTL); rctl &= ~E1000_RCTL_VFE; E1000_WRITE_REG(&adapter->hw, RCTL, rctl); - if(adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) { + if (adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) { e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; } @@ -4326,9 +4423,10 @@ e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) { struct e1000_adapter *adapter = netdev_priv(netdev); uint32_t vfta, index; - if((adapter->hw.mng_cookie.status & - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && - (vid == adapter->mng_vlan_id)) + + if ((adapter->hw.mng_cookie.status & + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && + (vid == adapter->mng_vlan_id)) return; /* add VID to filter table */ index = (vid >> 5) & 0x7F; @@ -4345,13 +4443,13 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) e1000_irq_disable(adapter); - if(adapter->vlgrp) + if (adapter->vlgrp) adapter->vlgrp->vlan_devices[vid] = NULL; e1000_irq_enable(adapter); - if((adapter->hw.mng_cookie.status & - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && + if ((adapter->hw.mng_cookie.status & + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && (vid == adapter->mng_vlan_id)) { /* release control to f/w */ e1000_release_hw_control(adapter); @@ -4370,10 +4468,10 @@ e1000_restore_vlan(struct e1000_adapter *adapter) { e1000_vlan_rx_register(adapter->netdev, adapter->vlgrp); - if(adapter->vlgrp) { + if (adapter->vlgrp) { uint16_t vid; - for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { - if(!adapter->vlgrp->vlan_devices[vid]) + for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { + if (!adapter->vlgrp->vlan_devices[vid]) continue; e1000_vlan_rx_add_vid(adapter->netdev, vid); } @@ -4386,13 +4484,13 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) adapter->hw.autoneg = 0; /* Fiber NICs only allow 1000 gbps Full duplex */ - if((adapter->hw.media_type == e1000_media_type_fiber) && + if ((adapter->hw.media_type == e1000_media_type_fiber) && spddplx != (SPEED_1000 + DUPLEX_FULL)) { DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); return -EINVAL; } - switch(spddplx) { + switch (spddplx) { case SPEED_10 + DUPLEX_HALF: adapter->hw.forced_speed_duplex = e1000_10_half; break; @@ -4418,6 +4516,54 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) } #ifdef CONFIG_PM +/* these functions save and restore 16 or 64 dwords (64-256 bytes) of config + * space versus the 64 bytes that pci_[save|restore]_state handle + */ +#define PCIE_CONFIG_SPACE_LEN 256 +#define PCI_CONFIG_SPACE_LEN 64 +static int +e1000_pci_save_state(struct e1000_adapter *adapter) +{ + struct pci_dev *dev = adapter->pdev; + int size; + int i; + if (adapter->hw.mac_type >= e1000_82571) + size = PCIE_CONFIG_SPACE_LEN; + else + size = PCI_CONFIG_SPACE_LEN; + + WARN_ON(adapter->config_space != NULL); + + adapter->config_space = kmalloc(size, GFP_KERNEL); + if (!adapter->config_space) { + DPRINTK(PROBE, ERR, "unable to allocate %d bytes\n", size); + return -ENOMEM; + } + for (i = 0; i < (size / 4); i++) + pci_read_config_dword(dev, i * 4, &adapter->config_space[i]); + return 0; +} + +static void +e1000_pci_restore_state(struct e1000_adapter *adapter) +{ + struct pci_dev *dev = adapter->pdev; + int size; + int i; + if (adapter->config_space == NULL) + return; + if (adapter->hw.mac_type >= e1000_82571) + size = PCIE_CONFIG_SPACE_LEN; + else + size = PCI_CONFIG_SPACE_LEN; + for (i = 0; i < (size / 4); i++) + pci_write_config_dword(dev, i * 4, adapter->config_space[i]); + kfree(adapter->config_space); + adapter->config_space = NULL; + return; +} +#endif /* CONFIG_PM */ + static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) { @@ -4429,25 +4575,33 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(netdev); - if(netif_running(netdev)) + if (netif_running(netdev)) e1000_down(adapter); +#ifdef CONFIG_PM + /* implement our own version of pci_save_state(pdev) because pci + * express adapters have larger 256 byte config spaces */ + retval = e1000_pci_save_state(adapter); + if (retval) + return retval; +#endif + status = E1000_READ_REG(&adapter->hw, STATUS); - if(status & E1000_STATUS_LU) + if (status & E1000_STATUS_LU) wufc &= ~E1000_WUFC_LNKC; - if(wufc) { + if (wufc) { e1000_setup_rctl(adapter); e1000_set_multi(netdev); /* turn on all-multi mode if wake on multicast is enabled */ - if(adapter->wol & E1000_WUFC_MC) { + if (adapter->wol & E1000_WUFC_MC) { rctl = E1000_READ_REG(&adapter->hw, RCTL); rctl |= E1000_RCTL_MPE; E1000_WRITE_REG(&adapter->hw, RCTL, rctl); } - if(adapter->hw.mac_type >= e1000_82540) { + if (adapter->hw.mac_type >= e1000_82540) { ctrl = E1000_READ_REG(&adapter->hw, CTRL); /* advertise wake from D3Cold */ #define E1000_CTRL_ADVD3WUC 0x00100000 @@ -4458,7 +4612,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); } - if(adapter->hw.media_type == e1000_media_type_fiber || + if (adapter->hw.media_type == e1000_media_type_fiber || adapter->hw.media_type == e1000_media_type_internal_serdes) { /* keep the laser running in D3 */ ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); @@ -4488,12 +4642,10 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n"); } - pci_save_state(pdev); - - if(adapter->hw.mac_type >= e1000_82540 && + if (adapter->hw.mac_type >= e1000_82540 && adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); - if(manc & E1000_MANC_SMBUS_EN) { + if (manc & E1000_MANC_SMBUS_EN) { manc |= E1000_MANC_ARP_EN; E1000_WRITE_REG(&adapter->hw, MANC, manc); retval = pci_enable_wake(pdev, PCI_D3hot, 1); @@ -4518,6 +4670,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) return 0; } +#ifdef CONFIG_PM static int e1000_resume(struct pci_dev *pdev) { @@ -4529,6 +4682,7 @@ e1000_resume(struct pci_dev *pdev) retval = pci_set_power_state(pdev, PCI_D0); if (retval) DPRINTK(PROBE, ERR, "Error in setting power state\n"); + e1000_pci_restore_state(adapter); ret_val = pci_enable_device(pdev); pci_set_master(pdev); @@ -4542,12 +4696,12 @@ e1000_resume(struct pci_dev *pdev) e1000_reset(adapter); E1000_WRITE_REG(&adapter->hw, WUS, ~0); - if(netif_running(netdev)) + if (netif_running(netdev)) e1000_up(adapter); netif_device_attach(netdev); - if(adapter->hw.mac_type >= e1000_82540 && + if (adapter->hw.mac_type >= e1000_82540 && adapter->hw.media_type == e1000_media_type_copper) { manc = E1000_READ_REG(&adapter->hw, MANC); manc &= ~(E1000_MANC_ARP_EN); diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h index aac64de6143..9790db974dc 100644 --- a/drivers/net/e1000/e1000_osdep.h +++ b/drivers/net/e1000/e1000_osdep.h @@ -47,7 +47,7 @@ BUG(); \ } else { \ msleep(x); \ - } } while(0) + } } while (0) /* Some workarounds require millisecond delays and are run during interrupt * 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 0a7918c6255..3768d83cd57 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c @@ -227,7 +227,7 @@ static int __devinit e1000_validate_option(int *value, struct e1000_option *opt, struct e1000_adapter *adapter) { - if(*value == OPTION_UNSET) { + if (*value == OPTION_UNSET) { *value = opt->def; return 0; } @@ -244,7 +244,7 @@ e1000_validate_option(int *value, struct e1000_option *opt, } break; case range_option: - if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) { + if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { DPRINTK(PROBE, INFO, "%s set to %i\n", opt->name, *value); return 0; @@ -254,10 +254,10 @@ e1000_validate_option(int *value, struct e1000_option *opt, int i; struct e1000_opt_list *ent; - for(i = 0; i < opt->arg.l.nr; i++) { + for (i = 0; i < opt->arg.l.nr; i++) { ent = &opt->arg.l.p[i]; - if(*value == ent->i) { - if(ent->str[0] != '\0') + if (*value == ent->i) { + if (ent->str[0] != '\0') DPRINTK(PROBE, INFO, "%s\n", ent->str); return 0; } @@ -291,7 +291,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) { int bd = adapter->bd_number; - if(bd >= E1000_MAX_NIC) { + if (bd >= E1000_MAX_NIC) { DPRINTK(PROBE, NOTICE, "Warning: no configuration for board #%i\n", bd); DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); @@ -315,7 +315,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_TxDescriptors > bd) { tx_ring->count = TxDescriptors[bd]; e1000_validate_option(&tx_ring->count, &opt, adapter); - E1000_ROUNDUP(tx_ring->count, + E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); } else { tx_ring->count = opt.def; @@ -341,7 +341,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_RxDescriptors > bd) { rx_ring->count = RxDescriptors[bd]; e1000_validate_option(&rx_ring->count, &opt, adapter); - E1000_ROUNDUP(rx_ring->count, + E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); } else { rx_ring->count = opt.def; @@ -403,7 +403,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_TxIntDelay > bd) { adapter->tx_int_delay = TxIntDelay[bd]; - e1000_validate_option(&adapter->tx_int_delay, &opt, + e1000_validate_option(&adapter->tx_int_delay, &opt, adapter); } else { adapter->tx_int_delay = opt.def; @@ -421,7 +421,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_TxAbsIntDelay > bd) { adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; - e1000_validate_option(&adapter->tx_abs_int_delay, &opt, + e1000_validate_option(&adapter->tx_abs_int_delay, &opt, adapter); } else { adapter->tx_abs_int_delay = opt.def; @@ -439,7 +439,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_RxIntDelay > bd) { adapter->rx_int_delay = RxIntDelay[bd]; - e1000_validate_option(&adapter->rx_int_delay, &opt, + e1000_validate_option(&adapter->rx_int_delay, &opt, adapter); } else { adapter->rx_int_delay = opt.def; @@ -457,7 +457,7 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_RxAbsIntDelay > bd) { adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; - e1000_validate_option(&adapter->rx_abs_int_delay, &opt, + e1000_validate_option(&adapter->rx_abs_int_delay, &opt, adapter); } else { adapter->rx_abs_int_delay = opt.def; @@ -475,17 +475,17 @@ e1000_check_options(struct e1000_adapter *adapter) if (num_InterruptThrottleRate > bd) { adapter->itr = InterruptThrottleRate[bd]; - switch(adapter->itr) { + switch (adapter->itr) { case 0: - DPRINTK(PROBE, INFO, "%s turned off\n", + DPRINTK(PROBE, INFO, "%s turned off\n", opt.name); break; case 1: - DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", + DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", opt.name); break; default: - e1000_validate_option(&adapter->itr, &opt, + e1000_validate_option(&adapter->itr, &opt, adapter); break; } @@ -494,7 +494,7 @@ e1000_check_options(struct e1000_adapter *adapter) } } - switch(adapter->hw.media_type) { + switch (adapter->hw.media_type) { case e1000_media_type_fiber: case e1000_media_type_internal_serdes: e1000_check_fiber_options(adapter); @@ -518,17 +518,17 @@ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter) { int bd = adapter->bd_number; - if(num_Speed > bd) { + if (num_Speed > bd) { DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " "parameter ignored\n"); } - if(num_Duplex > bd) { + if (num_Duplex > bd) { DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " "parameter ignored\n"); } - if((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { + if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " "not valid for fiber adapters, " "parameter ignored\n"); @@ -598,7 +598,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter) } } - if((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { + if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { DPRINTK(PROBE, INFO, "AutoNeg specified along with Speed or Duplex, " "parameter ignored\n"); @@ -659,7 +659,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter) switch (speed + dplx) { case 0: adapter->hw.autoneg = adapter->fc_autoneg = 1; - if((num_Speed > bd) && (speed != 0 || dplx != 0)) + if ((num_Speed > bd) && (speed != 0 || dplx != 0)) DPRINTK(PROBE, INFO, "Speed and duplex autonegotiation enabled\n"); break; diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 5e7199f7b59..9fd1925de36 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -301,7 +301,7 @@ config SERIAL_AT91_TTYAT depends on SERIAL_AT91=y help Say Y here if you wish to have the five internal AT91RM9200 UARTs - appear as /dev/ttyAT0-4 (major 240, minor 0-4) instead of the + appear as /dev/ttyAT0-4 (major 204, minor 154-158) instead of the normal /dev/ttyS0-4 (major 4, minor 64-68). This is necessary if you also want other UARTs, such as external 8250/16C550 compatible UARTs. diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c index 0e206063d68..2113feb75c3 100644 --- a/drivers/serial/at91_serial.c +++ b/drivers/serial/at91_serial.c @@ -222,8 +222,6 @@ static void at91_rx_chars(struct uart_port *port, struct pt_regs *regs) while (status & (AT91_US_RXRDY)) { ch = UART_GET_CHAR(port); - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - goto ignore_char; port->icount.rx++; flg = TTY_NORMAL; diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index 5fc4a62173d..fa4ae94243c 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c @@ -34,6 +34,7 @@ sunserial_console_termios(struct console *con) char *mode_prop = "ttyX-mode"; char *cd_prop = "ttyX-ignore-cd"; char *dtr_prop = "ttyX-rts-dtr-off"; + char *ssp_console_modes_prop = "ssp-console-modes"; int baud, bits, stop, cflag; char parity; int carrier = 0; @@ -43,14 +44,39 @@ sunserial_console_termios(struct console *con) if (!serial_console) return; - if (serial_console == 1) { + switch (serial_console) { + case PROMDEV_OTTYA: mode_prop[3] = 'a'; cd_prop[3] = 'a'; dtr_prop[3] = 'a'; - } else { + break; + + case PROMDEV_OTTYB: mode_prop[3] = 'b'; cd_prop[3] = 'b'; dtr_prop[3] = 'b'; + break; + + case PROMDEV_ORSC: + + nd = prom_pathtoinode("rsc"); + if (!nd) { + strcpy(mode, "115200,8,n,1,-"); + goto no_options; + } + + if (!prom_node_has_property(nd, ssp_console_modes_prop)) { + strcpy(mode, "115200,8,n,1,-"); + goto no_options; + } + + memset(mode, 0, sizeof(mode)); + prom_getstring(nd, ssp_console_modes_prop, mode, sizeof(mode)); + goto no_options; + + default: + strcpy(mode, "9600,8,n,1,-"); + goto no_options; } topnd = prom_getchild(prom_root_node); @@ -110,6 +136,10 @@ no_options: case 9600: cflag |= B9600; break; case 19200: cflag |= B19200; break; case 38400: cflag |= B38400; break; + case 57600: cflag |= B57600; break; + case 115200: cflag |= B115200; break; + case 230400: cflag |= B230400; break; + case 460800: cflag |= B460800; break; default: baud = 9600; cflag |= B9600; break; } diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 7e773ff76c6..8bcaebcc0ad 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) sunserial_console_termios(con); - /* Firmware console speed is limited to 150-->38400 baud so - * this hackish cflag thing is OK. - */ switch (con->cflag & CBAUD) { case B150: baud = 150; break; case B300: baud = 300; break; @@ -910,6 +907,10 @@ static int sunsab_console_setup(struct console *con, char *options) default: case B9600: baud = 9600; break; case B19200: baud = 19200; break; case B38400: baud = 38400; break; + case B57600: baud = 57600; break; + case B115200: baud = 115200; break; + case B230400: baud = 230400; break; + case B460800: baud = 460800; break; }; /* diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h index 740c297eb11..46a0402696d 100644 --- a/include/asm-arm/arch-omap/clock.h +++ b/include/asm-arm/arch-omap/clock.h @@ -38,8 +38,6 @@ struct clk { struct clk_functions { int (*clk_enable)(struct clk *clk); void (*clk_disable)(struct clk *clk); - int (*clk_use)(struct clk *clk); - void (*clk_unuse)(struct clk *clk); long (*clk_round_rate)(struct clk *clk, unsigned long rate); int (*clk_set_rate)(struct clk *clk, unsigned long rate); int (*clk_set_parent)(struct clk *clk, struct clk *parent); diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index dae138b9cac..1409c5bd703 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h @@ -108,6 +108,7 @@ #define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */ #define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */ +#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ #define DINT __REG(0x400000f0) /* DMA Interrupt Register */ #define DRCMR(n) __REG2(0x40000100, (n)<<2) @@ -1614,8 +1615,21 @@ #define SSCR0_National (0x2 << 4) /* National Microwire */ #define SSCR0_ECS (1 << 6) /* External clock select */ #define SSCR0_SSE (1 << 7) /* Synchronous Serial Port Enable */ +#if defined(CONFIG_PXA25x) #define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */ #define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */ +#elif defined(CONFIG_PXA27x) +#define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */ +#define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */ +#define SSCR0_EDSS (1 << 20) /* Extended data size select */ +#define SSCR0_NCS (1 << 21) /* Network clock select */ +#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */ +#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */ +#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */ +#define SSCR0_SlotsPerFrm(c) ((x) - 1) /* Time slots per frame [1..8] */ +#define SSCR0_ADC (1 << 30) /* Audio clock select */ +#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */ +#endif #define SSCR1_RIE (1 << 0) /* Receive FIFO Interrupt Enable */ #define SSCR1_TIE (1 << 1) /* Transmit FIFO Interrupt Enable */ diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index d02f1e8ae1a..3c59b2693fb 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h @@ -163,6 +163,7 @@ enum prom_input_device { PROMDEV_IKBD, /* input from keyboard */ PROMDEV_ITTYA, /* input from ttya */ PROMDEV_ITTYB, /* input from ttyb */ + PROMDEV_IRSC, /* input from rsc */ PROMDEV_I_UNK, }; @@ -174,6 +175,7 @@ enum prom_output_device { PROMDEV_OSCREEN, /* to screen */ PROMDEV_OTTYA, /* to ttya */ PROMDEV_OTTYB, /* to ttyb */ + PROMDEV_ORSC, /* to rsc */ PROMDEV_O_UNK, }; diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index fe26d431de8..7a92c1ce145 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -72,6 +72,7 @@ * over Ethernet */ #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ +#define ETH_P_TIPC 0x88CA /* TIPC */ /* * Non DIX types. Won't clash for 1500 types. diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h index a52c8c64a5a..33a653913d9 100644 --- a/include/linux/tipc_config.h +++ b/include/linux/tipc_config.h @@ -168,10 +168,13 @@ #define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */ /* - * Link priority limits (range from 0 to # priorities - 1) + * Link priority limits (min, default, max, media default) */ -#define TIPC_NUM_LINK_PRI 32 +#define TIPC_MIN_LINK_PRI 0 +#define TIPC_DEF_LINK_PRI 10 +#define TIPC_MAX_LINK_PRI 31 +#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1) /* * Link tolerance limits (min, default, max), in ms diff --git a/net/Kconfig b/net/Kconfig index 9296b269d67..bc603d9aea5 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -150,6 +150,7 @@ endif source "net/dccp/Kconfig" source "net/sctp/Kconfig" +source "net/tipc/Kconfig" source "net/atm/Kconfig" source "net/bridge/Kconfig" source "net/8021q/Kconfig" @@ -159,7 +160,6 @@ source "net/ipx/Kconfig" source "drivers/net/appletalk/Kconfig" source "net/x25/Kconfig" source "net/lapb/Kconfig" -source "net/tipc/Kconfig" config NET_DIVERT bool "Frame Diverter (EXPERIMENTAL)" diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 3827f881f42..da16f8fd149 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, */ mod_cur_headers(pkt_dev); - skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC); + datalen = (odev->hard_header_len + 16) & ~0xf; + skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen, GFP_ATOMIC); if (!skb) { sprintf(pkt_dev->result, "No memory"); return NULL; } - skb_reserve(skb, 16); + skb_reserve(skb, datalen); /* Reserve for ethernet and IP header */ eth = (__u8 *) skb_push(skb, 14); diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 192092b89e5..d8ce7133cd8 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, case IGMPV3_MODE_IS_EXCLUDE: if (gdeleted || sdeleted) return 0; - return !(pmc->gsquery && !psf->sf_gsresp); + if (!(pmc->gsquery && !psf->sf_gsresp)) { + if (pmc->sfmode == MCAST_INCLUDE) + return 1; + /* don't include if this source is excluded + * in all filters + */ + if (psf->sf_count[MCAST_INCLUDE]) + return type == IGMPV3_MODE_IS_INCLUDE; + return pmc->sfcount[MCAST_EXCLUDE] == + psf->sf_count[MCAST_EXCLUDE]; + } + return 0; case IGMPV3_CHANGE_TO_INCLUDE: if (gdeleted || sdeleted) return 0; @@ -385,7 +396,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, struct igmpv3_report *pih; struct igmpv3_grec *pgr = NULL; struct ip_sf_list *psf, *psf_next, *psf_prev, **psf_list; - int scount, first, isquery, truncate; + int scount, stotal, first, isquery, truncate; if (pmc->multiaddr == IGMP_ALL_HOSTS) return skb; @@ -395,25 +406,13 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, truncate = type == IGMPV3_MODE_IS_EXCLUDE || type == IGMPV3_CHANGE_TO_EXCLUDE; + stotal = scount = 0; + psf_list = sdeleted ? &pmc->tomb : &pmc->sources; - if (!*psf_list) { - if (type == IGMPV3_ALLOW_NEW_SOURCES || - type == IGMPV3_BLOCK_OLD_SOURCES) - return skb; - if (pmc->crcount || isquery) { - /* make sure we have room for group header and at - * least one source. - */ - if (skb && AVAILABLE(skb) < sizeof(struct igmpv3_grec)+ - sizeof(__u32)) { - igmpv3_sendpack(skb); - skb = NULL; /* add_grhead will get a new one */ - } - skb = add_grhead(skb, pmc, type, &pgr); - } - return skb; - } + if (!*psf_list) + goto empty_source; + pih = skb ? (struct igmpv3_report *)skb->h.igmph : NULL; /* 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, } } first = 1; - scount = 0; psf_prev = NULL; for (psf=*psf_list; psf; psf=psf_next) { u32 *psrc; @@ -460,7 +458,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, } psrc = (u32 *)skb_put(skb, sizeof(u32)); *psrc = psf->sf_inaddr; - scount++; + scount++; stotal++; if ((type == IGMPV3_ALLOW_NEW_SOURCES || type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) { psf->sf_crcount--; @@ -475,6 +473,21 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, } psf_prev = psf; } + +empty_source: + if (!stotal) { + if (type == IGMPV3_ALLOW_NEW_SOURCES || + type == IGMPV3_BLOCK_OLD_SOURCES) + return skb; + if (pmc->crcount || isquery) { + /* make sure we have room for group header */ + if (skb && AVAILABLE(skb)<sizeof(struct igmpv3_grec)) { + igmpv3_sendpack(skb); + skb = NULL; /* add_grhead will get a new one */ + } + skb = add_grhead(skb, pmc, type, &pgr); + } + } if (pgr) pgr->grec_nsrcs = htons(scount); @@ -557,11 +570,11 @@ static void igmpv3_send_cr(struct in_device *in_dev) skb = add_grec(skb, pmc, dtype, 1, 1); } if (pmc->crcount) { - pmc->crcount--; if (pmc->sfmode == MCAST_EXCLUDE) { type = IGMPV3_CHANGE_TO_INCLUDE; skb = add_grec(skb, pmc, type, 1, 0); } + pmc->crcount--; if (pmc->crcount == 0) { igmpv3_clear_zeros(&pmc->tomb); igmpv3_clear_zeros(&pmc->sources); @@ -594,12 +607,12 @@ static void igmpv3_send_cr(struct in_device *in_dev) /* filter mode changes */ if (pmc->crcount) { - pmc->crcount--; if (pmc->sfmode == MCAST_EXCLUDE) type = IGMPV3_CHANGE_TO_EXCLUDE; else type = IGMPV3_CHANGE_TO_INCLUDE; skb = add_grec(skb, pmc, type, 0, 0); + pmc->crcount--; } spin_unlock_bh(&pmc->lock); } @@ -735,11 +748,43 @@ static void igmp_timer_expire(unsigned long data) ip_ma_put(im); } -static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) +/* mark EXCLUDE-mode sources */ +static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) +{ + struct ip_sf_list *psf; + int i, scount; + + scount = 0; + for (psf=pmc->sources; psf; psf=psf->sf_next) { + if (scount == nsrcs) + break; + for (i=0; i<nsrcs; i++) { + /* skip inactive filters */ + if (pmc->sfcount[MCAST_INCLUDE] || + pmc->sfcount[MCAST_EXCLUDE] != + psf->sf_count[MCAST_EXCLUDE]) + continue; + if (srcs[i] == psf->sf_inaddr) { + scount++; + break; + } + } + } + pmc->gsquery = 0; + if (scount == nsrcs) /* all sources excluded */ + return 0; + return 1; +} + +static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) { struct ip_sf_list *psf; int i, scount; + if (pmc->sfmode == MCAST_EXCLUDE) + return igmp_xmarksources(pmc, nsrcs, srcs); + + /* mark INCLUDE-mode sources */ scount = 0; for (psf=pmc->sources; psf; psf=psf->sf_next) { if (scount == nsrcs) @@ -751,6 +796,12 @@ static void igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) break; } } + if (!scount) { + pmc->gsquery = 0; + return 0; + } + pmc->gsquery = 1; + return 1; } static 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, */ read_lock(&in_dev->mc_list_lock); for (im=in_dev->mc_list; im!=NULL; im=im->next) { + int changed; + if (group && group != im->multiaddr) continue; if (im->multiaddr == IGMP_ALL_HOSTS) @@ -854,10 +907,11 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, im->gsquery = im->gsquery && mark; else im->gsquery = mark; - if (im->gsquery) - igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); + changed = !im->gsquery || + igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); spin_unlock_bh(&im->lock); - igmp_mod_timer(im, max_delay); + if (changed) + igmp_mod_timer(im, max_delay); } read_unlock(&in_dev->mc_list_lock); } @@ -1510,7 +1564,7 @@ static void sf_markstate(struct ip_mc_list *pmc) static int sf_setstate(struct ip_mc_list *pmc) { - struct ip_sf_list *psf; + struct ip_sf_list *psf, *dpsf; int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; int qrv = pmc->interface->mr_qrv; int new_in, rv; @@ -1522,8 +1576,46 @@ static int sf_setstate(struct ip_mc_list *pmc) !psf->sf_count[MCAST_INCLUDE]; } else new_in = psf->sf_count[MCAST_INCLUDE] != 0; - if (new_in != psf->sf_oldin) { - psf->sf_crcount = qrv; + if (new_in) { + if (!psf->sf_oldin) { + struct ip_sf_list *prev = 0; + + for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { + if (dpsf->sf_inaddr == psf->sf_inaddr) + break; + prev = dpsf; + } + if (dpsf) { + if (prev) + prev->sf_next = dpsf->sf_next; + else + pmc->tomb = dpsf->sf_next; + kfree(dpsf); + } + psf->sf_crcount = qrv; + rv++; + } + } else if (psf->sf_oldin) { + + psf->sf_crcount = 0; + /* + * add or update "delete" records if an active filter + * is now inactive + */ + for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) + if (dpsf->sf_inaddr == psf->sf_inaddr) + break; + if (!dpsf) { + dpsf = (struct ip_sf_list *) + kmalloc(sizeof(*dpsf), GFP_ATOMIC); + if (!dpsf) + continue; + *dpsf = *psf; + /* pmc->lock held by callers */ + dpsf->sf_next = pmc->tomb; + pmc->tomb = dpsf; + } + dpsf->sf_crcount = qrv; rv++; } } diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f2e82afc15b..d82c242ea70 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -241,7 +241,8 @@ static int rt_hash_log; static unsigned int rt_hash_rnd; static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); -#define RT_CACHE_STAT_INC(field) (__get_cpu_var(rt_cache_stat).field++) +#define RT_CACHE_STAT_INC(field) \ + (per_cpu(rt_cache_stat, raw_smp_processor_id()).field++) static int rt_intern_hash(unsigned hash, struct rtable *rth, struct rtable **res); diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig index 05ab18e62de..3891cc00087 100644 --- a/net/tipc/Kconfig +++ b/net/tipc/Kconfig @@ -8,7 +8,12 @@ menu "TIPC Configuration (EXPERIMENTAL)" config TIPC tristate "The TIPC Protocol (EXPERIMENTAL)" ---help--- - TBD. + The Transparent Inter Process Communication (TIPC) protocol is + specially designed for intra cluster communication. This protocol + originates from Ericsson where it has been used in carrier grade + cluster applications for many years. + + For more information about TIPC, see http://tipc.sourceforge.net. This protocol support is also available as a module ( = code which 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 eca22260c98..0be25e175b9 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -47,7 +47,7 @@ u32 tipc_get_addr(void) } /** - * addr_domain_valid - validates a network domain address + * tipc_addr_domain_valid - validates a network domain address * * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, * where Z, C, and N are non-zero and do not exceed the configured limits. @@ -55,7 +55,7 @@ u32 tipc_get_addr(void) * Returns 1 if domain address is valid, otherwise 0 */ -int addr_domain_valid(u32 addr) +int tipc_addr_domain_valid(u32 addr) { u32 n = tipc_node(addr); u32 c = tipc_cluster(addr); @@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr) } /** - * addr_node_valid - validates a proposed network address for this node + * tipc_addr_node_valid - validates a proposed network address for this node * * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed * the configured limits. @@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr) * Returns 1 if address can be used, otherwise 0 */ -int addr_node_valid(u32 addr) +int tipc_addr_node_valid(u32 addr) { - return (addr_domain_valid(addr) && tipc_node(addr)); + return (tipc_addr_domain_valid(addr) && tipc_node(addr)); } diff --git a/net/tipc/addr.h b/net/tipc/addr.h index 02ca71783e2..bcfebb3cbbf 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) return string; } -int addr_domain_valid(u32); -int addr_node_valid(u32 addr); +int tipc_addr_domain_valid(u32); +int tipc_addr_node_valid(u32 addr); #endif diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 9713d622efb..a7b04f397c1 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -82,7 +82,7 @@ struct bcbearer { struct bearer bearer; struct media media; struct bcbearer_pair bpairs[MAX_BEARERS]; - struct bcbearer_pair bpairs_temp[TIPC_NUM_LINK_PRI]; + struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; }; /** @@ -104,7 +104,7 @@ static struct bclink *bclink = NULL; static struct link *bcl = NULL; static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED; -char bc_link_name[] = "multicast-link"; +char tipc_bclink_name[] = "multicast-link"; static inline u32 buf_seqno(struct sk_buff *buf) @@ -178,19 +178,19 @@ static void bclink_retransmit_pkt(u32 after, u32 to) buf = buf->next; } if (buf != NULL) - link_retransmit(bcl, buf, mod(to - after)); + tipc_link_retransmit(bcl, buf, mod(to - after)); spin_unlock_bh(&bc_lock); } /** - * bclink_acknowledge - handle acknowledgement of broadcast packets + * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets * @n_ptr: node that sent acknowledgement info * @acked: broadcast sequence # that has been acknowledged * * Node is locked, bc_lock unlocked. */ -void bclink_acknowledge(struct node *n_ptr, u32 acked) +void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked) { struct sk_buff *crs; struct sk_buff *next; @@ -226,16 +226,16 @@ void bclink_acknowledge(struct node *n_ptr, u32 acked) /* Try resolving broadcast link congestion, if necessary */ if (unlikely(bcl->next_out)) - link_push_queue(bcl); + tipc_link_push_queue(bcl); if (unlikely(released && !list_empty(&bcl->waiting_ports))) - link_wakeup_ports(bcl, 0); + tipc_link_wakeup_ports(bcl, 0); spin_unlock_bh(&bc_lock); } /** * bclink_send_ack - unicast an ACK msg * - * net_lock and node lock set + * tipc_net_lock and node lock set */ static void bclink_send_ack(struct node *n_ptr) @@ -243,13 +243,13 @@ static void bclink_send_ack(struct node *n_ptr) struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1]; if (l_ptr != NULL) - link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); } /** * bclink_send_nack- broadcast a NACK msg * - * net_lock and node lock set + * tipc_net_lock and node lock set */ static void bclink_send_nack(struct node *n_ptr) @@ -271,11 +271,11 @@ static void bclink_send_nack(struct node *n_ptr) msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); msg_set_bcast_tag(msg, tipc_own_tag); - if (bearer_send(&bcbearer->bearer, buf, 0)) { + if (tipc_bearer_send(&bcbearer->bearer, buf, 0)) { bcl->stats.sent_nacks++; buf_discard(buf); } else { - bearer_schedule(bcl->b_ptr, bcl); + tipc_bearer_schedule(bcl->b_ptr, bcl); bcl->proto_msg_queue = buf; bcl->stats.bearer_congs++; } @@ -291,12 +291,12 @@ static void bclink_send_nack(struct node *n_ptr) } /** - * bclink_check_gap - send a NACK if a sequence gap exists + * tipc_bclink_check_gap - send a NACK if a sequence gap exists * - * net_lock and node lock set + * tipc_net_lock and node lock set */ -void bclink_check_gap(struct node *n_ptr, u32 last_sent) +void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent) { if (!n_ptr->bclink.supported || 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) } /** - * bclink_peek_nack - process a NACK msg meant for another node + * tipc_bclink_peek_nack - process a NACK msg meant for another node * - * Only net_lock set. + * Only tipc_net_lock set. */ -void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) +void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) { - struct node *n_ptr = node_find(dest); + struct node *n_ptr = tipc_node_find(dest); u32 my_after, my_to; - if (unlikely(!n_ptr || !node_is_up(n_ptr))) + if (unlikely(!n_ptr || !tipc_node_is_up(n_ptr))) return; - node_lock(n_ptr); + tipc_node_lock(n_ptr); /* * Modify gap to suppress unnecessary NACKs from this node */ @@ -364,20 +364,20 @@ void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) bclink_set_gap(n_ptr); } } - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); } /** - * bclink_send_msg - broadcast a packet to all nodes in cluster + * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster */ -int bclink_send_msg(struct sk_buff *buf) +int tipc_bclink_send_msg(struct sk_buff *buf) { int res; spin_lock_bh(&bc_lock); - res = link_send_buf(bcl, buf); + res = tipc_link_send_buf(bcl, buf); if (unlikely(res == -ELINKCONG)) buf_discard(buf); else @@ -393,22 +393,22 @@ int bclink_send_msg(struct sk_buff *buf) } /** - * bclink_recv_pkt - receive a broadcast packet, and deliver upwards + * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards * - * net_lock is read_locked, no other locks set + * tipc_net_lock is read_locked, no other locks set */ -void bclink_recv_pkt(struct sk_buff *buf) +void tipc_bclink_recv_pkt(struct sk_buff *buf) { struct tipc_msg *msg = buf_msg(buf); - struct node* node = node_find(msg_prevnode(msg)); + struct node* node = tipc_node_find(msg_prevnode(msg)); u32 next_in; u32 seqno; struct sk_buff *deferred; msg_dbg(msg, "<BC<<<"); - if (unlikely(!node || !node_is_up(node) || !node->bclink.supported || + if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || (msg_mc_netid(msg) != tipc_net_id))) { buf_discard(buf); return; @@ -417,14 +417,14 @@ void bclink_recv_pkt(struct sk_buff *buf) if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { msg_dbg(msg, "<BCNACK<<<"); if (msg_destnode(msg) == tipc_own_addr) { - node_lock(node); - bclink_acknowledge(node, msg_bcast_ack(msg)); - node_unlock(node); + tipc_node_lock(node); + tipc_bclink_acknowledge(node, msg_bcast_ack(msg)); + tipc_node_unlock(node); bcl->stats.recv_nacks++; bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); } else { - bclink_peek_nack(msg_destnode(msg), + tipc_bclink_peek_nack(msg_destnode(msg), msg_bcast_tag(msg), msg_bcgap_after(msg), msg_bcgap_to(msg)); @@ -433,7 +433,7 @@ void bclink_recv_pkt(struct sk_buff *buf) return; } - node_lock(node); + tipc_node_lock(node); receive: deferred = node->bclink.deferred_head; next_in = mod(node->bclink.last_in + 1); @@ -448,26 +448,26 @@ receive: bcl->stats.sent_acks++; } if (likely(msg_isdata(msg))) { - node_unlock(node); - port_recv_mcast(buf, NULL); + tipc_node_unlock(node); + tipc_port_recv_mcast(buf, NULL); } else if (msg_user(msg) == MSG_BUNDLER) { bcl->stats.recv_bundles++; bcl->stats.recv_bundled += msg_msgcnt(msg); - node_unlock(node); - link_recv_bundle(buf); + tipc_node_unlock(node); + tipc_link_recv_bundle(buf); } else if (msg_user(msg) == MSG_FRAGMENTER) { bcl->stats.recv_fragments++; - if (link_recv_fragment(&node->bclink.defragm, - &buf, &msg)) + if (tipc_link_recv_fragment(&node->bclink.defragm, + &buf, &msg)) bcl->stats.recv_fragmented++; - node_unlock(node); - net_route_msg(buf); + tipc_node_unlock(node); + tipc_net_route_msg(buf); } else { - node_unlock(node); - net_route_msg(buf); + tipc_node_unlock(node); + tipc_net_route_msg(buf); } if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) { - node_lock(node); + tipc_node_lock(node); buf = deferred; msg = buf_msg(buf); node->bclink.deferred_head = deferred->next; @@ -478,9 +478,9 @@ receive: u32 gap_after = node->bclink.gap_after; u32 gap_to = node->bclink.gap_to; - if (link_defer_pkt(&node->bclink.deferred_head, - &node->bclink.deferred_tail, - buf)) { + if (tipc_link_defer_pkt(&node->bclink.deferred_head, + &node->bclink.deferred_tail, + buf)) { node->bclink.nack_sync++; bcl->stats.deferred_recv++; if (seqno == mod(gap_after + 1)) @@ -497,10 +497,10 @@ receive: bcl->stats.duplicates++; buf_discard(buf); } - node_unlock(node); + tipc_node_unlock(node); } -u32 bclink_get_last_sent(void) +u32 tipc_bclink_get_last_sent(void) { u32 last_sent = mod(bcl->next_out_no - 1); @@ -509,15 +509,15 @@ u32 bclink_get_last_sent(void) return last_sent; } -u32 bclink_acks_missing(struct node *n_ptr) +u32 tipc_bclink_acks_missing(struct node *n_ptr) { return (n_ptr->bclink.supported && - (bclink_get_last_sent() != n_ptr->bclink.acked)); + (tipc_bclink_get_last_sent() != n_ptr->bclink.acked)); } /** - * bcbearer_send - send a packet through the broadcast pseudo-bearer + * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer * * Send through as many bearers as necessary to reach all nodes * that support TIPC multicasting. @@ -525,9 +525,9 @@ u32 bclink_acks_missing(struct node *n_ptr) * Returns 0 if packet sent successfully, non-zero if not */ -int bcbearer_send(struct sk_buff *buf, - struct tipc_bearer *unused1, - struct tipc_media_addr *unused2) +int tipc_bcbearer_send(struct sk_buff *buf, + struct tipc_bearer *unused1, + struct tipc_media_addr *unused2) { static int send_count = 0; @@ -541,8 +541,8 @@ int bcbearer_send(struct sk_buff *buf, if (likely(!msg_non_seq(buf_msg(buf)))) { struct tipc_msg *msg; - assert(cluster_bcast_nodes.count != 0); - bcbuf_set_acks(buf, cluster_bcast_nodes.count); + assert(tipc_cltr_bcast_nodes.count != 0); + bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count); msg = buf_msg(buf); msg_set_non_seq(msg); msg_set_mc_netid(msg, tipc_net_id); @@ -555,7 +555,7 @@ int bcbearer_send(struct sk_buff *buf, /* Send buffer over bearers until all targets reached */ - remains = cluster_bcast_nodes; + remains = tipc_cltr_bcast_nodes; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { struct bearer *p = bcbearer->bpairs[bp_index].primary; @@ -564,7 +564,7 @@ int bcbearer_send(struct sk_buff *buf, if (!p) break; /* no more bearers to try */ - nmap_diff(&remains, &p->nodes, &remains_new); + tipc_nmap_diff(&remains, &p->nodes, &remains_new); if (remains_new.count == remains.count) continue; /* bearer pair doesn't add anything */ @@ -597,10 +597,10 @@ update: } /** - * bcbearer_sort - create sets of bearer pairs used by broadcast bearer + * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer */ -void bcbearer_sort(void) +void tipc_bcbearer_sort(void) { struct bcbearer_pair *bp_temp = bcbearer->bpairs_temp; struct bcbearer_pair *bp_curr; @@ -614,7 +614,7 @@ void bcbearer_sort(void) memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); for (b_index = 0; b_index < MAX_BEARERS; b_index++) { - struct bearer *b = &bearers[b_index]; + struct bearer *b = &tipc_bearers[b_index]; if (!b->active || !b->nodes.count) continue; @@ -630,7 +630,7 @@ void bcbearer_sort(void) bp_curr = bcbearer->bpairs; memset(bcbearer->bpairs, 0, sizeof(bcbearer->bpairs)); - for (pri = (TIPC_NUM_LINK_PRI - 1); pri >= 0; pri--) { + for (pri = TIPC_MAX_LINK_PRI; pri >= 0; pri--) { if (!bp_temp[pri].primary) continue; @@ -638,8 +638,8 @@ void bcbearer_sort(void) bp_curr->primary = bp_temp[pri].primary; if (bp_temp[pri].secondary) { - if (nmap_equal(&bp_temp[pri].primary->nodes, - &bp_temp[pri].secondary->nodes)) { + if (tipc_nmap_equal(&bp_temp[pri].primary->nodes, + &bp_temp[pri].secondary->nodes)) { bp_curr->secondary = bp_temp[pri].secondary; } else { bp_curr++; @@ -654,14 +654,14 @@ void bcbearer_sort(void) } /** - * bcbearer_push - resolve bearer congestion + * tipc_bcbearer_push - resolve bearer congestion * * Forces bclink to push out any unsent packets, until all packets are gone * or congestion reoccurs. * No locks set when function called */ -void bcbearer_push(void) +void tipc_bcbearer_push(void) { struct bearer *b_ptr; @@ -669,20 +669,20 @@ void bcbearer_push(void) b_ptr = &bcbearer->bearer; if (b_ptr->publ.blocked) { b_ptr->publ.blocked = 0; - bearer_lock_push(b_ptr); + tipc_bearer_lock_push(b_ptr); } spin_unlock_bh(&bc_lock); } -int bclink_stats(char *buf, const u32 buf_size) +int tipc_bclink_stats(char *buf, const u32 buf_size) { struct print_buf pb; if (!bcl) return 0; - printbuf_init(&pb, buf, buf_size); + tipc_printbuf_init(&pb, buf, buf_size); spin_lock_bh(&bc_lock); @@ -718,10 +718,10 @@ int bclink_stats(char *buf, const u32 buf_size) : 0); spin_unlock_bh(&bc_lock); - return printbuf_validate(&pb); + return tipc_printbuf_validate(&pb); } -int bclink_reset_stats(void) +int tipc_bclink_reset_stats(void) { if (!bcl) return -ENOPROTOOPT; @@ -732,7 +732,7 @@ int bclink_reset_stats(void) return TIPC_OK; } -int bclink_set_queue_limits(u32 limit) +int tipc_bclink_set_queue_limits(u32 limit) { if (!bcl) return -ENOPROTOOPT; @@ -740,12 +740,12 @@ int bclink_set_queue_limits(u32 limit) return -EINVAL; spin_lock_bh(&bc_lock); - link_set_queue_limits(bcl, limit); + tipc_link_set_queue_limits(bcl, limit); spin_unlock_bh(&bc_lock); return TIPC_OK; } -int bclink_init(void) +int tipc_bclink_init(void) { bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); @@ -762,7 +762,7 @@ int bclink_init(void) memset(bcbearer, 0, sizeof(struct bcbearer)); INIT_LIST_HEAD(&bcbearer->bearer.cong_links); bcbearer->bearer.media = &bcbearer->media; - bcbearer->media.send_msg = bcbearer_send; + bcbearer->media.send_msg = tipc_bcbearer_send; sprintf(bcbearer->media.name, "tipc-multicast"); bcl = &bclink->link; @@ -772,27 +772,27 @@ int bclink_init(void) bclink->node.lock = SPIN_LOCK_UNLOCKED; bcl->owner = &bclink->node; bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; - link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); + tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); bcl->b_ptr = &bcbearer->bearer; bcl->state = WORKING_WORKING; - sprintf(bcl->name, bc_link_name); + sprintf(bcl->name, tipc_bclink_name); if (BCLINK_LOG_BUF_SIZE) { char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC); if (!pb) goto nomem; - printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE); + tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE); } return TIPC_OK; } -void bclink_stop(void) +void tipc_bclink_stop(void) { spin_lock_bh(&bc_lock); if (bcbearer) { - link_stop(bcl); + tipc_link_stop(bcl); if (BCLINK_LOG_BUF_SIZE) kfree(bcl->print_buf.buf); bcl = NULL; diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index 5430e524b4f..0e3be2ab330 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h @@ -70,14 +70,14 @@ struct port_list { struct node; -extern char bc_link_name[]; +extern char tipc_bclink_name[]; /** * nmap_get - determine if node exists in a node map */ -static inline int nmap_get(struct node_map *nm_ptr, u32 node) +static inline int tipc_nmap_get(struct node_map *nm_ptr, u32 node) { int n = tipc_node(node); int w = n / WSIZE; @@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node) * nmap_add - add a node to a node map */ -static inline void nmap_add(struct node_map *nm_ptr, u32 node) +static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node) { int n = tipc_node(node); int w = n / WSIZE; @@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node) * nmap_remove - remove a node from a node map */ -static inline void nmap_remove(struct node_map *nm_ptr, u32 node) +static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node) { int n = tipc_node(node); int w = n / WSIZE; @@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node) * nmap_equal - test for equality of node maps */ -static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) +static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b) { return !memcmp(nm_a, nm_b, sizeof(*nm_a)); } @@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) */ -static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, - struct node_map *nm_diff) +static inline void tipc_nmap_diff(struct node_map *nm_a, struct node_map *nm_b, + struct node_map *nm_diff) { int stop = sizeof(nm_a->map) / sizeof(u32); int w; @@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, * port_list_add - add a port to a port list, ensuring no duplicates */ -static inline void port_list_add(struct port_list *pl_ptr, u32 port) +static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) { struct port_list *item = pl_ptr; int i; @@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port) * Note: First item is on stack, so it doesn't need to be released */ -static inline void port_list_free(struct port_list *pl_ptr) +static inline void tipc_port_list_free(struct port_list *pl_ptr) { struct port_list *item; struct port_list *next; @@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr) } -int bclink_init(void); -void bclink_stop(void); -void bclink_acknowledge(struct node *n_ptr, u32 acked); -int bclink_send_msg(struct sk_buff *buf); -void bclink_recv_pkt(struct sk_buff *buf); -u32 bclink_get_last_sent(void); -u32 bclink_acks_missing(struct node *n_ptr); -void bclink_check_gap(struct node *n_ptr, u32 seqno); -int bclink_stats(char *stats_buf, const u32 buf_size); -int bclink_reset_stats(void); -int bclink_set_queue_limits(u32 limit); -void bcbearer_sort(void); -void bcbearer_push(void); +int tipc_bclink_init(void); +void tipc_bclink_stop(void); +void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked); +int tipc_bclink_send_msg(struct sk_buff *buf); +void tipc_bclink_recv_pkt(struct sk_buff *buf); +u32 tipc_bclink_get_last_sent(void); +u32 tipc_bclink_acks_missing(struct node *n_ptr); +void tipc_bclink_check_gap(struct node *n_ptr, u32 seqno); +int tipc_bclink_stats(char *stats_buf, const u32 buf_size); +int tipc_bclink_reset_stats(void); +int tipc_bclink_set_queue_limits(u32 limit); +void tipc_bcbearer_sort(void); +void tipc_bcbearer_push(void); #endif diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 3dd19fdc5a2..64dcb0f3a8b 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -48,7 +48,7 @@ static struct media *media_list = 0; static u32 media_count = 0; -struct bearer *bearers = 0; +struct bearer *tipc_bearers = 0; /** * media_name_valid - validate media name @@ -107,7 +107,7 @@ int tipc_register_media(u32 media_type, u32 i; int res = -EINVAL; - write_lock_bh(&net_lock); + write_lock_bh(&tipc_net_lock); if (!media_list) goto exit; @@ -119,7 +119,8 @@ int tipc_register_media(u32 media_type, warn("Media registration error: no broadcast address supplied\n"); goto exit; } - if (bearer_priority >= TIPC_NUM_LINK_PRI) { + if ((bearer_priority < TIPC_MIN_LINK_PRI) && + (bearer_priority > TIPC_MAX_LINK_PRI)) { warn("Media registration error: priority %u\n", bearer_priority); goto exit; } @@ -164,15 +165,15 @@ int tipc_register_media(u32 media_type, dbg("Media <%s> registered\n", name); res = 0; exit: - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); return res; } /** - * media_addr_printf - record media address in print buffer + * tipc_media_addr_printf - record media address in print buffer */ -void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) +void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) { struct media *m_ptr; u32 media_type; @@ -200,25 +201,25 @@ void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) } /** - * media_get_names - record names of registered media in buffer + * tipc_media_get_names - record names of registered media in buffer */ -struct sk_buff *media_get_names(void) +struct sk_buff *tipc_media_get_names(void) { struct sk_buff *buf; struct media *m_ptr; int i; - buf = cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); + buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); if (!buf) return NULL; - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { - cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, - strlen(m_ptr->name) + 1); + tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, + strlen(m_ptr->name) + 1); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return buf; } @@ -282,7 +283,7 @@ static struct bearer *bearer_find(const char *name) struct bearer *b_ptr; u32 i; - for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { + for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) return b_ptr; } @@ -290,16 +291,16 @@ static struct bearer *bearer_find(const char *name) } /** - * bearer_find - locates bearer object with matching interface name + * tipc_bearer_find_interface - locates bearer object with matching interface name */ -struct bearer *bearer_find_interface(const char *if_name) +struct bearer *tipc_bearer_find_interface(const char *if_name) { struct bearer *b_ptr; char *b_if_name; u32 i; - for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { + for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (!b_ptr->active) continue; b_if_name = strchr(b_ptr->publ.name, ':') + 1; @@ -310,54 +311,54 @@ struct bearer *bearer_find_interface(const char *if_name) } /** - * bearer_get_names - record names of bearers in buffer + * tipc_bearer_get_names - record names of bearers in buffer */ -struct sk_buff *bearer_get_names(void) +struct sk_buff *tipc_bearer_get_names(void) { struct sk_buff *buf; struct media *m_ptr; struct bearer *b_ptr; int i, j; - buf = cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); + buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); if (!buf) return NULL; - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { for (j = 0; j < MAX_BEARERS; j++) { - b_ptr = &bearers[j]; + b_ptr = &tipc_bearers[j]; if (b_ptr->active && (b_ptr->media == m_ptr)) { - cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, - b_ptr->publ.name, - strlen(b_ptr->publ.name) + 1); + tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, + b_ptr->publ.name, + strlen(b_ptr->publ.name) + 1); } } } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return buf; } -void bearer_add_dest(struct bearer *b_ptr, u32 dest) +void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest) { - nmap_add(&b_ptr->nodes, dest); - disc_update_link_req(b_ptr->link_req); - bcbearer_sort(); + tipc_nmap_add(&b_ptr->nodes, dest); + tipc_disc_update_link_req(b_ptr->link_req); + tipc_bcbearer_sort(); } -void bearer_remove_dest(struct bearer *b_ptr, u32 dest) +void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) { - nmap_remove(&b_ptr->nodes, dest); - disc_update_link_req(b_ptr->link_req); - bcbearer_sort(); + tipc_nmap_remove(&b_ptr->nodes, dest); + tipc_disc_update_link_req(b_ptr->link_req); + tipc_bcbearer_sort(); } /* * bearer_push(): Resolve bearer congestion. Force the waiting * links to push out their unsent packets, one packet per link * per iteration, until all packets are gone or congestion reoccurs. - * 'net_lock' is read_locked when this function is called + * 'tipc_net_lock' is read_locked when this function is called * bearer.lock must be taken before calling * Returns binary true(1) ore false(0) */ @@ -371,7 +372,7 @@ static int bearer_push(struct bearer *b_ptr) while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) { - res = link_push_packet(ln); + res = tipc_link_push_packet(ln); if (res == PUSH_FAILED) break; if (res == PUSH_FINISHED) @@ -381,7 +382,7 @@ static int bearer_push(struct bearer *b_ptr) return list_empty(&b_ptr->cong_links); } -void bearer_lock_push(struct bearer *b_ptr) +void tipc_bearer_lock_push(struct bearer *b_ptr) { int res; @@ -389,7 +390,7 @@ void bearer_lock_push(struct bearer *b_ptr) res = bearer_push(b_ptr); spin_unlock_bh(&b_ptr->publ.lock); if (res) - bcbearer_push(); + tipc_bcbearer_push(); } @@ -404,7 +405,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr) spin_lock_bh(&b_ptr->publ.lock); b_ptr->continue_count++; if (!list_empty(&b_ptr->cong_links)) - k_signal((Handler)bearer_lock_push, (unsigned long)b_ptr); + tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr); b_ptr->publ.blocked = 0; spin_unlock_bh(&b_ptr->publ.lock); } @@ -413,11 +414,11 @@ void tipc_continue(struct tipc_bearer *tb_ptr) * Schedule link for sending of messages after the bearer * has been deblocked by 'continue()'. This method is called * when somebody tries to send a message via this link while - * the bearer is congested. 'net_lock' is in read_lock here + * the bearer is congested. 'tipc_net_lock' is in read_lock here * bearer.lock is busy */ -static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) +static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) { list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); } @@ -426,24 +427,24 @@ static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) * Schedule link for sending of messages after the bearer * has been deblocked by 'continue()'. This method is called * when somebody tries to send a message via this link while - * the bearer is congested. 'net_lock' is in read_lock here, + * the bearer is congested. 'tipc_net_lock' is in read_lock here, * bearer.lock is free */ -void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) +void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) { spin_lock_bh(&b_ptr->publ.lock); - bearer_schedule_unlocked(b_ptr, l_ptr); + tipc_bearer_schedule_unlocked(b_ptr, l_ptr); spin_unlock_bh(&b_ptr->publ.lock); } /* - * bearer_resolve_congestion(): Check if there is bearer congestion, + * tipc_bearer_resolve_congestion(): Check if there is bearer congestion, * and if there is, try to resolve it before returning. - * 'net_lock' is read_locked when this function is called + * 'tipc_net_lock' is read_locked when this function is called */ -int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) +int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) { int res = 1; @@ -451,7 +452,7 @@ int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) return 1; spin_lock_bh(&b_ptr->publ.lock); if (!bearer_push(b_ptr)) { - bearer_schedule_unlocked(b_ptr, l_ptr); + tipc_bearer_schedule_unlocked(b_ptr, l_ptr); res = 0; } spin_unlock_bh(&b_ptr->publ.lock); @@ -476,14 +477,19 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; + if (!bearer_name_validate(name, &b_name) || - !addr_domain_valid(bcast_scope) || - !in_scope(bcast_scope, tipc_own_addr) || - (priority > TIPC_NUM_LINK_PRI)) + !tipc_addr_domain_valid(bcast_scope) || + !in_scope(bcast_scope, tipc_own_addr)) + return -EINVAL; + + if ((priority < TIPC_MIN_LINK_PRI || + priority > TIPC_MAX_LINK_PRI) && + (priority != TIPC_MEDIA_LINK_PRI)) return -EINVAL; - write_lock_bh(&net_lock); - if (!bearers) + write_lock_bh(&tipc_net_lock); + if (!tipc_bearers) goto failed; m_ptr = media_find(b_name.media_name); @@ -491,22 +497,23 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) warn("No media <%s>\n", b_name.media_name); goto failed; } - if (priority == TIPC_NUM_LINK_PRI) + + if (priority == TIPC_MEDIA_LINK_PRI) priority = m_ptr->priority; restart: bearer_id = MAX_BEARERS; with_this_prio = 1; for (i = MAX_BEARERS; i-- != 0; ) { - if (!bearers[i].active) { + if (!tipc_bearers[i].active) { bearer_id = i; continue; } - if (!strcmp(name, bearers[i].publ.name)) { + if (!strcmp(name, tipc_bearers[i].publ.name)) { warn("Bearer <%s> already enabled\n", name); goto failed; } - if ((bearers[i].priority == priority) && + if ((tipc_bearers[i].priority == priority) && (++with_this_prio > 2)) { if (priority-- == 0) { warn("Third bearer <%s> with priority %u, unable to lower to %u\n", @@ -523,7 +530,7 @@ restart: goto failed; } - b_ptr = &bearers[bearer_id]; + b_ptr = &tipc_bearers[bearer_id]; memset(b_ptr, 0, sizeof(struct bearer)); strcpy(b_ptr->publ.name, name); @@ -542,16 +549,16 @@ restart: INIT_LIST_HEAD(&b_ptr->cong_links); INIT_LIST_HEAD(&b_ptr->links); if (m_ptr->bcast) { - b_ptr->link_req = disc_init_link_req(b_ptr, &m_ptr->bcast_addr, - bcast_scope, 2); + b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr, + bcast_scope, 2); } b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; - write_unlock_bh(&net_lock); - info("Enabled bearer <%s>, discovery domain %s\n", - name, addr_string_fill(addr_string, bcast_scope)); + write_unlock_bh(&tipc_net_lock); + info("Enabled bearer <%s>, discovery domain %s, priority %u\n", + name, addr_string_fill(addr_string, bcast_scope), priority); return 0; failed: - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); return res; } @@ -569,11 +576,11 @@ int tipc_block_bearer(const char *name) if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); b_ptr = bearer_find(name); if (!b_ptr) { warn("Attempt to block unknown bearer <%s>\n", name); - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return -EINVAL; } @@ -583,11 +590,11 @@ int tipc_block_bearer(const char *name) struct node *n_ptr = l_ptr->owner; spin_lock_bh(&n_ptr->lock); - link_reset(l_ptr); + tipc_link_reset(l_ptr); spin_unlock_bh(&n_ptr->lock); } spin_unlock_bh(&b_ptr->publ.lock); - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); info("Blocked bearer <%s>\n", name); return TIPC_OK; } @@ -595,7 +602,7 @@ int tipc_block_bearer(const char *name) /** * bearer_disable - * - * Note: This routine assumes caller holds net_lock. + * Note: This routine assumes caller holds tipc_net_lock. */ static int bearer_disable(const char *name) @@ -613,19 +620,19 @@ static int bearer_disable(const char *name) return -EINVAL; } - disc_stop_link_req(b_ptr->link_req); + tipc_disc_stop_link_req(b_ptr->link_req); spin_lock_bh(&b_ptr->publ.lock); b_ptr->link_req = NULL; b_ptr->publ.blocked = 1; if (b_ptr->media->disable_bearer) { spin_unlock_bh(&b_ptr->publ.lock); - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); b_ptr->media->disable_bearer(&b_ptr->publ); - write_lock_bh(&net_lock); + write_lock_bh(&tipc_net_lock); spin_lock_bh(&b_ptr->publ.lock); } list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { - link_delete(l_ptr); + tipc_link_delete(l_ptr); } spin_unlock_bh(&b_ptr->publ.lock); info("Disabled bearer <%s>\n", name); @@ -637,54 +644,54 @@ int tipc_disable_bearer(const char *name) { int res; - write_lock_bh(&net_lock); + write_lock_bh(&tipc_net_lock); res = bearer_disable(name); - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); return res; } -int bearer_init(void) +int tipc_bearer_init(void) { int res; - write_lock_bh(&net_lock); - bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC); + write_lock_bh(&tipc_net_lock); + tipc_bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC); media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC); - if (bearers && media_list) { - memset(bearers, 0, MAX_BEARERS * sizeof(struct bearer)); + if (tipc_bearers && media_list) { + memset(tipc_bearers, 0, MAX_BEARERS * sizeof(struct bearer)); memset(media_list, 0, MAX_MEDIA * sizeof(struct media)); res = TIPC_OK; } else { - kfree(bearers); + kfree(tipc_bearers); kfree(media_list); - bearers = 0; + tipc_bearers = 0; media_list = 0; res = -ENOMEM; } - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); return res; } -void bearer_stop(void) +void tipc_bearer_stop(void) { u32 i; - if (!bearers) + if (!tipc_bearers) return; for (i = 0; i < MAX_BEARERS; i++) { - if (bearers[i].active) - bearers[i].publ.blocked = 1; + if (tipc_bearers[i].active) + tipc_bearers[i].publ.blocked = 1; } for (i = 0; i < MAX_BEARERS; i++) { - if (bearers[i].active) - bearer_disable(bearers[i].publ.name); + if (tipc_bearers[i].active) + bearer_disable(tipc_bearers[i].publ.name); } - kfree(bearers); + kfree(tipc_bearers); kfree(media_list); - bearers = 0; + tipc_bearers = 0; media_list = 0; media_count = 0; } diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 21e63d3f018..c4e7c1c3655 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -37,7 +37,7 @@ #ifndef _TIPC_BEARER_H #define _TIPC_BEARER_H -#include <net/tipc/tipc_bearer.h> +#include "core.h" #include "bcast.h" #define MAX_BEARERS 8 @@ -114,26 +114,24 @@ struct bearer_name { struct link; -extern struct bearer *bearers; +extern struct bearer *tipc_bearers; -void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); -struct sk_buff *media_get_names(void); +void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); +struct sk_buff *tipc_media_get_names(void); -struct sk_buff *bearer_get_names(void); -void bearer_add_dest(struct bearer *b_ptr, u32 dest); -void bearer_remove_dest(struct bearer *b_ptr, u32 dest); -void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); -struct bearer *bearer_find_interface(const char *if_name); -int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); -int bearer_init(void); -void bearer_stop(void); -int bearer_broadcast(struct sk_buff *buf, struct tipc_bearer *b_ptr, - struct tipc_media_addr *dest); -void bearer_lock_push(struct bearer *b_ptr); +struct sk_buff *tipc_bearer_get_names(void); +void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest); +void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest); +void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); +struct bearer *tipc_bearer_find_interface(const char *if_name); +int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); +int tipc_bearer_init(void); +void tipc_bearer_stop(void); +void tipc_bearer_lock_push(struct bearer *b_ptr); /** - * bearer_send- sends buffer to destination over bearer + * tipc_bearer_send- sends buffer to destination over bearer * * Returns true (1) if successful, or false (0) if unable to send * @@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr); * and let TIPC's link code deal with the undelivered message. */ -static inline int bearer_send(struct bearer *b_ptr, struct sk_buff *buf, - struct tipc_media_addr *dest) +static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, + struct tipc_media_addr *dest) { return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); } /** - * bearer_congested - determines if bearer is currently congested + * tipc_bearer_congested - determines if bearer is currently congested */ -static inline int bearer_congested(struct bearer *b_ptr, struct link *l_ptr) +static inline int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) { if (unlikely(b_ptr->publ.blocked)) return 1; if (likely(list_empty(&b_ptr->cong_links))) return 0; - return !bearer_resolve_congestion(b_ptr, l_ptr); + return !tipc_bearer_resolve_congestion(b_ptr, l_ptr); } #endif diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c index f0f7bac51d4..ab974ca1937 100644 --- a/net/tipc/cluster.c +++ b/net/tipc/cluster.c @@ -44,15 +44,15 @@ #include "msg.h" #include "bearer.h" -void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, - u32 lower, u32 upper); -struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest); +void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, + u32 lower, u32 upper); +struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest); -struct node **local_nodes = 0; -struct node_map cluster_bcast_nodes = {0,{0,}}; -u32 highest_allowed_slave = 0; +struct node **tipc_local_nodes = 0; +struct node_map tipc_cltr_bcast_nodes = {0,{0,}}; +u32 tipc_highest_allowed_slave = 0; -struct cluster *cluster_create(u32 addr) +struct cluster *tipc_cltr_create(u32 addr) { struct _zone *z_ptr; struct cluster *c_ptr; @@ -77,16 +77,16 @@ struct cluster *cluster_create(u32 addr) } memset(c_ptr->nodes, 0, alloc); if (in_own_cluster(addr)) - local_nodes = c_ptr->nodes; + tipc_local_nodes = c_ptr->nodes; c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_node = 0; - z_ptr = zone_find(tipc_zone(addr)); + z_ptr = tipc_zone_find(tipc_zone(addr)); if (z_ptr == NULL) { - z_ptr = zone_create(addr); + z_ptr = tipc_zone_create(addr); } if (z_ptr != NULL) { - zone_attach_cluster(z_ptr, c_ptr); + tipc_zone_attach_cluster(z_ptr, c_ptr); c_ptr->owner = z_ptr; } else { @@ -97,23 +97,23 @@ struct cluster *cluster_create(u32 addr) return c_ptr; } -void cluster_delete(struct cluster *c_ptr) +void tipc_cltr_delete(struct cluster *c_ptr) { u32 n_num; if (!c_ptr) return; for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) { - node_delete(c_ptr->nodes[n_num]); + tipc_node_delete(c_ptr->nodes[n_num]); } for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) { - node_delete(c_ptr->nodes[n_num]); + tipc_node_delete(c_ptr->nodes[n_num]); } kfree(c_ptr->nodes); kfree(c_ptr); } -u32 cluster_next_node(struct cluster *c_ptr, u32 addr) +u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr) { struct node *n_ptr; u32 n_num = tipc_node(addr) + 1; @@ -122,24 +122,24 @@ u32 cluster_next_node(struct cluster *c_ptr, u32 addr) return addr; for (; n_num <= c_ptr->highest_node; n_num++) { n_ptr = c_ptr->nodes[n_num]; - if (n_ptr && node_has_active_links(n_ptr)) + if (n_ptr && tipc_node_has_active_links(n_ptr)) return n_ptr->addr; } for (n_num = 1; n_num < tipc_node(addr); n_num++) { n_ptr = c_ptr->nodes[n_num]; - if (n_ptr && node_has_active_links(n_ptr)) + if (n_ptr && tipc_node_has_active_links(n_ptr)) return n_ptr->addr; } return 0; } -void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr) +void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr) { u32 n_num = tipc_node(n_ptr->addr); u32 max_n_num = tipc_max_nodes; if (in_own_cluster(n_ptr->addr)) - max_n_num = highest_allowed_slave; + max_n_num = tipc_highest_allowed_slave; assert(n_num > 0); assert(n_num <= max_n_num); assert(c_ptr->nodes[n_num] == 0); @@ -149,12 +149,12 @@ void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr) } /** - * cluster_select_router - select router to a cluster + * tipc_cltr_select_router - select router to a cluster * * Uses deterministic and fair algorithm. */ -u32 cluster_select_router(struct cluster *c_ptr, u32 ref) +u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref) { u32 n_num; u32 ulim = c_ptr->highest_node; @@ -174,29 +174,29 @@ u32 cluster_select_router(struct cluster *c_ptr, u32 ref) /* Lookup upwards with wrap-around */ do { - if (node_is_up(c_ptr->nodes[n_num])) + if (tipc_node_is_up(c_ptr->nodes[n_num])) break; } while (++n_num <= ulim); if (n_num > ulim) { n_num = 1; do { - if (node_is_up(c_ptr->nodes[n_num])) + if (tipc_node_is_up(c_ptr->nodes[n_num])) break; } while (++n_num < tstart); if (n_num == tstart) return 0; } assert(n_num <= ulim); - return node_select_router(c_ptr->nodes[n_num], ref); + return tipc_node_select_router(c_ptr->nodes[n_num], ref); } /** - * cluster_select_node - select destination node within a remote cluster + * tipc_cltr_select_node - select destination node within a remote cluster * * Uses deterministic and fair algorithm. */ -struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) +struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector) { u32 n_num; u32 mask = tipc_max_nodes; @@ -215,11 +215,11 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) /* Lookup upwards with wrap-around */ for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) { - if (node_has_active_links(c_ptr->nodes[n_num])) + if (tipc_node_has_active_links(c_ptr->nodes[n_num])) return c_ptr->nodes[n_num]; } for (n_num = 1; n_num < start_entry; n_num++) { - if (node_has_active_links(c_ptr->nodes[n_num])) + if (tipc_node_has_active_links(c_ptr->nodes[n_num])) return c_ptr->nodes[n_num]; } return 0; @@ -229,7 +229,7 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) * Routing table management: See description in node.c */ -struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest) +struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest) { u32 size = INT_H_SIZE + data_size; struct sk_buff *buf = buf_acquire(size); @@ -243,39 +243,39 @@ struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest) return buf; } -void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, +void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lower, u32 upper) { - struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); + struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr); struct tipc_msg *msg; if (buf) { msg = buf_msg(buf); msg_set_remote_node(msg, dest); msg_set_type(msg, ROUTE_ADDITION); - cluster_multicast(c_ptr, buf, lower, upper); + tipc_cltr_multicast(c_ptr, buf, lower, upper); } else { warn("Memory squeeze: broadcast of new route failed\n"); } } -void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, - u32 lower, u32 upper) +void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, + u32 lower, u32 upper) { - struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); + struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr); struct tipc_msg *msg; if (buf) { msg = buf_msg(buf); msg_set_remote_node(msg, dest); msg_set_type(msg, ROUTE_REMOVAL); - cluster_multicast(c_ptr, buf, lower, upper); + tipc_cltr_multicast(c_ptr, buf, lower, upper); } else { warn("Memory squeeze: broadcast of lost route failed\n"); } } -void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) +void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest) { struct sk_buff *buf; struct tipc_msg *msg; @@ -288,21 +288,21 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) assert(in_own_cluster(c_ptr->addr)); if (highest <= LOWEST_SLAVE) return; - buf = cluster_prepare_routing_msg(highest - LOWEST_SLAVE + 1, - c_ptr->addr); + buf = tipc_cltr_prepare_routing_msg(highest - LOWEST_SLAVE + 1, + c_ptr->addr); if (buf) { msg = buf_msg(buf); msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, SLAVE_ROUTING_TABLE); for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { if (c_ptr->nodes[n_num] && - node_has_active_links(c_ptr->nodes[n_num])) { + tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); } } if (send) - link_send(buf, dest, dest); + tipc_link_send(buf, dest, dest); else buf_discard(buf); } else { @@ -310,7 +310,7 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) } } -void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) +void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest) { struct sk_buff *buf; struct tipc_msg *msg; @@ -323,20 +323,20 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) assert(!is_slave(dest)); assert(in_own_cluster(dest)); highest = c_ptr->highest_node; - buf = cluster_prepare_routing_msg(highest + 1, c_ptr->addr); + buf = tipc_cltr_prepare_routing_msg(highest + 1, c_ptr->addr); if (buf) { msg = buf_msg(buf); msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, EXT_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { if (c_ptr->nodes[n_num] && - node_has_active_links(c_ptr->nodes[n_num])) { + tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); } } if (send) - link_send(buf, dest, dest); + tipc_link_send(buf, dest, dest); else buf_discard(buf); } else { @@ -344,7 +344,7 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) } } -void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) +void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest) { struct sk_buff *buf; struct tipc_msg *msg; @@ -354,20 +354,20 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) assert(is_slave(dest)); assert(in_own_cluster(c_ptr->addr)); - buf = cluster_prepare_routing_msg(highest, c_ptr->addr); + buf = tipc_cltr_prepare_routing_msg(highest, c_ptr->addr); if (buf) { msg = buf_msg(buf); msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, LOCAL_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { if (c_ptr->nodes[n_num] && - node_has_active_links(c_ptr->nodes[n_num])) { + tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); } } if (send) - link_send(buf, dest, dest); + tipc_link_send(buf, dest, dest); else buf_discard(buf); } else { @@ -375,7 +375,7 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) } } -void cluster_recv_routing_table(struct sk_buff *buf) +void tipc_cltr_recv_routing_table(struct sk_buff *buf) { struct tipc_msg *msg = buf_msg(buf); struct cluster *c_ptr; @@ -388,9 +388,9 @@ void cluster_recv_routing_table(struct sk_buff *buf) u32 c_num; u32 n_num; - c_ptr = cluster_find(rem_node); + c_ptr = tipc_cltr_find(rem_node); if (!c_ptr) { - c_ptr = cluster_create(rem_node); + c_ptr = tipc_cltr_create(rem_node); if (!c_ptr) { buf_discard(buf); return; @@ -412,10 +412,10 @@ void cluster_recv_routing_table(struct sk_buff *buf) u32 addr = tipc_addr(z_num, c_num, n_num); n_ptr = c_ptr->nodes[n_num]; if (!n_ptr) { - n_ptr = node_create(addr); + n_ptr = tipc_node_create(addr); } if (n_ptr) - node_add_router(n_ptr, router); + tipc_node_add_router(n_ptr, router); } } break; @@ -428,10 +428,10 @@ void cluster_recv_routing_table(struct sk_buff *buf) u32 addr = tipc_addr(z_num, c_num, slave_num); n_ptr = c_ptr->nodes[slave_num]; if (!n_ptr) { - n_ptr = node_create(addr); + n_ptr = tipc_node_create(addr); } if (n_ptr) - node_add_router(n_ptr, router); + tipc_node_add_router(n_ptr, router); } } break; @@ -445,9 +445,9 @@ void cluster_recv_routing_table(struct sk_buff *buf) } n_ptr = c_ptr->nodes[tipc_node(rem_node)]; if (!n_ptr) - n_ptr = node_create(rem_node); + n_ptr = tipc_node_create(rem_node); if (n_ptr) - node_add_router(n_ptr, router); + tipc_node_add_router(n_ptr, router); break; case ROUTE_REMOVAL: if (!is_slave(tipc_own_addr)) { @@ -459,7 +459,7 @@ void cluster_recv_routing_table(struct sk_buff *buf) } n_ptr = c_ptr->nodes[tipc_node(rem_node)]; if (n_ptr) - node_remove_router(n_ptr, router); + tipc_node_remove_router(n_ptr, router); break; default: assert(!"Illegal routing manager message received\n"); @@ -467,7 +467,7 @@ void cluster_recv_routing_table(struct sk_buff *buf) buf_discard(buf); } -void cluster_remove_as_router(struct cluster *c_ptr, u32 router) +void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router) { u32 start_entry; u32 tstop; @@ -486,17 +486,17 @@ void cluster_remove_as_router(struct cluster *c_ptr, u32 router) for (n_num = start_entry; n_num <= tstop; n_num++) { if (c_ptr->nodes[n_num]) { - node_remove_router(c_ptr->nodes[n_num], router); + tipc_node_remove_router(c_ptr->nodes[n_num], router); } } } /** - * cluster_multicast - multicast message to local nodes + * tipc_cltr_multicast - multicast message to local nodes */ -void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, - u32 lower, u32 upper) +void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, + u32 lower, u32 upper) { struct sk_buff *buf_copy; struct node *n_ptr; @@ -505,9 +505,9 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, assert(lower <= upper); assert(((lower >= 1) && (lower <= tipc_max_nodes)) || - ((lower >= LOWEST_SLAVE) && (lower <= highest_allowed_slave))); + ((lower >= LOWEST_SLAVE) && (lower <= tipc_highest_allowed_slave))); assert(((upper >= 1) && (upper <= tipc_max_nodes)) || - ((upper >= LOWEST_SLAVE) && (upper <= highest_allowed_slave))); + ((upper >= LOWEST_SLAVE) && (upper <= tipc_highest_allowed_slave))); assert(in_own_cluster(c_ptr->addr)); 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, tstop = upper; for (n_num = lower; n_num <= tstop; n_num++) { n_ptr = c_ptr->nodes[n_num]; - if (n_ptr && node_has_active_links(n_ptr)) { + if (n_ptr && tipc_node_has_active_links(n_ptr)) { buf_copy = skb_copy(buf, GFP_ATOMIC); if (buf_copy == NULL) break; msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); - link_send(buf_copy, n_ptr->addr, n_ptr->addr); + tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); } } buf_discard(buf); } /** - * cluster_broadcast - broadcast message to all nodes within cluster + * tipc_cltr_broadcast - broadcast message to all nodes within cluster */ -void cluster_broadcast(struct sk_buff *buf) +void tipc_cltr_broadcast(struct sk_buff *buf) { struct sk_buff *buf_copy; struct cluster *c_ptr; @@ -541,7 +541,7 @@ void cluster_broadcast(struct sk_buff *buf) u32 node_type; if (tipc_mode == TIPC_NET_MODE) { - c_ptr = cluster_find(tipc_own_addr); + c_ptr = tipc_cltr_find(tipc_own_addr); assert(in_own_cluster(c_ptr->addr)); /* For now */ /* Send to standard nodes, then repeat loop sending to slaves */ @@ -550,14 +550,14 @@ void cluster_broadcast(struct sk_buff *buf) for (node_type = 1; node_type <= 2; node_type++) { for (n_num = tstart; n_num <= tstop; n_num++) { n_ptr = c_ptr->nodes[n_num]; - if (n_ptr && node_has_active_links(n_ptr)) { + if (n_ptr && tipc_node_has_active_links(n_ptr)) { buf_copy = skb_copy(buf, GFP_ATOMIC); if (buf_copy == NULL) goto exit; msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); - link_send(buf_copy, n_ptr->addr, - n_ptr->addr); + tipc_link_send(buf_copy, n_ptr->addr, + n_ptr->addr); } } tstart = LOWEST_SLAVE; @@ -568,9 +568,9 @@ exit: buf_discard(buf); } -int cluster_init(void) +int tipc_cltr_init(void) { - highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves; - return cluster_create(tipc_own_addr) ? TIPC_OK : -ENOMEM; + tipc_highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves; + return tipc_cltr_create(tipc_own_addr) ? TIPC_OK : -ENOMEM; } diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h index 1ffb095991d..9963642e105 100644 --- a/net/tipc/cluster.h +++ b/net/tipc/cluster.h @@ -60,29 +60,29 @@ struct cluster { }; -extern struct node **local_nodes; -extern u32 highest_allowed_slave; -extern struct node_map cluster_bcast_nodes; +extern struct node **tipc_local_nodes; +extern u32 tipc_highest_allowed_slave; +extern struct node_map tipc_cltr_bcast_nodes; -void cluster_remove_as_router(struct cluster *c_ptr, u32 router); -void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest); -struct node *cluster_select_node(struct cluster *c_ptr, u32 selector); -u32 cluster_select_router(struct cluster *c_ptr, u32 ref); -void cluster_recv_routing_table(struct sk_buff *buf); -struct cluster *cluster_create(u32 addr); -void cluster_delete(struct cluster *c_ptr); -void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr); -void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest); -void cluster_broadcast(struct sk_buff *buf); -int cluster_init(void); -u32 cluster_next_node(struct cluster *c_ptr, u32 addr); -void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); -void cluster_send_local_routes(struct cluster *c_ptr, u32 dest); -void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); +void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router); +void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest); +struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector); +u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref); +void tipc_cltr_recv_routing_table(struct sk_buff *buf); +struct cluster *tipc_cltr_create(u32 addr); +void tipc_cltr_delete(struct cluster *c_ptr); +void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr); +void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest); +void tipc_cltr_broadcast(struct sk_buff *buf); +int tipc_cltr_init(void); +u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr); +void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); +void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest); +void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); -static inline struct cluster *cluster_find(u32 addr) +static inline struct cluster *tipc_cltr_find(u32 addr) { - struct _zone *z_ptr = zone_find(addr); + struct _zone *z_ptr = tipc_zone_find(addr); if (z_ptr) return z_ptr->clusters[1]; diff --git a/net/tipc/config.c b/net/tipc/config.c index 8ddef4fce2c..3c8e6740e5a 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 */ static int rep_headroom; /* reply message headroom to use */ -void cfg_link_event(u32 addr, char *name, int up) +void tipc_cfg_link_event(u32 addr, char *name, int up) { /* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */ } -struct sk_buff *cfg_reply_alloc(int payload_size) +struct sk_buff *tipc_cfg_reply_alloc(int payload_size) { struct sk_buff *buf; @@ -86,14 +86,14 @@ struct sk_buff *cfg_reply_alloc(int payload_size) return buf; } -int cfg_append_tlv(struct sk_buff *buf, int tlv_type, - void *tlv_data, int tlv_data_size) +int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, + void *tlv_data, int tlv_data_size) { struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; int new_tlv_space = TLV_SPACE(tlv_data_size); if (skb_tailroom(buf) < new_tlv_space) { - dbg("cfg_append_tlv unable to append TLV\n"); + dbg("tipc_cfg_append_tlv unable to append TLV\n"); return 0; } skb_put(buf, new_tlv_space); @@ -104,28 +104,28 @@ int cfg_append_tlv(struct sk_buff *buf, int tlv_type, return 1; } -struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value) +struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) { struct sk_buff *buf; u32 value_net; - buf = cfg_reply_alloc(TLV_SPACE(sizeof(value))); + buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); if (buf) { value_net = htonl(value); - cfg_append_tlv(buf, tlv_type, &value_net, - sizeof(value_net)); + tipc_cfg_append_tlv(buf, tlv_type, &value_net, + sizeof(value_net)); } return buf; } -struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string) +struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string) { struct sk_buff *buf; int string_len = strlen(string) + 1; - buf = cfg_reply_alloc(TLV_SPACE(string_len)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(string_len)); if (buf) - cfg_append_tlv(buf, tlv_type, string, string_len); + tipc_cfg_append_tlv(buf, tlv_type, string, string_len); return buf; } @@ -246,7 +246,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg, exit: rmsg.result_len = htonl(msg_sect[1].iov_len); rmsg.retval = htonl(rv); - cfg_respond(msg_sect, 2u, orig); + tipc_cfg_respond(msg_sect, 2u, orig); } #endif @@ -255,26 +255,26 @@ static struct sk_buff *cfg_enable_bearer(void) struct tipc_bearer_config *args; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_CONFIG)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); args = (struct tipc_bearer_config *)TLV_DATA(req_tlv_area); if (tipc_enable_bearer(args->name, ntohl(args->detect_scope), ntohl(args->priority))) - return cfg_reply_error_string("unable to enable bearer"); + return tipc_cfg_reply_error_string("unable to enable bearer"); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_disable_bearer(void) { if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area))) - return cfg_reply_error_string("unable to disable bearer"); + return tipc_cfg_reply_error_string("unable to disable bearer"); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_own_addr(void) @@ -282,25 +282,25 @@ static struct sk_buff *cfg_set_own_addr(void) u32 addr; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); addr = *(u32 *)TLV_DATA(req_tlv_area); addr = ntohl(addr); if (addr == tipc_own_addr) - return cfg_reply_none(); - if (!addr_node_valid(addr)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (node address)"); + return tipc_cfg_reply_none(); + if (!tipc_addr_node_valid(addr)) + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (node address)"); if (tipc_own_addr) - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot change node address once assigned)"); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot change node address once assigned)"); spin_unlock_bh(&config_lock); - stop_net(); + tipc_core_stop_net(); tipc_own_addr = addr; - start_net(); + tipc_core_start_net(); spin_lock_bh(&config_lock); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_remote_mng(void) @@ -308,12 +308,12 @@ static struct sk_buff *cfg_set_remote_mng(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); tipc_remote_management = (value != 0); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_publications(void) @@ -321,15 +321,15 @@ static struct sk_buff *cfg_set_max_publications(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 1, 65535)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (max publications must be 1-65535)"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max publications must be 1-65535)"); tipc_max_publications = value; - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_subscriptions(void) @@ -337,15 +337,15 @@ static struct sk_buff *cfg_set_max_subscriptions(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 1, 65535)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (max subscriptions must be 1-65535"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max subscriptions must be 1-65535"); tipc_max_subscriptions = value; - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_ports(void) @@ -354,31 +354,31 @@ static struct sk_buff *cfg_set_max_ports(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 127, 65535)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (max ports must be 127-65535)"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max ports must be 127-65535)"); if (value == tipc_max_ports) - return cfg_reply_none(); + return tipc_cfg_reply_none(); if (atomic_read(&tipc_user_count) > 2) - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot change max ports while TIPC users exist)"); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot change max ports while TIPC users exist)"); spin_unlock_bh(&config_lock); orig_mode = tipc_get_mode(); if (orig_mode == TIPC_NET_MODE) - stop_net(); - stop_core(); + tipc_core_stop_net(); + tipc_core_stop(); tipc_max_ports = value; - start_core(); + tipc_core_start(); if (orig_mode == TIPC_NET_MODE) - start_net(); + tipc_core_start_net(); spin_lock_bh(&config_lock); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static 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) if (value != *parameter) { orig_mode = tipc_get_mode(); if (orig_mode == TIPC_NET_MODE) - stop_net(); + tipc_core_stop_net(); *parameter = value; if (orig_mode == TIPC_NET_MODE) - start_net(); + tipc_core_start_net(); } - return cfg_reply_none(); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_zones(void) @@ -402,12 +402,12 @@ static struct sk_buff *cfg_set_max_zones(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 1, 255)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (max zones must be 1-255)"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max zones must be 1-255)"); return set_net_max(value, &tipc_max_zones); } @@ -416,13 +416,13 @@ static struct sk_buff *cfg_set_max_clusters(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != 1) - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (max clusters fixed at 1)"); - return cfg_reply_none(); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (max clusters fixed at 1)"); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_nodes(void) @@ -430,12 +430,12 @@ static struct sk_buff *cfg_set_max_nodes(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 8, 2047)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (max nodes must be 8-2047)"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max nodes must be 8-2047)"); return set_net_max(value, &tipc_max_nodes); } @@ -444,13 +444,13 @@ static struct sk_buff *cfg_set_max_slaves(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != 0) - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (max secondary nodes fixed at 0)"); - return cfg_reply_none(); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (max secondary nodes fixed at 0)"); + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_netid(void) @@ -458,22 +458,22 @@ static struct sk_buff *cfg_set_netid(void) u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 1, 9999)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (network id must be 1-9999)"); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (network id must be 1-9999)"); if (tipc_own_addr) - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot change network id once part of network)"); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot change network id once part of network)"); return set_net_max(value, &tipc_net_id); } -struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, - int request_space, int reply_headroom) +struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, + int request_space, int reply_headroom) { struct sk_buff *rep_tlv_buf; @@ -490,19 +490,19 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, if (likely(orig_node == tipc_own_addr)) { /* command is permitted */ } else if (cmd >= 0x8000) { - rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot be done remotely)"); + rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot be done remotely)"); goto exit; } else if (!tipc_remote_management) { - rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NO_REMOTE); + rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NO_REMOTE); goto exit; } else if (cmd >= 0x4000) { u32 domain = 0; - if ((nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) || + if ((tipc_nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) || (domain != orig_node)) { - rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR); + rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR); goto exit; } } @@ -511,50 +511,50 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, switch (cmd) { case TIPC_CMD_NOOP: - rep_tlv_buf = cfg_reply_none(); + rep_tlv_buf = tipc_cfg_reply_none(); break; case TIPC_CMD_GET_NODES: - rep_tlv_buf = node_get_nodes(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_node_get_nodes(req_tlv_area, req_tlv_space); break; case TIPC_CMD_GET_LINKS: - rep_tlv_buf = node_get_links(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_node_get_links(req_tlv_area, req_tlv_space); break; case TIPC_CMD_SHOW_LINK_STATS: - rep_tlv_buf = link_cmd_show_stats(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_link_cmd_show_stats(req_tlv_area, req_tlv_space); break; case TIPC_CMD_RESET_LINK_STATS: - rep_tlv_buf = link_cmd_reset_stats(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_link_cmd_reset_stats(req_tlv_area, req_tlv_space); break; case TIPC_CMD_SHOW_NAME_TABLE: - rep_tlv_buf = nametbl_get(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space); break; case TIPC_CMD_GET_BEARER_NAMES: - rep_tlv_buf = bearer_get_names(); + rep_tlv_buf = tipc_bearer_get_names(); break; case TIPC_CMD_GET_MEDIA_NAMES: - rep_tlv_buf = media_get_names(); + rep_tlv_buf = tipc_media_get_names(); break; case TIPC_CMD_SHOW_PORTS: - rep_tlv_buf = port_get_ports(); + rep_tlv_buf = tipc_port_get_ports(); break; #if 0 case TIPC_CMD_SHOW_PORT_STATS: rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space); break; case TIPC_CMD_RESET_PORT_STATS: - rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED); + rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED); break; #endif case TIPC_CMD_SET_LOG_SIZE: - rep_tlv_buf = log_resize(req_tlv_area, req_tlv_space); + rep_tlv_buf = tipc_log_resize(req_tlv_area, req_tlv_space); break; case TIPC_CMD_DUMP_LOG: - rep_tlv_buf = log_dump(); + rep_tlv_buf = tipc_log_dump(); break; case TIPC_CMD_SET_LINK_TOL: case TIPC_CMD_SET_LINK_PRI: case TIPC_CMD_SET_LINK_WINDOW: - rep_tlv_buf = link_cmd_config(req_tlv_area, req_tlv_space, cmd); + rep_tlv_buf = tipc_link_cmd_config(req_tlv_area, req_tlv_space, cmd); break; case TIPC_CMD_ENABLE_BEARER: 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, rep_tlv_buf = cfg_set_netid(); break; case TIPC_CMD_GET_REMOTE_MNG: - rep_tlv_buf = cfg_reply_unsigned(tipc_remote_management); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_remote_management); break; case TIPC_CMD_GET_MAX_PORTS: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_ports); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_ports); break; case TIPC_CMD_GET_MAX_PUBL: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_publications); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_publications); break; case TIPC_CMD_GET_MAX_SUBSCR: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_subscriptions); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); break; case TIPC_CMD_GET_MAX_ZONES: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_zones); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_zones); break; case TIPC_CMD_GET_MAX_CLUSTERS: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_clusters); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters); break; case TIPC_CMD_GET_MAX_NODES: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_nodes); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes); break; case TIPC_CMD_GET_MAX_SLAVES: - rep_tlv_buf = cfg_reply_unsigned(tipc_max_slaves); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_slaves); break; case TIPC_CMD_GET_NETID: - rep_tlv_buf = cfg_reply_unsigned(tipc_net_id); + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); break; default: rep_tlv_buf = NULL; @@ -655,11 +655,11 @@ static void cfg_named_msg_event(void *userdata, /* Generate reply for request (if can't, return request) */ - rep_buf = cfg_do_cmd(orig->node, - ntohs(req_hdr->tcm_type), - msg + sizeof(*req_hdr), - size - sizeof(*req_hdr), - BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); + rep_buf = tipc_cfg_do_cmd(orig->node, + ntohs(req_hdr->tcm_type), + msg + sizeof(*req_hdr), + size - sizeof(*req_hdr), + BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); if (rep_buf) { skb_push(rep_buf, sizeof(*rep_hdr)); rep_hdr = (struct tipc_cfg_msg_hdr *)rep_buf->data; @@ -675,7 +675,7 @@ static void cfg_named_msg_event(void *userdata, tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len); } -int cfg_init(void) +int tipc_cfg_init(void) { struct tipc_name_seq seq; int res; @@ -696,7 +696,7 @@ int cfg_init(void) seq.type = TIPC_CFG_SRV; seq.lower = seq.upper = tipc_own_addr; - res = nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq); + res = tipc_nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq); if (res) goto failed; @@ -709,7 +709,7 @@ failed: return res; } -void cfg_stop(void) +void tipc_cfg_stop(void) { if (mng.user_ref) { tipc_detach(mng.user_ref); diff --git a/net/tipc/config.h b/net/tipc/config.h index 646377d4045..7a728f954d8 100644 --- a/net/tipc/config.h +++ b/net/tipc/config.h @@ -39,42 +39,41 @@ /* ---------------------------------------------------------------------- */ -#include <linux/tipc.h> -#include <linux/tipc_config.h> +#include "core.h" #include "link.h" -struct sk_buff *cfg_reply_alloc(int payload_size); -int cfg_append_tlv(struct sk_buff *buf, int tlv_type, - void *tlv_data, int tlv_data_size); -struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value); -struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string); +struct sk_buff *tipc_cfg_reply_alloc(int payload_size); +int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, + void *tlv_data, int tlv_data_size); +struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value); +struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string); -static inline struct sk_buff *cfg_reply_none(void) +static inline struct sk_buff *tipc_cfg_reply_none(void) { - return cfg_reply_alloc(0); + return tipc_cfg_reply_alloc(0); } -static inline struct sk_buff *cfg_reply_unsigned(u32 value) +static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value) { - return cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value); + return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value); } -static inline struct sk_buff *cfg_reply_error_string(char *string) +static inline struct sk_buff *tipc_cfg_reply_error_string(char *string) { - return cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); + return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); } -static inline struct sk_buff *cfg_reply_ultra_string(char *string) +static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string) { - return cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); + return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); } -struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, - const void *req_tlv_area, int req_tlv_space, - int headroom); +struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, + const void *req_tlv_area, int req_tlv_space, + int headroom); -void cfg_link_event(u32 addr, char *name, int up); -int cfg_init(void); -void cfg_stop(void); +void tipc_cfg_link_event(u32 addr, char *name, int up); +int tipc_cfg_init(void); +void tipc_cfg_stop(void); #endif diff --git a/net/tipc/core.c b/net/tipc/core.c index e83ac06e31b..3d0a8ee4e1d 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -37,7 +37,6 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> -#include <linux/version.h> #include <linux/random.h> #include "core.h" @@ -49,14 +48,14 @@ #include "subscr.h" #include "config.h" -int eth_media_start(void); -void eth_media_stop(void); -int handler_start(void); -void handler_stop(void); -int socket_init(void); -void socket_stop(void); -int netlink_start(void); -void netlink_stop(void); +int tipc_eth_media_start(void); +void tipc_eth_media_stop(void); +int tipc_handler_start(void); +void tipc_handler_stop(void); +int tipc_socket_init(void); +void tipc_socket_stop(void); +int tipc_netlink_start(void); +void tipc_netlink_stop(void); #define MOD_NAME "tipc_start: " @@ -113,56 +112,56 @@ int tipc_get_mode(void) } /** - * stop_net - shut down TIPC networking sub-systems + * tipc_core_stop_net - shut down TIPC networking sub-systems */ -void stop_net(void) +void tipc_core_stop_net(void) { - eth_media_stop(); - tipc_stop_net(); + tipc_eth_media_stop(); + tipc_net_stop(); } /** * start_net - start TIPC networking sub-systems */ -int start_net(void) +int tipc_core_start_net(void) { int res; - if ((res = tipc_start_net()) || - (res = eth_media_start())) { - stop_net(); + if ((res = tipc_net_start()) || + (res = tipc_eth_media_start())) { + tipc_core_stop_net(); } return res; } /** - * stop_core - switch TIPC from SINGLE NODE to NOT RUNNING mode + * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode */ -void stop_core(void) +void tipc_core_stop(void) { if (tipc_mode != TIPC_NODE_MODE) return; tipc_mode = TIPC_NOT_RUNNING; - netlink_stop(); - handler_stop(); - cfg_stop(); - subscr_stop(); - reg_stop(); - nametbl_stop(); - ref_table_stop(); - socket_stop(); + tipc_netlink_stop(); + tipc_handler_stop(); + tipc_cfg_stop(); + tipc_subscr_stop(); + tipc_reg_stop(); + tipc_nametbl_stop(); + tipc_ref_table_stop(); + tipc_socket_stop(); } /** - * start_core - switch TIPC from NOT RUNNING to SINGLE NODE mode + * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode */ -int start_core(void) +int tipc_core_start(void) { int res; @@ -172,16 +171,16 @@ int start_core(void) get_random_bytes(&tipc_random, sizeof(tipc_random)); tipc_mode = TIPC_NODE_MODE; - if ((res = handler_start()) || - (res = ref_table_init(tipc_max_ports + tipc_max_subscriptions, - tipc_random)) || - (res = reg_start()) || - (res = nametbl_init()) || - (res = k_signal((Handler)subscr_start, 0)) || - (res = k_signal((Handler)cfg_init, 0)) || - (res = netlink_start()) || - (res = socket_init())) { - stop_core(); + if ((res = tipc_handler_start()) || + (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions, + tipc_random)) || + (res = tipc_reg_start()) || + (res = tipc_nametbl_init()) || + (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || + (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || + (res = tipc_netlink_start()) || + (res = tipc_socket_init())) { + tipc_core_stop(); } return res; } @@ -191,7 +190,7 @@ static int __init tipc_init(void) { int res; - log_reinit(CONFIG_TIPC_LOG); + tipc_log_reinit(CONFIG_TIPC_LOG); info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); tipc_own_addr = 0; @@ -205,7 +204,7 @@ static int __init tipc_init(void) tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); tipc_net_id = 4711; - if ((res = start_core())) + if ((res = tipc_core_start())) err("Unable to start in single node mode\n"); else info("Started in single node mode\n"); @@ -214,10 +213,10 @@ static int __init tipc_init(void) static void __exit tipc_exit(void) { - stop_net(); - stop_core(); + tipc_core_stop_net(); + tipc_core_stop(); info("Deactivated\n"); - log_stop(); + tipc_log_stop(); } module_init(tipc_init); diff --git a/net/tipc/core.h b/net/tipc/core.h index b69b60b2cc8..1f2e8b27a13 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -37,6 +37,11 @@ #ifndef _TIPC_CORE_H #define _TIPC_CORE_H +#include <linux/tipc.h> +#include <linux/tipc_config.h> +#include <net/tipc/tipc_msg.h> +#include <net/tipc/tipc_port.h> +#include <net/tipc/tipc_bearer.h> #include <net/tipc/tipc.h> #include <linux/types.h> #include <linux/kernel.h> @@ -60,9 +65,9 @@ #define assert(i) BUG_ON(!(i)) struct tipc_msg; -extern struct print_buf *CONS, *LOG; -extern struct print_buf *TEE(struct print_buf *, struct print_buf *); -void msg_print(struct print_buf*,struct tipc_msg *,const char*); +extern struct print_buf *TIPC_CONS, *TIPC_LOG; +extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *); +void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); void tipc_printf(struct print_buf *, const char *fmt, ...); void tipc_dump(struct print_buf*,const char *fmt, ...); @@ -79,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) #define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) -#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) msg_print(DBG_OUTPUT, msg, txt);} while(0) +#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0) #define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) @@ -89,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); * here, or on a per .c file basis, by redefining these symbols. The following * print buffer options are available: * - * NULL : Output to null print buffer (i.e. print nowhere) - * CONS : Output to system console - * LOG : Output to TIPC log buffer - * &buf : Output to user-defined buffer (struct print_buf *) - * TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TEE(CONS,LOG) ) + * NULL : Output to null print buffer (i.e. print nowhere) + * TIPC_CONS : Output to system console + * TIPC_LOG : Output to TIPC log buffer + * &buf : Output to user-defined buffer (struct print_buf *) + * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) ) */ #ifndef TIPC_OUTPUT -#define TIPC_OUTPUT TEE(CONS,LOG) +#define TIPC_OUTPUT TIPC_TEE(TIPC_CONS,TIPC_LOG) #endif #ifndef DBG_OUTPUT @@ -162,10 +167,10 @@ extern atomic_t tipc_user_count; * Routines available to privileged subsystems */ -extern int start_core(void); -extern void stop_core(void); -extern int start_net(void); -extern void stop_net(void); +extern int tipc_core_start(void); +extern void tipc_core_stop(void); +extern int tipc_core_start_net(void); +extern void tipc_core_stop_net(void); static inline int delimit(int val, int min, int max) { @@ -183,7 +188,7 @@ static inline int delimit(int val, int min, int max) typedef void (*Handler) (unsigned long); -u32 k_signal(Handler routine, unsigned long argument); +u32 tipc_k_signal(Handler routine, unsigned long argument); /** * k_init_timer - initialize a timer diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 7ed60a1cfbb..4f4beefa783 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c @@ -44,10 +44,10 @@ static char print_string[MAX_STRING]; static spinlock_t print_lock = SPIN_LOCK_UNLOCKED; static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; -struct print_buf *CONS = &cons_buf; +struct print_buf *TIPC_CONS = &cons_buf; static struct print_buf log_buf = { NULL, 0, NULL, NULL }; -struct print_buf *LOG = &log_buf; +struct print_buf *TIPC_LOG = &log_buf; #define FORMAT(PTR,LEN,FMT) \ @@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf; * simultaneous use of the print buffer(s) being manipulated. * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of * 'print_string' and to protect its print buffer(s). - * 3) TEE() uses 'print_lock' to protect its print buffer(s). - * 4) Routines of the form log_XXX() uses 'print_lock' to protect LOG. + * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s). + * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG. */ /** - * printbuf_init - initialize print buffer to empty + * tipc_printbuf_init - initialize print buffer to empty */ -void printbuf_init(struct print_buf *pb, char *raw, u32 sz) +void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz) { if (!pb || !raw || (sz < (MAX_STRING + 1))) return; @@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz) } /** - * printbuf_reset - reinitialize print buffer to empty state + * tipc_printbuf_reset - reinitialize print buffer to empty state */ -void printbuf_reset(struct print_buf *pb) +void tipc_printbuf_reset(struct print_buf *pb) { if (pb && pb->buf) - printbuf_init(pb, pb->buf, pb->size); + tipc_printbuf_init(pb, pb->buf, pb->size); } /** - * printbuf_empty - test if print buffer is in empty state + * tipc_printbuf_empty - test if print buffer is in empty state */ -int printbuf_empty(struct print_buf *pb) +int tipc_printbuf_empty(struct print_buf *pb) { return (!pb || !pb->buf || (pb->crs == pb->buf)); } /** - * printbuf_validate - check for print buffer overflow + * tipc_printbuf_validate - check for print buffer overflow * * Verifies that a print buffer has captured all data written to it. * If data has been lost, linearize buffer and prepend an error message @@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb) * Returns length of print buffer data string (including trailing NULL) */ -int printbuf_validate(struct print_buf *pb) +int tipc_printbuf_validate(struct print_buf *pb) { char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; char *cp_buf; @@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb) if (pb->buf[pb->size - 1] == '\0') { cp_buf = kmalloc(pb->size, GFP_ATOMIC); if (cp_buf != NULL){ - printbuf_init(&cb, cp_buf, pb->size); - printbuf_move(&cb, pb); - printbuf_move(pb, &cb); + tipc_printbuf_init(&cb, cp_buf, pb->size); + tipc_printbuf_move(&cb, pb); + tipc_printbuf_move(pb, &cb); kfree(cp_buf); memcpy(pb->buf, err, strlen(err)); } else { - printbuf_reset(pb); + tipc_printbuf_reset(pb); tipc_printf(pb, err); } } @@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb) } /** - * printbuf_move - move print buffer contents to another print buffer + * tipc_printbuf_move - move print buffer contents to another print buffer * * Current contents of destination print buffer (if any) are discarded. * Source print buffer becomes empty if a successful move occurs. */ -void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) +void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) { int len; @@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) return; if (!pb_from || !pb_from->buf) { - printbuf_reset(pb_to); + tipc_printbuf_reset(pb_to); return; } if (pb_to->size < pb_from->size) { - printbuf_reset(pb_to); + tipc_printbuf_reset(pb_to); tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); return; } @@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) strcpy(pb_to->crs, pb_from->buf); pb_to->crs += len; - printbuf_reset(pb_from); + tipc_printbuf_reset(pb_from); } /** @@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) strcpy(print_string, "*** STRING TOO LONG ***"); while (pb) { - if (pb == CONS) + if (pb == TIPC_CONS) printk(print_string); else if (pb->buf) { chars_left = pb->buf + pb->size - pb->crs - 1; @@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) } /** - * TEE - perform next output operation on both print buffers + * TIPC_TEE - perform next output operation on both print buffers */ -struct print_buf *TEE(struct print_buf *b0, struct print_buf *b1) +struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1) { struct print_buf *pb = b0; @@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) int len; spin_lock_bh(&print_lock); - FORMAT(CONS->buf, len, fmt); - printk(CONS->buf); + FORMAT(TIPC_CONS->buf, len, fmt); + printk(TIPC_CONS->buf); for (; pb; pb = pb->next) { - if (pb == CONS) + if (pb == TIPC_CONS) continue; printk("\n---- Start of dump,%s log ----\n\n", - (pb == LOG) ? "global" : "local"); + (pb == TIPC_LOG) ? "global" : "local"); printbuf_dump(pb); - printbuf_reset(pb); + tipc_printbuf_reset(pb); printk("\n-------- End of dump --------\n"); } spin_unlock_bh(&print_lock); } /** - * log_stop - free up TIPC log print buffer + * tipc_log_stop - free up TIPC log print buffer */ -void log_stop(void) +void tipc_log_stop(void) { spin_lock_bh(&print_lock); - if (LOG->buf) { - kfree(LOG->buf); - LOG->buf = NULL; + if (TIPC_LOG->buf) { + kfree(TIPC_LOG->buf); + TIPC_LOG->buf = NULL; } spin_unlock_bh(&print_lock); } /** - * log_reinit - set TIPC log print buffer to specified size + * tipc_log_reinit - set TIPC log print buffer to specified size */ -void log_reinit(int log_size) +void tipc_log_reinit(int log_size) { - log_stop(); + tipc_log_stop(); if (log_size) { if (log_size <= MAX_STRING) log_size = MAX_STRING + 1; spin_lock_bh(&print_lock); - printbuf_init(LOG, kmalloc(log_size, GFP_ATOMIC), log_size); + tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size); spin_unlock_bh(&print_lock); } } /** - * log_resize - reconfigure size of TIPC log buffer + * tipc_log_resize - reconfigure size of TIPC log buffer */ -struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space) { u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); if (value != delimit(value, 0, 32768)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (log size must be 0-32768)"); - log_reinit(value); - return cfg_reply_none(); + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (log size must be 0-32768)"); + tipc_log_reinit(value); + return tipc_cfg_reply_none(); } /** - * log_dump - capture TIPC log buffer contents in configuration message + * tipc_log_dump - capture TIPC log buffer contents in configuration message */ -struct sk_buff *log_dump(void) +struct sk_buff *tipc_log_dump(void) { struct sk_buff *reply; spin_lock_bh(&print_lock); - if (!LOG->buf) - reply = cfg_reply_ultra_string("log not activated\n"); - else if (printbuf_empty(LOG)) - reply = cfg_reply_ultra_string("log is empty\n"); + if (!TIPC_LOG->buf) + reply = tipc_cfg_reply_ultra_string("log not activated\n"); + else if (tipc_printbuf_empty(TIPC_LOG)) + reply = tipc_cfg_reply_ultra_string("log is empty\n"); else { struct tlv_desc *rep_tlv; struct print_buf pb; int str_len; - str_len = min(LOG->size, 32768u); - reply = cfg_reply_alloc(TLV_SPACE(str_len)); + str_len = min(TIPC_LOG->size, 32768u); + reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len)); if (reply) { rep_tlv = (struct tlv_desc *)reply->data; - printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); - printbuf_move(&pb, LOG); + tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); + tipc_printbuf_move(&pb, TIPC_LOG); str_len = strlen(TLV_DATA(rep_tlv)) + 1; skb_put(reply, TLV_SPACE(str_len)); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h index c6b2a64c224..227f050d2a5 100644 --- a/net/tipc/dbg.h +++ b/net/tipc/dbg.h @@ -44,16 +44,16 @@ struct print_buf { struct print_buf *next; }; -void printbuf_init(struct print_buf *pb, char *buf, u32 sz); -void printbuf_reset(struct print_buf *pb); -int printbuf_empty(struct print_buf *pb); -int printbuf_validate(struct print_buf *pb); -void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from); +void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz); +void tipc_printbuf_reset(struct print_buf *pb); +int tipc_printbuf_empty(struct print_buf *pb); +int tipc_printbuf_validate(struct print_buf *pb); +void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from); -void log_reinit(int log_size); -void log_stop(void); +void tipc_log_reinit(int log_size); +void tipc_log_stop(void); -struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space); -struct sk_buff *log_dump(void); +struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space); +struct sk_buff *tipc_log_dump(void); #endif diff --git a/net/tipc/discover.c b/net/tipc/discover.c index b106ef1621c..53ba4630c10 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) * disc_lost_link(): A link has lost contact */ -void disc_link_event(u32 addr, char *name, int up) +void tipc_disc_link_event(u32 addr, char *name, int up) { if (in_own_cluster(addr)) return; @@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up) } /** - * disc_init_msg - initialize a link setup message + * tipc_disc_init_msg - initialize a link setup message * @type: message type (request or response) * @req_links: number of links associated with message * @dest_domain: network domain of node(s) which should respond to message * @b_ptr: ptr to bearer issuing message */ -struct sk_buff *disc_init_msg(u32 type, - u32 req_links, - u32 dest_domain, - struct bearer *b_ptr) +struct sk_buff *tipc_disc_init_msg(u32 type, + u32 req_links, + u32 dest_domain, + struct bearer *b_ptr) { struct sk_buff *buf = buf_acquire(DSC_H_SIZE); struct tipc_msg *msg; @@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type, } /** - * disc_recv_msg - handle incoming link setup message (request or response) + * tipc_disc_recv_msg - handle incoming link setup message (request or response) * @buf: buffer containing message */ -void disc_recv_msg(struct sk_buff *buf) +void tipc_disc_recv_msg(struct sk_buff *buf) { struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle; struct link *link; @@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf) if (net_id != tipc_net_id) return; - if (!addr_domain_valid(dest)) + if (!tipc_addr_domain_valid(dest)) return; - if (!addr_node_valid(orig)) + if (!tipc_addr_node_valid(orig)) return; if (orig == tipc_own_addr) return; @@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf) /* Always accept link here */ struct sk_buff *rbuf; struct tipc_media_addr *addr; - struct node *n_ptr = node_find(orig); + struct node *n_ptr = tipc_node_find(orig); int link_up; dbg(" in own cluster\n"); if (n_ptr == NULL) { - n_ptr = node_create(orig); + n_ptr = tipc_node_create(orig); } if (n_ptr == NULL) { warn("Memory squeeze; Failed to create node\n"); @@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf) link = n_ptr->links[b_ptr->identity]; if (!link) { dbg("creating link\n"); - link = link_create(b_ptr, orig, &media_addr); + link = tipc_link_create(b_ptr, orig, &media_addr); if (!link) { spin_unlock_bh(&n_ptr->lock); return; @@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf) warn("New bearer address for %s\n", addr_string_fill(addr_string, orig)); memcpy(addr, &media_addr, sizeof(*addr)); - link_reset(link); + tipc_link_reset(link); } - link_up = link_is_up(link); + link_up = tipc_link_is_up(link); spin_unlock_bh(&n_ptr->lock); if ((type == DSC_RESP_MSG) || link_up) return; - rbuf = disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); + rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); if (rbuf != NULL) { msg_dbg(buf_msg(rbuf),"SEND:"); b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr); @@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf) } /** - * disc_stop_link_req - stop sending periodic link setup requests + * tipc_disc_stop_link_req - stop sending periodic link setup requests * @req: ptr to link request structure */ -void disc_stop_link_req(struct link_req *req) +void tipc_disc_stop_link_req(struct link_req *req) { if (!req) return; @@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req) } /** - * disc_update_link_req - update frequency of periodic link setup requests + * tipc_disc_update_link_req - update frequency of periodic link setup requests * @req: ptr to link request structure */ -void disc_update_link_req(struct link_req *req) +void tipc_disc_update_link_req(struct link_req *req) { if (!req) return; @@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req) } /** - * disc_init_link_req - start sending periodic link setup requests + * tipc_disc_init_link_req - start sending periodic link setup requests * @b_ptr: ptr to bearer issuing requests * @dest: destination address for request messages * @dest_domain: network domain of node(s) which should respond to message @@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req) * Returns pointer to link request structure, or NULL if unable to create. */ -struct link_req *disc_init_link_req(struct bearer *b_ptr, - const struct tipc_media_addr *dest, - u32 dest_domain, - u32 req_links) +struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, + const struct tipc_media_addr *dest, + u32 dest_domain, + u32 req_links) { struct link_req *req; @@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr, if (!req) return NULL; - req->buf = disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); + req->buf = tipc_disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); if (!req->buf) { kfree(req); return NULL; diff --git a/net/tipc/discover.h b/net/tipc/discover.h index 2a6114d9162..0454fd1ae7f 100644 --- a/net/tipc/discover.h +++ b/net/tipc/discover.h @@ -37,20 +37,20 @@ #ifndef _TIPC_DISCOVER_H #define _TIPC_DISCOVER_H -#include <linux/tipc.h> +#include "core.h" struct link_req; -struct link_req *disc_init_link_req(struct bearer *b_ptr, - const struct tipc_media_addr *dest, - u32 dest_domain, - u32 req_links); -void disc_update_link_req(struct link_req *req); -void disc_stop_link_req(struct link_req *req); +struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, + const struct tipc_media_addr *dest, + u32 dest_domain, + u32 req_links); +void tipc_disc_update_link_req(struct link_req *req); +void tipc_disc_stop_link_req(struct link_req *req); -void disc_recv_msg(struct sk_buff *buf); +void tipc_disc_recv_msg(struct sk_buff *buf); -void disc_link_event(u32 addr, char *name, int up); +void tipc_disc_link_event(u32 addr, char *name, int up); #if 0 int disc_create_link(const struct tipc_link_create *argv); #endif diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 34d0462db3a..1f8d83b9c8b 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -38,13 +38,11 @@ #include <net/tipc/tipc_bearer.h> #include <net/tipc/tipc_msg.h> #include <linux/netdevice.h> -#include <linux/version.h> #define MAX_ETH_BEARERS 2 -#define TIPC_PROTOCOL 0x88ca -#define ETH_LINK_PRIORITY 10 +#define ETH_LINK_PRIORITY TIPC_DEF_LINK_PRI #define ETH_LINK_TOLERANCE TIPC_DEF_LINK_TOL - +#define ETH_LINK_WINDOW TIPC_DEF_LINK_WIN /** * struct eth_bearer - Ethernet bearer data structure @@ -78,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, clone->nh.raw = clone->data; dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; clone->dev = dev; - dev->hard_header(clone, dev, TIPC_PROTOCOL, + dev->hard_header(clone, dev, ETH_P_TIPC, &dest->dev_addr.eth_addr, dev->dev_addr, clone->len); dev_queue_xmit(clone); @@ -141,7 +139,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) return -EDQUOT; if (!eb_ptr->dev) { eb_ptr->dev = dev; - eb_ptr->tipc_packet_type.type = __constant_htons(TIPC_PROTOCOL); + eb_ptr->tipc_packet_type.type = __constant_htons(ETH_P_TIPC); eb_ptr->tipc_packet_type.dev = dev; eb_ptr->tipc_packet_type.func = recv_msg; 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 } /** - * eth_media_start - activate Ethernet bearer support + * tipc_eth_media_start - activate Ethernet bearer support * * Register Ethernet media type with TIPC bearer code. Also register * with OS for notifications about device state changes. */ -int eth_media_start(void) +int tipc_eth_media_start(void) { struct tipc_media_addr bcast_addr; int res; @@ -260,7 +258,7 @@ int eth_media_start(void) res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", enable_bearer, disable_bearer, send_msg, eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, - ETH_LINK_TOLERANCE, TIPC_DEF_LINK_WIN); + ETH_LINK_TOLERANCE, ETH_LINK_WINDOW); if (res) return res; @@ -273,10 +271,10 @@ int eth_media_start(void) } /** - * eth_media_stop - deactivate Ethernet bearer support + * tipc_eth_media_stop - deactivate Ethernet bearer support */ -void eth_media_stop(void) +void tipc_eth_media_stop(void) { int i; diff --git a/net/tipc/handler.c b/net/tipc/handler.c index f320010f8a6..966f70a1b60 100644 --- a/net/tipc/handler.c +++ b/net/tipc/handler.c @@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy); static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0); -unsigned int k_signal(Handler routine, unsigned long argument) +unsigned int tipc_k_signal(Handler routine, unsigned long argument) { struct queue_item *item; @@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy) spin_unlock_bh(&qitem_lock); } -int handler_start(void) +int tipc_handler_start(void) { tipc_queue_item_cache = kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), @@ -107,7 +107,7 @@ int handler_start(void) return 0; } -void handler_stop(void) +void tipc_handler_stop(void) { struct list_head *l, *n; struct queue_item *item; diff --git a/net/tipc/link.c b/net/tipc/link.c index 7265f4be476..511872afa45 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, #define LINK_LOG_BUF_SIZE 0 #define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0) -#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) msg_print(&l_ptr->print_buf, msg, txt); } while(0) +#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0) #define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0) #define dbg_link_dump() do { \ if (LINK_LOG_BUF_SIZE) { \ tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ - printbuf_move(LOG, &l_ptr->print_buf); \ + tipc_printbuf_move(LOG, &l_ptr->print_buf); \ } \ } while (0) @@ -252,14 +252,14 @@ static inline u32 link_last_sent(struct link *l_ptr) * Simple non-inlined link routines (i.e. referenced outside this file) */ -int link_is_up(struct link *l_ptr) +int tipc_link_is_up(struct link *l_ptr) { if (!l_ptr) return 0; return (link_working_working(l_ptr) || link_working_unknown(l_ptr)); } -int link_is_active(struct link *l_ptr) +int tipc_link_is_active(struct link *l_ptr) { return ((l_ptr->owner->active_links[0] == l_ptr) || (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) * link_timeout - handle expiration of link timer * @l_ptr: pointer to link * - * This routine must not grab "net_lock" to avoid a potential deadlock conflict - * with link_delete(). (There is no risk that the node will be deleted by - * another thread because link_delete() always cancels the link timer before - * node_delete() is called.) + * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict + * with tipc_link_delete(). (There is no risk that the node will be deleted by + * another thread because tipc_link_delete() always cancels the link timer before + * tipc_node_delete() is called.) */ static void link_timeout(struct link *l_ptr) { - node_lock(l_ptr->owner); + tipc_node_lock(l_ptr->owner); /* update counters used in statistical profiling of send traffic */ @@ -391,9 +391,9 @@ static void link_timeout(struct link *l_ptr) link_state_event(l_ptr, TIMEOUT_EVT); if (l_ptr->next_out) - link_push_queue(l_ptr); + tipc_link_push_queue(l_ptr); - node_unlock(l_ptr->owner); + tipc_node_unlock(l_ptr->owner); } static 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) } /** - * link_create - create a new link + * tipc_link_create - create a new link * @b_ptr: pointer to associated bearer * @peer: network address of node at other end of link * @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) * Returns pointer to link. */ -struct link *link_create(struct bearer *b_ptr, const u32 peer, - const struct tipc_media_addr *media_addr) +struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, + const struct tipc_media_addr *media_addr) { struct link *l_ptr; struct tipc_msg *msg; @@ -449,7 +449,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, strcpy((char *)msg_data(msg), if_name); l_ptr->priority = b_ptr->priority; - link_set_queue_limits(l_ptr, b_ptr->media->window); + tipc_link_set_queue_limits(l_ptr, b_ptr->media->window); link_init_max_pkt(l_ptr); @@ -458,7 +458,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, link_reset_statistics(l_ptr); - l_ptr->owner = node_attach_link(l_ptr); + l_ptr->owner = tipc_node_attach_link(l_ptr); if (!l_ptr->owner) { kfree(l_ptr); return NULL; @@ -472,52 +472,52 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, warn("Memory squeeze; Failed to create link\n"); return NULL; } - printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); + tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); } - k_signal((Handler)link_start, (unsigned long)l_ptr); + tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr); - dbg("link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", + dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); return l_ptr; } /** - * link_delete - delete a link + * tipc_link_delete - delete a link * @l_ptr: pointer to link * - * Note: 'net_lock' is write_locked, bearer is locked. + * Note: 'tipc_net_lock' is write_locked, bearer is locked. * This routine must not grab the node lock until after link timer cancellation * to avoid a potential deadlock situation. */ -void link_delete(struct link *l_ptr) +void tipc_link_delete(struct link *l_ptr) { if (!l_ptr) { err("Attempt to delete non-existent link\n"); return; } - dbg("link_delete()\n"); + dbg("tipc_link_delete()\n"); k_cancel_timer(&l_ptr->timer); - node_lock(l_ptr->owner); - link_reset(l_ptr); - node_detach_link(l_ptr->owner, l_ptr); - link_stop(l_ptr); + tipc_node_lock(l_ptr->owner); + tipc_link_reset(l_ptr); + tipc_node_detach_link(l_ptr->owner, l_ptr); + tipc_link_stop(l_ptr); list_del_init(&l_ptr->link_list); if (LINK_LOG_BUF_SIZE) kfree(l_ptr->print_buf.buf); - node_unlock(l_ptr->owner); + tipc_node_unlock(l_ptr->owner); k_term_timer(&l_ptr->timer); kfree(l_ptr); } -void link_start(struct link *l_ptr) +void tipc_link_start(struct link *l_ptr) { - dbg("link_start %x\n", l_ptr); + dbg("tipc_link_start %x\n", l_ptr); link_state_event(l_ptr, STARTING_EVT); } @@ -535,8 +535,8 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) { struct port *p_ptr; - spin_lock_bh(&port_list_lock); - p_ptr = port_lock(origport); + spin_lock_bh(&tipc_port_list_lock); + p_ptr = tipc_port_lock(origport); if (p_ptr) { if (!p_ptr->wakeup) goto exit; @@ -548,13 +548,13 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); l_ptr->stats.link_congs++; exit: - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); } - spin_unlock_bh(&port_list_lock); + spin_unlock_bh(&tipc_port_list_lock); return -ELINKCONG; } -void link_wakeup_ports(struct link *l_ptr, int all) +void tipc_link_wakeup_ports(struct link *l_ptr, int all) { struct port *p_ptr; struct port *temp_p_ptr; @@ -564,7 +564,7 @@ void link_wakeup_ports(struct link *l_ptr, int all) win = 100000; if (win <= 0) return; - if (!spin_trylock_bh(&port_list_lock)) + if (!spin_trylock_bh(&tipc_port_list_lock)) return; if (link_congested(l_ptr)) goto exit; @@ -583,7 +583,7 @@ void link_wakeup_ports(struct link *l_ptr, int all) } exit: - spin_unlock_bh(&port_list_lock); + spin_unlock_bh(&tipc_port_list_lock); } /** @@ -606,11 +606,11 @@ static void link_release_outqueue(struct link *l_ptr) } /** - * link_reset_fragments - purge link's inbound message fragments queue + * tipc_link_reset_fragments - purge link's inbound message fragments queue * @l_ptr: pointer to link */ -void link_reset_fragments(struct link *l_ptr) +void tipc_link_reset_fragments(struct link *l_ptr) { struct sk_buff *buf = l_ptr->defragm_buf; struct sk_buff *next; @@ -624,11 +624,11 @@ void link_reset_fragments(struct link *l_ptr) } /** - * link_stop - purge all inbound and outbound messages associated with link + * tipc_link_stop - purge all inbound and outbound messages associated with link * @l_ptr: pointer to link */ -void link_stop(struct link *l_ptr) +void tipc_link_stop(struct link *l_ptr) { struct sk_buff *buf; struct sk_buff *next; @@ -647,7 +647,7 @@ void link_stop(struct link *l_ptr) buf = next; } - link_reset_fragments(l_ptr); + tipc_link_reset_fragments(l_ptr); buf_discard(l_ptr->proto_msg_queue); l_ptr->proto_msg_queue = NULL; @@ -677,7 +677,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), ev->up = up; ev->fcn = fcn; memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME); - k_signal((Handler)link_recv_event, (unsigned long)ev); + tipc_k_signal((Handler)link_recv_event, (unsigned long)ev); } #else @@ -686,7 +686,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), #endif -void link_reset(struct link *l_ptr) +void tipc_link_reset(struct link *l_ptr) { struct sk_buff *buf; u32 prev_state = l_ptr->state; @@ -706,13 +706,13 @@ void link_reset(struct link *l_ptr) if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET)) return; - node_link_down(l_ptr->owner, l_ptr); - bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); + tipc_node_link_down(l_ptr->owner, l_ptr); + tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); #if 0 - tipc_printf(CONS, "\nReset link <%s>\n", l_ptr->name); + tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name); dbg_link_dump(); #endif - if (node_has_active_links(l_ptr->owner) && + if (tipc_node_has_active_links(l_ptr->owner) && l_ptr->owner->permit_changeover) { l_ptr->reset_checkpoint = checkpoint; l_ptr->exp_msg_count = START_CHANGEOVER; @@ -730,7 +730,7 @@ void link_reset(struct link *l_ptr) buf = next; } if (!list_empty(&l_ptr->waiting_ports)) - link_wakeup_ports(l_ptr, 1); + tipc_link_wakeup_ports(l_ptr, 1); l_ptr->retransm_queue_head = 0; l_ptr->retransm_queue_size = 0; @@ -747,20 +747,20 @@ void link_reset(struct link *l_ptr) l_ptr->stale_count = 0; link_reset_statistics(l_ptr); - link_send_event(cfg_link_event, l_ptr, 0); + link_send_event(tipc_cfg_link_event, l_ptr, 0); if (!in_own_cluster(l_ptr->addr)) - link_send_event(disc_link_event, l_ptr, 0); + link_send_event(tipc_disc_link_event, l_ptr, 0); } static void link_activate(struct link *l_ptr) { l_ptr->next_in_no = 1; - node_link_up(l_ptr->owner, l_ptr); - bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); - link_send_event(cfg_link_event, l_ptr, 1); + tipc_node_link_up(l_ptr->owner, l_ptr); + tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); + link_send_event(tipc_cfg_link_event, l_ptr, 1); if (!in_own_cluster(l_ptr->addr)) - link_send_event(disc_link_event, l_ptr, 1); + link_send_event(tipc_disc_link_event, l_ptr, 1); } /** @@ -799,13 +799,13 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link("TIM "); if (l_ptr->next_in_no != l_ptr->checkpoint) { l_ptr->checkpoint = l_ptr->next_in_no; - if (bclink_acks_missing(l_ptr->owner)) { - link_send_proto_msg(l_ptr, STATE_MSG, - 0, 0, 0, 0, 0); + if (tipc_bclink_acks_missing(l_ptr->owner)) { + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { - link_send_proto_msg(l_ptr, STATE_MSG, - 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } link_set_timer(l_ptr, cont_intv); @@ -814,16 +814,16 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link(" -> WU\n"); l_ptr->state = WORKING_UNKNOWN; l_ptr->fsm_msg_cnt = 0; - link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv / 4); break; case RESET_MSG: dbg_link("RES -> RR\n"); - link_reset(l_ptr); + tipc_link_reset(l_ptr); l_ptr->state = RESET_RESET; l_ptr->fsm_msg_cnt = 0; - link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -844,10 +844,10 @@ static void link_state_event(struct link *l_ptr, unsigned event) break; case RESET_MSG: dbg_link("RES -> RR\n"); - link_reset(l_ptr); + tipc_link_reset(l_ptr); l_ptr->state = RESET_RESET; l_ptr->fsm_msg_cnt = 0; - link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -858,9 +858,9 @@ static void link_state_event(struct link *l_ptr, unsigned event) l_ptr->state = WORKING_WORKING; l_ptr->fsm_msg_cnt = 0; l_ptr->checkpoint = l_ptr->next_in_no; - if (bclink_acks_missing(l_ptr->owner)) { - link_send_proto_msg(l_ptr, STATE_MSG, - 0, 0, 0, 0, 0); + if (tipc_bclink_acks_missing(l_ptr->owner)) { + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } link_set_timer(l_ptr, cont_intv); @@ -868,18 +868,18 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link("Probing %u/%u,timer = %u ms)\n", l_ptr->fsm_msg_cnt, l_ptr->abort_limit, cont_intv / 4); - link_send_proto_msg(l_ptr, STATE_MSG, - 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv / 4); } else { /* Link has failed */ dbg_link("-> RU (%u probes unanswered)\n", l_ptr->fsm_msg_cnt); - link_reset(l_ptr); + tipc_link_reset(l_ptr); l_ptr->state = RESET_UNKNOWN; l_ptr->fsm_msg_cnt = 0; - link_send_proto_msg(l_ptr, RESET_MSG, - 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, RESET_MSG, + 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); } @@ -904,7 +904,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) l_ptr->state = WORKING_WORKING; l_ptr->fsm_msg_cnt = 0; link_activate(l_ptr); - link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -913,7 +913,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link(" -> RR\n"); l_ptr->state = RESET_RESET; l_ptr->fsm_msg_cnt = 0; - link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -923,7 +923,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) /* fall through */ case TIMEOUT_EVT: dbg_link("TIM \n"); - link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -947,7 +947,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) l_ptr->state = WORKING_WORKING; l_ptr->fsm_msg_cnt = 0; link_activate(l_ptr); - link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); break; @@ -956,7 +956,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) break; case TIMEOUT_EVT: dbg_link("TIM\n"); - link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv); 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, } /* - * link_send_buf() is the 'full path' for messages, called from + * tipc_link_send_buf() is the 'full path' for messages, called from * inside TIPC when the 'fast path' in tipc_send_buf * has failed, and from link_send() */ -int link_send_buf(struct link *l_ptr, struct sk_buff *buf) +int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) { struct tipc_msg *msg = buf_msg(buf); u32 size = msg_size(msg); @@ -1051,7 +1051,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) buf_discard(buf); if (imp > CONN_MANAGER) { warn("Resetting <%s>, send queue full", l_ptr->name); - link_reset(l_ptr); + tipc_link_reset(l_ptr); } return dsz; } @@ -1059,21 +1059,21 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) /* Fragmentation needed ? */ if (size > max_packet) - return link_send_long_buf(l_ptr, buf); + return tipc_link_send_long_buf(l_ptr, buf); /* Packet can be queued or sent: */ if (queue_size > l_ptr->stats.max_queue_sz) l_ptr->stats.max_queue_sz = queue_size; - if (likely(!bearer_congested(l_ptr->b_ptr, l_ptr) && + if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && !link_congested(l_ptr))) { link_add_to_outqueue(l_ptr, buf, msg); - if (likely(bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) { + if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) { l_ptr->unacked_window = 0; } else { - bearer_schedule(l_ptr->b_ptr, l_ptr); + tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); l_ptr->stats.bearer_congs++; l_ptr->next_out = buf; } @@ -1088,7 +1088,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (l_ptr->next_out && link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { - bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); + tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); return dsz; } @@ -1114,38 +1114,38 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (!l_ptr->next_out) l_ptr->next_out = buf; link_add_to_outqueue(l_ptr, buf, msg); - bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); + tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); return dsz; } /* - * link_send(): same as link_send_buf(), but the link to use has + * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has * not been selected yet, and the the owner node is not locked * Called by TIPC internal users, e.g. the name distributor */ -int link_send(struct sk_buff *buf, u32 dest, u32 selector) +int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) { struct link *l_ptr; struct node *n_ptr; int res = -ELINKCONG; - read_lock_bh(&net_lock); - n_ptr = node_select(dest, selector); + read_lock_bh(&tipc_net_lock); + n_ptr = tipc_node_select(dest, selector); if (n_ptr) { - node_lock(n_ptr); + tipc_node_lock(n_ptr); l_ptr = n_ptr->active_links[selector & 1]; - dbg("link_send: found link %x for dest %x\n", l_ptr, dest); + dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest); if (l_ptr) { - res = link_send_buf(l_ptr, buf); + res = tipc_link_send_buf(l_ptr, buf); } - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); } else { dbg("Attempt to send msg to unknown node:\n"); msg_dbg(buf_msg(buf),">>>"); buf_discard(buf); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return res; } @@ -1166,14 +1166,14 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) { if (likely(list_empty(&l_ptr->b_ptr->cong_links))) { link_add_to_outqueue(l_ptr, buf, msg); - if (likely(bearer_send(l_ptr->b_ptr, buf, - &l_ptr->media_addr))) { + if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, + &l_ptr->media_addr))) { l_ptr->unacked_window = 0; msg_dbg(msg,"SENT_FAST:"); return res; } dbg("failed sent fast...\n"); - bearer_schedule(l_ptr->b_ptr, l_ptr); + tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); l_ptr->stats.bearer_congs++; l_ptr->next_out = buf; return res; @@ -1182,7 +1182,7 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, else *used_max_pkt = link_max_pkt(l_ptr); } - return link_send_buf(l_ptr, buf); /* All other cases */ + return tipc_link_send_buf(l_ptr, buf); /* All other cases */ } /* @@ -1200,24 +1200,24 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) u32 dummy; if (destnode == tipc_own_addr) - return port_recv_msg(buf); + return tipc_port_recv_msg(buf); - read_lock_bh(&net_lock); - n_ptr = node_select(destnode, selector); + read_lock_bh(&tipc_net_lock); + n_ptr = tipc_node_select(destnode, selector); if (likely(n_ptr)) { - node_lock(n_ptr); + tipc_node_lock(n_ptr); l_ptr = n_ptr->active_links[selector]; dbg("send_fast: buf %x selected %x, destnode = %x\n", buf, l_ptr, destnode); if (likely(l_ptr)) { res = link_send_buf_fast(l_ptr, buf, &dummy); - node_unlock(n_ptr); - read_unlock_bh(&net_lock); + tipc_node_unlock(n_ptr); + read_unlock_bh(&tipc_net_lock); return res; } - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); res = msg_data_sz(buf_msg(buf)); tipc_reject_msg(buf, TIPC_ERR_NO_NODE); return res; @@ -1225,15 +1225,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) /* - * link_send_sections_fast: Entry for messages where the + * tipc_link_send_sections_fast: Entry for messages where the * destination processor is known and the header is complete, * except for total message length. * Returns user data length or errno. */ -int link_send_sections_fast(struct port *sender, - struct iovec const *msg_sect, - const u32 num_sect, - u32 destaddr) +int tipc_link_send_sections_fast(struct port *sender, + struct iovec const *msg_sect, + const u32 num_sect, + u32 destaddr) { struct tipc_msg *hdr = &sender->publ.phdr; struct link *l_ptr; @@ -1253,10 +1253,10 @@ again: res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt, !sender->user_port, &buf); - read_lock_bh(&net_lock); - node = node_select(destaddr, selector); + read_lock_bh(&tipc_net_lock); + node = tipc_node_select(destaddr, selector); if (likely(node)) { - node_lock(node); + tipc_node_lock(node); l_ptr = node->active_links[selector]; if (likely(l_ptr)) { if (likely(buf)) { @@ -1265,8 +1265,8 @@ again: if (unlikely(res < 0)) buf_discard(buf); exit: - node_unlock(node); - read_unlock_bh(&net_lock); + tipc_node_unlock(node); + read_unlock_bh(&tipc_net_lock); return res; } @@ -1290,8 +1290,8 @@ exit: */ sender->max_pkt = link_max_pkt(l_ptr); - node_unlock(node); - read_unlock_bh(&net_lock); + tipc_node_unlock(node); + read_unlock_bh(&tipc_net_lock); if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) @@ -1300,17 +1300,17 @@ exit: return link_send_sections_long(sender, msg_sect, num_sect, destaddr); } - node_unlock(node); + tipc_node_unlock(node); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); /* Couldn't find a link to the destination node */ if (buf) return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); if (res >= 0) - return port_reject_sections(sender, hdr, msg_sect, num_sect, - TIPC_ERR_NO_NODE); + return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect, + TIPC_ERR_NO_NODE); return res; } @@ -1444,17 +1444,17 @@ error: * Now we have a buffer chain. Select a link and check * that packet size is still OK */ - node = node_select(destaddr, sender->publ.ref & 1); + node = tipc_node_select(destaddr, sender->publ.ref & 1); if (likely(node)) { - node_lock(node); + tipc_node_lock(node); l_ptr = node->active_links[sender->publ.ref & 1]; if (!l_ptr) { - node_unlock(node); + tipc_node_unlock(node); goto reject; } if (link_max_pkt(l_ptr) < max_pkt) { sender->max_pkt = link_max_pkt(l_ptr); - node_unlock(node); + tipc_node_unlock(node); for (; buf_chain; buf_chain = buf) { buf = buf_chain->next; buf_discard(buf_chain); @@ -1467,8 +1467,8 @@ reject: buf = buf_chain->next; buf_discard(buf_chain); } - return port_reject_sections(sender, hdr, msg_sect, num_sect, - TIPC_ERR_NO_NODE); + return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect, + TIPC_ERR_NO_NODE); } /* Append whole chain to send queue: */ @@ -1491,15 +1491,15 @@ reject: /* Send it, if possible: */ - link_push_queue(l_ptr); - node_unlock(node); + tipc_link_push_queue(l_ptr); + tipc_node_unlock(node); return dsz; } /* - * link_push_packet: Push one unsent packet to the media + * tipc_link_push_packet: Push one unsent packet to the media */ -u32 link_push_packet(struct link *l_ptr) +u32 tipc_link_push_packet(struct link *l_ptr) { struct sk_buff *buf = l_ptr->first_out; u32 r_q_size = l_ptr->retransm_queue_size; @@ -1526,7 +1526,7 @@ u32 link_push_packet(struct link *l_ptr) if (r_q_size && buf && !skb_cloned(buf)) { msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); - if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { + if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-RETR>"); l_ptr->retransm_queue_head = mod(++r_q_head); l_ptr->retransm_queue_size = --r_q_size; @@ -1545,7 +1545,7 @@ u32 link_push_packet(struct link *l_ptr) if (buf) { msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); - if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { + if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-PROT>"); l_ptr->unacked_window = 0; buf_discard(buf); @@ -1569,7 +1569,7 @@ u32 link_push_packet(struct link *l_ptr) if (mod(next - first) < l_ptr->queue_limit[0]) { msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); - if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { + if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (msg_user(msg) == MSG_BUNDLER) msg_set_type(msg, CLOSED_MSG); msg_dbg(msg, ">PUSH-DATA>"); @@ -1589,29 +1589,29 @@ u32 link_push_packet(struct link *l_ptr) * push_queue(): push out the unsent messages of a link where * congestion has abated. Node is locked */ -void link_push_queue(struct link *l_ptr) +void tipc_link_push_queue(struct link *l_ptr) { u32 res; - if (bearer_congested(l_ptr->b_ptr, l_ptr)) + if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) return; do { - res = link_push_packet(l_ptr); + res = tipc_link_push_packet(l_ptr); } while (res == TIPC_OK); if (res == PUSH_FAILED) - bearer_schedule(l_ptr->b_ptr, l_ptr); + tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); } -void link_retransmit(struct link *l_ptr, struct sk_buff *buf, - u32 retransmits) +void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, + u32 retransmits) { struct tipc_msg *msg; dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); - if (bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { + if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>"); dbg_print_link(l_ptr, " "); 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, msg = buf_msg(buf); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); - if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { + if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { /* Catch if retransmissions fail repeatedly: */ if (l_ptr->last_retransmitted == msg_seqno(msg)) { if (++l_ptr->stale_count > 100) { - msg_print(CONS, buf_msg(buf), ">RETR>"); + tipc_msg_print(TIPC_CONS, buf_msg(buf), ">RETR>"); info("...Retransmitted %u times\n", l_ptr->stale_count); - link_print(l_ptr, CONS, "Resetting Link\n");; - link_reset(l_ptr); + link_print(l_ptr, TIPC_CONS, "Resetting Link\n");; + tipc_link_reset(l_ptr); break; } } else { @@ -1643,7 +1643,7 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf, retransmits--; l_ptr->stats.retransmitted++; } else { - bearer_schedule(l_ptr->b_ptr, l_ptr); + tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); l_ptr->stats.bearer_congs++; l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); l_ptr->retransm_queue_size = retransmits; @@ -1663,9 +1663,9 @@ static void link_recv_non_seq(struct sk_buff *buf) struct tipc_msg *msg = buf_msg(buf); if (msg_user(msg) == LINK_CONFIG) - disc_recv_msg(buf); + tipc_disc_recv_msg(buf); else - bclink_recv_pkt(buf); + tipc_bclink_recv_pkt(buf); } /** @@ -1692,7 +1692,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) { - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); while (head) { struct bearer *b_ptr; struct node *n_ptr; @@ -1720,22 +1720,22 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) link_recv_non_seq(buf); continue; } - n_ptr = node_find(msg_prevnode(msg)); + n_ptr = tipc_node_find(msg_prevnode(msg)); if (unlikely(!n_ptr)) goto cont; - node_lock(n_ptr); + tipc_node_lock(n_ptr); l_ptr = n_ptr->links[b_ptr->identity]; if (unlikely(!l_ptr)) { - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); goto cont; } /* * Release acked messages */ if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { - if (node_is_up(n_ptr) && n_ptr->bclink.supported) - bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); + if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported) + tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); } crs = l_ptr->first_out; @@ -1752,12 +1752,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) l_ptr->out_queue_size -= released; } if (unlikely(l_ptr->next_out)) - link_push_queue(l_ptr); + tipc_link_push_queue(l_ptr); if (unlikely(!list_empty(&l_ptr->waiting_ports))) - link_wakeup_ports(l_ptr, 0); + tipc_link_wakeup_ports(l_ptr, 0); if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) { l_ptr->stats.sent_acks++; - link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); } protocol_check: @@ -1770,8 +1770,8 @@ protocol_check: if (likely(msg_is_dest(msg, tipc_own_addr))) { deliver: if (likely(msg_isdata(msg))) { - node_unlock(n_ptr); - port_recv_msg(buf); + tipc_node_unlock(n_ptr); + tipc_port_recv_msg(buf); continue; } switch (msg_user(msg)) { @@ -1779,34 +1779,32 @@ deliver: l_ptr->stats.recv_bundles++; l_ptr->stats.recv_bundled += msg_msgcnt(msg); - node_unlock(n_ptr); - link_recv_bundle(buf); + tipc_node_unlock(n_ptr); + tipc_link_recv_bundle(buf); continue; case ROUTE_DISTRIBUTOR: - node_unlock(n_ptr); - cluster_recv_routing_table(buf); + tipc_node_unlock(n_ptr); + tipc_cltr_recv_routing_table(buf); continue; case NAME_DISTRIBUTOR: - node_unlock(n_ptr); - named_recv(buf); + tipc_node_unlock(n_ptr); + tipc_named_recv(buf); continue; case CONN_MANAGER: - node_unlock(n_ptr); - port_recv_proto_msg(buf); + tipc_node_unlock(n_ptr); + tipc_port_recv_proto_msg(buf); continue; case MSG_FRAGMENTER: l_ptr->stats.recv_fragments++; - if (link_recv_fragment( - &l_ptr->defragm_buf, - &buf, &msg)) { + if (tipc_link_recv_fragment(&l_ptr->defragm_buf, + &buf, &msg)) { l_ptr->stats.recv_fragmented++; goto deliver; } break; case CHANGEOVER_PROTOCOL: type = msg_type(msg); - if (link_recv_changeover_msg( - &l_ptr, &buf)) { + if (link_recv_changeover_msg(&l_ptr, &buf)) { msg = buf_msg(buf); seq_no = msg_seqno(msg); TIPC_SKB_CB(buf)->handle @@ -1818,20 +1816,20 @@ deliver: break; } } - node_unlock(n_ptr); - net_route_msg(buf); + tipc_node_unlock(n_ptr); + tipc_net_route_msg(buf); continue; } link_handle_out_of_seq_msg(l_ptr, buf); head = link_insert_deferred_queue(l_ptr, head); - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); continue; } if (msg_user(msg) == LINK_PROTOCOL) { link_recv_proto_msg(l_ptr, buf); head = link_insert_deferred_queue(l_ptr, head); - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); continue; } msg_dbg(msg,"NSEQ<REC<"); @@ -1842,14 +1840,14 @@ deliver: msg_dbg(msg,"RECV-REINS:"); buf->next = head; head = buf; - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); continue; } - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); cont: buf_discard(buf); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); } /* @@ -1858,9 +1856,9 @@ cont: * Returns the increase of the queue length,i.e. 0 or 1 */ -u32 link_defer_pkt(struct sk_buff **head, - struct sk_buff **tail, - struct sk_buff *buf) +u32 tipc_link_defer_pkt(struct sk_buff **head, + struct sk_buff **tail, + struct sk_buff *buf) { struct sk_buff *prev = 0; struct sk_buff *crs = *head; @@ -1939,12 +1937,12 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, return; } - if (link_defer_pkt(&l_ptr->oldest_deferred_in, - &l_ptr->newest_deferred_in, buf)) { + if (tipc_link_defer_pkt(&l_ptr->oldest_deferred_in, + &l_ptr->newest_deferred_in, buf)) { l_ptr->deferred_inqueue_sz++; l_ptr->stats.deferred_recv++; if ((l_ptr->deferred_inqueue_sz % 16) == 1) - link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); } else l_ptr->stats.duplicates++; } @@ -1952,8 +1950,8 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, /* * Send protocol message to the other endpoint. */ -void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, - u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) +void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, + u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) { struct sk_buff *buf = 0; 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, msg_set_type(msg, msg_typ); msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); - msg_set_last_bcast(msg, bclink_get_last_sent()); + msg_set_last_bcast(msg, tipc_bclink_get_last_sent()); if (msg_typ == STATE_MSG) { u32 next_sent = mod(l_ptr->next_out_no); - if (!link_is_up(l_ptr)) + if (!tipc_link_is_up(l_ptr)) return; if (l_ptr->next_out) 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, msg_set_max_pkt(msg, l_ptr->max_pkt_target); } - if (node_has_redundant_links(l_ptr->owner)) { + if (tipc_node_has_redundant_links(l_ptr->owner)) { msg_set_redundant_link(msg); } else { msg_clear_redundant_link(msg); @@ -2026,7 +2024,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, /* Congestion? */ - if (bearer_congested(l_ptr->b_ptr, l_ptr)) { + if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { if (!l_ptr->proto_msg_queue) { l_ptr->proto_msg_queue = 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, memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); msg_set_size(buf_msg(buf), msg_size); - if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { + if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { l_ptr->unacked_window = 0; buf_discard(buf); return; } /* New congestion */ - bearer_schedule(l_ptr->b_ptr, l_ptr); + tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); l_ptr->proto_msg_queue = buf; l_ptr->stats.bearer_congs++; } @@ -2131,7 +2129,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) l_ptr->peer_bearer_id = msg_bearer_id(msg); /* Synchronize broadcast sequence numbers */ - if (!node_has_redundant_links(l_ptr->owner)) { + if (!tipc_node_has_redundant_links(l_ptr->owner)) { l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); } break; @@ -2145,7 +2143,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) warn("Changing prio <%s>: %u->%u\n", l_ptr->name, l_ptr->priority, msg_linkprio(msg)); l_ptr->priority = msg_linkprio(msg); - link_reset(l_ptr); /* Enforce change to take effect */ + tipc_link_reset(l_ptr); /* Enforce change to take effect */ break; } 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) /* Protocol message before retransmits, reduce loss risk */ - bclink_check_gap(l_ptr->owner, msg_last_bcast(msg)); + tipc_bclink_check_gap(l_ptr->owner, msg_last_bcast(msg)); if (rec_gap || (msg_probe(msg))) { - link_send_proto_msg(l_ptr, STATE_MSG, - 0, rec_gap, 0, 0, max_pkt_ack); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 0, rec_gap, 0, 0, max_pkt_ack); } if (msg_seq_gap(msg)) { msg_dbg(msg, "With Gap:"); l_ptr->stats.recv_nacks++; - link_retransmit(l_ptr, l_ptr->first_out, - msg_seq_gap(msg)); + tipc_link_retransmit(l_ptr, l_ptr->first_out, + msg_seq_gap(msg)); } break; default: @@ -2198,20 +2196,20 @@ exit: /* - * link_tunnel(): Send one message via a link belonging to + * tipc_link_tunnel(): Send one message via a link belonging to * another bearer. Owner node is locked. */ -void link_tunnel(struct link *l_ptr, - struct tipc_msg *tunnel_hdr, - struct tipc_msg *msg, - u32 selector) +void tipc_link_tunnel(struct link *l_ptr, + struct tipc_msg *tunnel_hdr, + struct tipc_msg *msg, + u32 selector) { struct link *tunnel; struct sk_buff *buf; u32 length = msg_size(msg); tunnel = l_ptr->owner->active_links[selector & 1]; - if (!link_is_up(tunnel)) + if (!tipc_link_is_up(tunnel)) return; msg_set_size(tunnel_hdr, length + INT_H_SIZE); buf = buf_acquire(length + INT_H_SIZE); @@ -2222,7 +2220,7 @@ void link_tunnel(struct link *l_ptr, dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); msg_dbg(buf_msg(buf), ">SEND>"); assert(tunnel); - link_send_buf(tunnel, buf); + tipc_link_send_buf(tunnel, buf); } @@ -2232,12 +2230,12 @@ void link_tunnel(struct link *l_ptr, * Owner node is locked. */ -void link_changeover(struct link *l_ptr) +void tipc_link_changeover(struct link *l_ptr) { u32 msgcount = l_ptr->out_queue_size; struct sk_buff *crs = l_ptr->first_out; struct link *tunnel = l_ptr->owner->active_links[0]; - int split_bundles = node_has_redundant_links(l_ptr->owner); + int split_bundles = tipc_node_has_redundant_links(l_ptr->owner); struct tipc_msg tunnel_hdr; if (!tunnel) @@ -2261,7 +2259,7 @@ void link_changeover(struct link *l_ptr) dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); - link_send_buf(tunnel, buf); + tipc_link_send_buf(tunnel, buf); } else { warn("Memory squeeze; link changeover failed\n"); } @@ -2277,20 +2275,20 @@ void link_changeover(struct link *l_ptr) while (msgcount--) { msg_set_seqno(m,msg_seqno(msg)); - link_tunnel(l_ptr, &tunnel_hdr, m, - msg_link_selector(m)); + tipc_link_tunnel(l_ptr, &tunnel_hdr, m, + msg_link_selector(m)); pos += align(msg_size(m)); m = (struct tipc_msg *)pos; } } else { - link_tunnel(l_ptr, &tunnel_hdr, msg, - msg_link_selector(msg)); + tipc_link_tunnel(l_ptr, &tunnel_hdr, msg, + msg_link_selector(msg)); } crs = crs->next; } } -void link_send_duplicate(struct link *l_ptr, struct link *tunnel) +void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) { struct sk_buff *iter; struct tipc_msg tunnel_hdr; @@ -2320,8 +2318,8 @@ void link_send_duplicate(struct link *l_ptr, struct link *tunnel) dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); msg_dbg(buf_msg(outbuf), ">SEND>"); - link_send_buf(tunnel, outbuf); - if (!link_is_up(l_ptr)) + tipc_link_send_buf(tunnel, outbuf); + if (!tipc_link_is_up(l_ptr)) return; iter = iter->next; } @@ -2393,9 +2391,9 @@ static int link_recv_changeover_msg(struct link **l_ptr, /* First original message ?: */ - if (link_is_up(dest_link)) { + if (tipc_link_is_up(dest_link)) { msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); - link_reset(dest_link); + tipc_link_reset(dest_link); dest_link->exp_msg_count = msg_count; if (!msg_count) goto exit; @@ -2436,7 +2434,7 @@ exit: /* * Bundler functionality: */ -void link_recv_bundle(struct sk_buff *buf) +void tipc_link_recv_bundle(struct sk_buff *buf) { u32 msgcount = msg_msgcnt(buf_msg(buf)); u32 pos = INT_H_SIZE; @@ -2456,7 +2454,7 @@ void link_recv_bundle(struct sk_buff *buf) }; pos += align(msg_size(buf_msg(obuf))); msg_dbg(buf_msg(obuf), " /"); - net_route_msg(obuf); + tipc_net_route_msg(obuf); } buf_discard(buf); } @@ -2467,11 +2465,11 @@ void link_recv_bundle(struct sk_buff *buf) /* - * link_send_long_buf: Entry for buffers needing fragmentation. + * tipc_link_send_long_buf: Entry for buffers needing fragmentation. * The buffer is complete, inclusive total message length. * Returns user data length. */ -int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) +int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) { struct tipc_msg *inmsg = buf_msg(buf); struct tipc_msg fragm_hdr; @@ -2521,8 +2519,8 @@ int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) /* Send queued messages first, if any: */ l_ptr->stats.sent_fragments++; - link_send_buf(l_ptr, fragm); - if (!link_is_up(l_ptr)) + tipc_link_send_buf(l_ptr, fragm); + if (!tipc_link_is_up(l_ptr)) return dsz; msg_set_fragm_no(&fragm_hdr, ++fragm_no); rest -= fragm_sz; @@ -2582,11 +2580,11 @@ static inline void incr_timer_cnt(struct sk_buff *buf) } /* - * link_recv_fragment(): Called with node lock on. Returns + * tipc_link_recv_fragment(): Called with node lock on. Returns * the reassembled buffer if message is complete. */ -int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, - struct tipc_msg **m) +int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, + struct tipc_msg **m) { struct sk_buff *prev = 0; struct sk_buff *fbuf = *fb; @@ -2714,7 +2712,7 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance) } -void link_set_queue_limits(struct link *l_ptr, u32 window) +void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) { /* Data messages from this node, inclusive FIRST_FRAGM */ l_ptr->queue_limit[DATA_LOW] = window; @@ -2739,7 +2737,7 @@ void link_set_queue_limits(struct link *l_ptr, u32 window) * @name - ptr to link name string * @node - ptr to area to be filled with ptr to associated node * - * Caller must hold 'net_lock' to ensure node and bearer are not deleted; + * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted; * this also prevents link deletion. * * 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) if (!link_name_validate(name, &link_name_parts)) return 0; - b_ptr = bearer_find_interface(link_name_parts.if_local); + b_ptr = tipc_bearer_find_interface(link_name_parts.if_local); if (!b_ptr) return 0; - *node = node_find(link_name_parts.addr_peer); + *node = tipc_node_find(link_name_parts.addr_peer); if (!*node) return 0; @@ -2769,8 +2767,8 @@ static struct link *link_find_link(const char *name, struct node **node) return l_ptr; } -struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, - u16 cmd) +struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, + u16 cmd) { struct tipc_link_config *args; u32 new_value; @@ -2779,61 +2777,62 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, int res; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); args = (struct tipc_link_config *)TLV_DATA(req_tlv_area); new_value = ntohl(args->value); - if (!strcmp(args->name, bc_link_name)) { + if (!strcmp(args->name, tipc_bclink_name)) { if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && - (bclink_set_queue_limits(new_value) == 0)) - return cfg_reply_none(); - return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot change setting on broadcast link)"); + (tipc_bclink_set_queue_limits(new_value) == 0)) + return tipc_cfg_reply_none(); + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot change setting on broadcast link)"); } - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); l_ptr = link_find_link(args->name, &node); if (!l_ptr) { - read_unlock_bh(&net_lock); - return cfg_reply_error_string("link not found"); + read_unlock_bh(&tipc_net_lock); + return tipc_cfg_reply_error_string("link not found"); } - node_lock(node); + tipc_node_lock(node); res = -EINVAL; switch (cmd) { case TIPC_CMD_SET_LINK_TOL: if ((new_value >= TIPC_MIN_LINK_TOL) && (new_value <= TIPC_MAX_LINK_TOL)) { link_set_supervision_props(l_ptr, new_value); - link_send_proto_msg(l_ptr, STATE_MSG, - 0, 0, new_value, 0, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 0, 0, new_value, 0, 0); res = TIPC_OK; } break; case TIPC_CMD_SET_LINK_PRI: - if (new_value < TIPC_NUM_LINK_PRI) { + if ((new_value >= TIPC_MIN_LINK_PRI) && + (new_value <= TIPC_MAX_LINK_PRI)) { l_ptr->priority = new_value; - link_send_proto_msg(l_ptr, STATE_MSG, - 0, 0, 0, new_value, 0); + tipc_link_send_proto_msg(l_ptr, STATE_MSG, + 0, 0, 0, new_value, 0); res = TIPC_OK; } break; case TIPC_CMD_SET_LINK_WINDOW: if ((new_value >= TIPC_MIN_LINK_WIN) && (new_value <= TIPC_MAX_LINK_WIN)) { - link_set_queue_limits(l_ptr, new_value); + tipc_link_set_queue_limits(l_ptr, new_value); res = TIPC_OK; } break; } - node_unlock(node); + tipc_node_unlock(node); - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); if (res) - return cfg_reply_error_string("cannot change link setting"); + return tipc_cfg_reply_error_string("cannot change link setting"); - return cfg_reply_none(); + return tipc_cfg_reply_none(); } /** @@ -2848,34 +2847,34 @@ static void link_reset_statistics(struct link *l_ptr) l_ptr->stats.recv_info = l_ptr->next_in_no; } -struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) { char *link_name; struct link *l_ptr; struct node *node; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); link_name = (char *)TLV_DATA(req_tlv_area); - if (!strcmp(link_name, bc_link_name)) { - if (bclink_reset_stats()) - return cfg_reply_error_string("link not found"); - return cfg_reply_none(); + if (!strcmp(link_name, tipc_bclink_name)) { + if (tipc_bclink_reset_stats()) + return tipc_cfg_reply_error_string("link not found"); + return tipc_cfg_reply_none(); } - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); l_ptr = link_find_link(link_name, &node); if (!l_ptr) { - read_unlock_bh(&net_lock); - return cfg_reply_error_string("link not found"); + read_unlock_bh(&tipc_net_lock); + return tipc_cfg_reply_error_string("link not found"); } - node_lock(node); + tipc_node_lock(node); link_reset_statistics(l_ptr); - node_unlock(node); - read_unlock_bh(&net_lock); - return cfg_reply_none(); + tipc_node_unlock(node); + read_unlock_bh(&tipc_net_lock); + return tipc_cfg_reply_none(); } /** @@ -2888,7 +2887,7 @@ static u32 percent(u32 count, u32 total) } /** - * link_stats - print link statistics + * tipc_link_stats - print link statistics * @name: link name * @buf: print buffer area * @buf_size: size of print buffer area @@ -2896,7 +2895,7 @@ static u32 percent(u32 count, u32 total) * Returns length of print buffer data string (or 0 if error) */ -static int link_stats(const char *name, char *buf, const u32 buf_size) +static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) { struct print_buf pb; struct link *l_ptr; @@ -2904,22 +2903,22 @@ static int link_stats(const char *name, char *buf, const u32 buf_size) char *status; u32 profile_total = 0; - if (!strcmp(name, bc_link_name)) - return bclink_stats(buf, buf_size); + if (!strcmp(name, tipc_bclink_name)) + return tipc_bclink_stats(buf, buf_size); - printbuf_init(&pb, buf, buf_size); + tipc_printbuf_init(&pb, buf, buf_size); - read_lock_bh(&net_lock); + read_lock_bh(&tipc_net_lock); l_ptr = link_find_link(name, &node); if (!l_ptr) { - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return 0; } - node_lock(node); + tipc_node_lock(node); - if (link_is_active(l_ptr)) + if (tipc_link_is_active(l_ptr)) status = "ACTIVE"; - else if (link_is_up(l_ptr)) + else if (tipc_link_is_up(l_ptr)) status = "STANDBY"; else status = "DEFUNCT"; @@ -2975,33 +2974,33 @@ static int link_stats(const char *name, char *buf, const u32 buf_size) ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) : 0); - node_unlock(node); - read_unlock_bh(&net_lock); - return printbuf_validate(&pb); + tipc_node_unlock(node); + read_unlock_bh(&tipc_net_lock); + return tipc_printbuf_validate(&pb); } #define MAX_LINK_STATS_INFO 2000 -struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) { struct sk_buff *buf; struct tlv_desc *rep_tlv; int str_len; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); - buf = cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO)); if (!buf) return NULL; rep_tlv = (struct tlv_desc *)buf->data; - str_len = link_stats((char *)TLV_DATA(req_tlv_area), - (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); + str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area), + (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); if (!str_len) { buf_discard(buf); - return cfg_reply_error_string("link not found"); + return tipc_cfg_reply_error_string("link not found"); } skb_put(buf, TLV_SPACE(str_len)); @@ -3020,20 +3019,20 @@ int link_control(const char *name, u32 op, u32 val) u32 a; a = link_name2addr(name, &bearer_id); - read_lock_bh(&net_lock); - node = node_find(a); + read_lock_bh(&tipc_net_lock); + node = tipc_node_find(a); if (node) { - node_lock(node); + tipc_node_lock(node); l_ptr = node->links[bearer_id]; if (l_ptr) { if (op == TIPC_REMOVE_LINK) { struct bearer *b_ptr = l_ptr->b_ptr; spin_lock_bh(&b_ptr->publ.lock); - link_delete(l_ptr); + tipc_link_delete(l_ptr); spin_unlock_bh(&b_ptr->publ.lock); } if (op == TIPC_CMD_BLOCK_LINK) { - link_reset(l_ptr); + tipc_link_reset(l_ptr); l_ptr->blocked = 1; } if (op == TIPC_CMD_UNBLOCK_LINK) { @@ -3041,22 +3040,22 @@ int link_control(const char *name, u32 op, u32 val) } res = TIPC_OK; } - node_unlock(node); + tipc_node_unlock(node); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return res; } #endif /** - * link_get_max_pkt - get maximum packet size to use when sending to destination + * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination * @dest: network address of destination node * @selector: used to select from set of active links * * If no active link can be found, uses default maximum packet size. */ -u32 link_get_max_pkt(u32 dest, u32 selector) +u32 tipc_link_get_max_pkt(u32 dest, u32 selector) { struct node *n_ptr; struct link *l_ptr; @@ -3065,16 +3064,16 @@ u32 link_get_max_pkt(u32 dest, u32 selector) if (dest == tipc_own_addr) return MAX_MSG_SIZE; - read_lock_bh(&net_lock); - n_ptr = node_select(dest, selector); + read_lock_bh(&tipc_net_lock); + n_ptr = tipc_node_select(dest, selector); if (n_ptr) { - node_lock(n_ptr); + tipc_node_lock(n_ptr); l_ptr = n_ptr->active_links[selector & 1]; if (l_ptr) res = link_max_pkt(l_ptr); - node_unlock(n_ptr); + tipc_node_unlock(n_ptr); } - read_unlock_bh(&net_lock); + read_unlock_bh(&tipc_net_lock); return res; } diff --git a/net/tipc/link.h b/net/tipc/link.h index c2553f07375..2d3c157f707 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h @@ -221,44 +221,43 @@ struct link { struct port; -struct link *link_create(struct bearer *b_ptr, const u32 peer, - const struct tipc_media_addr *media_addr); -void link_delete(struct link *l_ptr); -void link_changeover(struct link *l_ptr); -void link_send_duplicate(struct link *l_ptr, struct link *dest); -void link_reset_fragments(struct link *l_ptr); -int link_is_up(struct link *l_ptr); -int link_is_active(struct link *l_ptr); -void link_start(struct link *l_ptr); -u32 link_push_packet(struct link *l_ptr); -void link_stop(struct link *l_ptr); -struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); -struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); -struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); -void link_reset(struct link *l_ptr); -int link_send(struct sk_buff *buf, u32 dest, u32 selector); -int link_send_buf(struct link *l_ptr, struct sk_buff *buf); -u32 link_get_max_pkt(u32 dest,u32 selector); -int link_send_sections_fast(struct port* sender, - struct iovec const *msg_sect, - const u32 num_sect, - u32 destnode); - -int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); -void link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, - struct tipc_msg *msg, u32 selector); -void link_recv_bundle(struct sk_buff *buf); -int link_recv_fragment(struct sk_buff **pending, - struct sk_buff **fb, - struct tipc_msg **msg); -void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, - u32 tolerance, u32 priority, u32 acked_mtu); -void link_push_queue(struct link *l_ptr); -u32 link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, +struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, + const struct tipc_media_addr *media_addr); +void tipc_link_delete(struct link *l_ptr); +void tipc_link_changeover(struct link *l_ptr); +void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest); +void tipc_link_reset_fragments(struct link *l_ptr); +int tipc_link_is_up(struct link *l_ptr); +int tipc_link_is_active(struct link *l_ptr); +void tipc_link_start(struct link *l_ptr); +u32 tipc_link_push_packet(struct link *l_ptr); +void tipc_link_stop(struct link *l_ptr); +struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); +struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); +struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); +void tipc_link_reset(struct link *l_ptr); +int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); +int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf); +u32 tipc_link_get_max_pkt(u32 dest,u32 selector); +int tipc_link_send_sections_fast(struct port* sender, + struct iovec const *msg_sect, + const u32 num_sect, + u32 destnode); +int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); +void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, + struct tipc_msg *msg, u32 selector); +void tipc_link_recv_bundle(struct sk_buff *buf); +int tipc_link_recv_fragment(struct sk_buff **pending, + struct sk_buff **fb, + struct tipc_msg **msg); +void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, + u32 tolerance, u32 priority, u32 acked_mtu); +void tipc_link_push_queue(struct link *l_ptr); +u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, struct sk_buff *buf); -void link_wakeup_ports(struct link *l_ptr, int all); -void link_set_queue_limits(struct link *l_ptr, u32 window); -void link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); +void tipc_link_wakeup_ports(struct link *l_ptr, int all); +void tipc_link_set_queue_limits(struct link *l_ptr, u32 window); +void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); /* * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 03dbc55cb04..3bd345a344e 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -41,18 +41,7 @@ #include "bearer.h" -void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) -{ - memcpy(&((int *)m)[5], a, sizeof(*a)); -} - -void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) -{ - memcpy(a, &((int*)m)[5], sizeof(*a)); -} - - -void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) +void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) { u32 usr = msg_user(msg); tipc_printf(buf, str); @@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) tipc_printf(buf, ":REQL(%u):", msg_req_links(msg)); tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg)); tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg)); - media_addr_printf(buf, orig); + tipc_media_addr_printf(buf, orig); } if (msg_user(msg) == BCAST_PROTOCOL) { 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) } tipc_printf(buf, "\n"); if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { - msg_print(buf,msg_get_wrapped(msg)," /"); + tipc_msg_print(buf,msg_get_wrapped(msg)," /"); } if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { - msg_print(buf,msg_get_wrapped(msg)," /"); + tipc_msg_print(buf,msg_get_wrapped(msg)," /"); } } diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 662c81862a0..6699aaf7bd4 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h @@ -37,7 +37,7 @@ #ifndef _TIPC_MSG_H #define _TIPC_MSG_H -#include <net/tipc/tipc_msg.h> +#include "core.h" #define TIPC_VERSION 2 #define DATA_LOW TIPC_LOW_IMPORTANCE @@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr, return -EFAULT; } +static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) +{ + memcpy(&((int *)m)[5], a, sizeof(*a)); +} -struct tipc_media_addr; - -extern void msg_set_media_addr(struct tipc_msg *m, - struct tipc_media_addr *a); - -extern void msg_get_media_addr(struct tipc_msg *m, - struct tipc_media_addr *a); - +static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) +{ + memcpy(a, &((int*)m)[5], sizeof(*a)); +} #endif diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 41cbaf1a4a7..830f9099904 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) } /** - * named_publish - tell other nodes about a new publication by this node + * tipc_named_publish - tell other nodes about a new publication by this node */ -void named_publish(struct publication *publ) +void tipc_named_publish(struct publication *publ) { struct sk_buff *buf; struct distr_item *item; @@ -133,15 +133,15 @@ void named_publish(struct publication *publ) item = (struct distr_item *)msg_data(buf_msg(buf)); publ_to_item(item, publ); - dbg("named_withdraw: broadcasting publish msg\n"); - cluster_broadcast(buf); + dbg("tipc_named_withdraw: broadcasting publish msg\n"); + tipc_cltr_broadcast(buf); } /** - * named_withdraw - tell other nodes about a withdrawn publication by this node + * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node */ -void named_withdraw(struct publication *publ) +void tipc_named_withdraw(struct publication *publ) { struct sk_buff *buf; struct distr_item *item; @@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ) item = (struct distr_item *)msg_data(buf_msg(buf)); publ_to_item(item, publ); - dbg("named_withdraw: broadcasting withdraw msg\n"); - cluster_broadcast(buf); + dbg("tipc_named_withdraw: broadcasting withdraw msg\n"); + tipc_cltr_broadcast(buf); } /** - * named_node_up - tell specified node about all publications by this node + * tipc_named_node_up - tell specified node about all publications by this node */ -void named_node_up(unsigned long node) +void tipc_named_node_up(unsigned long node) { struct publication *publ; struct distr_item *item = 0; @@ -175,7 +175,7 @@ void named_node_up(unsigned long node) u32 max_item_buf; assert(in_own_cluster(node)); - read_lock_bh(&nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf *= ITEM_SIZE; rest = publ_cnt * ITEM_SIZE; @@ -196,15 +196,15 @@ void named_node_up(unsigned long node) left -= ITEM_SIZE; if (!left) { msg_set_link_selector(buf_msg(buf), node); - dbg("named_node_up: sending publish msg to " + dbg("tipc_named_node_up: sending publish msg to " "<%u.%u.%u>\n", tipc_zone(node), tipc_cluster(node), tipc_node(node)); - link_send(buf, node, node); + tipc_link_send(buf, node, node); buf = 0; } } exit: - read_unlock_bh(&nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); } /** @@ -221,73 +221,73 @@ exit: static void node_is_down(struct publication *publ) { struct publication *p; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); dbg("node_is_down: withdrawing %u, %u, %u\n", publ->type, publ->lower, publ->upper); publ->key += 1222345; - p = nametbl_remove_publ(publ->type, publ->lower, - publ->node, publ->ref, publ->key); + p = tipc_nametbl_remove_publ(publ->type, publ->lower, + publ->node, publ->ref, publ->key); assert(p == publ); - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); if (publ) kfree(publ); } /** - * named_recv - process name table update message sent by another node + * tipc_named_recv - process name table update message sent by another node */ -void named_recv(struct sk_buff *buf) +void tipc_named_recv(struct sk_buff *buf) { struct publication *publ; struct tipc_msg *msg = buf_msg(buf); struct distr_item *item = (struct distr_item *)msg_data(msg); u32 count = msg_data_sz(msg) / ITEM_SIZE; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); while (count--) { if (msg_type(msg) == PUBLICATION) { - dbg("named_recv: got publication for %u, %u, %u\n", + dbg("tipc_named_recv: got publication for %u, %u, %u\n", ntohl(item->type), ntohl(item->lower), ntohl(item->upper)); - publ = nametbl_insert_publ(ntohl(item->type), - ntohl(item->lower), - ntohl(item->upper), - TIPC_CLUSTER_SCOPE, - msg_orignode(msg), - ntohl(item->ref), - ntohl(item->key)); + publ = tipc_nametbl_insert_publ(ntohl(item->type), + ntohl(item->lower), + ntohl(item->upper), + TIPC_CLUSTER_SCOPE, + msg_orignode(msg), + ntohl(item->ref), + ntohl(item->key)); if (publ) { - nodesub_subscribe(&publ->subscr, - msg_orignode(msg), - publ, - (net_ev_handler)node_is_down); + tipc_nodesub_subscribe(&publ->subscr, + msg_orignode(msg), + publ, + (net_ev_handler)node_is_down); } } else if (msg_type(msg) == WITHDRAWAL) { - dbg("named_recv: got withdrawl for %u, %u, %u\n", + dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", ntohl(item->type), ntohl(item->lower), ntohl(item->upper)); - publ = nametbl_remove_publ(ntohl(item->type), - ntohl(item->lower), - msg_orignode(msg), - ntohl(item->ref), - ntohl(item->key)); + publ = tipc_nametbl_remove_publ(ntohl(item->type), + ntohl(item->lower), + msg_orignode(msg), + ntohl(item->ref), + ntohl(item->key)); if (publ) { - nodesub_unsubscribe(&publ->subscr); + tipc_nodesub_unsubscribe(&publ->subscr); kfree(publ); } } else { - warn("named_recv: unknown msg\n"); + warn("tipc_named_recv: unknown msg\n"); } item++; } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); buf_discard(buf); } /** - * named_reinit - re-initialize local publication list + * tipc_named_reinit - re-initialize local publication list * * This routine is called whenever TIPC networking is (re)enabled. * All existing publications by this node that have "cluster" or "zone" scope @@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf) * (If the node's address is unchanged, the update loop terminates immediately.) */ -void named_reinit(void) +void tipc_named_reinit(void) { struct publication *publ; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); list_for_each_entry(publ, &publ_root, local_list) { if (publ->node == tipc_own_addr) break; publ->node = tipc_own_addr; } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h index a04bdeac84e..843da0172f4 100644 --- a/net/tipc/name_distr.h +++ b/net/tipc/name_distr.h @@ -39,10 +39,10 @@ #include "name_table.h" -void named_publish(struct publication *publ); -void named_withdraw(struct publication *publ); -void named_node_up(unsigned long node); -void named_recv(struct sk_buff *buf); -void named_reinit(void); +void tipc_named_publish(struct publication *publ); +void tipc_named_withdraw(struct publication *publ); +void tipc_named_node_up(unsigned long node); +void tipc_named_recv(struct sk_buff *buf); +void tipc_named_reinit(void); #endif diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 972c83eb83b..3f4b23bd08f 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -99,9 +99,9 @@ struct name_table { u32 local_publ_count; }; -struct name_table table = { NULL } ; +static struct name_table table = { NULL } ; static atomic_t rsv_publ_ok = ATOMIC_INIT(0); -rwlock_t nametbl_lock = RW_LOCK_UNLOCKED; +rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED; static inline int hash(int x) @@ -139,10 +139,10 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, } /** - * subseq_alloc - allocate a specified number of sub-sequence structures + * tipc_subseq_alloc - allocate a specified number of sub-sequence structures */ -struct sub_seq *subseq_alloc(u32 cnt) +struct sub_seq *tipc_subseq_alloc(u32 cnt) { u32 sz = cnt * sizeof(struct sub_seq); struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); @@ -153,16 +153,16 @@ struct sub_seq *subseq_alloc(u32 cnt) } /** - * nameseq_create - create a name sequence structure for the specified 'type' + * tipc_nameseq_create - create a name sequence structure for the specified 'type' * * Allocates a single sub-sequence structure and sets it to all 0's. */ -struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) +struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) { struct name_seq *nseq = (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); - struct sub_seq *sseq = subseq_alloc(1); + struct sub_seq *sseq = tipc_subseq_alloc(1); if (!nseq || !sseq) { 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) nseq->lock = SPIN_LOCK_UNLOCKED; nseq->type = type; nseq->sseqs = sseq; - dbg("nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", + dbg("tipc_nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", nseq, type, nseq->sseqs, nseq->first_free); nseq->alloc = 1; INIT_HLIST_NODE(&nseq->ns_list); @@ -240,10 +240,10 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) } /** - * nameseq_insert_publ - + * tipc_nameseq_insert_publ - */ -struct publication *nameseq_insert_publ(struct name_seq *nseq, +struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, u32 type, u32 lower, u32 upper, u32 scope, u32 node, u32 port, u32 key) { @@ -285,7 +285,7 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, if (nseq->first_free == nseq->alloc) { struct sub_seq *sseqs = nseq->sseqs; - nseq->sseqs = subseq_alloc(nseq->alloc * 2); + nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2); if (nseq->sseqs != NULL) { memcpy(nseq->sseqs, sseqs, nseq->alloc * sizeof (struct sub_seq)); @@ -354,23 +354,23 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, */ list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { dbg("calling report_overlap()\n"); - subscr_report_overlap(s, - publ->lower, - publ->upper, - TIPC_PUBLISHED, - publ->ref, - publ->node, - created_subseq); + tipc_subscr_report_overlap(s, + publ->lower, + publ->upper, + TIPC_PUBLISHED, + publ->ref, + publ->node, + created_subseq); } return publ; } /** - * nameseq_remove_publ - + * tipc_nameseq_remove_publ - */ -struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, - u32 node, u32 ref, u32 key) +struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, + u32 node, u32 ref, u32 key) { struct publication *publ; struct publication *prev; @@ -470,24 +470,24 @@ struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, * Any subscriptions waiting ? */ list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { - subscr_report_overlap(s, - publ->lower, - publ->upper, - TIPC_WITHDRAWN, - publ->ref, - publ->node, - removed_subseq); + tipc_subscr_report_overlap(s, + publ->lower, + publ->upper, + TIPC_WITHDRAWN, + publ->ref, + publ->node, + removed_subseq); } return publ; } /** - * nameseq_subscribe: attach a subscription, and issue + * tipc_nameseq_subscribe: attach a subscription, and issue * the prescribed number of events if there is any sub- * sequence overlapping with the requested sequence */ -void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) +void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) { struct sub_seq *sseq = nseq->sseqs; @@ -498,18 +498,18 @@ void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) while (sseq != &nseq->sseqs[nseq->first_free]) { struct publication *zl = sseq->zone_list; - if (zl && subscr_overlap(s,sseq->lower,sseq->upper)) { + if (zl && tipc_subscr_overlap(s,sseq->lower,sseq->upper)) { struct publication *crs = zl; int must_report = 1; do { - subscr_report_overlap(s, - sseq->lower, - sseq->upper, - TIPC_PUBLISHED, - crs->ref, - crs->node, - must_report); + tipc_subscr_report_overlap(s, + sseq->lower, + sseq->upper, + TIPC_PUBLISHED, + crs->ref, + crs->node, + must_report); must_report = 0; crs = crs->zone_list_next; } while (crs != zl); @@ -538,8 +538,8 @@ static struct name_seq *nametbl_find_seq(u32 type) return 0; }; -struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, - u32 scope, u32 node, u32 port, u32 key) +struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, + u32 scope, u32 node, u32 port, u32 key) { struct name_seq *seq = nametbl_find_seq(type); @@ -552,19 +552,19 @@ struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); if (!seq) { - seq = nameseq_create(type, &table.types[hash(type)]); - dbg("nametbl_insert_publ: created %x\n", seq); + seq = tipc_nameseq_create(type, &table.types[hash(type)]); + dbg("tipc_nametbl_insert_publ: created %x\n", seq); } if (!seq) return 0; assert(seq->type == type); - return nameseq_insert_publ(seq, type, lower, upper, - scope, node, port, key); + return tipc_nameseq_insert_publ(seq, type, lower, upper, + scope, node, port, key); } -struct publication *nametbl_remove_publ(u32 type, u32 lower, - u32 node, u32 ref, u32 key) +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, + u32 node, u32 ref, u32 key) { struct publication *publ; struct name_seq *seq = nametbl_find_seq(type); @@ -573,7 +573,7 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, return 0; dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); - publ = nameseq_remove_publ(seq, lower, node, ref, key); + publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key); if (!seq->first_free && list_empty(&seq->subscriptions)) { hlist_del_init(&seq->ns_list); @@ -584,14 +584,14 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, } /* - * nametbl_translate(): Translate tipc_name -> tipc_portid. + * tipc_nametbl_translate(): Translate tipc_name -> tipc_portid. * Very time-critical. * * Note: on entry 'destnode' is the search domain used during translation; * on exit it passes back the node address of the matching port (if any) */ -u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) +u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) { struct sub_seq *sseq; struct publication *publ = 0; @@ -601,7 +601,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) if (!in_scope(*destnode, tipc_own_addr)) return 0; - read_lock_bh(&nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(type); if (unlikely(!seq)) goto not_found; @@ -619,7 +619,7 @@ found: ref = publ->ref; *destnode = publ->node; spin_unlock_bh(&seq->lock); - read_unlock_bh(&nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); return ref; } publ = sseq->cluster_list; @@ -657,12 +657,12 @@ found: spin_unlock_bh(&seq->lock); not_found: *destnode = 0; - read_unlock_bh(&nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); return 0; } /** - * nametbl_mc_translate - find multicast destinations + * tipc_nametbl_mc_translate - find multicast destinations * * Creates list of all local ports that overlap the given multicast address; * also determines if any off-node ports overlap. @@ -674,15 +674,15 @@ not_found: * Returns non-zero if any off-node ports overlap */ -int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, - struct port_list *dports) +int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, + struct port_list *dports) { struct name_seq *seq; struct sub_seq *sseq; struct sub_seq *sseq_stop; int res = 0; - read_lock_bh(&nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(type); if (!seq) goto exit; @@ -700,7 +700,7 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, if (publ && (publ->scope <= limit)) do { if (publ->node == tipc_own_addr) - port_list_add(dports, publ->ref); + tipc_port_list_add(dports, publ->ref); else res = 1; publ = publ->cluster_list_next; @@ -709,15 +709,15 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, spin_unlock_bh(&seq->lock); exit: - read_unlock_bh(&nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); return res; } /** - * nametbl_publish_rsv - publish port name using a reserved name type + * tipc_nametbl_publish_rsv - publish port name using a reserved name type */ -int nametbl_publish_rsv(u32 ref, unsigned int scope, +int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) { int res; @@ -729,10 +729,10 @@ int nametbl_publish_rsv(u32 ref, unsigned int scope, } /** - * nametbl_publish - add name publication to network name tables + * tipc_nametbl_publish - add name publication to network name tables */ -struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, +struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key) { struct publication *publ; @@ -748,77 +748,77 @@ struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, return 0; } - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); table.local_publ_count++; - publ = nametbl_insert_publ(type, lower, upper, scope, + publ = tipc_nametbl_insert_publ(type, lower, upper, scope, tipc_own_addr, port_ref, key); if (publ && (scope != TIPC_NODE_SCOPE)) { - named_publish(publ); + tipc_named_publish(publ); } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); return publ; } /** - * nametbl_withdraw - withdraw name publication from network name tables + * tipc_nametbl_withdraw - withdraw name publication from network name tables */ -int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) +int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) { struct publication *publ; - dbg("nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); - write_lock_bh(&nametbl_lock); - publ = nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); + dbg("tipc_nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); + write_lock_bh(&tipc_nametbl_lock); + publ = tipc_nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); if (publ) { table.local_publ_count--; if (publ->scope != TIPC_NODE_SCOPE) - named_withdraw(publ); - write_unlock_bh(&nametbl_lock); + tipc_named_withdraw(publ); + write_unlock_bh(&tipc_nametbl_lock); list_del_init(&publ->pport_list); kfree(publ); return 1; } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); return 0; } /** - * nametbl_subscribe - add a subscription object to the name table + * tipc_nametbl_subscribe - add a subscription object to the name table */ void -nametbl_subscribe(struct subscription *s) +tipc_nametbl_subscribe(struct subscription *s) { u32 type = s->seq.type; struct name_seq *seq; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(type); if (!seq) { - seq = nameseq_create(type, &table.types[hash(type)]); + seq = tipc_nameseq_create(type, &table.types[hash(type)]); } if (seq){ spin_lock_bh(&seq->lock); - dbg("nametbl_subscribe:found %x for <%u,%u,%u>\n", + dbg("tipc_nametbl_subscribe:found %x for <%u,%u,%u>\n", seq, type, s->seq.lower, s->seq.upper); assert(seq->type == type); - nameseq_subscribe(seq, s); + tipc_nameseq_subscribe(seq, s); spin_unlock_bh(&seq->lock); } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } /** - * nametbl_unsubscribe - remove a subscription object from name table + * tipc_nametbl_unsubscribe - remove a subscription object from name table */ void -nametbl_unsubscribe(struct subscription *s) +tipc_nametbl_unsubscribe(struct subscription *s) { struct name_seq *seq; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(s->seq.type); if (seq != NULL){ spin_lock_bh(&seq->lock); @@ -830,7 +830,7 @@ nametbl_unsubscribe(struct subscription *s) kfree(seq); } } - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } @@ -983,17 +983,17 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, } } -void nametbl_print(struct print_buf *buf, const char *str) +void tipc_nametbl_print(struct print_buf *buf, const char *str) { tipc_printf(buf, str); - read_lock_bh(&nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); nametbl_list(buf, 0, 0, 0, 0); - read_unlock_bh(&nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); } #define MAX_NAME_TBL_QUERY 32768 -struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) { struct sk_buff *buf; struct tipc_name_table_query *argv; @@ -1002,20 +1002,20 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) int str_len; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); - buf = cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); if (!buf) return NULL; rep_tlv = (struct tlv_desc *)buf->data; - printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); + tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); - read_lock_bh(&nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), ntohl(argv->lowbound), ntohl(argv->upbound)); - read_unlock_bh(&nametbl_lock); - str_len = printbuf_validate(&b); + read_unlock_bh(&tipc_nametbl_lock); + str_len = tipc_printbuf_validate(&b); skb_put(buf, TLV_SPACE(str_len)); 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) return buf; } -void nametbl_dump(void) +void tipc_nametbl_dump(void) { - nametbl_list(CONS, 0, 0, 0, 0); + nametbl_list(TIPC_CONS, 0, 0, 0, 0); } -int nametbl_init(void) +int tipc_nametbl_init(void) { int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; @@ -1036,14 +1036,14 @@ int nametbl_init(void) if (!table.types) return -ENOMEM; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); memset(table.types, 0, array_size); table.local_publ_count = 0; - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); return 0; } -void nametbl_stop(void) +void tipc_nametbl_stop(void) { struct hlist_head *seq_head; struct hlist_node *seq_node; @@ -1054,7 +1054,7 @@ void nametbl_stop(void) if (!table.types) return; - write_lock_bh(&nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); for (i = 0; i < tipc_nametbl_size; i++) { seq_head = &table.types[i]; hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) { @@ -1075,5 +1075,5 @@ void nametbl_stop(void) } kfree(table.types); table.types = NULL; - write_unlock_bh(&nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index f82693384f6..e8a3d71763c 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h @@ -85,24 +85,24 @@ struct publication { }; -extern rwlock_t nametbl_lock; +extern rwlock_t tipc_nametbl_lock; -struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space); -u32 nametbl_translate(u32 type, u32 instance, u32 *node); -int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, +struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space); +u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node); +int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, struct port_list *dports); -int nametbl_publish_rsv(u32 ref, unsigned int scope, +int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq); -struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, +struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key); -int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); -struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, +int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); +struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, u32 scope, u32 node, u32 ref, u32 key); -struct publication *nametbl_remove_publ(u32 type, u32 lower, +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node, u32 ref, u32 key); -void nametbl_subscribe(struct subscription *s); -void nametbl_unsubscribe(struct subscription *s); -int nametbl_init(void); -void nametbl_stop(void); +void tipc_nametbl_subscribe(struct subscription *s); +void tipc_nametbl_unsubscribe(struct subscription *s); +int tipc_nametbl_init(void); +void tipc_nametbl_stop(void); #endif diff --git a/net/tipc/net.c b/net/tipc/net.c index 6826b493c1d..074891ad4f0 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c @@ -58,25 +58,25 @@ * 1: The routing hierarchy. * Comprises the structures 'zone', 'cluster', 'node', 'link' * and 'bearer'. The whole hierarchy is protected by a big - * read/write lock, net_lock, to enssure that nothing is added + * read/write lock, tipc_net_lock, to enssure that nothing is added * or removed while code is accessing any of these structures. * This layer must not be called from the two others while they * hold any of their own locks. * Neither must it itself do any upcalls to the other two before - * it has released net_lock and other protective locks. + * it has released tipc_net_lock and other protective locks. * - * Within the net_lock domain there are two sub-domains;'node' and + * Within the tipc_net_lock domain there are two sub-domains;'node' and * 'bearer', where local write operations are permitted, * provided that those are protected by individual spin_locks - * per instance. Code holding net_lock(read) and a node spin_lock + * per instance. Code holding tipc_net_lock(read) and a node spin_lock * is permitted to poke around in both the node itself and its * subordinate links. I.e, it can update link counters and queues, * change link state, send protocol messages, and alter the * "active_links" array in the node; but it can _not_ remove a link * or a node from the overall structure. * Correspondingly, individual bearers may change status within a - * net_lock(read), protected by an individual spin_lock ber bearer - * instance, but it needs net_lock(write) to remove/add any bearers. + * tipc_net_lock(read), protected by an individual spin_lock ber bearer + * instance, but it needs tipc_net_lock(write) to remove/add any bearers. * * * 2: The transport level of the protocol. @@ -97,91 +97,91 @@ * (Nobody is using read-only access to this, so it can just as * well be changed to a spin_lock) * - A spin lock to protect the registry of kernel/driver users (reg.c) - * - A global spin_lock (port_lock), which only task is to ensure + * - A global spin_lock (tipc_port_lock), which only task is to ensure * consistency where more than one port is involved in an operation, * i.e., whe a port is part of a linked list of ports. * There are two such lists; 'port_list', which is used for management, * and 'wait_list', which is used to queue ports during congestion. * * 3: The name table (name_table.c, name_distr.c, subscription.c) - * - There is one big read/write-lock (nametbl_lock) protecting the + * - There is one big read/write-lock (tipc_nametbl_lock) protecting the * overall name table structure. Nothing must be added/removed to * this structure without holding write access to it. * - There is one local spin_lock per sub_sequence, which can be seen - * as a sub-domain to the nametbl_lock domain. It is used only + * as a sub-domain to the tipc_nametbl_lock domain. It is used only * for translation operations, and is needed because a translation * steps the root of the 'publication' linked list between each lookup. - * This is always used within the scope of a nametbl_lock(read). + * This is always used within the scope of a tipc_nametbl_lock(read). * - A local spin_lock protecting the queue of subscriber events. */ -rwlock_t net_lock = RW_LOCK_UNLOCKED; -struct network net = { 0 }; +rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED; +struct network tipc_net = { 0 }; -struct node *net_select_remote_node(u32 addr, u32 ref) +struct node *tipc_net_select_remote_node(u32 addr, u32 ref) { - return zone_select_remote_node(net.zones[tipc_zone(addr)], addr, ref); + return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); } -u32 net_select_router(u32 addr, u32 ref) +u32 tipc_net_select_router(u32 addr, u32 ref) { - return zone_select_router(net.zones[tipc_zone(addr)], addr, ref); + return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref); } -u32 net_next_node(u32 a) +u32 tipc_net_next_node(u32 a) { - if (net.zones[tipc_zone(a)]) - return zone_next_node(a); + if (tipc_net.zones[tipc_zone(a)]) + return tipc_zone_next_node(a); return 0; } -void net_remove_as_router(u32 router) +void tipc_net_remove_as_router(u32 router) { u32 z_num; for (z_num = 1; z_num <= tipc_max_zones; z_num++) { - if (!net.zones[z_num]) + if (!tipc_net.zones[z_num]) continue; - zone_remove_as_router(net.zones[z_num], router); + tipc_zone_remove_as_router(tipc_net.zones[z_num], router); } } -void net_send_external_routes(u32 dest) +void tipc_net_send_external_routes(u32 dest) { u32 z_num; for (z_num = 1; z_num <= tipc_max_zones; z_num++) { - if (net.zones[z_num]) - zone_send_external_routes(net.zones[z_num], dest); + if (tipc_net.zones[z_num]) + tipc_zone_send_external_routes(tipc_net.zones[z_num], dest); } } -int net_init(void) +static int net_init(void) { u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1); - memset(&net, 0, sizeof(net)); - net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC); - if (!net.zones) { + memset(&tipc_net, 0, sizeof(tipc_net)); + tipc_net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC); + if (!tipc_net.zones) { return -ENOMEM; } - memset(net.zones, 0, sz); + memset(tipc_net.zones, 0, sz); return TIPC_OK; } -void net_stop(void) +static void net_stop(void) { u32 z_num; - if (!net.zones) + if (!tipc_net.zones) return; for (z_num = 1; z_num <= tipc_max_zones; z_num++) { - zone_delete(net.zones[z_num]); + tipc_zone_delete(tipc_net.zones[z_num]); } - kfree(net.zones); - net.zones = 0; + kfree(tipc_net.zones); + tipc_net.zones = 0; } static void net_route_named_msg(struct sk_buff *buf) @@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf) u32 dport; if (!msg_named(msg)) { - msg_dbg(msg, "net->drop_nam:"); + msg_dbg(msg, "tipc_net->drop_nam:"); buf_discard(buf); return; } dnode = addr_domain(msg_lookup_scope(msg)); - dport = nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode); - dbg("net->lookup<%u,%u>-><%u,%x>\n", + dport = tipc_nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode); + dbg("tipc_net->lookup<%u,%u>-><%u,%x>\n", msg_nametype(msg), msg_nameinst(msg), dport, dnode); if (dport) { msg_set_destnode(msg, dnode); msg_set_destport(msg, dport); - net_route_msg(buf); + tipc_net_route_msg(buf); return; } - msg_dbg(msg, "net->rej:NO NAME: "); + msg_dbg(msg, "tipc_net->rej:NO NAME: "); tipc_reject_msg(buf, TIPC_ERR_NO_NAME); } -void net_route_msg(struct sk_buff *buf) +void tipc_net_route_msg(struct sk_buff *buf) { struct tipc_msg *msg; u32 dnode; @@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf) return; } - msg_dbg(msg, "net->rout: "); + msg_dbg(msg, "tipc_net->rout: "); /* Handle message for this node */ dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); if (in_scope(dnode, tipc_own_addr)) { if (msg_isdata(msg)) { if (msg_mcast(msg)) - port_recv_mcast(buf, NULL); + tipc_port_recv_mcast(buf, NULL); else if (msg_destport(msg)) - port_recv_msg(buf); + tipc_port_recv_msg(buf); else net_route_named_msg(buf); return; } switch (msg_user(msg)) { case ROUTE_DISTRIBUTOR: - cluster_recv_routing_table(buf); + tipc_cltr_recv_routing_table(buf); break; case NAME_DISTRIBUTOR: - named_recv(buf); + tipc_named_recv(buf); break; case CONN_MANAGER: - port_recv_proto_msg(buf); + tipc_port_recv_proto_msg(buf); break; default: msg_dbg(msg,"DROP/NET/<REC<"); @@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf) /* Handle message for another node */ msg_dbg(msg, "NET>SEND>: "); - link_send(buf, dnode, msg_link_selector(msg)); + tipc_link_send(buf, dnode, msg_link_selector(msg)); } -int tipc_start_net(void) +int tipc_net_start(void) { char addr_string[16]; int res; @@ -277,35 +277,35 @@ int tipc_start_net(void) return -ENOPROTOOPT; tipc_mode = TIPC_NET_MODE; - named_reinit(); - port_reinit(); + tipc_named_reinit(); + tipc_port_reinit(); - if ((res = bearer_init()) || + if ((res = tipc_bearer_init()) || (res = net_init()) || - (res = cluster_init()) || - (res = bclink_init())) { + (res = tipc_cltr_init()) || + (res = tipc_bclink_init())) { return res; } - subscr_stop(); - cfg_stop(); - k_signal((Handler)subscr_start, 0); - k_signal((Handler)cfg_init, 0); + tipc_subscr_stop(); + tipc_cfg_stop(); + tipc_k_signal((Handler)tipc_subscr_start, 0); + tipc_k_signal((Handler)tipc_cfg_init, 0); info("Started in network mode\n"); info("Own node address %s, network identity %u\n", addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); return TIPC_OK; } -void tipc_stop_net(void) +void tipc_net_stop(void) { if (tipc_mode != TIPC_NET_MODE) return; - write_lock_bh(&net_lock); - bearer_stop(); + write_lock_bh(&tipc_net_lock); + tipc_bearer_stop(); tipc_mode = TIPC_NODE_MODE; - bclink_stop(); + tipc_bclink_stop(); net_stop(); - write_unlock_bh(&net_lock); + write_unlock_bh(&tipc_net_lock); info("Left network mode \n"); } diff --git a/net/tipc/net.h b/net/tipc/net.h index 948c6d42102..f3e0b85e647 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h @@ -49,18 +49,16 @@ struct network { }; -extern struct network net; -extern rwlock_t net_lock; +extern struct network tipc_net; +extern rwlock_t tipc_net_lock; -int net_init(void); -void net_stop(void); -void net_remove_as_router(u32 router); -void net_send_external_routes(u32 dest); -void net_route_msg(struct sk_buff *buf); -struct node *net_select_remote_node(u32 addr, u32 ref); -u32 net_select_router(u32 addr, u32 ref); +void tipc_net_remove_as_router(u32 router); +void tipc_net_send_external_routes(u32 dest); +void tipc_net_route_msg(struct sk_buff *buf); +struct node *tipc_net_select_remote_node(u32 addr, u32 ref); +u32 tipc_net_select_router(u32 addr, u32 ref); -int tipc_start_net(void); -void tipc_stop_net(void); +int tipc_net_start(void); +void tipc_net_stop(void); #endif diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 19b3f402253..eb1bb4dce7a 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) int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN); if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) - rep_buf = cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); + rep_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); else - rep_buf = cfg_do_cmd(req_userhdr->dest, - req_userhdr->cmd, - NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, - NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), - hdr_space); + rep_buf = tipc_cfg_do_cmd(req_userhdr->dest, + req_userhdr->cmd, + NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, + NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), + hdr_space); if (rep_buf) { skb_push(rep_buf, hdr_space); @@ -81,7 +81,7 @@ static struct genl_ops ops = { static int family_registered = 0; -int netlink_start(void) +int tipc_netlink_start(void) { @@ -103,7 +103,7 @@ int netlink_start(void) return -EFAULT; } -void netlink_stop(void) +void tipc_netlink_stop(void) { if (family_registered) { genl_unregister_family(&family); diff --git a/net/tipc/node.c b/net/tipc/node.c index 05688d01138..6d65010e5fa 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -45,17 +45,16 @@ #include "port.h" #include "bearer.h" #include "name_distr.h" -#include "net.h" void node_print(struct print_buf *buf, struct node *n_ptr, char *str); static void node_lost_contact(struct node *n_ptr); static void node_established_contact(struct node *n_ptr); -struct node *nodes = NULL; /* sorted list of nodes within cluster */ +struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ u32 tipc_own_tag = 0; -struct node *node_create(u32 addr) +struct node *tipc_node_create(u32 addr) { struct cluster *c_ptr; struct node *n_ptr; @@ -68,16 +67,16 @@ struct node *node_create(u32 addr) n_ptr->lock = SPIN_LOCK_UNLOCKED; INIT_LIST_HEAD(&n_ptr->nsub); - c_ptr = cluster_find(addr); + c_ptr = tipc_cltr_find(addr); if (c_ptr == NULL) - c_ptr = cluster_create(addr); + c_ptr = tipc_cltr_create(addr); if (c_ptr != NULL) { n_ptr->owner = c_ptr; - cluster_attach_node(c_ptr, n_ptr); + tipc_cltr_attach_node(c_ptr, n_ptr); n_ptr->last_router = -1; /* Insert node into ordered list */ - for (curr_node = &nodes; *curr_node; + for (curr_node = &tipc_nodes; *curr_node; curr_node = &(*curr_node)->next) { if (addr < (*curr_node)->addr) { n_ptr->next = *curr_node; @@ -93,13 +92,13 @@ struct node *node_create(u32 addr) return n_ptr; } -void node_delete(struct node *n_ptr) +void tipc_node_delete(struct node *n_ptr) { if (!n_ptr) return; #if 0 - /* Not needed because links are already deleted via bearer_stop() */ + /* Not needed because links are already deleted via tipc_bearer_stop() */ u32 l_num; @@ -114,12 +113,12 @@ void node_delete(struct node *n_ptr) /** - * node_link_up - handle addition of link + * tipc_node_link_up - handle addition of link * * Link becomes active (alone or shared) or standby, depending on its priority. */ -void node_link_up(struct node *n_ptr, struct link *l_ptr) +void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) { struct link **active = &n_ptr->active_links[0]; @@ -136,7 +135,7 @@ void node_link_up(struct node *n_ptr, struct link *l_ptr) info("Link is standby\n"); return; } - link_send_duplicate(active[0], l_ptr); + tipc_link_send_duplicate(active[0], l_ptr); if (l_ptr->priority == active[0]->priority) { active[0] = l_ptr; return; @@ -161,7 +160,7 @@ static void node_select_active_links(struct node *n_ptr) for (i = 0; i < MAX_BEARERS; i++) { struct link *l_ptr = n_ptr->links[i]; - if (!l_ptr || !link_is_up(l_ptr) || + if (!l_ptr || !tipc_link_is_up(l_ptr) || (l_ptr->priority < highest_prio)) continue; @@ -175,14 +174,14 @@ static void node_select_active_links(struct node *n_ptr) } /** - * node_link_down - handle loss of link + * tipc_node_link_down - handle loss of link */ -void node_link_down(struct node *n_ptr, struct link *l_ptr) +void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) { struct link **active; - if (!link_is_active(l_ptr)) { + if (!tipc_link_is_active(l_ptr)) { info("Lost standby link <%s> on network plane %c\n", l_ptr->name, l_ptr->b_ptr->net_plane); return; @@ -197,40 +196,40 @@ void node_link_down(struct node *n_ptr, struct link *l_ptr) active[1] = active[0]; if (active[0] == l_ptr) node_select_active_links(n_ptr); - if (node_is_up(n_ptr)) - link_changeover(l_ptr); + if (tipc_node_is_up(n_ptr)) + tipc_link_changeover(l_ptr); else node_lost_contact(n_ptr); } -int node_has_active_links(struct node *n_ptr) +int tipc_node_has_active_links(struct node *n_ptr) { return (n_ptr && ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); } -int node_has_redundant_links(struct node *n_ptr) +int tipc_node_has_redundant_links(struct node *n_ptr) { - return (node_has_active_links(n_ptr) && + return (tipc_node_has_active_links(n_ptr) && (n_ptr->active_links[0] != n_ptr->active_links[1])); } -int node_has_active_routes(struct node *n_ptr) +int tipc_node_has_active_routes(struct node *n_ptr) { return (n_ptr && (n_ptr->last_router >= 0)); } -int node_is_up(struct node *n_ptr) +int tipc_node_is_up(struct node *n_ptr) { - return (node_has_active_links(n_ptr) || node_has_active_routes(n_ptr)); + return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); } -struct node *node_attach_link(struct link *l_ptr) +struct node *tipc_node_attach_link(struct link *l_ptr) { - struct node *n_ptr = node_find(l_ptr->addr); + struct node *n_ptr = tipc_node_find(l_ptr->addr); if (!n_ptr) - n_ptr = node_create(l_ptr->addr); + n_ptr = tipc_node_create(l_ptr->addr); if (n_ptr) { u32 bearer_id = l_ptr->b_ptr->identity; char addr_string[16]; @@ -246,7 +245,7 @@ struct node *node_attach_link(struct link *l_ptr) if (!n_ptr->links[bearer_id]) { n_ptr->links[bearer_id] = l_ptr; - net.zones[tipc_zone(l_ptr->addr)]->links++; + tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; n_ptr->link_cnt++; return n_ptr; } @@ -257,10 +256,10 @@ struct node *node_attach_link(struct link *l_ptr) return 0; } -void node_detach_link(struct node *n_ptr, struct link *l_ptr) +void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) { n_ptr->links[l_ptr->b_ptr->identity] = 0; - net.zones[tipc_zone(l_ptr->addr)]->links--; + tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; n_ptr->link_cnt--; } @@ -315,45 +314,45 @@ static void node_established_contact(struct node *n_ptr) struct cluster *c_ptr; dbg("node_established_contact:-> %x\n", n_ptr->addr); - if (!node_has_active_routes(n_ptr)) { - k_signal((Handler)named_node_up, n_ptr->addr); + if (!tipc_node_has_active_routes(n_ptr)) { + tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); } /* Syncronize broadcast acks */ - n_ptr->bclink.acked = bclink_get_last_sent(); + n_ptr->bclink.acked = tipc_bclink_get_last_sent(); if (is_slave(tipc_own_addr)) return; if (!in_own_cluster(n_ptr->addr)) { /* Usage case 1 (see above) */ - c_ptr = cluster_find(tipc_own_addr); + c_ptr = tipc_cltr_find(tipc_own_addr); if (!c_ptr) - c_ptr = cluster_create(tipc_own_addr); + c_ptr = tipc_cltr_create(tipc_own_addr); if (c_ptr) - cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, - tipc_max_nodes); + tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, + tipc_max_nodes); return; } c_ptr = n_ptr->owner; if (is_slave(n_ptr->addr)) { /* Usage case 2 (see above) */ - cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); - cluster_send_local_routes(c_ptr, n_ptr->addr); + tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); + tipc_cltr_send_local_routes(c_ptr, n_ptr->addr); return; } if (n_ptr->bclink.supported) { - nmap_add(&cluster_bcast_nodes, n_ptr->addr); + tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr); if (n_ptr->addr < tipc_own_addr) tipc_own_tag++; } /* Case 3 (see above) */ - net_send_external_routes(n_ptr->addr); - cluster_send_slave_routes(c_ptr, n_ptr->addr); - cluster_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, - highest_allowed_slave); + tipc_net_send_external_routes(n_ptr->addr); + tipc_cltr_send_slave_routes(c_ptr, n_ptr->addr); + tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, + tipc_highest_allowed_slave); } static void node_lost_contact(struct node *n_ptr) @@ -375,39 +374,39 @@ static void node_lost_contact(struct node *n_ptr) n_ptr->bclink.defragm = NULL; } if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { - bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); + tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); } /* Update routing tables */ if (is_slave(tipc_own_addr)) { - net_remove_as_router(n_ptr->addr); + tipc_net_remove_as_router(n_ptr->addr); } else { if (!in_own_cluster(n_ptr->addr)) { /* Case 4 (see above) */ - c_ptr = cluster_find(tipc_own_addr); - cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, - tipc_max_nodes); + c_ptr = tipc_cltr_find(tipc_own_addr); + tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, + tipc_max_nodes); } else { /* Case 5 (see above) */ - c_ptr = cluster_find(n_ptr->addr); + c_ptr = tipc_cltr_find(n_ptr->addr); if (is_slave(n_ptr->addr)) { - cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, - tipc_max_nodes); + tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, + tipc_max_nodes); } else { if (n_ptr->bclink.supported) { - nmap_remove(&cluster_bcast_nodes, - n_ptr->addr); + tipc_nmap_remove(&tipc_cltr_bcast_nodes, + n_ptr->addr); if (n_ptr->addr < tipc_own_addr) tipc_own_tag--; } - net_remove_as_router(n_ptr->addr); - cluster_bcast_lost_route(c_ptr, n_ptr->addr, - LOWEST_SLAVE, - highest_allowed_slave); + tipc_net_remove_as_router(n_ptr->addr); + tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, + LOWEST_SLAVE, + tipc_highest_allowed_slave); } } } - if (node_has_active_routes(n_ptr)) + if (tipc_node_has_active_routes(n_ptr)) return; info("Lost contact with %s\n", @@ -420,35 +419,35 @@ static void node_lost_contact(struct node *n_ptr) continue; l_ptr->reset_checkpoint = l_ptr->next_in_no; l_ptr->exp_msg_count = 0; - link_reset_fragments(l_ptr); + tipc_link_reset_fragments(l_ptr); } /* Notify subscribers */ list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { ns->node = 0; list_del_init(&ns->nodesub_list); - k_signal((Handler)ns->handle_node_down, - (unsigned long)ns->usr_handle); + tipc_k_signal((Handler)ns->handle_node_down, + (unsigned long)ns->usr_handle); } } /** - * node_select_next_hop - find the next-hop node for a message + * tipc_node_select_next_hop - find the next-hop node for a message * * Called by when cluster local lookup has failed. */ -struct node *node_select_next_hop(u32 addr, u32 selector) +struct node *tipc_node_select_next_hop(u32 addr, u32 selector) { struct node *n_ptr; u32 router_addr; - if (!addr_domain_valid(addr)) + if (!tipc_addr_domain_valid(addr)) return 0; /* Look for direct link to destination processsor */ - n_ptr = node_find(addr); - if (n_ptr && node_has_active_links(n_ptr)) + n_ptr = tipc_node_find(addr); + if (n_ptr && tipc_node_has_active_links(n_ptr)) return n_ptr; /* Cluster local system nodes *must* have direct links */ @@ -456,9 +455,9 @@ struct node *node_select_next_hop(u32 addr, u32 selector) return 0; /* Look for cluster local router with direct link to node */ - router_addr = node_select_router(n_ptr, selector); + router_addr = tipc_node_select_router(n_ptr, selector); if (router_addr) - return node_select(router_addr, selector); + return tipc_node_select(router_addr, selector); /* Slave nodes can only be accessed within own cluster via a 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) /* Inter zone/cluster -- find any direct link to remote cluster */ addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); - n_ptr = net_select_remote_node(addr, selector); - if (n_ptr && node_has_active_links(n_ptr)) + n_ptr = tipc_net_select_remote_node(addr, selector); + if (n_ptr && tipc_node_has_active_links(n_ptr)) return n_ptr; /* Last resort -- look for any router to anywhere in remote zone */ - router_addr = net_select_router(addr, selector); + router_addr = tipc_net_select_router(addr, selector); if (router_addr) - return node_select(router_addr, selector); + return tipc_node_select(router_addr, selector); return 0; } /** - * node_select_router - select router to reach specified node + * tipc_node_select_router - select router to reach specified node * * Uses a deterministic and fair algorithm for selecting router node. */ -u32 node_select_router(struct node *n_ptr, u32 ref) +u32 tipc_node_select_router(struct node *n_ptr, u32 ref) { u32 ulim; u32 mask; @@ -523,7 +522,7 @@ u32 node_select_router(struct node *n_ptr, u32 ref) return tipc_addr(own_zone(), own_cluster(), r); } -void node_add_router(struct node *n_ptr, u32 router) +void tipc_node_add_router(struct node *n_ptr, u32 router) { u32 r_num = tipc_node(router); @@ -534,7 +533,7 @@ void node_add_router(struct node *n_ptr, u32 router) !n_ptr->routers[n_ptr->last_router]); } -void node_remove_router(struct node *n_ptr, u32 router) +void tipc_node_remove_router(struct node *n_ptr, u32 router) { u32 r_num = tipc_node(router); @@ -547,7 +546,7 @@ void node_remove_router(struct node *n_ptr, u32 router) while ((--n_ptr->last_router >= 0) && !n_ptr->routers[n_ptr->last_router]); - if (!node_is_up(n_ptr)) + if (!tipc_node_is_up(n_ptr)) node_lost_contact(n_ptr); } @@ -572,16 +571,16 @@ u32 tipc_available_nodes(const u32 domain) struct node *n_ptr; u32 cnt = 0; - for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { + for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { if (!in_scope(domain, n_ptr->addr)) continue; - if (node_is_up(n_ptr)) + if (tipc_node_is_up(n_ptr)) cnt++; } return cnt; } -struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) { u32 domain; struct sk_buff *buf; @@ -589,40 +588,40 @@ struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) struct tipc_node_info node_info; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); domain = *(u32 *)TLV_DATA(req_tlv_area); domain = ntohl(domain); - if (!addr_domain_valid(domain)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (network address)"); + if (!tipc_addr_domain_valid(domain)) + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (network address)"); - if (!nodes) - return cfg_reply_none(); + if (!tipc_nodes) + return tipc_cfg_reply_none(); /* For now, get space for all other nodes (will need to modify this when slave nodes are supported */ - buf = cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * - (tipc_max_nodes - 1)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * + (tipc_max_nodes - 1)); if (!buf) return NULL; /* Add TLVs for all nodes in scope */ - for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { + for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { if (!in_scope(domain, n_ptr->addr)) continue; node_info.addr = htonl(n_ptr->addr); - node_info.up = htonl(node_is_up(n_ptr)); - cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, - &node_info, sizeof(node_info)); + node_info.up = htonl(tipc_node_is_up(n_ptr)); + tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, + &node_info, sizeof(node_info)); } return buf; } -struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) +struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) { u32 domain; struct sk_buff *buf; @@ -630,22 +629,22 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) struct tipc_link_info link_info; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) - return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); domain = *(u32 *)TLV_DATA(req_tlv_area); domain = ntohl(domain); - if (!addr_domain_valid(domain)) - return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE - " (network address)"); + if (!tipc_addr_domain_valid(domain)) + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (network address)"); - if (!nodes) - return cfg_reply_none(); + if (!tipc_nodes) + return tipc_cfg_reply_none(); /* For now, get space for 2 links to all other nodes + bcast link (will need to modify this when slave nodes are supported */ - buf = cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * - (2 * (tipc_max_nodes - 1) + 1)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * + (2 * (tipc_max_nodes - 1) + 1)); if (!buf) return NULL; @@ -654,12 +653,12 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) link_info.dest = tipc_own_addr & 0xfffff00; link_info.dest = htonl(link_info.dest); link_info.up = htonl(1); - sprintf(link_info.str, bc_link_name); - cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); + sprintf(link_info.str, tipc_bclink_name); + tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); /* Add TLVs for any other links in scope */ - for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { + for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { u32 i; 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) if (!n_ptr->links[i]) continue; link_info.dest = htonl(n_ptr->addr); - link_info.up = htonl(link_is_up(n_ptr->links[i])); + link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); strcpy(link_info.str, n_ptr->links[i]->name); - cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, - &link_info, sizeof(link_info)); + tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, + &link_info, sizeof(link_info)); } } diff --git a/net/tipc/node.h b/net/tipc/node.h index b39442badcc..29f7ae6992d 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h @@ -92,31 +92,31 @@ struct node { } bclink; }; -extern struct node *nodes; +extern struct node *tipc_nodes; extern u32 tipc_own_tag; -struct node *node_create(u32 addr); -void node_delete(struct node *n_ptr); -struct node *node_attach_link(struct link *l_ptr); -void node_detach_link(struct node *n_ptr, struct link *l_ptr); -void node_link_down(struct node *n_ptr, struct link *l_ptr); -void node_link_up(struct node *n_ptr, struct link *l_ptr); -int node_has_active_links(struct node *n_ptr); -int node_has_redundant_links(struct node *n_ptr); -u32 node_select_router(struct node *n_ptr, u32 ref); -struct node *node_select_next_hop(u32 addr, u32 selector); -int node_is_up(struct node *n_ptr); -void node_add_router(struct node *n_ptr, u32 router); -void node_remove_router(struct node *n_ptr, u32 router); -struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space); -struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space); +struct node *tipc_node_create(u32 addr); +void tipc_node_delete(struct node *n_ptr); +struct node *tipc_node_attach_link(struct link *l_ptr); +void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr); +void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr); +void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr); +int tipc_node_has_active_links(struct node *n_ptr); +int tipc_node_has_redundant_links(struct node *n_ptr); +u32 tipc_node_select_router(struct node *n_ptr, u32 ref); +struct node *tipc_node_select_next_hop(u32 addr, u32 selector); +int tipc_node_is_up(struct node *n_ptr); +void tipc_node_add_router(struct node *n_ptr, u32 router); +void tipc_node_remove_router(struct node *n_ptr, u32 router); +struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); +struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); -static inline struct node *node_find(u32 addr) +static inline struct node *tipc_node_find(u32 addr) { if (likely(in_own_cluster(addr))) - return local_nodes[tipc_node(addr)]; - else if (addr_domain_valid(addr)) { - struct cluster *c_ptr = cluster_find(addr); + return tipc_local_nodes[tipc_node(addr)]; + else if (tipc_addr_domain_valid(addr)) { + struct cluster *c_ptr = tipc_cltr_find(addr); if (c_ptr) return c_ptr->nodes[tipc_node(addr)]; @@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr) return 0; } -static inline struct node *node_select(u32 addr, u32 selector) +static inline struct node *tipc_node_select(u32 addr, u32 selector) { if (likely(in_own_cluster(addr))) - return local_nodes[tipc_node(addr)]; - return node_select_next_hop(addr, selector); + return tipc_local_nodes[tipc_node(addr)]; + return tipc_node_select_next_hop(addr, selector); } -static inline void node_lock(struct node *n_ptr) +static inline void tipc_node_lock(struct node *n_ptr) { spin_lock_bh(&n_ptr->lock); } -static inline void node_unlock(struct node *n_ptr) +static inline void tipc_node_unlock(struct node *n_ptr) { spin_unlock_bh(&n_ptr->lock); } diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c index 79375927916..afeea121d8b 100644 --- a/net/tipc/node_subscr.c +++ b/net/tipc/node_subscr.c @@ -41,39 +41,39 @@ #include "addr.h" /** - * nodesub_subscribe - create "node down" subscription for specified node + * tipc_nodesub_subscribe - create "node down" subscription for specified node */ -void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, +void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void *usr_handle, net_ev_handler handle_down) { node_sub->node = 0; if (addr == tipc_own_addr) return; - if (!addr_node_valid(addr)) { + if (!tipc_addr_node_valid(addr)) { warn("node_subscr with illegal %x\n", addr); return; } node_sub->handle_node_down = handle_down; node_sub->usr_handle = usr_handle; - node_sub->node = node_find(addr); + node_sub->node = tipc_node_find(addr); assert(node_sub->node); - node_lock(node_sub->node); + tipc_node_lock(node_sub->node); list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub); - node_unlock(node_sub->node); + tipc_node_unlock(node_sub->node); } /** - * nodesub_unsubscribe - cancel "node down" subscription (if any) + * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any) */ -void nodesub_unsubscribe(struct node_subscr *node_sub) +void tipc_nodesub_unsubscribe(struct node_subscr *node_sub) { if (!node_sub->node) return; - node_lock(node_sub->node); + tipc_node_lock(node_sub->node); list_del_init(&node_sub->nodesub_list); - node_unlock(node_sub->node); + tipc_node_unlock(node_sub->node); } diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h index a3b87ac4859..01751c4fbb4 100644 --- a/net/tipc/node_subscr.h +++ b/net/tipc/node_subscr.h @@ -56,8 +56,8 @@ struct node_subscr { struct list_head nodesub_list; }; -void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, - void *usr_handle, net_ev_handler handle_down); -void nodesub_unsubscribe(struct node_subscr *node_sub); +void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, + void *usr_handle, net_ev_handler handle_down); +void tipc_nodesub_unsubscribe(struct node_subscr *node_sub); #endif diff --git a/net/tipc/port.c b/net/tipc/port.c index 66caca7abe9..72aae52bfec 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -57,10 +57,10 @@ static struct sk_buff *msg_queue_head = 0; static struct sk_buff *msg_queue_tail = 0; -spinlock_t port_list_lock = SPIN_LOCK_UNLOCKED; +spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED; static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; -LIST_HEAD(ports); +static LIST_HEAD(ports); static void port_handle_node_down(unsigned long ref); static struct sk_buff* port_build_self_abort_msg(struct port *,u32 err); static 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, struct sk_buff *buf; struct sk_buff *ibuf = NULL; struct port_list dports = {0, NULL, }; - struct port *oport = port_deref(ref); + struct port *oport = tipc_port_deref(ref); int ext_targets; int res; @@ -129,8 +129,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, /* Figure out where to send multicast message */ - ext_targets = nametbl_mc_translate(seq->type, seq->lower, seq->upper, - TIPC_NODE_SCOPE, &dports); + ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, + TIPC_NODE_SCOPE, &dports); /* Send message to destinations (duplicate it only if necessary) */ @@ -138,12 +138,12 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, if (dports.count != 0) { ibuf = skb_copy(buf, GFP_ATOMIC); if (ibuf == NULL) { - port_list_free(&dports); + tipc_port_list_free(&dports); buf_discard(buf); return -ENOMEM; } } - res = bclink_send_msg(buf); + res = tipc_bclink_send_msg(buf); if ((res < 0) && (dports.count != 0)) { buf_discard(ibuf); } @@ -153,20 +153,20 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, if (res >= 0) { if (ibuf) - port_recv_mcast(ibuf, &dports); + tipc_port_recv_mcast(ibuf, &dports); } else { - port_list_free(&dports); + tipc_port_list_free(&dports); } return res; } /** - * port_recv_mcast - deliver multicast message to all destination ports + * tipc_port_recv_mcast - deliver multicast message to all destination ports * * If there is no port list, perform a lookup to create one */ -void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) +void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp) { struct tipc_msg* msg; struct port_list dports = {0, NULL, }; @@ -179,7 +179,7 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) /* Create destination port list, if one wasn't supplied */ if (dp == NULL) { - nametbl_mc_translate(msg_nametype(msg), + tipc_nametbl_mc_translate(msg_nametype(msg), msg_namelower(msg), msg_nameupper(msg), TIPC_CLUSTER_SCOPE, @@ -192,8 +192,8 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) if (dp->count != 0) { if (dp->count == 1) { msg_set_destport(msg, dp->ports[0]); - port_recv_msg(buf); - port_list_free(dp); + tipc_port_recv_msg(buf); + tipc_port_list_free(dp); return; } for (; cnt < dp->count; cnt++) { @@ -209,12 +209,12 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) item = item->next; } msg_set_destport(buf_msg(b),item->ports[index]); - port_recv_msg(b); + tipc_port_recv_msg(b); } } exit: buf_discard(buf); - port_list_free(dp); + tipc_port_list_free(dp); } /** @@ -238,14 +238,14 @@ u32 tipc_createport_raw(void *usr_handle, return 0; } memset(p_ptr, 0, sizeof(*p_ptr)); - ref = ref_acquire(p_ptr, &p_ptr->publ.lock); + ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock); if (!ref) { warn("Reference Table Exhausted\n"); kfree(p_ptr); return 0; } - port_lock(ref); + tipc_port_lock(ref); p_ptr->publ.ref = ref; msg = &p_ptr->publ.phdr; 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, p_ptr->wakeup = wakeup; p_ptr->user_port = 0; k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); - spin_lock_bh(&port_list_lock); + spin_lock_bh(&tipc_port_list_lock); INIT_LIST_HEAD(&p_ptr->publications); INIT_LIST_HEAD(&p_ptr->port_list); list_add_tail(&p_ptr->port_list, &ports); - spin_unlock_bh(&port_list_lock); - port_unlock(p_ptr); + spin_unlock_bh(&tipc_port_list_lock); + tipc_port_unlock(p_ptr); return ref; } @@ -279,31 +279,31 @@ int tipc_deleteport(u32 ref) struct sk_buff *buf = 0; tipc_withdraw(ref, 0, 0); - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; - ref_discard(ref); - port_unlock(p_ptr); + tipc_ref_discard(ref); + tipc_port_unlock(p_ptr); k_cancel_timer(&p_ptr->timer); if (p_ptr->publ.connected) { buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); - nodesub_unsubscribe(&p_ptr->subscription); + tipc_nodesub_unsubscribe(&p_ptr->subscription); } if (p_ptr->user_port) { - reg_remove_port(p_ptr->user_port); + tipc_reg_remove_port(p_ptr->user_port); kfree(p_ptr->user_port); } - spin_lock_bh(&port_list_lock); + spin_lock_bh(&tipc_port_list_lock); list_del(&p_ptr->port_list); list_del(&p_ptr->wait_list); - spin_unlock_bh(&port_list_lock); + spin_unlock_bh(&tipc_port_list_lock); k_term_timer(&p_ptr->timer); kfree(p_ptr); dbg("Deleted port %u\n", ref); - net_route_msg(buf); + tipc_net_route_msg(buf); return TIPC_OK; } @@ -315,7 +315,7 @@ int tipc_deleteport(u32 ref) struct tipc_port *tipc_get_port(const u32 ref) { - return (struct tipc_port *)ref_deref(ref); + return (struct tipc_port *)tipc_ref_deref(ref); } /** @@ -327,11 +327,11 @@ void *tipc_get_handle(const u32 ref) struct port *p_ptr; void * handle; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return 0; handle = p_ptr->publ.usr_handle; - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return handle; } @@ -344,7 +344,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; *isunreliable = port_unreliable(p_ptr); @@ -356,11 +356,11 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; msg_set_src_droppable(&p_ptr->publ.phdr, (isunreliable != 0)); - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -373,7 +373,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; *isunrejectable = port_unreturnable(p_ptr); @@ -385,11 +385,11 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; msg_set_dest_droppable(&p_ptr->publ.phdr, (isunrejectable != 0)); - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -476,25 +476,25 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) /* send self-abort message when rejecting on a connected port */ if (msg_connected(msg)) { struct sk_buff *abuf = 0; - struct port *p_ptr = port_lock(msg_destport(msg)); + struct port *p_ptr = tipc_port_lock(msg_destport(msg)); if (p_ptr) { if (p_ptr->publ.connected) abuf = port_build_self_abort_msg(p_ptr, err); - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); } - net_route_msg(abuf); + tipc_net_route_msg(abuf); } /* send rejected message */ buf_discard(buf); - net_route_msg(rbuf); + tipc_net_route_msg(rbuf); return data_sz; } -int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, - struct iovec const *msg_sect, u32 num_sect, - int err) +int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, + struct iovec const *msg_sect, u32 num_sect, + int err) { struct sk_buff *buf; int res; @@ -509,7 +509,7 @@ int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, static void port_timeout(unsigned long ref) { - struct port *p_ptr = port_lock(ref); + struct port *p_ptr = tipc_port_lock(ref); struct sk_buff *buf = 0; if (!p_ptr || !p_ptr->publ.connected) @@ -532,21 +532,21 @@ static void port_timeout(unsigned long ref) p_ptr->probing_state = PROBING; k_start_timer(&p_ptr->timer, p_ptr->probing_interval); } - port_unlock(p_ptr); - net_route_msg(buf); + tipc_port_unlock(p_ptr); + tipc_net_route_msg(buf); } static void port_handle_node_down(unsigned long ref) { - struct port *p_ptr = port_lock(ref); + struct port *p_ptr = tipc_port_lock(ref); struct sk_buff* buf = 0; if (!p_ptr) return; buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); - port_unlock(p_ptr); - net_route_msg(buf); + tipc_port_unlock(p_ptr); + tipc_net_route_msg(buf); } @@ -589,10 +589,10 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err) 0); } -void port_recv_proto_msg(struct sk_buff *buf) +void tipc_port_recv_proto_msg(struct sk_buff *buf) { struct tipc_msg *msg = buf_msg(buf); - struct port *p_ptr = port_lock(msg_destport(msg)); + struct port *p_ptr = tipc_port_lock(msg_destport(msg)); u32 err = TIPC_OK; struct sk_buff *r_buf = 0; struct sk_buff *abort_buf = 0; @@ -615,11 +615,11 @@ void port_recv_proto_msg(struct sk_buff *buf) } } if (msg_type(msg) == CONN_ACK) { - int wakeup = port_congested(p_ptr) && + int wakeup = tipc_port_congested(p_ptr) && p_ptr->publ.congested && p_ptr->wakeup; p_ptr->acked += msg_msgcnt(msg); - if (port_congested(p_ptr)) + if (tipc_port_congested(p_ptr)) goto exit; p_ptr->publ.congested = 0; if (!wakeup) @@ -659,9 +659,9 @@ void port_recv_proto_msg(struct sk_buff *buf) port_incr_out_seqno(p_ptr); exit: if (p_ptr) - port_unlock(p_ptr); - net_route_msg(r_buf); - net_route_msg(abort_buf); + tipc_port_unlock(p_ptr); + tipc_net_route_msg(r_buf); + tipc_net_route_msg(abort_buf); buf_discard(buf); } @@ -704,7 +704,7 @@ static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) #define MAX_PORT_QUERY 32768 -struct sk_buff *port_get_ports(void) +struct sk_buff *tipc_port_get_ports(void) { struct sk_buff *buf; struct tlv_desc *rep_tlv; @@ -712,20 +712,20 @@ struct sk_buff *port_get_ports(void) struct port *p_ptr; int str_len; - buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY)); if (!buf) return NULL; rep_tlv = (struct tlv_desc *)buf->data; - printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY); - spin_lock_bh(&port_list_lock); + tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY); + spin_lock_bh(&tipc_port_list_lock); list_for_each_entry(p_ptr, &ports, port_list) { spin_lock_bh(p_ptr->publ.lock); port_print(p_ptr, &pb, 0); spin_unlock_bh(p_ptr->publ.lock); } - spin_unlock_bh(&port_list_lock); - str_len = printbuf_validate(&pb); + spin_unlock_bh(&tipc_port_list_lock); + str_len = tipc_printbuf_validate(&pb); skb_put(buf, TLV_SPACE(str_len)); 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) ref = *(u32 *)TLV_DATA(req_tlv_area); ref = ntohl(ref); - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return cfg_reply_error_string("port not found"); - buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS)); + buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS)); if (!buf) { - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return NULL; } rep_tlv = (struct tlv_desc *)buf->data; - printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS); + tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS); port_print(p_ptr, &pb, 1); /* NEED TO FILL IN ADDITIONAL PORT STATISTICS HERE */ - port_unlock(p_ptr); - str_len = printbuf_validate(&pb); + tipc_port_unlock(p_ptr); + str_len = tipc_printbuf_validate(&pb); skb_put(buf, TLV_SPACE(str_len)); 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) #endif -void port_reinit(void) +void tipc_port_reinit(void) { struct port *p_ptr; struct tipc_msg *msg; - spin_lock_bh(&port_list_lock); + spin_lock_bh(&tipc_port_list_lock); list_for_each_entry(p_ptr, &ports, port_list) { msg = &p_ptr->publ.phdr; if (msg_orignode(msg) == tipc_own_addr) break; msg_set_orignode(msg, tipc_own_addr); } - spin_unlock_bh(&port_list_lock); + spin_unlock_bh(&tipc_port_list_lock); } @@ -820,7 +820,7 @@ static void port_dispatcher_sigh(void *dummy) struct tipc_msg *msg = buf_msg(buf); u32 dref = msg_destport(msg); - p_ptr = port_lock(dref); + p_ptr = tipc_port_lock(dref); if (!p_ptr) { /* Port deleted while msg in queue */ tipc_reject_msg(buf, TIPC_ERR_NO_PORT); @@ -976,7 +976,7 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) msg_queue_tail = buf; } else { msg_queue_tail = msg_queue_head = buf; - k_signal((Handler)port_dispatcher_sigh, 0); + tipc_k_signal((Handler)port_dispatcher_sigh, 0); } spin_unlock_bh(&queue_lock); return TIPC_OK; @@ -994,14 +994,14 @@ static void port_wakeup_sh(unsigned long ref) tipc_continue_event cb = 0; void *uh = 0; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (p_ptr) { up_ptr = p_ptr->user_port; if (up_ptr) { cb = up_ptr->continue_event_cb; uh = up_ptr->usr_handle; } - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); } if (cb) cb(uh, ref); @@ -1010,7 +1010,7 @@ static void port_wakeup_sh(unsigned long ref) static void port_wakeup(struct tipc_port *p_ptr) { - k_signal((Handler)port_wakeup_sh, p_ptr->ref); + tipc_k_signal((Handler)port_wakeup_sh, p_ptr->ref); } void tipc_acknowledge(u32 ref, u32 ack) @@ -1018,7 +1018,7 @@ void tipc_acknowledge(u32 ref, u32 ack) struct port *p_ptr; struct sk_buff *buf = 0; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return; if (p_ptr->publ.connected) { @@ -1033,8 +1033,8 @@ void tipc_acknowledge(u32 ref, u32 ack) port_out_seqno(p_ptr), ack); } - port_unlock(p_ptr); - net_route_msg(buf); + tipc_port_unlock(p_ptr); + tipc_net_route_msg(buf); } /* @@ -1063,7 +1063,7 @@ int tipc_createport(u32 user_ref, return -ENOMEM; } ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance); - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) { kfree(up_ptr); return -ENOMEM; @@ -1081,10 +1081,10 @@ int tipc_createport(u32 user_ref, up_ptr->conn_msg_cb = conn_msg_cb; up_ptr->continue_event_cb = continue_event_cb; INIT_LIST_HEAD(&up_ptr->uport_list); - reg_add_port(up_ptr); + tipc_reg_add_port(up_ptr); *portref = p_ptr->publ.ref; dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -1099,7 +1099,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; *importance = (unsigned int)msg_importance(&p_ptr->publ.phdr); @@ -1114,7 +1114,7 @@ int tipc_set_portimportance(u32 ref, unsigned int imp) if (imp > TIPC_CRITICAL_IMPORTANCE) return -EINVAL; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; 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) u32 key; int res = -EINVAL; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, " "lower = %u, upper = %u\n", 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) res = -EADDRINUSE; goto exit; } - publ = nametbl_publish(seq->type, seq->lower, seq->upper, - scope, p_ptr->publ.ref, key); + publ = tipc_nametbl_publish(seq->type, seq->lower, seq->upper, + scope, p_ptr->publ.ref, key); if (publ) { list_add(&publ->pport_list, &p_ptr->publications); p_ptr->pub_count++; @@ -1156,7 +1156,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) res = TIPC_OK; } exit: - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return res; } @@ -1167,7 +1167,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) struct publication *tpubl; int res = -EINVAL; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (!p_ptr->publ.published) @@ -1175,8 +1175,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) if (!seq) { list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { - nametbl_withdraw(publ->type, publ->lower, - publ->ref, publ->key); + tipc_nametbl_withdraw(publ->type, publ->lower, + publ->ref, publ->key); } res = TIPC_OK; } else { @@ -1190,8 +1190,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) continue; if (publ->upper != seq->upper) break; - nametbl_withdraw(publ->type, publ->lower, - publ->ref, publ->key); + tipc_nametbl_withdraw(publ->type, publ->lower, + publ->ref, publ->key); res = TIPC_OK; break; } @@ -1199,7 +1199,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) if (list_empty(&p_ptr->publications)) p_ptr->publ.published = 0; exit: - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return res; } @@ -1209,7 +1209,7 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer) struct tipc_msg *msg; int res = -EINVAL; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (p_ptr->publ.published || p_ptr->publ.connected) @@ -1234,13 +1234,13 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer) p_ptr->publ.connected = 1; k_start_timer(&p_ptr->timer, p_ptr->probing_interval); - nodesub_subscribe(&p_ptr->subscription,peer->node, + tipc_nodesub_subscribe(&p_ptr->subscription,peer->node, (void *)(unsigned long)ref, (net_ev_handler)port_handle_node_down); res = TIPC_OK; exit: - port_unlock(p_ptr); - p_ptr->max_pkt = link_get_max_pkt(peer->node, ref); + tipc_port_unlock(p_ptr); + p_ptr->max_pkt = tipc_link_get_max_pkt(peer->node, ref); return res; } @@ -1254,16 +1254,16 @@ int tipc_disconnect(u32 ref) struct port *p_ptr; int res = -ENOTCONN; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (p_ptr->publ.connected) { p_ptr->publ.connected = 0; /* let timer expire on it's own to avoid deadlock! */ - nodesub_unsubscribe(&p_ptr->subscription); + tipc_nodesub_unsubscribe(&p_ptr->subscription); res = TIPC_OK; } - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return res; } @@ -1275,7 +1275,7 @@ int tipc_shutdown(u32 ref) struct port *p_ptr; struct sk_buff *buf = 0; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1293,8 +1293,8 @@ int tipc_shutdown(u32 ref) port_out_seqno(p_ptr), 0); } - port_unlock(p_ptr); - net_route_msg(buf); + tipc_port_unlock(p_ptr); + tipc_net_route_msg(buf); return tipc_disconnect(ref); } @@ -1302,11 +1302,11 @@ int tipc_isconnected(u32 ref, int *isconnected) { struct port *p_ptr; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; *isconnected = p_ptr->publ.connected; - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -1315,7 +1315,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) struct port *p_ptr; int res; - p_ptr = port_lock(ref); + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (p_ptr->publ.connected) { @@ -1324,23 +1324,23 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) res = TIPC_OK; } else res = -ENOTCONN; - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); return res; } int tipc_ref_valid(u32 ref) { /* Works irrespective of type */ - return !!ref_deref(ref); + return !!tipc_ref_deref(ref); } /* - * port_recv_sections(): Concatenate and deliver sectioned + * tipc_port_recv_sections(): Concatenate and deliver sectioned * message for this node. */ -int port_recv_sections(struct port *sender, unsigned int num_sect, +int tipc_port_recv_sections(struct port *sender, unsigned int num_sect, struct iovec const *msg_sect) { struct sk_buff *buf; @@ -1349,7 +1349,7 @@ int port_recv_sections(struct port *sender, unsigned int num_sect, res = msg_build(&sender->publ.phdr, msg_sect, num_sect, MAX_MSG_SIZE, !sender->user_port, &buf); if (likely(buf)) - port_recv_msg(buf); + tipc_port_recv_msg(buf); return res; } @@ -1363,18 +1363,18 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) u32 destnode; int res; - p_ptr = port_deref(ref); + p_ptr = tipc_port_deref(ref); if (!p_ptr || !p_ptr->publ.connected) return -EINVAL; p_ptr->publ.congested = 1; - if (!port_congested(p_ptr)) { + if (!tipc_port_congested(p_ptr)) { destnode = port_peernode(p_ptr); if (likely(destnode != tipc_own_addr)) - res = link_send_sections_fast(p_ptr, msg_sect, num_sect, - destnode); + res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, + destnode); else - res = port_recv_sections(p_ptr, num_sect, msg_sect); + res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect); if (likely(res != -ELINKCONG)) { port_incr_out_seqno(p_ptr); @@ -1404,7 +1404,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) u32 sz; u32 res; - p_ptr = port_deref(ref); + p_ptr = tipc_port_deref(ref); if (!p_ptr || !p_ptr->publ.connected) return -EINVAL; @@ -1419,11 +1419,11 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) memcpy(buf->data, (unchar *)msg, hsz); destnode = msg_destnode(msg); p_ptr->publ.congested = 1; - if (!port_congested(p_ptr)) { + if (!tipc_port_congested(p_ptr)) { if (likely(destnode != tipc_own_addr)) res = tipc_send_buf_fast(buf, destnode); else { - port_recv_msg(buf); + tipc_port_recv_msg(buf); res = sz; } if (likely(res != -ELINKCONG)) { @@ -1458,7 +1458,7 @@ int tipc_forward2name(u32 ref, u32 destport = 0; int res; - p_ptr = port_deref(ref); + p_ptr = tipc_port_deref(ref); if (!p_ptr || p_ptr->publ.connected) return -EINVAL; @@ -1472,16 +1472,16 @@ int tipc_forward2name(u32 ref, msg_set_lookup_scope(msg, addr_scope(domain)); if (importance <= TIPC_CRITICAL_IMPORTANCE) msg_set_importance(msg,importance); - destport = nametbl_translate(name->type, name->instance, &destnode); + destport = tipc_nametbl_translate(name->type, name->instance, &destnode); msg_set_destnode(msg, destnode); msg_set_destport(msg, destport); if (likely(destport || destnode)) { p_ptr->sent++; if (likely(destnode == tipc_own_addr)) - return port_recv_sections(p_ptr, num_sect, msg_sect); - res = link_send_sections_fast(p_ptr, msg_sect, num_sect, - destnode); + return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); + res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, + destnode); if (likely(res != -ELINKCONG)) return res; if (port_unreliable(p_ptr)) { @@ -1490,8 +1490,8 @@ int tipc_forward2name(u32 ref, } return -ELINKCONG; } - return port_reject_sections(p_ptr, msg, msg_sect, num_sect, - TIPC_ERR_NO_NAME); + return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, + TIPC_ERR_NO_NAME); } /** @@ -1530,7 +1530,7 @@ int tipc_forward_buf2name(u32 ref, u32 destport = 0; int res; - p_ptr = (struct port *)ref_deref(ref); + p_ptr = (struct port *)tipc_ref_deref(ref); if (!p_ptr || p_ptr->publ.connected) return -EINVAL; @@ -1545,7 +1545,7 @@ int tipc_forward_buf2name(u32 ref, msg_set_lookup_scope(msg, addr_scope(domain)); msg_set_hdr_sz(msg, LONG_H_SIZE); msg_set_size(msg, LONG_H_SIZE + dsz); - destport = nametbl_translate(name->type, name->instance, &destnode); + destport = tipc_nametbl_translate(name->type, name->instance, &destnode); msg_set_destnode(msg, destnode); msg_set_destport(msg, destport); msg_dbg(msg, "forw2name ==> "); @@ -1557,7 +1557,7 @@ int tipc_forward_buf2name(u32 ref, if (likely(destport || destnode)) { p_ptr->sent++; if (destnode == tipc_own_addr) - return port_recv_msg(buf); + return tipc_port_recv_msg(buf); res = tipc_send_buf_fast(buf, destnode); if (likely(res != -ELINKCONG)) return res; @@ -1601,7 +1601,7 @@ int tipc_forward2port(u32 ref, struct tipc_msg *msg; int res; - p_ptr = port_deref(ref); + p_ptr = tipc_port_deref(ref); if (!p_ptr || p_ptr->publ.connected) return -EINVAL; @@ -1616,8 +1616,8 @@ int tipc_forward2port(u32 ref, msg_set_importance(msg, importance); p_ptr->sent++; if (dest->node == tipc_own_addr) - return port_recv_sections(p_ptr, num_sect, msg_sect); - res = link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node); + return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); + res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node); if (likely(res != -ELINKCONG)) return res; if (port_unreliable(p_ptr)) { @@ -1658,7 +1658,7 @@ int tipc_forward_buf2port(u32 ref, struct tipc_msg *msg; int res; - p_ptr = (struct port *)ref_deref(ref); + p_ptr = (struct port *)tipc_ref_deref(ref); if (!p_ptr || p_ptr->publ.connected) return -EINVAL; @@ -1680,7 +1680,7 @@ int tipc_forward_buf2port(u32 ref, msg_dbg(msg, "buf2port: "); p_ptr->sent++; if (dest->node == tipc_own_addr) - return port_recv_msg(buf); + return tipc_port_recv_msg(buf); res = tipc_send_buf_fast(buf, dest->node); if (likely(res != -ELINKCONG)) return res; diff --git a/net/tipc/port.h b/net/tipc/port.h index e829a99d3b7..839f100da64 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h @@ -37,7 +37,7 @@ #ifndef _TIPC_PORT_H #define _TIPC_PORT_H -#include <net/tipc/tipc_port.h> +#include "core.h" #include "ref.h" #include "net.h" #include "msg.h" @@ -110,65 +110,65 @@ struct port { struct node_subscr subscription; }; -extern spinlock_t port_list_lock; +extern spinlock_t tipc_port_list_lock; struct port_list; -int port_recv_sections(struct port *p_ptr, u32 num_sect, - struct iovec const *msg_sect); -int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, - struct iovec const *msg_sect, u32 num_sect, - int err); -struct sk_buff *port_get_ports(void); +int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect, + struct iovec const *msg_sect); +int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, + struct iovec const *msg_sect, u32 num_sect, + int err); +struct sk_buff *tipc_port_get_ports(void); struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space); -void port_recv_proto_msg(struct sk_buff *buf); -void port_recv_mcast(struct sk_buff *buf, struct port_list *dp); -void port_reinit(void); +void tipc_port_recv_proto_msg(struct sk_buff *buf); +void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp); +void tipc_port_reinit(void); /** - * port_lock - lock port instance referred to and return its pointer + * tipc_port_lock - lock port instance referred to and return its pointer */ -static inline struct port *port_lock(u32 ref) +static inline struct port *tipc_port_lock(u32 ref) { - return (struct port *)ref_lock(ref); + return (struct port *)tipc_ref_lock(ref); } /** - * port_unlock - unlock a port instance + * tipc_port_unlock - unlock a port instance * - * Can use pointer instead of ref_unlock() since port is already locked. + * Can use pointer instead of tipc_ref_unlock() since port is already locked. */ -static inline void port_unlock(struct port *p_ptr) +static inline void tipc_port_unlock(struct port *p_ptr) { spin_unlock_bh(p_ptr->publ.lock); } -static inline struct port* port_deref(u32 ref) +static inline struct port* tipc_port_deref(u32 ref) { - return (struct port *)ref_deref(ref); + return (struct port *)tipc_ref_deref(ref); } -static inline u32 peer_port(struct port *p_ptr) +static inline u32 tipc_peer_port(struct port *p_ptr) { return msg_destport(&p_ptr->publ.phdr); } -static inline u32 peer_node(struct port *p_ptr) +static inline u32 tipc_peer_node(struct port *p_ptr) { return msg_destnode(&p_ptr->publ.phdr); } -static inline int port_congested(struct port *p_ptr) +static inline int tipc_port_congested(struct port *p_ptr) { return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); } /** - * port_recv_msg - receive message from lower layer and deliver to port user + * tipc_port_recv_msg - receive message from lower layer and deliver to port user */ -static inline int port_recv_msg(struct sk_buff *buf) +static inline int tipc_port_recv_msg(struct sk_buff *buf) { struct port *p_ptr; struct tipc_msg *msg = buf_msg(buf); @@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf) /* forward unresolved named message */ if (unlikely(!destport)) { - net_route_msg(buf); + tipc_net_route_msg(buf); return dsz; } /* validate destination & pass to port, otherwise reject message */ - p_ptr = port_lock(destport); + p_ptr = tipc_port_lock(destport); if (likely(p_ptr)) { if (likely(p_ptr->publ.connected)) { - if ((unlikely(msg_origport(msg) != peer_port(p_ptr))) || - (unlikely(msg_orignode(msg) != peer_node(p_ptr))) || + if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) || + (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) || (unlikely(!msg_connected(msg)))) { err = TIPC_ERR_NO_PORT; - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); goto reject; } } err = p_ptr->dispatcher(&p_ptr->publ, buf); - port_unlock(p_ptr); + tipc_port_unlock(p_ptr); if (likely(!err)) return dsz; } else { diff --git a/net/tipc/ref.c b/net/tipc/ref.c index 944093fe246..5a13c2defe4 100644 --- a/net/tipc/ref.c +++ b/net/tipc/ref.c @@ -61,15 +61,15 @@ * because entry 0's reference field has the form XXXX|1--1. */ -struct ref_table ref_table = { 0 }; +struct ref_table tipc_ref_table = { 0 }; -rwlock_t reftbl_lock = RW_LOCK_UNLOCKED; +static rwlock_t ref_table_lock = RW_LOCK_UNLOCKED; /** - * ref_table_init - create reference table for objects + * tipc_ref_table_init - create reference table for objects */ -int ref_table_init(u32 requested_size, u32 start) +int tipc_ref_table_init(u32 requested_size, u32 start) { struct reference *table; u32 sz = 1 << 4; @@ -83,43 +83,43 @@ int ref_table_init(u32 requested_size, u32 start) if (table == NULL) return -ENOMEM; - write_lock_bh(&reftbl_lock); + write_lock_bh(&ref_table_lock); index_mask = sz - 1; for (i = sz - 1; i >= 0; i--) { table[i].object = 0; table[i].lock = SPIN_LOCK_UNLOCKED; table[i].data.next_plus_upper = (start & ~index_mask) + i - 1; } - ref_table.entries = table; - ref_table.index_mask = index_mask; - ref_table.first_free = sz - 1; - ref_table.last_free = 1; - write_unlock_bh(&reftbl_lock); + tipc_ref_table.entries = table; + tipc_ref_table.index_mask = index_mask; + tipc_ref_table.first_free = sz - 1; + tipc_ref_table.last_free = 1; + write_unlock_bh(&ref_table_lock); return TIPC_OK; } /** - * ref_table_stop - destroy reference table for objects + * tipc_ref_table_stop - destroy reference table for objects */ -void ref_table_stop(void) +void tipc_ref_table_stop(void) { - if (!ref_table.entries) + if (!tipc_ref_table.entries) return; - vfree(ref_table.entries); - ref_table.entries = 0; + vfree(tipc_ref_table.entries); + tipc_ref_table.entries = 0; } /** - * ref_acquire - create reference to an object + * tipc_ref_acquire - create reference to an object * * Return a unique reference value which can be translated back to the pointer * 'object' at a later time. Also, pass back a pointer to the lock protecting * the object, but without locking it. */ -u32 ref_acquire(void *object, spinlock_t **lock) +u32 tipc_ref_acquire(void *object, spinlock_t **lock) { struct reference *entry; u32 index; @@ -127,17 +127,17 @@ u32 ref_acquire(void *object, spinlock_t **lock) u32 next_plus_upper; u32 reference = 0; - assert(ref_table.entries && object); + assert(tipc_ref_table.entries && object); - write_lock_bh(&reftbl_lock); - if (ref_table.first_free) { - index = ref_table.first_free; - entry = &(ref_table.entries[index]); - index_mask = ref_table.index_mask; + write_lock_bh(&ref_table_lock); + if (tipc_ref_table.first_free) { + index = tipc_ref_table.first_free; + entry = &(tipc_ref_table.entries[index]); + index_mask = tipc_ref_table.index_mask; /* take lock in case a previous user of entry still holds it */ spin_lock_bh(&entry->lock); next_plus_upper = entry->data.next_plus_upper; - ref_table.first_free = next_plus_upper & index_mask; + tipc_ref_table.first_free = next_plus_upper & index_mask; reference = (next_plus_upper & ~index_mask) + index; entry->data.reference = reference; entry->object = object; @@ -145,45 +145,45 @@ u32 ref_acquire(void *object, spinlock_t **lock) *lock = &entry->lock; spin_unlock_bh(&entry->lock); } - write_unlock_bh(&reftbl_lock); + write_unlock_bh(&ref_table_lock); return reference; } /** - * ref_discard - invalidate references to an object + * tipc_ref_discard - invalidate references to an object * * Disallow future references to an object and free up the entry for re-use. * Note: The entry's spin_lock may still be busy after discard */ -void ref_discard(u32 ref) +void tipc_ref_discard(u32 ref) { struct reference *entry; u32 index; u32 index_mask; - assert(ref_table.entries); + assert(tipc_ref_table.entries); assert(ref != 0); - write_lock_bh(&reftbl_lock); - index_mask = ref_table.index_mask; + write_lock_bh(&ref_table_lock); + index_mask = tipc_ref_table.index_mask; index = ref & index_mask; - entry = &(ref_table.entries[index]); + entry = &(tipc_ref_table.entries[index]); assert(entry->object != 0); assert(entry->data.reference == ref); /* mark entry as unused */ entry->object = 0; - if (ref_table.first_free == 0) - ref_table.first_free = index; + if (tipc_ref_table.first_free == 0) + tipc_ref_table.first_free = index; else /* next_plus_upper is always XXXX|0--0 for last free entry */ - ref_table.entries[ref_table.last_free].data.next_plus_upper + tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper |= index; - ref_table.last_free = index; + tipc_ref_table.last_free = index; /* increment upper bits of entry to invalidate subsequent references */ entry->data.next_plus_upper = (ref & ~index_mask) + (index_mask + 1); - write_unlock_bh(&reftbl_lock); + write_unlock_bh(&ref_table_lock); } diff --git a/net/tipc/ref.h b/net/tipc/ref.h index 429cde57228..4f8f9f40dca 100644 --- a/net/tipc/ref.h +++ b/net/tipc/ref.h @@ -54,7 +54,7 @@ struct reference { }; /** - * struct ref_table - table of TIPC object reference entries + * struct tipc_ref_table - table of TIPC object reference entries * @entries: pointer to array of reference entries * @index_mask: bitmask for array index portion of reference values * @first_free: array index of first unused object reference entry @@ -68,24 +68,24 @@ struct ref_table { u32 last_free; }; -extern struct ref_table ref_table; +extern struct ref_table tipc_ref_table; -int ref_table_init(u32 requested_size, u32 start); -void ref_table_stop(void); +int tipc_ref_table_init(u32 requested_size, u32 start); +void tipc_ref_table_stop(void); -u32 ref_acquire(void *object, spinlock_t **lock); -void ref_discard(u32 ref); +u32 tipc_ref_acquire(void *object, spinlock_t **lock); +void tipc_ref_discard(u32 ref); /** - * ref_lock - lock referenced object and return pointer to it + * tipc_ref_lock - lock referenced object and return pointer to it */ -static inline void *ref_lock(u32 ref) +static inline void *tipc_ref_lock(u32 ref) { - if (likely(ref_table.entries)) { + if (likely(tipc_ref_table.entries)) { struct reference *r = - &ref_table.entries[ref & ref_table.index_mask]; + &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; spin_lock_bh(&r->lock); if (likely(r->data.reference == ref)) @@ -96,31 +96,31 @@ static inline void *ref_lock(u32 ref) } /** - * ref_unlock - unlock referenced object + * tipc_ref_unlock - unlock referenced object */ -static inline void ref_unlock(u32 ref) +static inline void tipc_ref_unlock(u32 ref) { - if (likely(ref_table.entries)) { + if (likely(tipc_ref_table.entries)) { struct reference *r = - &ref_table.entries[ref & ref_table.index_mask]; + &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; if (likely(r->data.reference == ref)) spin_unlock_bh(&r->lock); else - err("ref_unlock() invoked using obsolete reference\n"); + err("tipc_ref_unlock() invoked using obsolete reference\n"); } } /** - * ref_deref - return pointer referenced object (without locking it) + * tipc_ref_deref - return pointer referenced object (without locking it) */ -static inline void *ref_deref(u32 ref) +static inline void *tipc_ref_deref(u32 ref) { - if (likely(ref_table.entries)) { + if (likely(tipc_ref_table.entries)) { struct reference *r = - &ref_table.entries[ref & ref_table.index_mask]; + &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; if (likely(r->data.reference == ref)) return r->object; diff --git a/net/tipc/socket.c b/net/tipc/socket.c index d21f8c0cd25..67253bfcd70 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -42,9 +42,7 @@ #include <linux/mm.h> #include <linux/slab.h> #include <linux/poll.h> -#include <linux/version.h> #include <linux/fcntl.h> -#include <linux/version.h> #include <asm/semaphore.h> #include <asm/string.h> #include <asm/atomic.h> @@ -1185,7 +1183,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) { sock->state = SS_DISCONNECTING; /* Note: Use signal since port lock is already taken! */ - k_signal((Handler)async_disconnect, tport->ref); + tipc_k_signal((Handler)async_disconnect, tport->ref); } /* Enqueue message (finally!) */ @@ -1685,11 +1683,11 @@ static struct proto tipc_proto = { }; /** - * socket_init - initialize TIPC socket interface + * tipc_socket_init - initialize TIPC socket interface * * Returns 0 on success, errno otherwise */ -int socket_init(void) +int tipc_socket_init(void) { int res; @@ -1712,9 +1710,9 @@ int socket_init(void) } /** - * sock_stop - stop TIPC socket interface + * tipc_socket_stop - stop TIPC socket interface */ -void socket_stop(void) +void tipc_socket_stop(void) { if (!sockets_enabled) return; diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 80e219ba527..5ff38b9f319 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c @@ -118,14 +118,14 @@ static void subscr_send_event(struct subscription *sub, } /** - * subscr_overlap - test for subscription overlap with the given values + * tipc_subscr_overlap - test for subscription overlap with the given values * * Returns 1 if there is overlap, otherwise 0. */ -int subscr_overlap(struct subscription *sub, - u32 found_lower, - u32 found_upper) +int tipc_subscr_overlap(struct subscription *sub, + u32 found_lower, + u32 found_upper) { if (found_lower < sub->seq.lower) @@ -138,22 +138,22 @@ int subscr_overlap(struct subscription *sub, } /** - * subscr_report_overlap - issue event if there is subscription overlap + * tipc_subscr_report_overlap - issue event if there is subscription overlap * * Protected by nameseq.lock in name_table.c */ -void subscr_report_overlap(struct subscription *sub, - u32 found_lower, - u32 found_upper, - u32 event, - u32 port_ref, - u32 node, - int must) +void tipc_subscr_report_overlap(struct subscription *sub, + u32 found_lower, + u32 found_upper, + u32 event, + u32 port_ref, + u32 node, + int must) { dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower, sub->seq.upper, found_lower, found_upper); - if (!subscr_overlap(sub, found_lower, found_upper)) + if (!tipc_subscr_overlap(sub, found_lower, found_upper)) return; if (!must && (sub->filter != TIPC_SUB_PORTS)) return; @@ -172,13 +172,13 @@ static void subscr_timeout(struct subscription *sub) /* Validate subscriber reference (in case subscriber is terminating) */ subscriber_ref = sub->owner->ref; - subscriber = (struct subscriber *)ref_lock(subscriber_ref); + subscriber = (struct subscriber *)tipc_ref_lock(subscriber_ref); if (subscriber == NULL) return; /* Unlink subscription from name table */ - nametbl_unsubscribe(sub); + tipc_nametbl_unsubscribe(sub); /* Notify subscriber of timeout, then unlink subscription */ @@ -192,7 +192,7 @@ static void subscr_timeout(struct subscription *sub) /* Now destroy subscription */ - ref_unlock(subscriber_ref); + tipc_ref_unlock(subscriber_ref); k_term_timer(&sub->timer); kfree(sub); atomic_dec(&topsrv.subscription_count); @@ -216,7 +216,7 @@ static void subscr_terminate(struct subscriber *subscriber) /* Invalidate subscriber reference */ - ref_discard(subscriber->ref); + tipc_ref_discard(subscriber->ref); spin_unlock_bh(subscriber->lock); /* Destroy any existing subscriptions for subscriber */ @@ -227,7 +227,7 @@ static void subscr_terminate(struct subscriber *subscriber) k_cancel_timer(&sub->timer); k_term_timer(&sub->timer); } - nametbl_unsubscribe(sub); + tipc_nametbl_unsubscribe(sub); list_del(&sub->subscription_list); dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n", sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); @@ -315,7 +315,7 @@ static void subscr_subscribe(struct tipc_subscr *s, k_start_timer(&sub->timer, sub->timeout); } sub->owner = subscriber; - nametbl_subscribe(sub); + tipc_nametbl_subscribe(sub); } /** @@ -332,7 +332,7 @@ static void subscr_conn_shutdown_event(void *usr_handle, struct subscriber *subscriber; spinlock_t *subscriber_lock; - subscriber = ref_lock((u32)(unsigned long)usr_handle); + subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle); if (subscriber == NULL) return; @@ -354,7 +354,7 @@ static void subscr_conn_msg_event(void *usr_handle, struct subscriber *subscriber; spinlock_t *subscriber_lock; - subscriber = ref_lock((u32)(unsigned long)usr_handle); + subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle); if (subscriber == NULL) return; @@ -401,7 +401,7 @@ static void subscr_named_msg_event(void *usr_handle, memset(subscriber, 0, sizeof(struct subscriber)); INIT_LIST_HEAD(&subscriber->subscription_list); INIT_LIST_HEAD(&subscriber->subscriber_list); - subscriber->ref = ref_acquire(subscriber, &subscriber->lock); + subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock); if (subscriber->ref == 0) { warn("Failed to acquire subscriber reference\n"); kfree(subscriber); @@ -423,7 +423,7 @@ static void subscr_named_msg_event(void *usr_handle, &subscriber->port_ref); if (subscriber->port_ref == 0) { warn("Memory squeeze; failed to create subscription port\n"); - ref_discard(subscriber->ref); + tipc_ref_discard(subscriber->ref); kfree(subscriber); return; } @@ -432,7 +432,7 @@ static void subscr_named_msg_event(void *usr_handle, /* Add subscriber to topology server's subscriber list */ - ref_lock(subscriber->ref); + tipc_ref_lock(subscriber->ref); spin_lock_bh(&topsrv.lock); list_add(&subscriber->subscriber_list, &topsrv.subscriber_list); spin_unlock_bh(&topsrv.lock); @@ -451,7 +451,7 @@ static void subscr_named_msg_event(void *usr_handle, spin_unlock_bh(subscriber_lock); } -int subscr_start(void) +int tipc_subscr_start(void) { struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV}; int res = -1; @@ -481,7 +481,7 @@ int subscr_start(void) if (res) goto failed; - res = nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); + res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); if (res) goto failed; @@ -496,7 +496,7 @@ failed: return res; } -void subscr_stop(void) +void tipc_subscr_stop(void) { struct subscriber *subscriber; struct subscriber *subscriber_temp; @@ -507,7 +507,7 @@ void subscr_stop(void) list_for_each_entry_safe(subscriber, subscriber_temp, &topsrv.subscriber_list, subscriber_list) { - ref_lock(subscriber->ref); + tipc_ref_lock(subscriber->ref); subscriber_lock = subscriber->lock; subscr_terminate(subscriber); spin_unlock_bh(subscriber_lock); @@ -522,6 +522,6 @@ int tipc_ispublished(struct tipc_name const *name) { u32 domain = 0; - return(nametbl_translate(name->type, name->instance,&domain) != 0); + return(tipc_nametbl_translate(name->type, name->instance,&domain) != 0); } diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index ccff4efcb75..1e5090465d2 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h @@ -60,21 +60,21 @@ struct subscription { struct subscriber *owner; }; -int subscr_overlap(struct subscription * sub, - u32 found_lower, - u32 found_upper); +int tipc_subscr_overlap(struct subscription * sub, + u32 found_lower, + u32 found_upper); -void subscr_report_overlap(struct subscription * sub, - u32 found_lower, - u32 found_upper, - u32 event, - u32 port_ref, - u32 node, - int must_report); +void tipc_subscr_report_overlap(struct subscription * sub, + u32 found_lower, + u32 found_upper, + u32 event, + u32 port_ref, + u32 node, + int must_report); -int subscr_start(void); +int tipc_subscr_start(void); -void subscr_stop(void); +void tipc_subscr_stop(void); #endif diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c index 35ec7dc8211..106200d7658 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) } /** - * reg_start - activate TIPC user registry + * tipc_reg_start - activate TIPC user registry */ -int reg_start(void) +int tipc_reg_start(void) { u32 u; int res; @@ -127,17 +127,17 @@ int reg_start(void) for (u = 1; u <= MAX_USERID; u++) { if (users[u].callback) - k_signal((Handler)reg_callback, - (unsigned long)&users[u]); + tipc_k_signal((Handler)reg_callback, + (unsigned long)&users[u]); } return TIPC_OK; } /** - * reg_stop - shut down & delete TIPC user registry + * tipc_reg_stop - shut down & delete TIPC user registry */ -void reg_stop(void) +void tipc_reg_stop(void) { int id; @@ -184,7 +184,7 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) atomic_inc(&tipc_user_count); if (cb && (tipc_mode != TIPC_NOT_RUNNING)) - k_signal((Handler)reg_callback, (unsigned long)user_ptr); + tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); return TIPC_OK; } @@ -223,10 +223,10 @@ void tipc_detach(u32 userid) } /** - * reg_add_port - register a user's driver port + * tipc_reg_add_port - register a user's driver port */ -int reg_add_port(struct user_port *up_ptr) +int tipc_reg_add_port(struct user_port *up_ptr) { struct tipc_user *user_ptr; @@ -245,10 +245,10 @@ int reg_add_port(struct user_port *up_ptr) } /** - * reg_remove_port - deregister a user's driver port + * tipc_reg_remove_port - deregister a user's driver port */ -int reg_remove_port(struct user_port *up_ptr) +int tipc_reg_remove_port(struct user_port *up_ptr) { if (up_ptr->user_ref == 0) return TIPC_OK; diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h index 122ca9be367..d0e88794ed1 100644 --- a/net/tipc/user_reg.h +++ b/net/tipc/user_reg.h @@ -39,10 +39,10 @@ #include "port.h" -int reg_start(void); -void reg_stop(void); +int tipc_reg_start(void); +void tipc_reg_stop(void); -int reg_add_port(struct user_port *up_ptr); -int reg_remove_port(struct user_port *up_ptr); +int tipc_reg_add_port(struct user_port *up_ptr); +int tipc_reg_remove_port(struct user_port *up_ptr); #endif diff --git a/net/tipc/zone.c b/net/tipc/zone.c index 4eaef662d56..7c11f7f83a2 100644 --- a/net/tipc/zone.c +++ b/net/tipc/zone.c @@ -42,12 +42,12 @@ #include "cluster.h" #include "node.h" -struct _zone *zone_create(u32 addr) +struct _zone *tipc_zone_create(u32 addr) { struct _zone *z_ptr = 0; u32 z_num; - if (!addr_domain_valid(addr)) + if (!tipc_addr_domain_valid(addr)) return 0; z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); @@ -55,24 +55,24 @@ struct _zone *zone_create(u32 addr) memset(z_ptr, 0, sizeof(*z_ptr)); z_num = tipc_zone(addr); z_ptr->addr = tipc_addr(z_num, 0, 0); - net.zones[z_num] = z_ptr; + tipc_net.zones[z_num] = z_ptr; } return z_ptr; } -void zone_delete(struct _zone *z_ptr) +void tipc_zone_delete(struct _zone *z_ptr) { u32 c_num; if (!z_ptr) return; for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { - cluster_delete(z_ptr->clusters[c_num]); + tipc_cltr_delete(z_ptr->clusters[c_num]); } kfree(z_ptr); } -void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) +void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) { u32 c_num = tipc_cluster(c_ptr->addr); @@ -82,19 +82,19 @@ void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) z_ptr->clusters[c_num] = c_ptr; } -void zone_remove_as_router(struct _zone *z_ptr, u32 router) +void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router) { u32 c_num; for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { if (z_ptr->clusters[c_num]) { - cluster_remove_as_router(z_ptr->clusters[c_num], - router); + tipc_cltr_remove_as_router(z_ptr->clusters[c_num], + router); } } } -void zone_send_external_routes(struct _zone *z_ptr, u32 dest) +void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest) { u32 c_num; @@ -102,12 +102,12 @@ void zone_send_external_routes(struct _zone *z_ptr, u32 dest) if (z_ptr->clusters[c_num]) { if (in_own_cluster(z_ptr->addr)) continue; - cluster_send_ext_routes(z_ptr->clusters[c_num], dest); + tipc_cltr_send_ext_routes(z_ptr->clusters[c_num], dest); } } } -struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) +struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) { struct cluster *c_ptr; struct node *n_ptr; @@ -118,7 +118,7 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) c_ptr = z_ptr->clusters[tipc_cluster(addr)]; if (!c_ptr) return 0; - n_ptr = cluster_select_node(c_ptr, ref); + n_ptr = tipc_cltr_select_node(c_ptr, ref); if (n_ptr) return n_ptr; @@ -127,14 +127,14 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) c_ptr = z_ptr->clusters[c_num]; if (!c_ptr) return 0; - n_ptr = cluster_select_node(c_ptr, ref); + n_ptr = tipc_cltr_select_node(c_ptr, ref); if (n_ptr) return n_ptr; } return 0; } -u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) +u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) { struct cluster *c_ptr; u32 c_num; @@ -143,14 +143,14 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) if (!z_ptr) return 0; c_ptr = z_ptr->clusters[tipc_cluster(addr)]; - router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; + router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0; if (router) return router; /* Links to any other clusters within the zone? */ for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { c_ptr = z_ptr->clusters[c_num]; - router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; + router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0; if (router) return router; } @@ -158,12 +158,12 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) } -u32 zone_next_node(u32 addr) +u32 tipc_zone_next_node(u32 addr) { - struct cluster *c_ptr = cluster_find(addr); + struct cluster *c_ptr = tipc_cltr_find(addr); if (c_ptr) - return cluster_next_node(c_ptr, addr); + return tipc_cltr_next_node(c_ptr, addr); return 0; } diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 4326f78d829..267999c5a24 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h @@ -54,18 +54,18 @@ struct _zone { u32 links; }; -struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); -u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); -void zone_remove_as_router(struct _zone *z_ptr, u32 router); -void zone_send_external_routes(struct _zone *z_ptr, u32 dest); -struct _zone *zone_create(u32 addr); -void zone_delete(struct _zone *z_ptr); -void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr); -u32 zone_next_node(u32 addr); +struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); +u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); +void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router); +void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest); +struct _zone *tipc_zone_create(u32 addr); +void tipc_zone_delete(struct _zone *z_ptr); +void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr); +u32 tipc_zone_next_node(u32 addr); -static inline struct _zone *zone_find(u32 addr) +static inline struct _zone *tipc_zone_find(u32 addr) { - return net.zones[tipc_zone(addr)]; + return tipc_net.zones[tipc_zone(addr)]; } #endif |