netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms
@ 2010-12-08 11:43 Vladislav Zolotarov
  2010-12-10  4:50 ` David Miller
  2010-12-12  4:14 ` Ben Hutchings
  0 siblings, 2 replies; 4+ messages in thread
From: Vladislav Zolotarov @ 2010-12-08 11:43 UTC (permalink / raw)
  To: Dave Miller; +Cc: netdev list, Eilon Greenstein

Make the LSO code work on BE platforms: parsing_data field of 
a parsing BD (PBD) for 57712 was improperly composed which made FW read wrong 
values for TCP header's length and offset and, as a result, the corresponding 
PCI device was performing bad DMA reads triggering EEH.

Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

---
 drivers/net/bnx2x/bnx2x_cmn.c |   42 +++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index a4555ed..236c00c 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -1795,15 +1795,15 @@ exit_lbl:
 }
 #endif
 
-static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb,
-				     struct eth_tx_parse_bd_e2 *pbd,
-				     u32 xmit_type)
+static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data,
+					u32 xmit_type)
 {
-	pbd->parsing_data |= cpu_to_le16(skb_shinfo(skb)->gso_size) <<
-		ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT;
+	*parsing_data |= (skb_shinfo(skb)->gso_size <<
+			      ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT) &
+			      ETH_TX_PARSE_BD_E2_LSO_MSS;
 	if ((xmit_type & XMIT_GSO_V6) &&
 	    (ipv6_hdr(skb)->nexthdr == NEXTHDR_IPV6))
-		pbd->parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR;
+		*parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR;
 }
 
 /**
@@ -1848,15 +1848,15 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb,
  * @return header len
  */
 static inline  u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb,
-	struct eth_tx_parse_bd_e2 *pbd,
-	u32 xmit_type)
+	u32 *parsing_data, u32 xmit_type)
 {
-	pbd->parsing_data |= cpu_to_le16(tcp_hdrlen(skb)/4) <<
-		ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT;
+	*parsing_data |= ((tcp_hdrlen(skb)/4) <<
+		ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) &
+		ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW;
 
-	pbd->parsing_data |= cpu_to_le16(((unsigned char *)tcp_hdr(skb) -
-					  skb->data) / 2) <<
-		ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT;
+	*parsing_data |= ((((u8 *)tcp_hdr(skb) - skb->data) / 2) <<
+		ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) &
+		ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W;
 
 	return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data;
 }
@@ -1925,6 +1925,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct eth_tx_bd *tx_data_bd, *total_pkt_bd = NULL;
 	struct eth_tx_parse_bd_e1x *pbd_e1x = NULL;
 	struct eth_tx_parse_bd_e2 *pbd_e2 = NULL;
+	u32 pbd_e2_parsing_data = 0;
 	u16 pkt_prod, bd_prod;
 	int nbd, fp_index;
 	dma_addr_t mapping;
@@ -2046,8 +2047,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2));
 		/* Set PBD in checksum offload case */
 		if (xmit_type & XMIT_CSUM)
-			hlen = bnx2x_set_pbd_csum_e2(bp,
-						     skb, pbd_e2, xmit_type);
+			hlen = bnx2x_set_pbd_csum_e2(bp, skb,
+						     &pbd_e2_parsing_data,
+						     xmit_type);
 	} else {
 		pbd_e1x = &fp->tx_desc_ring[bd_prod].parse_bd_e1x;
 		memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x));
@@ -2089,10 +2091,18 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 			bd_prod = bnx2x_tx_split(bp, fp, tx_buf, &tx_start_bd,
 						 hlen, bd_prod, ++nbd);
 		if (CHIP_IS_E2(bp))
-			bnx2x_set_pbd_gso_e2(skb, pbd_e2, xmit_type);
+			bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data,
+					     xmit_type);
 		else
 			bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type);
 	}
+
+	/* Set the PBD's parsing_data field if not zero
+	 * (for the chips newer than 57711).
+	 */
+	if (pbd_e2_parsing_data)
+		pbd_e2->parsing_data = cpu_to_le32(pbd_e2_parsing_data);
+
 	tx_data_bd = (struct eth_tx_bd *)tx_start_bd;
 
 	/* Handle fragmented skb */
-- 
1.7.0.4





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

* Re: [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms
  2010-12-08 11:43 [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms Vladislav Zolotarov
@ 2010-12-10  4:50 ` David Miller
  2010-12-12  4:14 ` Ben Hutchings
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-10  4:50 UTC (permalink / raw)
  To: vladz; +Cc: netdev, eilong

From: "Vladislav Zolotarov" <vladz@broadcom.com>
Date: Wed, 8 Dec 2010 13:43:09 +0200

> Make the LSO code work on BE platforms: parsing_data field of 
> a parsing BD (PBD) for 57712 was improperly composed which made FW read wrong 
> values for TCP header's length and offset and, as a result, the corresponding 
> PCI device was performing bad DMA reads triggering EEH.
> 
> Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Applied.

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

* Re: [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms
  2010-12-08 11:43 [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms Vladislav Zolotarov
  2010-12-10  4:50 ` David Miller
@ 2010-12-12  4:14 ` Ben Hutchings
  2010-12-12 13:54   ` Vladislav Zolotarov
  1 sibling, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2010-12-12  4:14 UTC (permalink / raw)
  To: Vladislav Zolotarov; +Cc: Dave Miller, netdev list, Eilon Greenstein

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Wed, 2010-12-08 at 13:43 +0200, Vladislav Zolotarov wrote:
> Make the LSO code work on BE platforms: parsing_data field of 
> a parsing BD (PBD) for 57712 was improperly composed which made FW read wrong 
> values for TCP header's length and offset and, as a result, the corresponding 
> PCI device was performing bad DMA reads triggering EEH.
[...]

This fix looks like it should go into the stable/longterm series.  Since
this driver has changed a lot since 2.6.32, you would need to provide a
backported patch for that.

Ben.

-- 
Ben Hutchings, Debian Developer and kernel team member


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms
  2010-12-12  4:14 ` Ben Hutchings
@ 2010-12-12 13:54   ` Vladislav Zolotarov
  0 siblings, 0 replies; 4+ messages in thread
From: Vladislav Zolotarov @ 2010-12-12 13:54 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Dave Miller, netdev list, Eilon Greenstein


> This fix looks like it should go into the stable/longterm series.  Since
> this driver has changed a lot since 2.6.32, you would need to provide a
> backported patch for that.

Ben, u r right. I'm preparing a similar patch series for net-2.6 at the
moment. Since the broken code was 57712 only, the only "stable" version
affected is a current net-2.6.

thanks,
vlad



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

end of thread, other threads:[~2010-12-12 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 11:43 [PATCH net-next 1/4] bnx2x: LSO code was broken on BE platforms Vladislav Zolotarov
2010-12-10  4:50 ` David Miller
2010-12-12  4:14 ` Ben Hutchings
2010-12-12 13:54   ` Vladislav Zolotarov

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).