Diff against updated 3c59x.c for Boomerang boards

Nathan Bryant (nathan@burgessinc.com)
Fri, 4 Apr 1997 12:07:17 -0500 (EST)


Howdy, hackers,

David Miller recently discovered a memory leak that exists in most of the
Linux network drivers. I believe the updated 3c59x.c (for Boomerang
cards) on http://cesdis.gsfc.nasa.gov/linux/ suffers from this problem;
here's a diff which I think should correct it.

--- 3c59x.c~ Fri Apr 4 11:08:59 1997
+++ 3c59x.c Fri Apr 4 11:37:07 1997
@@ -1025,6 +1025,7 @@
/* dev->tbusy = 0;*/
vp->stats.tx_errors++;
vp->stats.tx_dropped++;
+ dev_kfree_skb(skb, FREE_WRITE);
}

static int

BTW, looking at Dave's pre-patch-2.0.30-2, I found this patch against the
original (ie, non-Boomerang-compatible) 3c59x.c, which I have some
questions about:

***************
*** 775,789 ****
/* Issue TX_RESET and TX_START commands. */
outw(TxReset, ioaddr + EL3_CMD);
for (i = 20; i >= 0 ; i--)
- if ( ! inw(ioaddr + EL3_STATUS) & CmdInProgress) break;
outw(TxEnable, ioaddr + EL3_CMD);
dev->trans_start = jiffies;
dev->tbusy = 0;
vp->stats.tx_errors++;
vp->stats.tx_dropped++;
return 0; /* Yes, silently *drop* the packet! */
}
- dev->tbusy = 0;
}

/* Block a timer-based transmit from overlapping. This could better be
--- 775,795 ----
/* Issue TX_RESET and TX_START commands. */
outw(TxReset, ioaddr + EL3_CMD);
for (i = 20; i >= 0 ; i--)
+ if ( ! inw(ioaddr + EL3_STATUS) & CmdInProgress)
+ break;
outw(TxEnable, ioaddr + EL3_CMD);
dev->trans_start = jiffies;
dev->tbusy = 0;
vp->stats.tx_errors++;
vp->stats.tx_dropped++;
+ dev_kfree_skb(skb, FREE_WRITE);
return 0; /* Yes, silently *drop* the packet! */
}
+ }
+
+ if(skb == NULL) {
+ dev_tint(dev);
+ return NULL;
}

/* Block a timer-based transmit from overlapping. This could better be

Can anybody explain the (skb == NULL) check and the call to dev_tint()?
There is already a similar section in the updated 3c59x.c, but I'm not
really sure what it does.

regards,
Nathan "New to kernel hacking" Bryant
nathan@burgessinc.com