[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 15/16] vhost-pci-net: tell the driver that it is
From: |
Wei Wang |
Subject: |
[Qemu-devel] [PATCH v2 15/16] vhost-pci-net: tell the driver that it is ready to send packets |
Date: |
Fri, 12 May 2017 16:35:47 +0800 |
If the remote device on the other side doesn't need to be reset,
set bit 0 of the device status register to allow the driver to
send out the packets.
Signed-off-by: Wei Wang <address@hidden>
---
hw/net/vhost-pci-net.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/net/vhost-pci-net.c b/hw/net/vhost-pci-net.c
index a2dca50..513a7ff 100644
--- a/hw/net/vhost-pci-net.c
+++ b/hw/net/vhost-pci-net.c
@@ -130,6 +130,20 @@ static inline uint16_t rx2tx(uint16_t id)
return id - 1;
}
+static void vpnet_set_link_up(VhostPCINet *vpnet)
+{
+ VirtIODevice *vdev = VIRTIO_DEVICE(vpnet);
+ uint16_t old_status = vpnet->status;
+
+ /*
+ * Set the LINK_UP status bit and notify the driver that it can send
+ * packets.
+ */
+ vpnet->status |= VPNET_S_LINK_UP;
+ if (vpnet->status != old_status)
+ virtio_notify_config(vdev);
+}
+
static void vpnet_set_status(struct VirtIODevice *vdev, uint8_t status)
{
VhostPCINet *vpnet = VHOST_PCI_NET(vdev);
@@ -137,6 +151,7 @@ static void vpnet_set_status(struct VirtIODevice *vdev,
uint8_t status)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
VirtioBusState *vbus = VIRTIO_BUS(qbus);
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
+ VhostPCIDev *vp_dev = get_vhost_pci_dev();
VirtQueue *vq;
int r, i;
@@ -164,6 +179,11 @@ static void vpnet_set_status(struct VirtIODevice *vdev,
uint8_t status)
}
vpnet_send_ctrlq_msg_remote_mem(vpnet);
vpnet_send_ctrlq_msg_remoteq(vpnet);
+ /* If the peer device is not reset, start the device now */
+ if (!vp_dev->reset_virtio) {
+ vdev->status = status;
+ vpnet_set_link_up(vpnet);
+ }
}
}
--
2.7.4
- [Qemu-devel] [PATCH v2 06/16] virtio: add inter-vm notification support, (continued)
- [Qemu-devel] [PATCH v2 06/16] virtio: add inter-vm notification support, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 08/16] vhost-user: send guest physical address of virtqueues to the slave, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 09/16] vhost-user: send VHOST_USER_SET_VHOST_PCI_START/STOP, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 10/16] vhost-pci-net: send the negotiated feature bits to the master, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 11/16] vhost-user: add asynchronous read for the vhost-user master, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 12/16] vhost-user: handling VHOST_USER_SET_FEATURES, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 13/16] vhost-pci-slave: add "reset_virtio", Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 14/16] vhost-pci-slave: add support to delete a vhost-pci device, Wei Wang, 2017/05/12
- [Qemu-devel] [PATCH v2 15/16] vhost-pci-net: tell the driver that it is ready to send packets,
Wei Wang <=
- [Qemu-devel] [PATCH v2 16/16] vl: enable vhost-pci-slave, Wei Wang, 2017/05/12
- Re: [Qemu-devel] [PATCH v2 00/16] Vhost-pci for inter-VM communication, no-reply, 2017/05/12
- Re: [Qemu-devel] [PATCH v2 00/16] Vhost-pci for inter-VM communication, Jason Wang, 2017/05/16
- Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Wei Wang, 2017/05/16
- Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Jason Wang, 2017/05/17
- Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Jason Wang, 2017/05/17
- Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Wei Wang, 2017/05/17
- Re: [Qemu-devel] [virtio-dev] Re: [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Jason Wang, 2017/05/18
- Re: [Qemu-devel] [virtio-dev] Re: [virtio-dev] Re: [PATCH v2 00/16] Vhost-pci for inter-VM communication, Wei Wang, 2017/05/19