#include <palacios/vmm.h>
#include <palacios/vmm_ethernet.h>
+#include <vnet/vnet_host_interface.h>
#define MAC_NOSET 0
#define MAC_ANY 11
* redistribute, and modify it as specified in the file "V3VEE_LICENSE".
*/
-#ifndef __VNET_INTERFACE_H__
-#define __VNET_INTERFACE_H__
+#ifndef __VNET_HOST_INTERFACE_H__
+#define __VNET_HOST_INTERFACE_H__
-struct v3_thread {
+struct vnet_thread {
+ void * host_thread;
+ void * data;
};
-v3_thread * v3_thread_create(int (*func)(void *), void *arg, char * name);
-void v3_thread_sleep(int cond);
-void v3_thread_wakeup(v3_thread *);
-void v3_thread_kill(v3_thread *);
-void v3_thread_stop(v3_thread *);
-void v3_thread_continue(v3_thread *);
+struct vnet_timer {
+ void * host_timer;
+ void * data;
+};
+
+struct vnet_thread * vnet_thread_create(int (*func)(void *), void *arg, char * name);
+void vnet_thread_sleep(int cond);
+void vnet_thread_wakeup(struct vnet_thread *);
+void vnet_thread_kill(struct vnet_thread *);
+void vnet_thread_stop(struct vnet_thread *);
+void vnet_thread_continue(struct vnet_thread *);
-void udelay(unsigned long usecs);
+void vnet_udelay(unsigned long usecs);
// I know there is timer in palacios, but it has to be binded to specific VM, and the granularity is not
// guaranteed
// I need a timer that is global, not related to any specific VM, and also fine-granularity
-v3_timer * v3_create_timer(int interval /*in us*/, void (*timer_fun)(uint64_t eclipsed_cycles, void * priv_data), void * pri_data);
-int v3_del_timer(v3_timer *);
-int v3_start_timer(v3_timer *);
-int v3_stop_timer(v3_timer *);
+struct vnet_timer * vnet_create_timer(int interval /*in us*/, void (*timer_fun)(uint64_t eclipsed_cycles, void * priv_data), void * pri_data);
+int vnet_del_timer(struct vnet_timer *);
+int vnet_start_timer(struct vnet_timer *);
+int vnet_stop_timer(struct vnet_timer *);
#endif
#include <devices/lnx_virtio_pci.h>
#include <palacios/vm_guest_mem.h>
#include <palacios/vmm_sprintf.h>
-#include <palacios/vmm_vnet.h>
+#include <vnet/vnet.h>
#include <palacios/vmm_lock.h>
#include <palacios/vmm_util.h>
#include <devices/pci.h>
uint8_t mergeable_rx_bufs;
struct v3_timer * timer;
- void * poll_thread;
+ struct vnet_thread * poll_thread;
struct nic_statistics stats;
virtio_setup_queue(core, virtio, &virtio->tx_vq, pfn, page_addr);
if(virtio->tx_notify == 0){
disable_cb(&virtio->tx_vq);
- V3_THREAD_WAKEUP(virtio->poll_thread);
+ vnet_thread_wakeup(virtio->poll_thread);
}
break;
case 2:
handle_pkt_tx(&(virtio->vm->cores[0]), virtio);
v3_yield(NULL);
}else {
- V3_THREAD_SLEEP();
+ vnet_thread_sleep(0);
}
}
V3_Print("Virtio NIC: Switch TX to VMM driven mode\n");
disable_cb(&(net_state->tx_vq));
net_state->tx_notify = 0;
- V3_THREAD_WAKEUP(net_state->poll_thread);
+ vnet_thread_wakeup(net_state->poll_thread);
}
if(tx_rate < RATE_LOWER_THRESHOLD && net_state->tx_notify == 0){
ops->frontend_data = net_state;
memcpy(ops->fnt_mac, virtio->mac, ETH_ALEN);
- net_state->poll_thread = V3_CREATE_THREAD(virtio_tx_flush, (void *)net_state, "Virtio_Poll");
+ net_state->poll_thread = vnet_thread_create(virtio_tx_flush, (void *)net_state, "Virtio_Poll");
return 0;
}
#include <palacios/vmm_dev_mgr.h>
#include <palacios/vm_guest_mem.h>
#include <devices/lnx_virtio_pci.h>
-#include <palacios/vmm_vnet.h>
+#include <vnet/vnet.h>
#include <palacios/vmm_sprintf.h>
#include <devices/pci.h>
*/
//backend device for Virtio NIC
-#include <palacios/vmm_vnet.h>
+#include <vnet/vnet.h>
#include <palacios/vmm.h>
#include <palacios/vmm_dev_mgr.h>
#include <devices/lnx_virtio_pci.h>
v3_lock_t lock;
struct vnet_stat stats;
- void * pkt_flush_thread;
+ struct vnet_thread * pkt_flush_thread;
struct vnet_queue pkt_q;
return 0;
}
-#if 0
static int vnet_tx_flush(void *args){
unsigned long flags;
struct queue_entry * entry;
}
}
}
-#endif
int v3_init_vnet() {
memset(&vnet_state, 0, sizeof(vnet_state));
v3_lock_init(&(vnet_state.pkt_q.lock));
- //vnet_state.pkt_flush_thread = V3_CREATE_THREAD(vnet_tx_flush, NULL, "VNET_Pkts");
+ vnet_state.pkt_flush_thread = vnet_thread_create(vnet_tx_flush, NULL, "VNET_Pkts");
PrintDebug("VNET/P Core is initiated\n");