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.


build fix
[palacios-OLD.git] / palacios / src / devices / lnx_virtio_nic.c
index baf3369..642b259 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>
@@ -33,7 +33,7 @@
 #include <palacios/vmm_time.h>
 
 
-#ifndef CONFIG_DEBUG_VIRTIO_NET
+#ifndef V3_CONFIG_DEBUG_VIRTIO_NET
 #undef PrintDebug
 #define PrintDebug(fmt, args...)
 #endif
@@ -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;
 
@@ -199,7 +199,7 @@ static int tx_one_pkt(struct guest_info * core,
     }
 
     V3_Net_Print(2, "Virtio-NIC: virtio_tx: size: %d\n", len);
-    if(v3_net_debug >= 4){
+    if(vnet_debug >= 4){
        v3_hexdump(buf, len, NULL, 0);
     }
 
@@ -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:
@@ -561,7 +561,7 @@ static int virtio_rx(uint8_t * buf, uint32_t size, void * private_data) {
     unsigned long flags;
 
     V3_Net_Print(2, "Virtio-NIC: virtio_rx: size: %d\n", size);
-    if(v3_net_debug >= 4){
+    if(vnet_debug >= 4){
        v3_hexdump(buf, size, NULL, 0);
     }
 
@@ -660,7 +660,7 @@ static int virtio_rx(uint8_t * buf, uint32_t size, void * private_data) {
        /* kick guest to refill the queue */
        virtio->virtio_cfg.pci_isr = 0x1;       
        v3_pci_raise_irq(virtio->virtio_dev->pci_bus, 0, virtio->pci_dev);
-       v3_interrupt_cpu(virtio->virtio_dev->vm, virtio->virtio_dev->vm->cores[0].cpu_id, 0);
+       v3_interrupt_cpu(virtio->virtio_dev->vm, virtio->virtio_dev->vm->cores[0].pcpu_id, 0);
        virtio->stats.rx_interrupts ++;
        
        goto err_exit;
@@ -679,8 +679,8 @@ static int virtio_rx(uint8_t * buf, uint32_t size, void * private_data) {
 
     /* notify guest if it is in guest mode */
     if(virtio->rx_notify == 1 && 
-       V3_Get_CPU() != virtio->virtio_dev->vm->cores[0].cpu_id){
-       v3_interrupt_cpu(virtio->virtio_dev->vm, virtio->virtio_dev->vm->cores[0].cpu_id, 0);
+       V3_Get_CPU() != virtio->virtio_dev->vm->cores[0].pcpu_id){
+       v3_interrupt_cpu(virtio->virtio_dev->vm, virtio->virtio_dev->vm->cores[0].pcpu_id, 0);
     }
 
     return 0;
@@ -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(-1);
        }
     }
 
@@ -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_start_thread(virtio_tx_flush, (void *)net_state, "Virtio_Poll");
 
     return 0;
 }