NetBSD-Bugs archive

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

Re: kern/41679



Hi,

the problem isn't really that the emulated ethernet is too slow, but
that the re driver tries to use a mode of the device that the qemu
emulation doesn't support. (Actually, there is a compile time flag
in qemu which would implement this, but this isn't defined by default
and thus not by most installations of qemu, including the one used
by xen.)

The attached patch fixes the problem for me. Can you try it? (Sorry,
the patch is against current, but it should apply cleanly against
netbsd-5-0, too.)

Probably, the define of RTK_QEMU at the start of rtl8169.c is far from
optimal, and indeed, I intend to change that for the final commit, but
it should do for the test.

Ciao,
Wolfgang
--
Wolfgang%Solfrank.net@localhost                         Wolfgang Solfrank
Index: sys/dev/ic/rtl8169.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl8169.c,v
retrieving revision 1.128
diff -u -r1.128 rtl8169.c
--- sys/dev/ic/rtl8169.c        15 Sep 2009 19:29:17 -0000      1.128
+++ sys/dev/ic/rtl8169.c        13 Jan 2010 11:28:27 -0000
@@ -110,6 +110,10 @@
  * jumbo frames larger than 7.5K, so the max MTU possible with this
  * driver is 7500 bytes.
  */
+/*
+ * Support for timer interrupts isn't implemented in (most versions of) QEMU!!!
+ */
+#define        RTK_QEMU
 
 #include "bpfilter.h"
 
@@ -1367,7 +1371,9 @@
         * This is done in case the transmitter has gone idle.
         */
        if (sc->re_ldata.re_txq_free < RE_TX_QLEN) {
+#ifndef        RTK_QEMU
                CSR_WRITE_4(sc, RTK_TIMERCNT, 1);
+#endif
                if ((sc->sc_quirk & RTKQ_PCIE) != 0) {
                        /*
                         * Some chips will ignore a second TX request
@@ -1432,8 +1438,13 @@
                if (status & (RTK_ISR_RX_OK | RTK_ISR_RX_ERR))
                        re_rxeof(sc);
 
-               if (status & (RTK_ISR_TIMEOUT_EXPIRED | RTK_ISR_TX_ERR |
-                   RTK_ISR_TX_DESC_UNAVAIL))
+               if (status & (
+#ifdef RTK_QEMU
+                   RTK_ISR_TX_OK |
+#else
+                   RTK_ISR_TIMEOUT_EXPIRED |
+#endif
+                   RTK_ISR_TX_ERR | RTK_ISR_TX_DESC_UNAVAIL))
                        re_txeof(sc);
 
                if (status & RTK_ISR_SYSTEM_ERR) {
@@ -1696,6 +1707,7 @@
                else
                        CSR_WRITE_1(sc, RTK_GTXSTART, RTK_TXSTART_START);
 
+#ifndef        RTK_QEMU
                /*
                 * Use the countdown timer for interrupt moderation.
                 * 'TX done' interrupts are disabled. Instead, we reset the
@@ -1705,6 +1717,7 @@
                 * the timer count is reset to 0.
                 */
                CSR_WRITE_4(sc, RTK_TIMERCNT, 1);
+#endif
 
                /*
                 * Set a timeout in case the chip goes out to lunch.
@@ -1858,6 +1871,7 @@
        CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
 #endif
 
+#ifndef        RTK_QEMU
        /*
         * Initialize the timer interrupt register so that
         * a timer interrupt will be generated once the timer
@@ -1871,6 +1885,9 @@
        else {
                CSR_WRITE_4(sc, RTK_TIMERINT_8169, 0x800);
 
+#else
+       if ((sc->sc_quirk & RTKQ_8139CPLUS) == 0) {
+#endif
                /*
                 * For 8169 gigE NICs, set the max allowed RX packet
                 * size so we can receive jumbo frames.
Index: sys/dev/ic/rtl81x9reg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl81x9reg.h,v
retrieving revision 1.40
diff -u -r1.40 rtl81x9reg.h
--- sys/dev/ic/rtl81x9reg.h     5 Sep 2009 03:50:49 -0000       1.40
+++ sys/dev/ic/rtl81x9reg.h     13 Jan 2010 11:28:27 -0000
@@ -232,10 +232,17 @@
        RTK_ISR_RX_OVERRUN|RTK_ISR_PKT_UNDERRUN|RTK_ISR_FIFO_OFLOW|     \
        RTK_ISR_PCS_TIMEOUT|RTK_ISR_SYSTEM_ERR)
 
+#ifdef RTK_QEMU
+#define RTK_INTRS_CPLUS        \
+       (RTK_ISR_RX_OK|RTK_ISR_RX_ERR|RTK_ISR_TX_ERR|RTK_ISR_TX_OK|     \
+       RTK_ISR_RX_OVERRUN|RTK_ISR_PKT_UNDERRUN|RTK_ISR_FIFO_OFLOW|     \
+       RTK_ISR_PCS_TIMEOUT|RTK_ISR_SYSTEM_ERR|RTK_ISR_TIMEOUT_EXPIRED)
+#else
 #define RTK_INTRS_CPLUS        \
        (RTK_ISR_RX_OK|RTK_ISR_RX_ERR|RTK_ISR_TX_ERR|                   \
        RTK_ISR_RX_OVERRUN|RTK_ISR_PKT_UNDERRUN|RTK_ISR_FIFO_OFLOW|     \
        RTK_ISR_PCS_TIMEOUT|RTK_ISR_SYSTEM_ERR|RTK_ISR_TIMEOUT_EXPIRED)
+#endif
 
 
 /*


Home | Main Index | Thread Index | Old Index