Net patches
The following changes since commit d8276573da58e8ce78dab8c46dd660efd664bcb7:
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190510' into staging (2019-05-16 13:15:08 +0100)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
for you to fetch changes up to 78e4f446d2569210a8558946b2321f9ff2ef47f6:
net/colo-compare.c: Fix a crash in COLO Primary. (2019-05-17 17:00:12 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Chris Kenna (1):
e1000: Never increment the RX undersize count register
Jason Wang (1):
vhost_net: don't set backend for the uninitialized virtqueue
Lukas Straub (1):
net/colo-compare.c: Fix a crash in COLO Primary.
Stefano Garzarella (1):
net/slirp: fix the IPv6 prefix length error message
hw/net/e1000.c | 1 - hw/net/vhost_net.c | 10 ++++++++++ hw/virtio/virtio.c | 5 +++++ include/hw/virtio/virtio.h | 1 + net/colo-compare.c | 3 +-- net/slirp.c | 3 ++- 6 files changed, 19 insertions(+), 4 deletions(-)
[Qemu-devel] [PULL 1/4] vhost_net: don't set backend for the uninitialized virtqueue
We used to set backend unconditionally, this won't work for some guests (e.g windows driver) who may not initialize all virtqueues. For kernel backend, this will fail since it may try to validate the rings during setting backend.
Fixing this by simply skipping the backend set when we find desc is not ready.
--- hw/net/vhost_net.c | 10 ++++++++++ hw/virtio/virtio.c | 5 +++++ include/hw/virtio/virtio.h | 1 + 3 files changed, 16 insertions(+)
hw/net/vhost_net.c +10 -0
@@ -244,6 +244,11 @@ static int vhost_net_start_one(struct vhost_net *net,qemu_set_fd_handler (net->backend,NULL ,NULL ,NULL ); file.fd = net->backend;for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) { +if (!virtio_queue_enabled (dev, net->dev.vq_index + + file.index)) { +/* Queue might not be ready for start */ +continue ; + } r =vhost_net_set_backend (&net->dev, &file);if (r <0 ) { r = -errno;
@@ -256,6 +261,11 @@ fail: file.fd =-1 ;if (net->nc->info->type ==NET_CLIENT_DRIVER_TAP ) {while (file.index-- >0 ) { +if (!virtio_queue_enabled (dev, net->dev.vq_index + + file.index)) { +/* Queue might not be ready for start */ +continue ; + }int r =vhost_net_set_backend (&net->dev, &file);assert (r >=0 ); }
hw/virtio/virtio.c +5 -0
@@ -2318,6 +2318,11 @@ hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n)return vdev->vq[n].vring.desc; } +bool virtio_queue_enabled (VirtIODevice *vdev,int n) +{ +return virtio_queue_get_desc_addr (vdev, n) !=0 ; +} +hwaddr virtio_queue_get_avail_addr (VirtIODevice *vdev,int n) {return vdev->vq[n].vring.avail;
include/hw/virtio/virtio.h +1 -0
@@ -282,6 +282,7 @@ typedef struct VirtIORNGConf VirtIORNGConf; VIRTIO_F_IOMMU_PLATFORM, false)hwaddr virtio_queue_get_desc_addr (VirtIODevice *vdev,int n); +bool virtio_queue_enabled (VirtIODevice *vdev,int n);hwaddr virtio_queue_get_avail_addr (VirtIODevice *vdev,int n);hwaddr virtio_queue_get_used_addr (VirtIODevice *vdev,int n);hwaddr virtio_queue_get_desc_size (VirtIODevice *vdev,int n);
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 2/4] e1000: Never increment the RX undersize count register
In reply to Jason WangFrom: Chris Kenna <[email protected]>
In situations where e1000 receives an undersized Ethernet frame, QEMU increments the emulated "Receive Undersize Count (RUC)" register when padding the frame.
This is incorrect because this an expected scenario (e.g. with VLAN tag stripping) and not an error. As such, QEMU should not increment the emulated RUC.
--- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-)
hw/net/e1000.c +0 -1
@@ -901,7 +901,6 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt)if (size <sizeof (min_buf)) {iov_to_buf (iov, iovcnt,0 , min_buf, size);memset (&min_buf[size],0 ,sizeof (min_buf) - size); -e1000x_inc_reg_if_not_full (s->mac_reg,RUC ); min_iov.iov_base = filter_buf = min_buf; min_iov.iov_len = size =sizeof (min_buf); iovcnt =1 ;
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 4/4] net/colo-compare.c: Fix a crash in COLO Primary.
In reply to Jason WangFrom: Lukas Straub <[email protected]>
Because event_unhandled_count may be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.
The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug: https://bugs.launchpad.net/qemu/+bug/1824622
--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/colo-compare.c +1 -2
@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)break ; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx);
Signature · 1 line
2.5.0
[Qemu-devel] [PULL 3/4] net/slirp: fix the IPv6 prefix length error message
In reply to Jason WangFrom: Stefano Garzarella <[email protected]>
Reword and add a missing parentheses at the end of the error message.
--- net/slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/slirp.c +2 -1
@@ -498,7 +498,8 @@ static int net_slirp_init(NetClientState *peer, const char *model, }if (vprefix6_len <0 || vprefix6_len >126 ) {error_setg (errp, -"Invalid prefix provided (prefix len must be in range 0-126" ); +"Invalid IPv6 prefix provided " +"(IPv6 prefix length must be between 0 and 126)" );return -1 ; }
Signature · 1 line
2.5.0
Peter Maydell
AppliedQuoted 9 lines · Jason Wang
The following changes since commit
d8276573da58e8ce78dab8c46dd660efd664bcb7:Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190510' into staging (2019-05-16 13:15:08 +0100)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
78e4f446d2569210a8558946b2321f9ff2ef47f6:
net/colo-compare.c: Fix a crash in COLO Primary. (2019-05-17 17:00:12 +0800)----------------------------------------------------------------
----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.
-- PMM