From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK1XI-0007H6-Dj for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:51:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK1XF-0006AD-7D for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:51:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK1XF-00069l-25 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:50:57 -0400 Date: Tue, 28 Jul 2015 17:50:52 +0800 From: Fam Zheng Message-ID: <20150728095052.GA29631@ad.nay.redhat.com> References: <1438075550-27269-1-git-send-email-famz@redhat.com> <55B74C3D.6030102@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B74C3D.6030102@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH for-2.4 v2] xen: Drop net_rx_ok List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang Cc: jasowang@redhat.com, stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, Stefan Hajnoczi , Chen Gang On Tue, 07/28 17:32, Wen Congyang wrote: > On 07/28/2015 05:25 PM, Fam Zheng wrote: > > Let net_rx_packet() (which checks the same conditions) drops the packet > > if the device is not ready. Drop net_xen_info.can_receive and update the > > return value for the buffer full case. > > > > We rely on the qemu_flush_queued_packets() in net_event() to wake up > > the peer when the buffer becomes available again. > > > > Signed-off-by: Fam Zheng > > > > --- > > > > v2: > > Fix return value of net_rx_packet to keep the semantics when ring > > buffer is full. [Stefan] > > Update commit message accordingly. > > --- > > hw/net/xen_nic.c | 24 +----------------------- > > 1 file changed, 1 insertion(+), 23 deletions(-) > > > > diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c > > index 19ecfc4..acb7e2e 100644 > > --- a/hw/net/xen_nic.c > > +++ b/hw/net/xen_nic.c > > @@ -234,27 +234,6 @@ static void net_rx_response(struct XenNetDev *netdev, > > > > #define NET_IP_ALIGN 2 > > > > -static int net_rx_ok(NetClientState *nc) > > -{ > > - struct XenNetDev *netdev = qemu_get_nic_opaque(nc); > > - RING_IDX rc, rp; > > - > > - if (netdev->xendev.be_state != XenbusStateConnected) { > > - return 0; > > - } > > - > > - rc = netdev->rx_ring.req_cons; > > - rp = netdev->rx_ring.sring->req_prod; > > - xen_rmb(); > > - > > - if (rc == rp || RING_REQUEST_CONS_OVERFLOW(&netdev->rx_ring, rc)) { > > - xen_be_printf(&netdev->xendev, 2, "%s: no rx buffers (%d/%d)\n", > > - __FUNCTION__, rc, rp); > > - return 0; > > - } > > - return 1; > > -} > > - > > static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size) > > { > > struct XenNetDev *netdev = qemu_get_nic_opaque(nc); > > @@ -272,7 +251,7 @@ static ssize_t net_rx_packet(NetClientState *nc, const uint8_t *buf, size_t size > > > > if (rc == rp || RING_REQUEST_CONS_OVERFLOW(&netdev->rx_ring, rc)) { > > xen_be_printf(&netdev->xendev, 2, "no buffer, drop packet\n"); > > IIUC, 'return 0' means that the packet will be queued in the incoming queue. So the log should > be changed too. You're right, will fix. Fam