tg3: Fix jumbo loopback test on 5719
authorMichael Chan <mchan@broadcom.com>
Sun, 4 Mar 2012 14:48:13 +0000 (14:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Mar 2012 01:39:31 +0000 (20:39 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c

index 76f33d5c72723a2f43864e9044d3e7e5cb5cd56a..4b3243b2bdf141f021a95509a346abd733135b79 100644 (file)
@@ -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;
                }