All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719
@ 2012-03-05  0:48 Michael Chan
  2012-03-05  0:48 ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data Michael Chan
  2012-03-05  1:39 ` [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Chan @ 2012-03-05  0:48 UTC (permalink / raw)
  To: davem; +Cc: netdev

Loopback on 9K packet fails because the chip has a DMA limit of 4K.  The
loopback test logic uses a single BD for simplicity.  Fix it by reducing
the jumbo packet size to the DMA limit.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Matt Carlson <mcarlson@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 76f33d5..4b3243b 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -11727,6 +11727,10 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
 	} else {
 		num_pkts = 1;
 		data_off = ETH_HLEN;
+
+		if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
+		    tx_len > VLAN_ETH_FRAME_LEN)
+			base_flags |= TXD_FLAG_JMB_PKT;
 	}
 
 	for (i = data_off; i < tx_len; i++)
@@ -11857,6 +11861,10 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
 {
 	int err = -EIO;
 	u32 eee_cap;
+	u32 jmb_pkt_sz = 9000;
+
+	if (tp->dma_limit)
+		jmb_pkt_sz = tp->dma_limit - ETH_HLEN;
 
 	eee_cap = tp->phy_flags & TG3_PHYFLG_EEE_CAP;
 	tp->phy_flags &= ~TG3_PHYFLG_EEE_CAP;
@@ -11900,7 +11908,7 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
 			data[0] |= TG3_STD_LOOPBACK_FAILED;
 
 		if (tg3_flag(tp, JUMBO_RING_ENABLE) &&
-		    tg3_run_loopback(tp, 9000 + ETH_HLEN, false))
+		    tg3_run_loopback(tp, jmb_pkt_sz + ETH_HLEN, false))
 			data[0] |= TG3_JMB_LOOPBACK_FAILED;
 
 		tg3_mac_loopback(tp, false);
@@ -11925,7 +11933,7 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
 		    tg3_run_loopback(tp, ETH_FRAME_LEN, true))
 			data[1] |= TG3_TSO_LOOPBACK_FAILED;
 		if (tg3_flag(tp, JUMBO_RING_ENABLE) &&
-		    tg3_run_loopback(tp, 9000 + ETH_HLEN, false))
+		    tg3_run_loopback(tp, jmb_pkt_sz + ETH_HLEN, false))
 			data[1] |= TG3_JMB_LOOPBACK_FAILED;
 
 		if (do_extlpbk) {
@@ -11943,7 +11951,7 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
 			    tg3_run_loopback(tp, ETH_FRAME_LEN, true))
 				data[2] |= TG3_TSO_LOOPBACK_FAILED;
 			if (tg3_flag(tp, JUMBO_RING_ENABLE) &&
-			    tg3_run_loopback(tp, 9000 + ETH_HLEN, false))
+			    tg3_run_loopback(tp, jmb_pkt_sz + ETH_HLEN, false))
 				data[2] |= TG3_JMB_LOOPBACK_FAILED;
 		}
 
-- 
1.7.1

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

* [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data
  2012-03-05  0:48 [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 Michael Chan
@ 2012-03-05  0:48 ` Michael Chan
  2012-03-05  0:48   ` [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change Michael Chan
  2012-03-05  1:39   ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data David Miller
  2012-03-05  1:39 ` [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 David Miller
  1 sibling, 2 replies; 6+ messages in thread
From: Michael Chan @ 2012-03-05  0:48 UTC (permalink / raw)
  To: davem; +Cc: netdev

for weak memory model architectures to ensure that the chip will DMA
valid BD data.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Matt Carlson <mcarlson@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 4b3243b..0da93db 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -5928,6 +5928,9 @@ next_pkt_nopost:
 
 	/* Refill RX ring(s). */
 	if (!tg3_flag(tp, ENABLE_RSS)) {
+		/* Sync BD data before updating mailbox */
+		wmb();
+
 		if (work_mask & RXD_OPAQUE_RING_STD) {
 			tpr->rx_std_prod_idx = std_prod_idx &
 					       tp->rx_std_ring_mask;
@@ -6970,6 +6973,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	skb_tx_timestamp(skb);
 	netdev_sent_queue(tp->dev, skb->len);
 
+	/* Sync BD data before updating mailbox */
+	wmb();
+
 	/* Packets are ready, update Tx producer idx local and on card. */
 	tw32_tx_mbox(tnapi->prodmbox, entry);
 
@@ -11763,6 +11769,9 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
 
 	tnapi->tx_prod++;
 
+	/* Sync BD data before updating mailbox */
+	wmb();
+
 	tw32_tx_mbox(tnapi->prodmbox, tnapi->tx_prod);
 	tr32_mailbox(tnapi->prodmbox);
 
-- 
1.7.1

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

* [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change
  2012-03-05  0:48 ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data Michael Chan
@ 2012-03-05  0:48   ` Michael Chan
  2012-03-05  1:39     ` David Miller
  2012-03-05  1:39   ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Chan @ 2012-03-05  0:48 UTC (permalink / raw)
  To: davem; +Cc: netdev

GRC reset causes the read DMA engine to go into a mode that breaks up
requests into 256 bytes.  A PHY reset is required to bring it back to
the normal mode.

Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 0da93db..a8490a4 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12267,7 +12267,7 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
 static int tg3_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct tg3 *tp = netdev_priv(dev);
-	int err;
+	int err, reset_phy = 0;
 
 	if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
 		return -EINVAL;
@@ -12290,7 +12290,13 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
 
 	tg3_set_mtu(dev, tp, new_mtu);
 
-	err = tg3_restart_hw(tp, 0);
+	/* Reset PHY, otherwise the read DMA engine will be in a mode that
+	 * breaks all requests to 256 bytes.
+	 */
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766)
+		reset_phy = 1;
+
+	err = tg3_restart_hw(tp, reset_phy);
 
 	if (!err)
 		tg3_netif_start(tp);
-- 
1.7.1

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

* Re: [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719
  2012-03-05  0:48 [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 Michael Chan
  2012-03-05  0:48 ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data Michael Chan
@ 2012-03-05  1:39 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2012-03-05  1:39 UTC (permalink / raw)
  To: mchan; +Cc: netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Sun, 4 Mar 2012 16:48:13 -0800

> Loopback on 9K packet fails because the chip has a DMA limit of 4K.  The
> loopback test logic uses a single BD for simplicity.  Fix it by reducing
> the jumbo packet size to the DMA limit.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> Reviewed-by: Benjamin Li <benli@broadcom.com>
> Reviewed-by: Matt Carlson <mcarlson@broadcom.com>

Applied.

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

* Re: [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data
  2012-03-05  0:48 ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data Michael Chan
  2012-03-05  0:48   ` [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change Michael Chan
@ 2012-03-05  1:39   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2012-03-05  1:39 UTC (permalink / raw)
  To: mchan; +Cc: netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Sun, 4 Mar 2012 16:48:14 -0800

> for weak memory model architectures to ensure that the chip will DMA
> valid BD data.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>
> Reviewed-by: Benjamin Li <benli@broadcom.com>
> Reviewed-by: Matt Carlson <mcarlson@broadcom.com>

Applied.

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

* Re: [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change
  2012-03-05  0:48   ` [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change Michael Chan
@ 2012-03-05  1:39     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-03-05  1:39 UTC (permalink / raw)
  To: mchan; +Cc: netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Sun, 4 Mar 2012 16:48:15 -0800

> GRC reset causes the read DMA engine to go into a mode that breaks up
> requests into 256 bytes.  A PHY reset is required to bring it back to
> the normal mode.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Applied.

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

end of thread, other threads:[~2012-03-05  1:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-05  0:48 [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 Michael Chan
2012-03-05  0:48 ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data Michael Chan
2012-03-05  0:48   ` [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change Michael Chan
2012-03-05  1:39     ` David Miller
2012-03-05  1:39   ` [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data David Miller
2012-03-05  1:39 ` [PATCH 1/3 net-next] tg3: Fix jumbo loopback test on 5719 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.