From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSmfQ-0002ro-IN for qemu-devel@nongnu.org; Mon, 08 Feb 2016 09:19:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSmfM-00061p-Qj for qemu-devel@nongnu.org; Mon, 08 Feb 2016 09:19:52 -0500 Received: from duck.fensystems.co.uk ([2001:ba8:0:1d4::6950:5845]:49678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSmfM-00061Q-K0 for qemu-devel@nongnu.org; Mon, 08 Feb 2016 09:19:48 -0500 From: Michael Brown Date: Mon, 8 Feb 2016 14:19:33 +0000 Message-Id: <1454941174-25050-4-git-send-email-mcb30@ipxe.org> In-Reply-To: <1454941174-25050-1-git-send-email-mcb30@ipxe.org> References: <1454941174-25050-1-git-send-email-mcb30@ipxe.org> Subject: [Qemu-devel] [PATCH 3/4] usbnet: Detect short packets as sent by the xHCI controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Brown The xHCI controller will ignore the endpoint MTU and so may deliver packets of any length. Detect short packets as being any packet that has a length of zero or a length that is not a multiple of the MTU. Signed-off-by: Michael Brown --- hw/usb/dev-network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index f4e7acb..09312d4 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1206,7 +1206,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) s->out_ptr += sz; if (!is_rndis(s)) { - if (p->iov.size < 64) { + if (p->iov.size % 64 || p->iov.size == 0) { qemu_send_packet(qemu_get_queue(s->nic), s->out_buf, s->out_ptr); s->out_ptr = 0; } -- 2.3.8