From: Michael Brown Date: Wed, 4 Nov 2020 14:24:52 +0000 (+0000) Subject: [realtek] Reset NIC when closing interface if using legacy mode X-Git-Tag: v1.21.1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f560e7b70b5b1a3ecd2d03d8f319e79327dbd6c3;p=thirdparty%2Fipxe.git [realtek] Reset NIC when closing interface if using legacy mode The legacy transmit descriptor index is not reset by anything short of a full device reset. This can cause the legacy transmit ring to stall after closing and reopening the device, since the hardware and software indices will be out of sync. Fix by performing a reset after closing the interface. Do this only if operating in legacy mode, since in C+ mode the reset is not required and would undesirably clear additional state (such as the C+ command register itself). Signed-off-by: Michael Brown --- diff --git a/src/drivers/net/realtek.c b/src/drivers/net/realtek.c index 0421b4db7..e74128c4c 100644 --- a/src/drivers/net/realtek.c +++ b/src/drivers/net/realtek.c @@ -768,6 +768,10 @@ static void realtek_close ( struct net_device *netdev ) { /* Destroy transmit descriptor ring */ realtek_destroy_ring ( rtl, &rtl->tx ); + + /* Reset legacy transmit descriptor index, if applicable */ + if ( rtl->legacy ) + realtek_reset ( rtl ); } /**