[lkml]   [2002]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] 3c59x and resume
christophe barbé wrote:
> Here is a small patch tested with 2.4.18 and 2.4.19-pre4.
> It was proposed by Andrew but not integrated in pre4.
> The problem is when using the vortex driver and suspend/resuming the
> machine.

The patch looks fine to me.

This is a common bug in the Linux ethernet drivers. Let's
review it:

- The module init function keeps a driver-wide `card_idx'
- Every time a new card is detected, card_idx is incremented
and is associated with that card.
- The card instance's card_idx is used to index module options
- The global card_idx counter is never decremented.

So each time you hotplug a card, it gets the next index, and
eventually the index exceeds the size of the module options array
and the driver falls into its "oh, I've got more than eight
cards" mode.

The fix in this patch is to simply decrement card_idx in the
remove_one function. Which somewhat assumes that cards are
removed and inserted in LIFO order, but that's true for
just one card :)

Same bug appears to be present in about eight divers - just
grep for card_idx.

I don't immediately see a simple and clean fix for this.
If we have, say,

options 3c59x enable_wol=1,1,0,1,1,0,0,0

in modules.conf, and we really have eight NICS, and they're
being plugged and unplugged, how can we reliably associate
that option with the eight cards? So the right option is
applied to each card eash time it's inserted? Should the
option be associated with a card, or with a bus position?


Anyway. Let's apply the patch.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.136 / U:2.224 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site