* [Qemu-devel] [PATCH] e1000: check buffer availability
@ 2011-03-27 15:01 Michael S. Tsirkin
2011-03-28 10:50 ` [Qemu-devel] " Juan Quintela
2011-03-28 11:37 ` Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-03-27 15:01 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Jes.Sorensen, Alex Williamson, Juan Quintela
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>
---
hw/e1000.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 0a4574c..380d6fe 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -623,14 +623,6 @@ e1000_set_link_status(VLANClientState *nc)
set_ics(s, 0, E1000_ICR_LSC);
}
-static int
-e1000_can_receive(VLANClientState *nc)
-{
- E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
-
- return (s->mac_reg[RCTL] & E1000_RCTL_EN);
-}
-
static bool e1000_has_rxbufs(E1000State *s, size_t total_size)
{
int bufs;
@@ -649,6 +641,14 @@ static bool e1000_has_rxbufs(E1000State *s, size_t total_size)
return total_size <= bufs * s->rxbuf_size;
}
+static int
+e1000_can_receive(VLANClientState *nc)
+{
+ E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
+
+ return (s->mac_reg[RCTL] & E1000_RCTL_EN) && e1000_has_rxbufs(s, 1);
+}
+
static ssize_t
e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
{
--
1.7.3.2.91.g446ac
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-28 11:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27 15:01 [Qemu-devel] [PATCH] e1000: check buffer availability Michael S. Tsirkin
2011-03-28 10:50 ` [Qemu-devel] " Juan Quintela
2011-03-28 11:37 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).