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.


Merge branch 'devel' of palacios@newskysaw.cs.northwestern.edu:/home/palacios/palacio...
[palacios.git] / palacios / src / devices / lnx_virtio_nic.c
index acbce0d..ab9a78b 100644 (file)
@@ -173,7 +173,7 @@ pkt_tx(struct guest_info * core,
        return -ERR_VIRTIO_OTHER;
     }
 
-    return virtio->net_ops->send(buf, len, virtio->backend_data, NULL);
+    return virtio->net_ops->send(buf, len, virtio->backend_data);
 }
 
 
@@ -237,7 +237,7 @@ static int handle_rx_kick(struct guest_info *core,
     flags = v3_lock_irqsave(virtio->rx_lock);
 
     virtio->net_ops->start_rx(virtio->backend_data);
-    disable_cb(&virtio->rx_vq);
+    //disable_cb(&virtio->rx_vq);
 
     v3_unlock_irqrestore(virtio->rx_lock, flags);
        
@@ -375,7 +375,6 @@ static int virtio_io_write(struct guest_info *core,
     struct virtio_net_state * virtio = (struct virtio_net_state *)private_data;
     int port_idx = port % virtio->io_range_size;
 
-
     PrintDebug("VIRTIO NIC %p Write for port %d (index=%d) len=%d, value=%x\n", private_data,
               port, port_idx,  length, *(uint32_t *)src);
 
@@ -399,11 +398,11 @@ static int virtio_io_write(struct guest_info *core,
            switch (queue_idx) {
                case 0:
                    virtio_setup_queue(core, virtio, &virtio->rx_vq, pfn, page_addr);
-                   disable_cb(&virtio->rx_vq);
+                   //disable_cb(&virtio->rx_vq);
                    break;
                case 1:
                    virtio_setup_queue(core, virtio, &virtio->tx_vq, pfn, page_addr);
-                   disable_cb(&virtio->tx_vq);
+                   //disable_cb(&virtio->tx_vq);
                    break;
                case 2:
                    virtio_setup_queue(core, virtio, &virtio->ctrl_vq, pfn, page_addr);
@@ -427,9 +426,7 @@ static int virtio_io_write(struct guest_info *core,
                uint16_t queue_idx = *(uint16_t *)src;                  
                if (queue_idx == 0){
                    handle_rx_kick(core, virtio);
-                   PrintError("rx kick\n");
                } else if (queue_idx == 1){
-                   PrintError("tx kick\n");
                    if (handle_pkt_tx(core, virtio) == -1) {
                        PrintError("Could not handle NIC Notification\n");
                        return -1;
@@ -559,6 +556,13 @@ static int virtio_rx(uint8_t * buf, uint32_t size, void * private_data) {
     int ret_val = -ERR_VIRTIO_OTHER;
     int raw = 1;
 
+#ifndef CONFIG_DEBUG_VIRTIO_NET
+   {
+       PrintDebug("Virtio-NIC: virtio_rx: size: %d\n", size);  
+       //v3_hexdump(buf, size, NULL, 0);
+   }
+#endif
+
     flags = v3_lock_irqsave(virtio->rx_lock);
 
     virtio->pkt_recv ++;
@@ -650,9 +654,6 @@ exit:
 
 static struct v3_device_ops dev_ops = {
     .free = virtio_free,
-    .reset = NULL,
-    .start = NULL,
-    .stop = NULL,
 };
 
 
@@ -792,9 +793,9 @@ static int connect_fn(struct v3_vm_info * info,
 static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_dev_state * virtio_state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", name);
+    PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", dev_id);
 
     if (pci_bus == NULL) {
        PrintError("Virtio NIC: VirtIO devices require a PCI Bus");
@@ -808,14 +809,14 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     virtio_state->pci_bus = pci_bus;
     virtio_state->vm = vm;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Virtio NIC: Could not attach device %s\n", name);
+       PrintError("Virtio NIC: Could not attach device %s\n", dev_id);
        return -1;
     }
 
-    if (v3_dev_add_net_frontend(vm, name, connect_fn, (void *)virtio_state) == -1) {
-       PrintError("Virtio NIC: Could not register %s as net frontend\n", name);
+    if (v3_dev_add_net_frontend(vm, dev_id, connect_fn, (void *)virtio_state) == -1) {
+       PrintError("Virtio NIC: Could not register %s as net frontend\n", dev_id);
        return -1;
     }