tg3: Fix jumbo loopback test on 5719
Subsystems (3)
PATCH 1/3 tg3: Fix jumbo loopback test on 5719
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.
--- drivers/net/ethernet/broadcom/tg3.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +11 -3
@@ -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 ; }
Signature · 1 line
1.7.1
PATCH 2/3 tg3: Add memory barriers to sync BD data
for weak memory model architectures to ensure that the chip will DMA valid BD data.
--- drivers/net/ethernet/broadcom/tg3.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +9 -0
@@ -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);
Signature · 1 line
1.7.1
PATCH 3/3 tg3: Fix poor tx performance on 57766 after MTU change
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.
--- drivers/net/ethernet/broadcom/tg3.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +8 -2
@@ -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);
Signature · 1 line
1.7.1
Re: [PATCH 3/3 net-next] tg3: Fix poor tx performance on 57766 after MTU change
From: "Michael Chan" <[email protected]>
Date: Sun, 4 Mar 2012 16:48:15 -0800
Quoted 5 lines
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 <[email protected]>
Applied.
Re: [PATCH 2/3 net-next] tg3: Add memory barriers to sync BD data
In reply to Michael ChanFrom: "Michael Chan" <[email protected]>
Date: Sun, 4 Mar 2012 16:48:14 -0800
Quoted 6 lines
for weak memory model architectures to ensure that the chip will DMA valid BD data.
Signed-off-by Michael Chan <[email protected]>Reviewed-by Benjamin Li <[email protected]>Reviewed-by Matt Carlson <[email protected]>
Applied.
From: "Michael Chan" <[email protected]>
Date: Sun, 4 Mar 2012 16:48:13 -0800
Quoted 7 lines
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 <[email protected]>Reviewed-by Benjamin Li <[email protected]>Reviewed-by Matt Carlson <[email protected]>
Applied.