qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Ne2000 patch(2nd try)


From: Han, Zhu
Subject: [Qemu-devel] Ne2000 patch(2nd try)
Date: Mon, 22 May 2006 08:58:56 +0800

Hi, Fabrice,
Would you please check in the second part of the patch? I have answered your 
comment in my previous mail!
See the following information!:


Hi, Fabrice!
For your first comment, I have to say it's not a bug in the current OS. It's 
caused by the difference between ne2000's emulation and the real hardware 
detail. When the receive buffer is full and the receiving side has acknowledged 
the ENISR_RX signal, the hardware should raise the ENISR_OVER signal. But for 
the sake of simplicity, ne2000 don't implement ENISR_OVER semantic. And we 
really don't need any ENISR_OVER signal because we needn't do any recovery job. 
So, this is a workaround and the simplest way for this problem!

Best Regards, 
hanzhu
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Fabrice Bellard
Sent: 2006年5月12日 5:52
To: address@hidden
Subject: Re: [Qemu-devel] patch for ne2000.c

OK for (2).

For (1) It would be good to find the exact behaviour of the NE2000 card.
Maybe ENISR_RX remain set as long are there are packets in the buffer ?
Otherwise your fix is a workaround to correct a bug in the OS driver...

Fabrice.

Best Regards, 
hanzhu

--- qemu-snapshot-2006-05-07_23\hw\ne2000.c     Mon May 08 16:13:49 2006
+++ ./ne2000.c  Mon May 08 16:57:33 2006
@@ -159,9 +159,19 @@
     }
 }
 
+static int ne2000_buffer_full(NE2000State *s);
 static void ne2000_update_irq(NE2000State *s)
 {
     int isr;
+
+    if(ne2000_buffer_full(s)
+            && !(s->isr & ENISR_RX)){
+       /* The freeing space is not enough, tell the ne2k driver
+        * to fetch these packets!
+        */
+        s->isr |= ENISR_RX;
+    }
+    
     isr = (s->isr & s->imr) & 0x7f;
 #if defined(DEBUG_NE2000)
     printf("NE2000: Set IRQ line %d to %d (%02x %02x)\n",
@@ -206,7 +216,10 @@
 
     index = s->curpag << 8;
     boundary = s->boundary << 8;
-    if (index < boundary)
+    if (index <= boundary)
+       /* when index == boundary, we should assume 
+        * the buffer is full instead of empty!
+        */
         avail = boundary - index;
     else
         avail = (s->stop - s->start) - (index - boundary);

Attachment: qemu_ne2000.patch
Description: qemu_ne2000.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]