示例#1
0
static int
sef_cb_init_fresh(int type, sef_init_info_t *info)
{
	long instance = 0;
	env_parse("instance", "d", 0, &instance, 0, 255);

	if (virtio_net_probe((int)instance) != OK)
		panic("%s: No device found", name);

	if (virtio_net_config() != OK)
		panic("%s: No device found", name);

	if (virtio_net_alloc_bufs() != OK)
		panic("%s: Buffer allocation failed", name);

	virtio_net_init_queues();

	netdriver_announce();

	return(OK);
}
示例#2
0
/*
 * Initialize the driver and the virtual hardware.
 */
static int
virtio_net_init(unsigned int instance, ether_addr_t *addr)
{
	int r;

	if ((r = virtio_net_probe(instance)) != OK)
		return r;

	virtio_net_config(addr);

	if (virtio_net_alloc_bufs() != OK)
		panic("%s: Buffer allocation failed", name);

	virtio_net_init_queues();

	/* Add packets to the receive queue. */
	virtio_net_refill_rx_queue();

	virtio_device_ready(net_dev);

	virtio_irq_enable(net_dev);

	return(OK);
}