Ejemplo n.º 1
0
static void __exit vmm_net_exit(void)
{
	vmm_bridge_exit();

	vmm_netport_exit();
	vmm_netswitch_exit();
	vmm_mbufpool_exit();
}
Ejemplo n.º 2
0
static int __init vmm_net_init(void)
{
	int rc = VMM_OK;
	struct vmm_devtree_node *node;

	rc = vmm_mbufpool_init();
	if (rc) {
		vmm_printf("%s: Failed to init mbuf pool\n", __func__);
		goto mbufpool_init_failed;
	}

	rc = vmm_netswitch_init();
	if (rc) {
		vmm_printf("%s: Failed to init netswitch\n", __func__);
		goto netswitch_init_failed;
	}

	rc = vmm_netport_init();
	if (rc) {
		vmm_printf("%s: Failed to init netport\n", __func__);
		goto netport_init_failed;
	}

	rc = vmm_bridge_init();
	if (rc) {
		vmm_printf("%s: Failed to init bridge\n", __func__);
		goto bridge_init_failed;
	}

	node = vmm_devtree_getnode(VMM_DEVTREE_PATH_SEPARATOR_STRING
				   VMM_DEVTREE_VMMINFO_NODE_NAME
				   VMM_DEVTREE_PATH_SEPARATOR_STRING "net");
	if (!node) {
		vmm_printf("%s: devtree node not found\n", __func__);
		goto net_devtree_probe_failed;
	}

	rc = vmm_devdrv_probe(node);
	if (rc) {
		vmm_printf("%s: devtree node probe failed\n", __func__);
		goto net_devtree_probe_failed;
	}

	goto net_init_done;

net_devtree_probe_failed:
	vmm_bridge_exit();
bridge_init_failed:
	vmm_netport_exit();
netport_init_failed:
	vmm_netswitch_exit();
netswitch_init_failed:
	vmm_mbufpool_exit();
mbufpool_init_failed:

net_init_done:
	return rc;
}
Ejemplo n.º 3
0
static int __init vmm_net_init(void)
{
	int rc = VMM_OK;

	rc = vmm_mbufpool_init();
	if (rc) {
		vmm_printf("%s: Failed to init mbuf pool\n", __func__);
		goto mbufpool_init_failed;
	}

	rc = vmm_netswitch_init();
	if (rc) {
		vmm_printf("%s: Failed to init netswitch\n", __func__);
		goto netswitch_init_failed;
	}

	rc = vmm_netport_init();
	if (rc) {
		vmm_printf("%s: Failed to init netport\n", __func__);
		goto netport_init_failed;
	}

	rc = vmm_hub_init();
	if (rc) {
		vmm_printf("%s: Failed to init hub\n", __func__);
		goto hub_init_failed;
	}

	rc = vmm_bridge_init();
	if (rc) {
		vmm_printf("%s: Failed to init bridge\n", __func__);
		goto bridge_init_failed;
	}

#ifdef CONFIG_NET_AUTOCREATE_BRIDGE
	rc = vmm_netswitch_policy_create_switch("bridge",
				CONFIG_NET_AUTOCREATE_BRIDGE_NAME, 0, NULL);
	if (rc) {
		goto net_autocreate_failed;
	}
#endif

	goto net_init_done;

#ifdef CONFIG_NET_AUTOCREATE_BRIDGE
net_autocreate_failed:
	vmm_bridge_exit();
#endif
bridge_init_failed:
	vmm_hub_exit();
hub_init_failed:
	vmm_netport_exit();
netport_init_failed:
	vmm_netswitch_exit();
netswitch_init_failed:
	vmm_mbufpool_exit();
mbufpool_init_failed:

net_init_done:
	return rc;
}