netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36
@ 2010-06-25 17:03 Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 1/4] sfc: Fix reading of inserted hash Ben Hutchings
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-06-25 17:03 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

Dave,

You appear to have applied all my previous patches to net-next-2.6, so
here are the fix-ups for hash insertion.  Also, an improvement in
hardware monitoring which has been in the the out-of-tree sfc driver for
a while but which I failed to carry over.

Ben.

Ben Hutchings (4):
  sfc: Fix reading of inserted hash
  sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key
  sfc: Use Toeplitz IPv4 hash for RSS and hash insertion
  sfc: Log clearer error messages for hardware monitor

 drivers/net/sfc/efx.c           |    3 +++
 drivers/net/sfc/falcon.c        |   14 ++++++++++++--
 drivers/net/sfc/falcon_boards.c |   11 ++++++++---
 drivers/net/sfc/net_driver.h    |    1 +
 drivers/net/sfc/nic.h           |    1 -
 drivers/net/sfc/rx.c            |   11 ++++++-----
 drivers/net/sfc/selftest.c      |    3 ---
 drivers/net/sfc/siena.c         |   23 ++++++++++++++---------
 8 files changed, 44 insertions(+), 23 deletions(-)

-- 
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	[flat|nested] 6+ messages in thread

* [PATCH net-next-2.6 1/4] sfc: Fix reading of inserted hash
  2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
@ 2010-06-25 17:05 ` Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 2/4] sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key Ben Hutchings
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-06-25 17:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

The hash appears immediately before the packet data, not at the
beginning of the buffer. This means we can easily use negative offsets
from the start of packet data, so adjust the data and length at the
top of __efx_rx_packet() instead of wherever we consume the hash.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/rx.c       |   11 ++++++-----
 drivers/net/sfc/selftest.c |    3 ---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index 0fb9835..799c461 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -104,9 +104,9 @@ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
 static inline u32 efx_rx_buf_hash(struct efx_rx_buffer *buf)
 {
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) || NET_IP_ALIGN % 4 == 0
-	return __le32_to_cpup((const __le32 *)buf->data);
+	return __le32_to_cpup((const __le32 *)(buf->data - 4));
 #else
-	const u8 *data = (const u8 *)buf->data;
+	const u8 *data = (const u8 *)(buf->data - 4);
 	return ((u32)data[0]       |
 		(u32)data[1] << 8  |
 		(u32)data[2] << 16 |
@@ -469,8 +469,6 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
 
 		if (efx->net_dev->features & NETIF_F_RXHASH)
 			skb->rxhash = efx_rx_buf_hash(rx_buf);
-		rx_buf->data += efx->type->rx_buffer_hash_size;
-		rx_buf->len -= efx->type->rx_buffer_hash_size;
 
 		skb_shinfo(skb)->frags[0].page = page;
 		skb_shinfo(skb)->frags[0].page_offset =
@@ -577,6 +575,9 @@ void __efx_rx_packet(struct efx_channel *channel,
 	struct efx_nic *efx = channel->efx;
 	struct sk_buff *skb;
 
+	rx_buf->data += efx->type->rx_buffer_hash_size;
+	rx_buf->len -= efx->type->rx_buffer_hash_size;
+
 	/* If we're in loopback test, then pass the packet directly to the
 	 * loopback layer, and free the rx_buf here
 	 */
@@ -589,11 +590,11 @@ void __efx_rx_packet(struct efx_channel *channel,
 	if (rx_buf->skb) {
 		prefetch(skb_shinfo(rx_buf->skb));
 
+		skb_reserve(rx_buf->skb, efx->type->rx_buffer_hash_size);
 		skb_put(rx_buf->skb, rx_buf->len);
 
 		if (efx->net_dev->features & NETIF_F_RXHASH)
 			rx_buf->skb->rxhash = efx_rx_buf_hash(rx_buf);
-		skb_pull(rx_buf->skb, efx->type->rx_buffer_hash_size);
 
 		/* Move past the ethernet header. rx_buf->data still points
 		 * at the ethernet header */
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 0399be2..85f015f 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -258,9 +258,6 @@ void efx_loopback_rx_packet(struct efx_nic *efx,
 
 	payload = &state->payload;
 
-	buf_ptr += efx->type->rx_buffer_hash_size;
-	pkt_len -= efx->type->rx_buffer_hash_size;
-
 	received = (struct efx_loopback_payload *) buf_ptr;
 	received->ip.saddr = payload->ip.saddr;
 	if (state->offload_csum)
-- 
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-next-2.6 2/4] sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key
  2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 1/4] sfc: Fix reading of inserted hash Ben Hutchings
@ 2010-06-25 17:05 ` Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 3/4] sfc: Use Toeplitz IPv4 hash for RSS and hash insertion Ben Hutchings
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-06-25 17:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

We will use this hash key for Toeplitz IPv4 hashing too.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/efx.c        |    3 +++
 drivers/net/sfc/net_driver.h |    1 +
 drivers/net/sfc/nic.h        |    1 -
 drivers/net/sfc/siena.c      |   12 ++++--------
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index d68f061..2a90bf9 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1134,6 +1134,9 @@ static int efx_probe_nic(struct efx_nic *efx)
 	 * in MSI-X interrupts. */
 	efx_probe_interrupts(efx);
 
+	if (efx->n_channels > 1)
+		get_random_bytes(&efx->rx_hash_key, sizeof(efx->rx_hash_key));
+
 	efx_set_channels(efx);
 	efx->net_dev->real_num_tx_queues = efx->n_tx_channels;
 
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 8b17c92..ba272a4 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -733,6 +733,7 @@ struct efx_nic {
 	unsigned n_tx_channels;
 	unsigned int rx_buffer_len;
 	unsigned int rx_buffer_order;
+	u8 rx_hash_key[40];
 
 	unsigned int_error_count;
 	unsigned long int_error_expire;
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
index 534461f..a39822d 100644
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -142,7 +142,6 @@ struct siena_nic_data {
 	u32 fw_build;
 	struct efx_mcdi_iface mcdi;
 	int wol_filter_id;
-	u8 ipv6_rss_key[40];
 };
 
 extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len);
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index f1741b4..7fd258c 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -285,9 +285,6 @@ static int siena_probe_nic(struct efx_nic *efx)
 		goto fail5;
 	}
 
-	get_random_bytes(&nic_data->ipv6_rss_key,
-			 sizeof(nic_data->ipv6_rss_key));
-
 	return 0;
 
 fail5:
@@ -307,7 +304,6 @@ fail1:
  */
 static int siena_init_nic(struct efx_nic *efx)
 {
-	struct siena_nic_data *nic_data = efx->nic_data;
 	efx_oword_t temp;
 	int rc;
 
@@ -336,16 +332,16 @@ static int siena_init_nic(struct efx_nic *efx)
 	efx_writeo(efx, &temp, FR_AZ_RX_CFG);
 
 	/* Enable IPv6 RSS */
-	BUILD_BUG_ON(sizeof(nic_data->ipv6_rss_key) !=
+	BUILD_BUG_ON(sizeof(efx->rx_hash_key) <
 		     2 * sizeof(temp) + FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8 ||
 		     FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN != 0);
-	memcpy(&temp, nic_data->ipv6_rss_key, sizeof(temp));
+	memcpy(&temp, efx->rx_hash_key, sizeof(temp));
 	efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG1);
-	memcpy(&temp, nic_data->ipv6_rss_key + sizeof(temp), sizeof(temp));
+	memcpy(&temp, efx->rx_hash_key + sizeof(temp), sizeof(temp));
 	efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG2);
 	EFX_POPULATE_OWORD_2(temp, FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1,
 			     FRF_CZ_RX_RSS_IPV6_IP_THASH_ENABLE, 1);
-	memcpy(&temp, nic_data->ipv6_rss_key + 2 * sizeof(temp),
+	memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp),
 	       FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8);
 	efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3);
 
-- 
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-next-2.6 3/4] sfc: Use Toeplitz IPv4 hash for RSS and hash insertion
  2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 1/4] sfc: Fix reading of inserted hash Ben Hutchings
  2010-06-25 17:05 ` [PATCH net-next-2.6 2/4] sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key Ben Hutchings
@ 2010-06-25 17:05 ` Ben Hutchings
  2010-06-25 17:06 ` [PATCH net-next-2.6 4/4] sfc: Log clearer error messages for hardware monitor Ben Hutchings
  2010-06-26  4:08 ` [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-06-25 17:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

Insertion of the Falcon hash is unreliable.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/falcon.c |   14 ++++++++++++--
 drivers/net/sfc/siena.c  |   11 ++++++++++-
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 5a40145..4f9d33f 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1581,8 +1581,14 @@ static void falcon_init_rx_cfg(struct efx_nic *efx)
 		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_MAC_TH, data_xoff_thr);
 		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XON_TX_TH, ctrl_xon_thr);
 		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_XOFF_TX_TH, ctrl_xoff_thr);
-		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_HASH_INSRT_HDR, 1);
 		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 1);
+
+		/* Enable hash insertion. This is broken for the
+		 * 'Falcon' hash so also select Toeplitz TCP/IPv4 and
+		 * IPv4 hashes. */
+		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_HASH_INSRT_HDR, 1);
+		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_HASH_ALG, 1);
+		EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_IP_HASH, 1);
 	}
 	/* Always enable XOFF signal from RX FIFO.  We enable
 	 * or disable transmission of pause frames at the MAC. */
@@ -1656,8 +1662,12 @@ static int falcon_init_nic(struct efx_nic *efx)
 
 	falcon_init_rx_cfg(efx);
 
-	/* Set destination of both TX and RX Flush events */
 	if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) {
+		/* Set hash key for IPv4 */
+		memcpy(&temp, efx->rx_hash_key, sizeof(temp));
+		efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
+
+		/* Set destination of both TX and RX Flush events */
 		EFX_POPULATE_OWORD_1(temp, FRF_BZ_FLS_EVQ_ID, 0);
 		efx_writeo(efx, &temp, FR_BZ_DP_CTRL);
 	}
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index 7fd258c..3fab030 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -327,10 +327,19 @@ static int siena_init_nic(struct efx_nic *efx)
 
 	efx_reado(efx, &temp, FR_AZ_RX_CFG);
 	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_DESC_PUSH_EN, 0);
-	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_HASH_INSRT_HDR, 1);
 	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_INGR_EN, 1);
+	/* Enable hash insertion. This is broken for the 'Falcon' hash
+	 * if IPv6 hashing is also enabled, so also select Toeplitz
+	 * TCP/IPv4 and IPv4 hashes. */
+	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_HASH_INSRT_HDR, 1);
+	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_HASH_ALG, 1);
+	EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_IP_HASH, 1);
 	efx_writeo(efx, &temp, FR_AZ_RX_CFG);
 
+	/* Set hash key for IPv4 */
+	memcpy(&temp, efx->rx_hash_key, sizeof(temp));
+	efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
+
 	/* Enable IPv6 RSS */
 	BUILD_BUG_ON(sizeof(efx->rx_hash_key) <
 		     2 * sizeof(temp) + FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8 ||
-- 
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-next-2.6 4/4] sfc: Log clearer error messages for hardware monitor
  2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
                   ` (2 preceding siblings ...)
  2010-06-25 17:05 ` [PATCH net-next-2.6 3/4] sfc: Use Toeplitz IPv4 hash for RSS and hash insertion Ben Hutchings
@ 2010-06-25 17:06 ` Ben Hutchings
  2010-06-26  4:08 ` [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-06-25 17:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers, Jesper Dangaard Brouer

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/falcon_boards.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index 92b35e3..3d950c2 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -108,10 +108,15 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask)
 	if (alarms1 || alarms2) {
 		netif_err(efx, hw, efx->net_dev,
 			  "LM87 detected a hardware failure (status %02x:%02x)"
-			  "%s%s\n",
+			  "%s%s%s\n",
 			  alarms1, alarms2,
-			  (alarms1 & LM87_ALARM_TEMP_INT) ? " INTERNAL" : "",
-			  (alarms1 & LM87_ALARM_TEMP_EXT1) ? " EXTERNAL" : "");
+			  (alarms1 & LM87_ALARM_TEMP_INT) ?
+			  "; board is overheating" : "",
+			  (alarms1 & LM87_ALARM_TEMP_EXT1) ?
+			  "; controller is overheating" : "",
+			  (alarms1 & ~(LM87_ALARM_TEMP_INT | LM87_ALARM_TEMP_EXT1)
+			   || alarms2) ?
+			  "; electrical fault" : "");
 		return -ERANGE;
 	}
 
-- 
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-next-2.6 0/4] More sfc changes for 2.6.36
  2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
                   ` (3 preceding siblings ...)
  2010-06-25 17:06 ` [PATCH net-next-2.6 4/4] sfc: Log clearer error messages for hardware monitor Ben Hutchings
@ 2010-06-26  4:08 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-06-26  4:08 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 25 Jun 2010 18:03:54 +0100

> Ben Hutchings (4):
>   sfc: Fix reading of inserted hash
>   sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key
>   sfc: Use Toeplitz IPv4 hash for RSS and hash insertion
>   sfc: Log clearer error messages for hardware monitor

All applied, thanks.

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

end of thread, other threads:[~2010-06-26  4:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 17:03 [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 Ben Hutchings
2010-06-25 17:05 ` [PATCH net-next-2.6 1/4] sfc: Fix reading of inserted hash Ben Hutchings
2010-06-25 17:05 ` [PATCH net-next-2.6 2/4] sfc: Move siena_nic_data::ipv6_rss_key to efx_nic::rx_hash_key Ben Hutchings
2010-06-25 17:05 ` [PATCH net-next-2.6 3/4] sfc: Use Toeplitz IPv4 hash for RSS and hash insertion Ben Hutchings
2010-06-25 17:06 ` [PATCH net-next-2.6 4/4] sfc: Log clearer error messages for hardware monitor Ben Hutchings
2010-06-26  4:08 ` [PATCH net-next-2.6 0/4] More sfc changes for 2.6.36 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).