Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


fix the threads function calls using new vnet host interfaces
Lei Xia [Wed, 4 May 2011 16:30:58 +0000 (11:30 -0500)]
palacios/include/vnet/vnet.h
palacios/include/vnet/vnet_host_interface.h
palacios/src/devices/lnx_virtio_nic.c
palacios/src/devices/lnx_virtio_vnet.c
palacios/src/devices/vnet_nic.c
palacios/src/vnet/vnet_core.c

index 0f8c793..ec4fc10 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <palacios/vmm.h>
 #include <palacios/vmm_ethernet.h>
+#include <vnet/vnet_host_interface.h>
 
 #define MAC_NOSET      0
 #define MAC_ANY        11
index 768cdd1..cef3047 100644 (file)
  * 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
index fca709d..507ffc2 100644 (file)
@@ -25,7 +25,7 @@
 #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>
@@ -127,7 +127,7 @@ struct virtio_net_state {
     uint8_t mergeable_rx_bufs;
 
     struct v3_timer * timer;
-    void * poll_thread;
+    struct vnet_thread * poll_thread;
 
     struct nic_statistics stats;
 
@@ -406,7 +406,7 @@ static int virtio_io_write(struct guest_info *core,
                    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:
@@ -725,7 +725,7 @@ static int virtio_tx_flush(void * args){
            handle_pkt_tx(&(virtio->vm->cores[0]), virtio);
            v3_yield(NULL);
        }else {
-           V3_THREAD_SLEEP();
+           vnet_thread_sleep(0);
        }
     }
 
@@ -831,7 +831,7 @@ static void virtio_nic_timer(struct guest_info * core,
            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){
@@ -894,7 +894,7 @@ static int connect_fn(struct v3_vm_info * info,
     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;
 }
index 85535e8..e604b9e 100644 (file)
@@ -23,7 +23,7 @@
 #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>
 
index 80b8fea..bf0bf91 100644 (file)
@@ -19,7 +19,7 @@
  */
 //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>
index 9bf044a..5d454e8 100644 (file)
@@ -108,7 +108,7 @@ static struct {
     v3_lock_t lock;
     struct vnet_stat stats;
 
-    void * pkt_flush_thread;
+    struct vnet_thread * pkt_flush_thread;
 
     struct vnet_queue pkt_q;
 
@@ -708,7 +708,6 @@ int v3_vnet_add_bridge(struct v3_vm_info * vm,
     return 0;
 }
 
-#if 0
 static int vnet_tx_flush(void *args){
     unsigned long flags;
     struct queue_entry * entry;
@@ -743,7 +742,6 @@ static int vnet_tx_flush(void *args){
        }
     }
 }
-#endif
 
 int v3_init_vnet() {
     memset(&vnet_state, 0, sizeof(vnet_state));
@@ -766,7 +764,7 @@ int v3_init_vnet() {
 
     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");