struct v3_vnet_bridge_ops {
int (*input)(struct v3_vm_info * vm,
- struct v3_vnet_pkt * pkt,
- void * private_data);
+ struct v3_vnet_pkt * pkt,
+ void * private_data);
void (*poll)(struct v3_vm_info * vm,
- void * private_data);
+ void * private_data);
};
#define HOST_LNX_BRIDGE 1
#define CTL_VM_BRIDGE 2
int v3_vnet_add_bridge(struct v3_vm_info * vm,
- struct v3_vnet_bridge_ops * ops,
- uint8_t type,
- void * priv_data);
+ struct v3_vnet_bridge_ops * ops,
+ uint8_t type,
+ void * priv_data);
int v3_vnet_add_route(struct v3_vnet_route route);
int v3_vnet_send_pkt(struct v3_vnet_pkt * pkt, void * private_data, int synchronize);
int v3_vnet_find_dev(uint8_t * mac);
struct v3_vnet_dev_ops {
int (*input)(struct v3_vm_info * vm,
- struct v3_vnet_pkt * pkt,
- void * dev_data);
+ struct v3_vnet_pkt * pkt,
+ void * dev_data);
};
int v3_init_vnet(void);
}
/* THREAD FUNCTIONS */
-struct vnet_thread * vnet_start_thread(int (*func)(void *), void *arg, char * name);
+struct vnet_thread * vnet_start_thread(int (*func)(void *),
+ void *arg, char * name);
static inline void vnet_thread_sleep(long timeout){
if((host_hooks) && host_hooks->thread_sleep){
/* TIMER FUNCTIONS */
/* interval, in jittes */
-struct vnet_timer * vnet_create_timer(unsigned long interval, void (* timer_fun)(void * priv_data), void * pri_data);
+struct vnet_timer * vnet_create_timer(unsigned long interval,
+ void (* timer_fun)(void * priv_data),
+ void * pri_data);
static inline void vnet_del_timer(struct vnet_timer * timer){
if((host_hooks) && host_hooks->timer_del){
#define Vnet_Print(level, fmt, args...) \
- do { \
- extern int vnet_debug; \
- if(level <= vnet_debug) { \
+ do { \
+ extern int vnet_debug; \
+ if(level <= vnet_debug) { \
extern struct vnet_host_hooks * host_hooks; \
if ((host_hooks) && (host_hooks)->print) { \
(host_hooks)->print((fmt), ##args); \
- } \
- } \
+ } \
+ } \
} while (0)
#define Vnet_Debug(fmt, args...) \
- do { \
- extern struct vnet_host_hooks * host_hooks; \
- if ((host_hooks) && (host_hooks)->print) { \
- (host_hooks)->print((fmt), ##args); \
- } \
+ do { \
+ extern struct vnet_host_hooks * host_hooks; \
+ if ((host_hooks) && (host_hooks)->print) { \
+ (host_hooks)->print((fmt), ##args); \
+ } \
} while (0)
-
/* Lock Utilities */
int vnet_lock_init(vnet_lock_t * lock);
-\r
-
void init_vnet(struct vnet_host_hooks * hooks);
#define VNET_QUEUE_SIZE 1024
struct vnet_queue {
- struct queue_entry buf[VNET_QUEUE_SIZE];
- int head, tail;
- int count;
- vnet_lock_t lock;
+ struct queue_entry buf[VNET_QUEUE_SIZE];
+ int head, tail;
+ int count;
+ vnet_lock_t lock;
};
static struct {
}
matches = (struct route_list *)Vnet_Malloc(sizeof(struct route_list) +
- (sizeof(struct vnet_route_info *) * num_matches));
+ (sizeof(struct vnet_route_info *) * num_matches));
matches->num_routes = num_matches;
if (bridge == NULL) {
Vnet_Print(2, "VNET/P Core: No active bridge to sent data to\n");
- continue;
+ continue;
}
if(bridge->brg_ops.input(bridge->vm, pkt, bridge->private_data) < 0){
vnet_tx_one_pkt(pkt, NULL);
}else {
vnet_pkt_enqueue(pkt);
- Vnet_Print(2, "VNET/P Core: Put pkt into Queue: pkt size %d\n", pkt->size);
+ Vnet_Print(2, "VNET/P Core: Put pkt into Queue: pkt size %d\n", pkt->size);
}
return 0;
const uint_t prime_table_length = sizeof(primes) / sizeof(primes[0]);
struct hashtable * vnet_create_htable(uint_t min_size,
- uint_t (*hash_fn) (addr_t),
- int (*eq_fn) (addr_t, addr_t)) {
+ uint_t (*hash_fn) (addr_t),
+ int (*eq_fn) (addr_t, addr_t)) {
struct hashtable * htable;
uint_t prime_index;
uint_t size = primes[0];
struct vnet_timer * vnet_create_timer(unsigned long interval,
- void (* timer_fun)(void * priv_data), void * priv_data){
+ void (* timer_fun)(void * priv_data),
+ void * priv_data){
struct vnet_timer * timer = NULL;
if((host_hooks) && host_hooks->timer_create){