diff options
author | J. K. Cliburn <jcliburn@gmail.com> | 2011-01-01 00:02:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-03 14:04:49 -0500 |
commit | 2f32c867219734b06abc980d4812f67b6d6fe517 (patch) | |
tree | bada002a03498e5204c2706de19f635d9432bb2e | |
parent | b9556f9a1abdc56a179ac7ba6053469373b6de0f (diff) |
atl1: fix oops when changing tx/rx ring params
Commit 3f5a2a713aad28480d86b0add00c68484b54febc zeroes out the statistics
message block (SMB) and coalescing message block (CMB) when adapter ring
resources are freed. This is desirable behavior, but, as a side effect,
the commit leads to an oops when atl1_set_ringparam() attempts to alter
the number of rx or tx elements in the ring buffer (by using ethtool
-G, for example). We don't want SMB or CMB to change during this
operation.
Modify atl1_set_ringparam() to preserve SMB and CMB when changing ring
parameters.
Cc: stable@kernel.org
Signed-off-by: Jay Cliburn <jcliburn@gmail.com>
Reported-by: Tõnu Raitviir <jussuf@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/atlx/atl1.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 53363108994e..3acf5123a6ef 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev, | |||
3504 | struct atl1_rfd_ring rfd_old, rfd_new; | 3504 | struct atl1_rfd_ring rfd_old, rfd_new; |
3505 | struct atl1_rrd_ring rrd_old, rrd_new; | 3505 | struct atl1_rrd_ring rrd_old, rrd_new; |
3506 | struct atl1_ring_header rhdr_old, rhdr_new; | 3506 | struct atl1_ring_header rhdr_old, rhdr_new; |
3507 | struct atl1_smb smb; | ||
3508 | struct atl1_cmb cmb; | ||
3507 | int err; | 3509 | int err; |
3508 | 3510 | ||
3509 | tpd_old = adapter->tpd_ring; | 3511 | tpd_old = adapter->tpd_ring; |
@@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev, | |||
3544 | adapter->rrd_ring = rrd_old; | 3546 | adapter->rrd_ring = rrd_old; |
3545 | adapter->tpd_ring = tpd_old; | 3547 | adapter->tpd_ring = tpd_old; |
3546 | adapter->ring_header = rhdr_old; | 3548 | adapter->ring_header = rhdr_old; |
3549 | /* | ||
3550 | * Save SMB and CMB, since atl1_free_ring_resources | ||
3551 | * will clear them. | ||
3552 | */ | ||
3553 | smb = adapter->smb; | ||
3554 | cmb = adapter->cmb; | ||
3547 | atl1_free_ring_resources(adapter); | 3555 | atl1_free_ring_resources(adapter); |
3548 | adapter->rfd_ring = rfd_new; | 3556 | adapter->rfd_ring = rfd_new; |
3549 | adapter->rrd_ring = rrd_new; | 3557 | adapter->rrd_ring = rrd_new; |
3550 | adapter->tpd_ring = tpd_new; | 3558 | adapter->tpd_ring = tpd_new; |
3551 | adapter->ring_header = rhdr_new; | 3559 | adapter->ring_header = rhdr_new; |
3560 | adapter->smb = smb; | ||
3561 | adapter->cmb = cmb; | ||
3552 | 3562 | ||
3553 | err = atl1_up(adapter); | 3563 | err = atl1_up(adapter); |
3554 | if (err) | 3564 | if (err) |