]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Reset NIC when closing interface if using legacy mode
authorMichael Brown <mcb30@ipxe.org>
Wed, 4 Nov 2020 14:24:52 +0000 (14:24 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 4 Nov 2020 14:35:19 +0000 (14:35 +0000)
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 <mcb30@ipxe.org>
src/drivers/net/realtek.c

index 0421b4db7d0dbc094f69adf22defa0cd02977f58..e74128c4ce4575bd409bc5ec4a92c35e58d1b1af 100644 (file)
@@ -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 );
 }
 
 /**