[Devel] [PATCH vz7 3/3] venet: remove per-net hooks and related code

Andrew Vagin avagin at odin.com
Tue Sep 22 02:38:58 PDT 2015


On Mon, Sep 21, 2015 at 07:44:36PM +0400, Stanislav Kinsburskiy wrote:
> From: Stanislav Kinsburskiy <skinsbursky at parallels.com>
> 
> Venete device is now constructed via netlink interface
> 
> https://jira.sw.ru/browse/PSBM-23441

This patch should not be commited until vzctl will start use the new
interface.

> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at parallels.com>
> ---
>  drivers/net/venetdev.c |   79 ++----------------------------------------------
>  1 file changed, 4 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
> index 261be76..aea0893 100644
> --- a/drivers/net/venetdev.c
> +++ b/drivers/net/venetdev.c
> @@ -1113,67 +1113,6 @@ static struct cftype venet_cftypes[] = {
>  	{ }
>  };
>  
> -static int venet_dev_start(struct ve_struct *ve)
> -{
> -	struct net_device *dev_venet;
> -	int err;
> -
> -	dev_venet = alloc_netdev(0, "venet%d", venet_setup);
> -	if (!dev_venet)
> -		return -ENOMEM;
> -	dev_net_set(dev_venet, ve->ve_netns);
> -	err = dev_alloc_name(dev_venet, dev_venet->name);
> -	if (err<0)
> -		goto err;
> -	dev_venet->features |= NETIF_F_NETNS_LOCAL;
> -	dev_venet->rtnl_link_ops = &venet_link_ops;
> -	dev_venet->rtnl_link_state = RTNL_LINK_INITIALIZING;
> -	if ((err = register_netdev(dev_venet)) != 0)
> -		goto err;
> -	ve->_venet_dev = dev_venet;
> -	return 0;
> -err:
> -	free_netdev(dev_venet);
> -	printk(KERN_ERR "VENET initialization error err=%d\n", err);
> -	return err;
> -}
> -
> -static __net_init int venet_init_net(struct net *net)
> -{
> -	struct ve_struct *env = net->owner_ve;
> -	int err;
> -
> -	if (env->ve_netns && net != env->ve_netns) {
> -		/* Don't create venet-s in sub net namespaces */
> -		return 0;
> -	}
> -
> -	if (env->veip)
> -		return -EEXIST;
> -
> -	env->ve_netns = net;
> -
> -	err = veip_start(env);
> -	if (err != 0)
> -		goto err;
> -
> -	err = venet_dev_start(env);
> -	if (err)
> -		goto err_free;
> -
> -	return 0;
> -
> -err_free:
> -	veip_stop(env);
> -err:
> -	env->ve_netns = NULL;
> -	return err;
> -}
> -
> -static struct pernet_operations venet_net_ops = {
> -	.init = venet_init_net,
> -};
> -
>  /*
>   * VE context dropping is happening earlier than
>   * pernet_operations::exit method so we can't
> @@ -1273,20 +1212,14 @@ __init int venet_init(void)
>  	for (i = 0; i < VEIP_HASH_SZ; i++)
>  		INIT_HLIST_HEAD(ip_entry_hash_table + i);
>  
> -	err = register_pernet_device(&venet_net_ops);
> -	if (err)
> -		goto err_netdev;
> -
>  	de = proc_create("veip", S_IFREG | S_IRUSR, proc_vz_dir,
>  			&proc_veip_operations);
> -	if (!de) {
> -		err = -EINVAL;
> -		goto err_proc;
> -	}
> +	if (!de)
> +		return -EINVAL;
>  
>  	err = cgroup_add_cftypes(&ve_subsys, venet_cftypes);
>  	if (err)
> -		goto err_cgroup;
> +		goto err_proc;
>  
>  	vzioctl_register(&venetcalls);
>  	vzmon_register_veaddr_print_cb(veaddr_seq_print);
> @@ -1294,11 +1227,8 @@ __init int venet_init(void)
>  
>  	return rtnl_link_register(&venet_link_ops);
>  
> -err_cgroup:
> -	remove_proc_entry("veip", proc_vz_dir);
>  err_proc:
> -	unregister_pernet_device(&venet_net_ops);
> -err_netdev:
> +	remove_proc_entry("veip", proc_vz_dir);
>  	return err;
>  }
>  
> @@ -1307,7 +1237,6 @@ __exit void venet_exit(void)
>  	cgroup_rm_cftypes(&ve_subsys, venet_cftypes);
>  	vzmon_unregister_veaddr_print_cb(veaddr_seq_print);
>  	vzioctl_unregister(&venetcalls);
> -	unregister_pernet_device(&venet_net_ops);
>  	remove_proc_entry("veip", proc_vz_dir);
>  	veip_cleanup();
>  
> 
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel



More information about the Devel mailing list