[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/5] virtio-net: unbreak any layout
From: |
Jason Wang |
Subject: |
Re: [Qemu-devel] [PATCH 5/5] virtio-net: unbreak any layout |
Date: |
Mon, 13 Jul 2015 16:30:13 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 07/13/2015 02:50 PM, Paolo Bonzini wrote:
>
> On 13/07/2015 07:46, Jason Wang wrote:
>> - if (out_sg[0].iov_len < n->guest_hdr_len) {
>> + s = iov_to_buf(out_sg, out_num, 0, &hdr, sizeof(hdr));
>> + if (s != sizeof(hdr)) {
>> error_report("virtio-net header incorrect");
>> exit(1);
>> }
>> - virtio_net_hdr_swap(vdev, (void *) out_sg[0].iov_base);
>> + virtio_net_hdr_swap(vdev, (void *) &hdr);
>> + s = iov_from_buf(out_sg, out_num, 0, &hdr, sizeof(hdr));
>> + assert(s == sizeof(hdr));
>> }
> Are the copies necessary in the common case of no swap? In that case
> you can just use iov_size.
>
> Paolo
>
Not necessary, will fix this in V2.
Thanks
Re: [Qemu-devel] [PATCH 1/5] virtio-pci: ignore unaligned read/write in virtio_address_space_read()/write(), Michael S. Tsirkin, 2015/07/13
Re: [Qemu-devel] [PATCH 1/5] virtio-pci: ignore unaligned read/write in virtio_address_space_read()/write(), Jason Wang, 2015/07/13