diff mbox

atl1: fix oops when changing tx/rx ring params

Message ID 20101227095402.76f98027@osprey.hogchain.net
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

J. K. Cliburn Dec. 27, 2010, 3:54 p.m. UTC
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 descriptors 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>
---
 drivers/net/atlx/atl1.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

David Miller Dec. 31, 2010, 8:08 p.m. UTC | #1
From: "J. K. Cliburn" <jcliburn@gmail.com>
Date: Mon, 27 Dec 2010 09:54:02 -0600

> @@ -3544,11 +3546,20 @@ static int atl1_set_ringparam(struct net_device *netdev,
>  		adapter->rrd_ring = rrd_old;
>  		adapter->tpd_ring = tpd_old;
>  		adapter->ring_header = rhdr_old;
> +		/*
> + 		 * Save SMB and CMB, since atl1_free_ring_resources
> + 		 * will clear them as a result of commit
> + 		 * 3f5a2a713aad28480d86b0add00c68484b54febc
> + 		 */

Please do not reference commit IDs in code comments.

Thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index def8df8..6d4f051 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,
 	struct atl1_rfd_ring rfd_old, rfd_new;
 	struct atl1_rrd_ring rrd_old, rrd_new;
 	struct atl1_ring_header rhdr_old, rhdr_new;
+	struct atl1_smb smb;
+	struct atl1_cmb cmb;
 	int err;
 
 	tpd_old = adapter->tpd_ring;
@@ -3544,11 +3546,20 @@  static int atl1_set_ringparam(struct net_device *netdev,
 		adapter->rrd_ring = rrd_old;
 		adapter->tpd_ring = tpd_old;
 		adapter->ring_header = rhdr_old;
+		/*
+ 		 * Save SMB and CMB, since atl1_free_ring_resources
+ 		 * will clear them as a result of commit
+ 		 * 3f5a2a713aad28480d86b0add00c68484b54febc
+ 		 */
+		smb = adapter->smb;
+		cmb = adapter->cmb;
 		atl1_free_ring_resources(adapter);
 		adapter->rfd_ring = rfd_new;
 		adapter->rrd_ring = rrd_new;
 		adapter->tpd_ring = tpd_new;
 		adapter->ring_header = rhdr_new;
+		adapter->smb = smb;
+		adapter->cmb = cmb;
 
 		err = atl1_up(adapter);
 		if (err)