svn commit: r295927 - in head/sys/netinet: . tcp_stacks

John Baldwin jhb at freebsd.org
Wed Feb 24 01:25:15 UTC 2016


On Tuesday, February 23, 2016 05:53:39 PM Randall Stewart wrote:
> Author: rrs
> Date: Tue Feb 23 17:53:39 2016
> New Revision: 295927
> URL: https://svnweb.freebsd.org/changeset/base/295927
> 
> Log:
>   This fixes the fastpath code to have a better module initialization sequence when
>   included in loader.conf. It also fixes it so that no matter if some one incorrectly
>   specifies a load order, the lists and such will be initialized on demand at that
>   time so no one can make that mistake.
>   
>   Reviewed by:	hiren
>   Differential Revision:	D5189
> 
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
>   head/sys/netinet/tcp_subr.c
> 
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
> ==============================================================================
> --- head/sys/netinet/tcp_stacks/fastpath.c	Tue Feb 23 16:01:34 2016	(r295926)
> +++ head/sys/netinet/tcp_stacks/fastpath.c	Tue Feb 23 17:53:39 2016	(r295927)
> @@ -2453,4 +2453,4 @@ static moduledata_t new_tcp_fastpaths = 
>  };
>  
>  MODULE_VERSION(kern_tcpfastpaths, 1);
> -DECLARE_MODULE(kern_tcpfastpaths, new_tcp_fastpaths, SI_SUB_PSEUDO, SI_ORDER_ANY);
> +DECLARE_MODULE(kern_tcpfastpaths, new_tcp_fastpaths, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
> 
> Modified: head/sys/netinet/tcp_subr.c
> ==============================================================================
> --- head/sys/netinet/tcp_subr.c	Tue Feb 23 16:01:34 2016	(r295926)
> +++ head/sys/netinet/tcp_subr.c	Tue Feb 23 17:53:39 2016	(r295927)
> @@ -263,9 +263,20 @@ static struct tcp_function_block tcp_def
>  	0
>  };
>  
> +int t_functions_inited = 0;
>  struct tcp_funchead t_functions;
>  static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk;
>  
> +static void
> +init_tcp_functions()
> +{
> +	if (t_functions_inited == 0) {
> +		TAILQ_INIT(&t_functions);
> +		rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0);
> +		t_functions_inited = 1;
> +	}

You could use TAILQ_INITIALIZER and RW_SYSINIT instead of this helper function
to provide more deteriministic initialization.

-- 
John Baldwin


More information about the svn-src-all mailing list