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.


Add dynamic VMM Driven/Guest Driven mode switch in VNET devices
[palacios.git] / palacios / src / palacios / vmm_vnet_core.c
index 6b86436..a2d06f2 100644 (file)
@@ -46,7 +46,10 @@ struct vnet_dev {
     void * private_data;
 
     int active;
-    vnet_poll_type_t mode;  //vmm_drivern or guest_drivern
+    nic_poll_type_t mode;  /*vmm_drivern or guest_drivern */
+
+    uint64_t bytes_tx, bytes_rx;
+    uint32_t pkts_tx, pkt_rx;
     
     struct list_head node;
 } __attribute__((packed));
@@ -57,7 +60,7 @@ struct vnet_brg_dev {
     struct v3_vnet_bridge_ops brg_ops;
 
     uint8_t type;
-    vnet_poll_type_t mode;
+    nic_poll_type_t mode;
     int active;
     void * private_data;
 } __attribute__((packed));
@@ -90,7 +93,7 @@ static struct {
     int num_routes;
     int num_devs;
 
-    struct vnet_brg_dev *bridge;
+    struct vnet_brg_dev * bridge;
 
     v3_lock_t lock;
     struct vnet_stat stats;
@@ -642,6 +645,20 @@ int v3_vnet_add_bridge(struct v3_vm_info * vm,
 }
 
 
+void v3_vnet_do_poll(struct v3_vm_info * vm){
+    struct vnet_dev * dev = NULL; 
+
+    /* TODO: run this on separate threads
+      * round-robin schedule, with maximal budget for each poll
+      */
+    list_for_each_entry(dev, &(vnet_state.devs), node) {
+       if(dev->mode == VMM_DRIVERN){
+           dev->dev_ops.poll(vm, -1, dev->private_data);
+       }
+    }
+}
+
+
 int v3_init_vnet() {
     memset(&vnet_state, 0, sizeof(vnet_state));