From 5b792e164a3ed9d1e27f9259f7dd5a10262745c0 Mon Sep 17 00:00:00 2001 From: Xiao Wang <jasowang@redhat.com> Date: Tue, 24 May 2011 08:35:26 -0300 Subject: [PATCH 2/2] e1000: check buffer availability RH-Author: Xiao Wang <jasowang@redhat.com> Message-id: <20110524083526.21571.58320.stgit@dhcp-8-149.nay.redhat.com> Patchwork-id: 25391 O-Subject: [RHEL5.7 V2 PATCH 2/2] e1000: check buffer availability Bugzilla: 704097 RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> RH-Acked-by: Markus Armbruster <armbru@redhat.com> RH-Acked-by: Michael S. Tsirkin <mst@redhat.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=704097 Upstream: manually cherry-picked from 6cdfab2868dd593902e2b7db3ba9f49f2cc03e3f Test status: Tested in my local machine Reduce spurious packet drops on RX ring empty by verifying that we have at least 1 buffer ahead of the time. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> --- qemu/hw/e1000.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- qemu/hw/e1000.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu/hw/e1000.c b/qemu/hw/e1000.c index dc17736..aa2e287 100644 --- a/qemu/hw/e1000.c +++ b/qemu/hw/e1000.c @@ -630,7 +630,7 @@ e1000_can_receive(void *opaque) { E1000State *s = opaque; - return (s->mac_reg[RCTL] & E1000_RCTL_EN); + return (s->mac_reg[RCTL] & E1000_RCTL_EN) && e1000_has_rxbufs(s, 1); } static void -- 1.7.3.2