netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
@ 2010-04-28 19:00 Ben Hutchings
  2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-04-28 19:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

The original code would wait indefinitely if MAC stats DMA failed.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
 drivers/net/sfc/siena.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index 38dcc42..e0c46f5 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -456,8 +456,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
 
 static void siena_update_nic_stats(struct efx_nic *efx)
 {
-	while (siena_try_update_nic_stats(efx) == -EAGAIN)
-		cpu_relax();
+	int retry;
+
+	/* If we're unlucky enough to read statistics wduring the DMA, wait
+	 * up to 10ms for it to finish (typically takes <500us) */
+	for (retry = 0; retry < 100; ++retry) {
+		if (siena_try_update_nic_stats(efx) == 0)
+			return;
+		udelay(100);
+	}
+
+	/* Use the old values instead */
 }
 
 static void siena_start_nic_stats(struct efx_nic *efx)
-- 
1.6.2.5


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset
  2010-04-28 19:00 [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
@ 2010-04-28 19:01 ` Ben Hutchings
  2010-04-28 19:18   ` David Miller
  2010-04-28 19:01 ` [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards Ben Hutchings
  2010-04-28 19:18 ` [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2010-04-28 19:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

This fixes a regression introduced by commit
eb9f6744cbfa97674c13263802259b5aa0034594 "sfc: Implement ethtool
reset operation".

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
 drivers/net/sfc/efx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 6486657..649a264 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1861,6 +1861,7 @@ out:
 	}
 
 	if (disabled) {
+		dev_close(efx->net_dev);
 		EFX_ERR(efx, "has been disabled\n");
 		efx->state = STATE_DISABLED;
 	} else {
@@ -1884,8 +1885,7 @@ static void efx_reset_work(struct work_struct *data)
 	}
 
 	rtnl_lock();
-	if (efx_reset(efx, efx->reset_pending))
-		dev_close(efx->net_dev);
+	(void)efx_reset(efx, efx->reset_pending);
 	rtnl_unlock();
 }
 
-- 
1.6.2.5


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards
  2010-04-28 19:00 [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
  2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
@ 2010-04-28 19:01 ` Ben Hutchings
  2010-04-28 19:18   ` David Miller
  2010-04-28 19:18 ` [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2010-04-28 19:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

The driver needs specific PHY and board support code for each SFC4000
board; there is no point trying to continue if it is missing.
Currently unsupported boards can trigger an 'oops'.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
 drivers/net/sfc/falcon.c        |    4 +++-
 drivers/net/sfc/falcon_boards.c |   13 +++----------
 drivers/net/sfc/nic.h           |    2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index d294d66..08278e7 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1320,7 +1320,9 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
 
 	EFX_LOG(efx, "PHY is %d phy_id %d\n", efx->phy_type, efx->mdio.prtad);
 
-	falcon_probe_board(efx, board_rev);
+	rc = falcon_probe_board(efx, board_rev);
+	if (rc)
+		goto fail2;
 
 	kfree(nvconfig);
 	return 0;
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index 5712fdd..c7a933a 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -728,15 +728,7 @@ static const struct falcon_board_type board_types[] = {
 	},
 };
 
-static const struct falcon_board_type falcon_dummy_board = {
-	.init		= efx_port_dummy_op_int,
-	.init_phy	= efx_port_dummy_op_void,
-	.fini		= efx_port_dummy_op_void,
-	.set_id_led	= efx_port_dummy_op_set_id_led,
-	.monitor	= efx_port_dummy_op_int,
-};
-
-void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
+int falcon_probe_board(struct efx_nic *efx, u16 revision_info)
 {
 	struct falcon_board *board = falcon_board(efx);
 	u8 type_id = FALCON_BOARD_TYPE(revision_info);
@@ -754,8 +746,9 @@ void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
 			 (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
 			 ? board->type->ref_model : board->type->gen_type,
 			 'A' + board->major, board->minor);
+		return 0;
 	} else {
 		EFX_ERR(efx, "unknown board type %d\n", type_id);
-		board->type = &falcon_dummy_board;
+		return -ENODEV;
 	}
 }
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
index 9351c03..3166baf 100644
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -156,7 +156,7 @@ extern struct efx_nic_type siena_a0_nic_type;
  **************************************************************************
  */
 
-extern void falcon_probe_board(struct efx_nic *efx, u16 revision_info);
+extern int falcon_probe_board(struct efx_nic *efx, u16 revision_info);
 
 /* TX data path */
 extern int efx_nic_probe_tx(struct efx_tx_queue *tx_queue);
-- 
1.6.2.5

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
  2010-04-28 19:00 [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
  2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
  2010-04-28 19:01 ` [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards Ben Hutchings
@ 2010-04-28 19:18 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-28 19:18 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 28 Apr 2010 20:00:35 +0100

> The original code would wait indefinitely if MAC stats DMA failed.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> Cc: stable@kernel.org

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset
  2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
@ 2010-04-28 19:18   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-28 19:18 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 28 Apr 2010 20:01:33 +0100

> This fixes a regression introduced by commit
> eb9f6744cbfa97674c13263802259b5aa0034594 "sfc: Implement ethtool
> reset operation".
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> Cc: stable@kernel.org

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards
  2010-04-28 19:01 ` [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards Ben Hutchings
@ 2010-04-28 19:18   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-28 19:18 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 28 Apr 2010 20:01:50 +0100

> The driver needs specific PHY and board support code for each SFC4000
> board; there is no point trying to continue if it is missing.
> Currently unsupported boards can trigger an 'oops'.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> Cc: stable@kernel.org

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-28 19:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 19:00 [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
2010-04-28 19:18   ` David Miller
2010-04-28 19:01 ` [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards Ben Hutchings
2010-04-28 19:18   ` David Miller
2010-04-28 19:18 ` [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).