[PATCH] 8139too Interframe Gap Time

From: Rene Herman
Date: Wed Mar 10 2004 - 17:54:45 EST


Hi Jeff,

in drivers/net/8139too.c, we have:

/* Check this value: the documentation for IFG contradicts ifself. */
RTL_W32 (TxConfig, rtl8139_tx_config);

I see that in older versions of the documentation there indeed were some
contradictions but the current version 1.4:

ftp://210.51.181.211/cn/nic/rtl8139abcd8130810xseries/rtl8139cspec_1.4.pdf

clears it up and it seems 8139too guessed wrong. I have verified that
realtek's own windows 9x driver agrees with the documentation.

No equipment to actually measure the IFG and no difference in network
behaviour shows up on a good 100Mbit-FD switch connected LAN, but it
does on an el-cheapo 10Mbit-HD hub connected LAN. Without attached
patch the packet and collision counters are basically the same; with
patch, the latter is only some 70% of the former. Hurray!

Rene.


--- linux-2.6.4-rc2-mm1/drivers/net/8139too.c.orig 2004-03-10 21:01:08.000000000 +0100
+++ linux-2.6.4-rc2-mm1/drivers/net/8139too.c 2004-03-10 21:01:14.000000000 +0100
@@ -383,8 +383,14 @@

/* Bits in TxConfig. */
enum tx_config_bits {
- TxIFG1 = (1 << 25), /* Interframe Gap Time */
- TxIFG0 = (1 << 24), /* Enabling these bits violates IEEE 802.3 */
+
+ /* Interframe Gap Time. Only TxIFG96 doesn't violate IEEE 802.3 */
+ TxIFGShift = 24,
+ TxIFG84 = (0 << TxIFGShift), /* 8.4us / 840ns (10 / 100Mbps) */
+ TxIFG88 = (1 << TxIFGShift), /* 8.8us / 880ns (10 / 100Mbps) */
+ TxIFG92 = (2 << TxIFGShift), /* 9.2us / 920ns (10 / 100Mbps) */
+ TxIFG96 = (3 << TxIFGShift), /* 9.6us / 960ns (10 / 100Mbps) */
+
TxLoopBack = (1 << 18) | (1 << 17), /* enable loopback test mode */
TxCRC = (1 << 16), /* DISABLE appending CRC to end of Tx packets */
TxClearAbt = (1 << 0), /* Clear abort (WO) */
@@ -716,7 +722,7 @@
#endif

static const unsigned int rtl8139_tx_config =
- (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
+ TxIFG96 | (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);

static void __rtl8139_cleanup_dev (struct net_device *dev)
{
@@ -1393,8 +1399,6 @@

tp->rx_config = rtl8139_rx_config | AcceptBroadcast | AcceptMyPhys;
RTL_W32 (RxConfig, tp->rx_config);
-
- /* Check this value: the documentation for IFG contradicts ifself. */
RTL_W32 (TxConfig, rtl8139_tx_config);

tp->cur_rx = 0;