]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Defer packets when no transmit descriptors are available
authorMichael Brown <mcb30@ipxe.org>
Wed, 1 May 2013 13:07:51 +0000 (14:07 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 1 May 2013 13:07:51 +0000 (14:07 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/realtek.c

index f7b5ec58860c5327236dd7cbd2af0f066301ca91..1fd3931b68f09f033ab884a126e5031c7ba7bba3 100644 (file)
@@ -724,8 +724,8 @@ static int realtek_transmit ( struct net_device *netdev,
 
        /* Get next transmit descriptor */
        if ( ( rtl->tx.prod - rtl->tx.cons ) >= RTL_NUM_TX_DESC ) {
-               DBGC ( rtl, "REALTEK %p out of transmit descriptors\n", rtl );
-               return -ENOBUFS;
+               netdev_tx_defer ( netdev, iobuf );
+               return 0;
        }
        tx_idx = ( rtl->tx.prod++ % RTL_NUM_TX_DESC );
 
@@ -809,8 +809,8 @@ static void realtek_poll_tx ( struct net_device *netdev ) {
                DBGC2 ( rtl, "REALTEK %p TX %d complete\n", rtl, tx_idx );
 
                /* Complete TX descriptor */
-               netdev_tx_complete_next ( netdev );
                rtl->tx.cons++;
+               netdev_tx_complete_next ( netdev );
        }
 }