net/virtio-user: support to report net status
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index 740d7b1..7da9f6f 100644 (file)
@@ -135,17 +135,26 @@ virtio_user_set_features(struct virtio_hw *hw, uint64_t features)
 static uint8_t
 virtio_user_get_isr(struct virtio_hw *hw __rte_unused)
 {
-       /* When config interrupt happens, driver calls this function to query
-        * what kinds of change happen. Interrupt mode not supported for now.
+       /* rxq interrupts and config interrupt are separated in virtio-user,
+        * here we only report config change.
         */
-       return 0;
+       return VIRTIO_PCI_ISR_CONFIG;
 }
 
 static uint16_t
 virtio_user_set_config_irq(struct virtio_hw *hw __rte_unused,
                    uint16_t vec __rte_unused)
 {
-       return VIRTIO_MSI_NO_VECTOR;
+       return 0;
+}
+
+static uint16_t
+virtio_user_set_queue_irq(struct virtio_hw *hw __rte_unused,
+                         struct virtqueue *vq __rte_unused,
+                         uint16_t vec)
+{
+       /* pretend we have done that */
+       return vec;
 }
 
 /* This function is to get the queue size, aka, number of descs, of a specified
@@ -226,6 +235,7 @@ const struct virtio_pci_ops virtio_user_ops = {
        .set_features   = virtio_user_set_features,
        .get_isr        = virtio_user_get_isr,
        .set_config_irq = virtio_user_set_config_irq,
+       .set_queue_irq  = virtio_user_set_queue_irq,
        .get_queue_num  = virtio_user_get_queue_num,
        .setup_queue    = virtio_user_setup_queue,
        .del_queue      = virtio_user_del_queue,
@@ -313,6 +323,7 @@ virtio_user_eth_dev_alloc(const char *name)
        }
 
        hw->port_id = data->port_id;
+       dev->port_id = data->port_id;
        virtio_hw_internal[hw->port_id].vtpci_ops = &virtio_user_ops;
        hw->use_msix = 0;
        hw->modern   = 0;