bge: Reduce the number of dropped frames when flow-control is enabled
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 29 Jun 2012 10:31:10 +0000 (18:31 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 29 Jun 2012 10:31:10 +0000 (18:31 +0800)
Set the number of RX frames to receive after RX MBUF low watermark
has reached.  Previously it dropped incoming frames once
RX MBUF low watermark has reached.  The value used in MAC RX MBUF
low watermark is greater than or equal to 4 so receiving two more
RX frames should not be a problem.

Obtained-from: OpenBSD via FreeBSD 213255

sys/dev/netif/bge/if_bge.c
sys/dev/netif/bge/if_bgereg.h

index 6184149..187807b 100644 (file)
@@ -3147,6 +3147,14 @@ bge_init(void *xsc)
        /* Turn on receiver */
        BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
 
+       /*
+        * Set the number of good frames to receive after RX MBUF
+        * Low Watermark has been reached.  After the RX MAC receives
+        * this number of frames, it will drop subsequent incoming
+        * frames until the MBUF High Watermark is reached.
+        */
+       CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2);
+
        /* Tell firmware we're alive. */
        BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
 
index 42f6f94..d8d0114 100644 (file)
 #define BGE_RX_BD_RULES_CTL15          0x04F8
 #define BGE_RX_BD_RULES_MASKVAL15      0x04FC
 #define BGE_RX_RULES_CFG               0x0500
+#define BGE_MAX_RX_FRAME_LOWAT         0x0504
 #define BGE_SERDES_CFG                 0x0590
 #define BGE_SERDES_STS                 0x0594
 #define BGE_SGDIG_CFG                  0x05B0