Skip to content

Commit 7a99afe

Browse files
tanstafelPaolo Abeni
authored andcommitted
net: ks8851: Fix potential TX stall after interface reopen
The amount of TX space in the hardware buffer is tracked in the tx_space variable. The initial value is currently only set during driver probing. After closing the interface and reopening it the tx_space variable has the last value it had before close. If it is smaller than the size of the first send packet after reopeing the interface the queue will be stopped. The queue is woken up after receiving a TX interrupt but this will never happen since we did not send anything. This commit moves the initialization of the tx_space variable to the ks8851_net_open function right before starting the TX queue. Also query the value from the hardware instead of using a hard coded value. Only the SPI chip variant is affected by this issue because only this driver variant actually depends on the tx_space variable in the xmit function. Fixes: 3dc5d44 ("net: ks8851: Fix TX stall caused by TX buffer overrun") Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Simon Horman <[email protected]> Cc: [email protected] Cc: [email protected] # 5.10+ Signed-off-by: Ronald Wahl <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5c0b485 commit 7a99afe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/micrel/ks8851_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ static int ks8851_net_open(struct net_device *dev)
482482
ks8851_wrreg16(ks, KS_IER, ks->rc_ier);
483483

484484
ks->queued_len = 0;
485+
ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR);
485486
netif_start_queue(ks->netdev);
486487

487488
netif_dbg(ks, ifup, ks->netdev, "network device up\n");
@@ -1101,7 +1102,6 @@ int ks8851_probe_common(struct net_device *netdev, struct device *dev,
11011102
int ret;
11021103

11031104
ks->netdev = netdev;
1104-
ks->tx_space = 6144;
11051105

11061106
ks->gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
11071107
ret = PTR_ERR_OR_ZERO(ks->gpio);

0 commit comments

Comments
 (0)