From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH] Use guards in virtio-net for easier upstream merging Date: Thu, 04 Dec 2008 12:06:48 +0000 Message-ID: <1228392408.3732.72.camel@blaa> References: <1228336330-25664-1-git-send-email-aliguori@us.ibm.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Avi Kivity To: Anthony Liguori Return-path: Received: from mx2.redhat.com ([66.187.237.31]:50850 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750955AbYLDMIL (ORCPT ); Thu, 4 Dec 2008 07:08:11 -0500 In-Reply-To: <1228336330-25664-1-git-send-email-aliguori@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2008-12-03 at 14:32 -0600, Anthony Liguori wrote: > @@ -189,6 +205,9 @@ static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) > struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL; > int hdr_len, offset, i; > > + if (!virtio_net_can_receive(opaque)) > + return; Should pass the buffer size to virtio_net_can_receive() to limit the work virtqueue_avail_bytes() has to do. Cheers, Mark.