|
|
1.1 ! root 1: /****************************************************************************** ! 2: * Copyright (c) 2011 IBM Corporation ! 3: * All rights reserved. ! 4: * This program and the accompanying materials ! 5: * are made available under the terms of the BSD License ! 6: * which accompanies this distribution, and is available at ! 7: * http://www.opensource.org/licenses/bsd-license.php ! 8: * ! 9: * Contributors: ! 10: * IBM Corporation - initial implementation ! 11: *****************************************************************************/ ! 12: ! 13: #ifndef VIRTIO_NET_H ! 14: #define VIRTIO_NET_H ! 15: ! 16: #define RX_QUEUE_SIZE 16 ! 17: #define BUFFER_ENTRY_SIZE 1514 ! 18: ! 19: enum { ! 20: VQ_RX = 0, /* Receive Queue */ ! 21: VQ_TX = 1, /* Transmit Queue */ ! 22: }; ! 23: ! 24: struct vqs { ! 25: uint64_t id; /* Queue ID */ ! 26: uint32_t size; ! 27: void *buf_mem; ! 28: struct vring_desc *desc; ! 29: struct vring_avail *avail; ! 30: struct vring_used *used; ! 31: }; ! 32: ! 33: extern struct vqs vq[2]; ! 34: extern struct virtio_device virtiodev; ! 35: ! 36: /* Device is identified by RX queue ID: */ ! 37: #define DEVICE_ID vq[0].id ! 38: ! 39: extern snk_kernel_t *snk_kernel_interface; ! 40: extern snk_module_t *snk_module_interface; ! 41: extern snk_module_t virtionet_interface; ! 42: ! 43: #define printk(fmt...) do { snk_kernel_interface->print(fmt); } while(0) ! 44: #define malloc(args...) snk_kernel_interface->k_malloc(args) ! 45: #define malloc_aligned(args...) snk_kernel_interface->k_malloc_aligned(args) ! 46: #define free(args...) do { snk_kernel_interface->k_free(args); } while(0) ! 47: ! 48: #undef DEBUG ! 49: #ifdef DEBUG ! 50: # define dprintk(fmt...) printk(fmt) ! 51: #else ! 52: # define dprintk(fmt...) ! 53: #endif ! 54: ! 55: int vn_module_init_pci(snk_kernel_t *snk_kernel_int, pci_config_t *conf); ! 56: ! 57: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.