示例#1
0
文件: vport.c 项目: JunoZhu/ovs
/**
 *	ovs_vport_init - initialize vport subsystem
 *
 * Called at module load time to initialize the vport subsystem.
 */
int ovs_vport_init(void)
{
	int err;

	dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
			    GFP_KERNEL);
	if (!dev_table)
		return -ENOMEM;

	err = lisp_init_module();
	if (err)
		goto err_lisp;
	err = ipgre_init();
	if (err)
		goto err_gre;
	err = geneve_init_module();
	if (err)
		goto err_geneve;

	err = vxlan_init_module();
	if (err)
		goto err_vxlan;
	err = ovs_stt_init_module();
	if (err)
		goto err_stt;
	return 0;

err_stt:
	vxlan_cleanup_module();
err_vxlan:
	geneve_cleanup_module();
err_geneve:
	ipgre_fini();
err_gre:
	lisp_cleanup_module();
err_lisp:
	kfree(dev_table);
	return err;
}
示例#2
0
文件: vport.c 项目: openvswitch/ovs
/**
 *	ovs_vport_init - initialize vport subsystem
 *
 * Called at module load time to initialize the vport subsystem.
 */
int ovs_vport_init(void)
{
	int err;

	dev_table = kcalloc(VPORT_HASH_BUCKETS, sizeof(struct hlist_head),
			    GFP_KERNEL);
	if (!dev_table)
		return -ENOMEM;

	err = lisp_init_module();
	if (err)
		goto err_lisp;
	err = gre_init();
	if (err && err != -EEXIST) {
		goto err_gre;
	} else {
		if (err == -EEXIST) {
			pr_warn("Cannot take GRE protocol rx entry"\
				"- The GRE/ERSPAN rx feature not supported\n");
			/* continue GRE tx */
		}

		err = ipgre_init();
		if (err && err != -EEXIST) 
			goto err_ipgre;
		compat_gre_loaded = true;
	}
	err = ip6gre_init();
	if (err && err != -EEXIST) {
		goto err_ip6gre;
	} else {
		if (err == -EEXIST) {
			pr_warn("IPv6 GRE/ERSPAN Rx mode is not supported\n");
			goto skip_ip6_tunnel_init;
		}
	}

	err = ip6_tunnel_init();
	if (err)
		goto err_ip6_tunnel;
	else
		compat_ip6_tunnel_loaded = true;

skip_ip6_tunnel_init:
	err = geneve_init_module();
	if (err)
		goto err_geneve;
	err = vxlan_init_module();
	if (err)
		goto err_vxlan;
	err = ovs_stt_init_module();
	if (err)
		goto err_stt;

	return 0;
	ovs_stt_cleanup_module();
err_stt:
	vxlan_cleanup_module();
err_vxlan:
	geneve_cleanup_module();
err_geneve:
	ip6_tunnel_cleanup();
err_ip6_tunnel:
	ip6gre_fini();
err_ip6gre:
	ipgre_fini();
err_ipgre:
	gre_exit();
err_gre:
	lisp_cleanup_module();
err_lisp:
	kfree(dev_table);
	return err;
}