[vortex] Re: 3c59x stops receiving after 2^31-1 packets

Donald Becker becker@scyld.com
Tue, 16 May 2000 15:05:50 -0400 (EDT)


On Mon, 15 May 2000, Marcell GAL wrote:

> I use 2.3.99-pre6 and I am routing heavy traffic
> through my 3c905B (PCI) card. After RX packet counter
> stabilized at 2^31-1 = 2147483647 packets I received no
> frames any longer from that dev.
...

This is my bug.  It's a misordered unsigned comparisons in the skbuff refill
phase of the receive routine for non-Vortex chips.

The 3c59x.c driver does 
	for (; vp->dirty_rx < vp->cur_rx; vp->dirty_rx++) {
while the pci-skeleton.c driver has the correct code
	for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) {

They might look the same, but we are doing math over GF(2^32).

> Is this a problem with other eth drivers too?

No, the pci-skeleton.c driver has a correct example.

I thought that I had verified this on all of the drivers a few years ago,
when a similar error slipped into lance.c.  I must have missed checking
3c59x.c (or perhaps that check occured when this code was still in the
prototype "boomerang.c" file).

I scanned the my copies of the drivers for similar flaws, checking for both
cur_rx/dirty_rx and cur_tx/dirty_tx comparisons, and didn't see any other
problems.  Normally I would expect this type of bug to grow after moving
code around, but this line was broken-as-written in '96.  Other similar
checks in the driver were written correctly.

[[ Hmmm, actually, it shouldn't have been a problem until 2^32 packets...]]

Donald Becker				becker@scyld.com
Scyld Computing Corporation
410 Severn Ave. Suite 210
Annapolis MD 21403