[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] e1000: decrement RDT if equal to RDH
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] e1000: decrement RDT if equal to RDH |
Date: |
Mon, 12 Jan 2015 12:24:01 +0200 |
On Thu, Dec 18, 2014 at 12:01:48AM -0500, Jason Wang wrote:
>
>
> ----- Original Message -----
> > Some drivers set RDT=RDH. Oddly, this works on real hardware. To work
> > around this, autodecrement RDT when this happens.
> >
> > Signed-off-by: Richard Tollerton <address@hidden>
> > Signed-off-by: Jeff Westfahl <address@hidden>
> > ---
> > hw/net/e1000.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
>
> Please describe more details on the issue.
>
> The spec 3.2.6 said:
>
> "
> When the head pointer is equal to the tail pointer, the ring is empty.
> "
>
> So RDT=RDH in fact empty the ring. No?
Richard, can you respond please?
I'd like to see this clarified in code comment or
commit message before applying this patchset.
> >
> > diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> > index 44ae3a8..b8cbfc1 100644
> > --- a/hw/net/e1000.c
> > +++ b/hw/net/e1000.c
> > @@ -1152,6 +1152,12 @@ mac_writereg(E1000State *s, int index, uint32_t val)
> > static void
> > set_rdt(E1000State *s, int index, uint32_t val)
> > {
> > + if (val == s->mac_reg[RDH]) { /* Decrement RDT if it's too big */
> > + if (val == 0) {
> > + val = s->mac_reg[RDLEN] / sizeof(struct e1000_rx_desc);
> > + }
> > + val--;
> > + }
> > s->mac_reg[index] = val & 0xffff;
> > if (e1000_has_rxbufs(s, 1)) {
> > qemu_flush_queued_packets(qemu_get_queue(s->nic));
> > --
> > 2.1.3
> >
> >
> >
- Re: [Qemu-devel] [PATCH v2 2/2] e1000: decrement RDT if equal to RDH,
Michael S. Tsirkin <=