diff mbox

Lucid sfc pull request (v2)

Message ID 20100204222158.D8894F8980@sepang.rtg.net
State Accepted
Delegated to: Andy Whitcroft
Headers show

Commit Message

Tim Gardner Feb. 4, 2010, 10:21 p.m. UTC
The following changes since commit 932055fc7a0993c3ce6fe7b3337f2e427105ceca:
  Tim Gardner (1):
        UBUNTU: [Config] Implemented the amd64 preempt flavour

are available in the git repository at:

  git://kernel.ubuntu.com/rtg/ubuntu-lucid.git sfc

Ben Hutchings (3):
      sfc: Fix polling for slow MCDI operations
      sfc: Fix conditions for MDIO self-test
      sfc: Use fixed-size buffers for MCDI NVRAM requests

Guido Barzini (1):
      sfc: Add workspace for GMAC bug workaround to MCDI MAC_STATS buffer

Matthew Slattery (1):
      sfc: QT202x: Remove unreliable MMD check at initialisation

 drivers/net/sfc/mcdi.c       |   12 +++++++-----
 drivers/net/sfc/mcdi.h       |    1 +
 drivers/net/sfc/mcdi_pcol.h  |    4 +++-
 drivers/net/sfc/mtd.c        |    5 ++---
 drivers/net/sfc/qt202x_phy.c |    6 ------
 drivers/net/sfc/selftest.c   |    8 ++++++--
 6 files changed, 19 insertions(+), 17 deletions(-)

From a9abb51a556bc1779154d265f0845fdbb0c6b46e Mon Sep 17 00:00:00 2001
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 13 Jan 2010 04:34:25 +0000
Subject: [PATCH 1/5] sfc: Fix polling for slow MCDI operations

https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

When the interface is down and we are using polled mode for MCDI
operations, we busy-wait for completion for approximately 1 jiffy
using udelay() and then back off to schedule().  But the completion
will not wake the task, since we are using polled mode!  We must use
schedule_timeout_uninterruptible() instead.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 55029c1d65158aea9672c5dfadb43a57f23e3100)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/sfc/mcdi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Andy Whitcroft Feb. 5, 2010, 1:56 a.m. UTC | #1
Applied to Lucid.

-apw
diff mbox

Patch

diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index 683353b..0d4eba7 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -142,8 +142,9 @@  static int efx_mcdi_poll(struct efx_nic *efx)
 		if (spins != 0) {
 			--spins;
 			udelay(1);
-		} else
-			schedule();
+		} else {
+			schedule_timeout_uninterruptible(1);
+		}
 
 		time = get_seconds();
 
-- 
1.6.2.4


From a7e5bdf9f301e76236647c2eb285135cb4a25c88 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 13 Jan 2010 10:59:13 +0000
Subject: [PATCH 2/5] sfc: Fix conditions for MDIO self-test

https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

The MDIO self-test should not be run on boards without an MDIO PHY,
such as SFN5122F-R3 and later revisions.  It should also not try to
address a specific MMD in an MDIO clause 22 PHY.  Check the
mode_support field to decide which mode to use, if any.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f3766c26a5d00189e5c0965c66f01956d15a92d6)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/sfc/selftest.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index af39335..250c882 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -79,10 +79,14 @@  struct efx_loopback_state {
 static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests)
 {
 	int rc = 0;
-	int devad = __ffs(efx->mdio.mmds);
+	int devad;
 	u16 physid1, physid2;
 
-	if (efx->phy_type == PHY_TYPE_NONE)
+	if (efx->mdio.mode_support & MDIO_SUPPORTS_C45)
+		devad = __ffs(efx->mdio.mmds);
+	else if (efx->mdio.mode_support & MDIO_SUPPORTS_C22)
+		devad = MDIO_DEVAD_NONE;
+	else
 		return 0;
 
 	mutex_lock(&efx->mac_lock);
-- 
1.6.2.4


From c7c8d60d75ed087146d80b2045b176e1b561d390 Mon Sep 17 00:00:00 2001
From: Matthew Slattery <mslattery@solarflare.com>
Date: Mon, 18 Jan 2010 05:47:16 +0000
Subject: [PATCH 3/5] sfc: QT202x: Remove unreliable MMD check at initialisation

https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

Checking the PHY XS MMD here is unnecessary and can give false negatives.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 357d46a17e54c9a87e0e6ef3930ff4ab2d232b81)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/sfc/qt202x_phy.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index ff8f0a4..e0d13a4 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -318,12 +318,6 @@  static int qt202x_reset_phy(struct efx_nic *efx)
 	/* Wait 250ms for the PHY to complete bootup */
 	msleep(250);
 
-	/* Check that all the MMDs we expect are present and responding. We
-	 * expect faults on some if the link is down, but not on the PHY XS */
-	rc = efx_mdio_check_mmds(efx, QT202X_REQUIRED_DEVS, MDIO_DEVS_PHYXS);
-	if (rc < 0)
-		goto fail;
-
 	falcon_board(efx)->type->init_phy(efx);
 
 	return rc;
-- 
1.6.2.4


From 3ca206a53e7df7931620d1475754f6249267e5d8 Mon Sep 17 00:00:00 2001
From: Guido Barzini <gbarzini@solarflare.com>
Date: Mon, 25 Jan 2010 15:49:19 -0800
Subject: [PATCH 4/5] sfc: Add workspace for GMAC bug workaround to MCDI MAC_STATS buffer

https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

Due to a hardware bug in the SFC9000 family, the firmware must
transfer raw GMAC statistics to host memory before aggregating them
into the cooked (speed-independent) MAC statistics.  Extend the stats
buffer to support this.

The length of the buffer is explicit in the MAC_STATS command, so this
change is backward-compatible on both sides.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8704a2c8e9db24157a7b08d1678bf840f2318779)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/sfc/mcdi_pcol.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sfc/mcdi_pcol.h b/drivers/net/sfc/mcdi_pcol.h
index 2a85360..73e71f4 100644
--- a/drivers/net/sfc/mcdi_pcol.h
+++ b/drivers/net/sfc/mcdi_pcol.h
@@ -1090,8 +1090,10 @@ 
 #define MC_CMD_MAC_RX_LANES01_DISP_ERR 57
 #define MC_CMD_MAC_RX_LANES23_DISP_ERR 58
 #define MC_CMD_MAC_RX_MATCH_FAULT 59
+#define MC_CMD_GMAC_DMABUF_START 64
+#define MC_CMD_GMAC_DMABUF_END   95
 /* Insert new members here. */
-#define MC_CMD_MAC_GENERATION_END 60
+#define MC_CMD_MAC_GENERATION_END 96
 #define MC_CMD_MAC_NSTATS (MC_CMD_MAC_GENERATION_END+1)
 
 /* MC_CMD_MAC_STATS:
-- 
1.6.2.4


From 3c91495d812f25470fc6c86322d6b81b5dee5f1f Mon Sep 17 00:00:00 2001
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 25 Jan 2010 15:49:59 -0800
Subject: [PATCH 5/5] sfc: Use fixed-size buffers for MCDI NVRAM requests

https://lists.ubuntu.com/archives/kernel-team/2010-January/008303.html

The low-level MCDI code always uses 32-bit MMIO operations, and
callers must pad input and output buffers to multiples of 4 bytes.
The MCDI NVRAM functions are not doing this.  Also, their buffers are
declared as variable-length arrays with no explicit maximum length.

Switch to a fixed buffer size based on the chunk size used by the
MTD driver (which is a multiple of 4).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5a27e86babe79cf5f575394bb1055448458df6c7)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/sfc/mcdi.c |    7 ++++---
 drivers/net/sfc/mcdi.h |    1 +
 drivers/net/sfc/mtd.c  |    5 ++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index 0d4eba7..9f035b9 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -804,7 +804,7 @@  int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
 			loff_t offset, u8 *buffer, size_t length)
 {
 	u8 inbuf[MC_CMD_NVRAM_READ_IN_LEN];
-	u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(length)];
+	u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(EFX_MCDI_NVRAM_LEN_MAX)];
 	size_t outlen;
 	int rc;
 
@@ -828,7 +828,7 @@  fail:
 int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
 			   loff_t offset, const u8 *buffer, size_t length)
 {
-	u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(length)];
+	u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(EFX_MCDI_NVRAM_LEN_MAX)];
 	int rc;
 
 	MCDI_SET_DWORD(inbuf, NVRAM_WRITE_IN_TYPE, type);
@@ -838,7 +838,8 @@  int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
 
 	BUILD_BUG_ON(MC_CMD_NVRAM_WRITE_OUT_LEN != 0);
 
-	rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, sizeof(inbuf),
+	rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf,
+			  ALIGN(MC_CMD_NVRAM_WRITE_IN_LEN(length), 4),
 			  NULL, 0, NULL);
 	if (rc)
 		goto fail;
diff --git a/drivers/net/sfc/mcdi.h b/drivers/net/sfc/mcdi.h
index de91672..10ce98f 100644
--- a/drivers/net/sfc/mcdi.h
+++ b/drivers/net/sfc/mcdi.h
@@ -111,6 +111,7 @@  extern int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
 extern int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
 				loff_t offset, const u8 *buffer,
 				size_t length);
+#define EFX_MCDI_NVRAM_LEN_MAX 128
 extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type,
 				loff_t offset, size_t length);
 extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx,
diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c
index 3a46452..407bbad 100644
--- a/drivers/net/sfc/mtd.c
+++ b/drivers/net/sfc/mtd.c
@@ -23,7 +23,6 @@ 
 #include "mcdi_pcol.h"
 
 #define EFX_SPI_VERIFY_BUF_LEN 16
-#define EFX_MCDI_CHUNK_LEN 128
 
 struct efx_mtd_partition {
 	struct mtd_info mtd;
@@ -428,7 +427,7 @@  static int siena_mtd_read(struct mtd_info *mtd, loff_t start,
 	int rc = 0;
 
 	while (offset < end) {
-		chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN);
+		chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX);
 		rc = efx_mcdi_nvram_read(efx, part->mcdi.nvram_type, offset,
 					 buffer, chunk);
 		if (rc)
@@ -491,7 +490,7 @@  static int siena_mtd_write(struct mtd_info *mtd, loff_t start,
 	}
 
 	while (offset < end) {
-		chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN);
+		chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX);
 		rc = efx_mcdi_nvram_write(efx, part->mcdi.nvram_type, offset,
 					  buffer, chunk);
 		if (rc)