Skip to content

Commit 9b27517

Browse files
aneftinkuba-moo
authored andcommitted
igc: Add ndo_tx_timeout support
On some platforms, 100/1000/2500 speeds seem to have sometimes problems reporting false positive tx unit hang during stressful UDP traffic. Likely other Intel drivers introduce responses to a tx hang. Update the 'tx hang' comparator with the comparison of the head and tail of ring pointers and restore the tx_timeout_factor to the previous value (one). This can be test by using netperf or iperf3 applications. Example: iperf3 -s -p 5001 iperf3 -c 192.168.0.2 --udp -p 5001 --time 600 -b 0 netserver -p 16604 netperf -H 192.168.0.2 -l 600 -p 16604 -t UDP_STREAM -- -m 64000 Fixes: b27b8dc ("igc: Increase timeout value for Speed 100/1000/2500") Signed-off-by: Sasha Neftin <[email protected]> Tested-by: Naama Meir <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 18a0483 commit 9b27517

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,7 +2942,9 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget)
29422942
if (tx_buffer->next_to_watch &&
29432943
time_after(jiffies, tx_buffer->time_stamp +
29442944
(adapter->tx_timeout_factor * HZ)) &&
2945-
!(rd32(IGC_STATUS) & IGC_STATUS_TXOFF)) {
2945+
!(rd32(IGC_STATUS) & IGC_STATUS_TXOFF) &&
2946+
(rd32(IGC_TDH(tx_ring->reg_idx)) !=
2947+
readl(tx_ring->tail))) {
29462948
/* detected Tx unit hang */
29472949
netdev_err(tx_ring->netdev,
29482950
"Detected Tx Unit Hang\n"
@@ -5068,6 +5070,24 @@ static int igc_change_mtu(struct net_device *netdev, int new_mtu)
50685070
return 0;
50695071
}
50705072

5073+
/**
5074+
* igc_tx_timeout - Respond to a Tx Hang
5075+
* @netdev: network interface device structure
5076+
* @txqueue: queue number that timed out
5077+
**/
5078+
static void igc_tx_timeout(struct net_device *netdev,
5079+
unsigned int __always_unused txqueue)
5080+
{
5081+
struct igc_adapter *adapter = netdev_priv(netdev);
5082+
struct igc_hw *hw = &adapter->hw;
5083+
5084+
/* Do the reset outside of interrupt context */
5085+
adapter->tx_timeout_count++;
5086+
schedule_work(&adapter->reset_task);
5087+
wr32(IGC_EICS,
5088+
(adapter->eims_enable_mask & ~adapter->eims_other));
5089+
}
5090+
50715091
/**
50725092
* igc_get_stats64 - Get System Network Statistics
50735093
* @netdev: network interface device structure
@@ -5495,7 +5515,7 @@ static void igc_watchdog_task(struct work_struct *work)
54955515
case SPEED_100:
54965516
case SPEED_1000:
54975517
case SPEED_2500:
5498-
adapter->tx_timeout_factor = 7;
5518+
adapter->tx_timeout_factor = 1;
54995519
break;
55005520
}
55015521

@@ -6320,6 +6340,7 @@ static const struct net_device_ops igc_netdev_ops = {
63206340
.ndo_set_rx_mode = igc_set_rx_mode,
63216341
.ndo_set_mac_address = igc_set_mac,
63226342
.ndo_change_mtu = igc_change_mtu,
6343+
.ndo_tx_timeout = igc_tx_timeout,
63236344
.ndo_get_stats64 = igc_get_stats64,
63246345
.ndo_fix_features = igc_fix_features,
63256346
.ndo_set_features = igc_set_features,

0 commit comments

Comments
 (0)