aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Whitehead <Bryan.Whitehead@microchip.com>2019-02-26 14:06:26 -0500
committerDavid S. Miller <davem@davemloft.net>2019-03-01 14:34:09 -0500
commit90490ef7269906423a1c1b917fc24be8b1602658 (patch)
tree2a0e385426b26e4e01f546489521458214781218
parentd25ed413d5e51644e18f66e34eec049f17a7abcb (diff)
lan743x: Fix TX Stall Issue
It has been observed that tx queue stalls while downloading from certain web sites (example www.speedtest.net) The cause has been tracked down to a corner case where dma descriptors where not setup properly. And there for a tx completion interrupt was not signaled. This fix corrects the problem by properly marking the end of a multi descriptor transmission. Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver") Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/microchip/lan743x_main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 310807ef328b..4d1b4a24907f 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1400,7 +1400,8 @@ static int lan743x_tx_frame_start(struct lan743x_tx *tx,
1400} 1400}
1401 1401
1402static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx, 1402static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
1403 unsigned int frame_length) 1403 unsigned int frame_length,
1404 int nr_frags)
1404{ 1405{
1405 /* called only from within lan743x_tx_xmit_frame. 1406 /* called only from within lan743x_tx_xmit_frame.
1406 * assuming tx->ring_lock has already been acquired. 1407 * assuming tx->ring_lock has already been acquired.
@@ -1410,6 +1411,10 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
1410 1411
1411 /* wrap up previous descriptor */ 1412 /* wrap up previous descriptor */
1412 tx->frame_data0 |= TX_DESC_DATA0_EXT_; 1413 tx->frame_data0 |= TX_DESC_DATA0_EXT_;
1414 if (nr_frags <= 0) {
1415 tx->frame_data0 |= TX_DESC_DATA0_LS_;
1416 tx->frame_data0 |= TX_DESC_DATA0_IOC_;
1417 }
1413 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail]; 1418 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
1414 tx_descriptor->data0 = tx->frame_data0; 1419 tx_descriptor->data0 = tx->frame_data0;
1415 1420
@@ -1514,8 +1519,11 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
1514 u32 tx_tail_flags = 0; 1519 u32 tx_tail_flags = 0;
1515 1520
1516 /* wrap up previous descriptor */ 1521 /* wrap up previous descriptor */
1517 tx->frame_data0 |= TX_DESC_DATA0_LS_; 1522 if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==
1518 tx->frame_data0 |= TX_DESC_DATA0_IOC_; 1523 TX_DESC_DATA0_DTYPE_DATA_) {
1524 tx->frame_data0 |= TX_DESC_DATA0_LS_;
1525 tx->frame_data0 |= TX_DESC_DATA0_IOC_;
1526 }
1519 1527
1520 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail]; 1528 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
1521 buffer_info = &tx->buffer_info[tx->frame_tail]; 1529 buffer_info = &tx->buffer_info[tx->frame_tail];
@@ -1600,7 +1608,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
1600 } 1608 }
1601 1609
1602 if (gso) 1610 if (gso)
1603 lan743x_tx_frame_add_lso(tx, frame_length); 1611 lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);
1604 1612
1605 if (nr_frags <= 0) 1613 if (nr_frags <= 0)
1606 goto finish; 1614 goto finish;