]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[undi] Place an upper limit on the number of PXENV_UNDI_ISR calls per poll
authorMichael Brown <mcb30@ipxe.org>
Sat, 3 May 2014 11:53:20 +0000 (12:53 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sat, 3 May 2014 18:52:10 +0000 (19:52 +0100)
PXENV_UNDI_ISR calls may implicitly refill the underlying receive
ring, and so could continue to retrieve packets indefinitely.  Place
an upper limit on the number of calls to PXENV_UNDI_ISR per call to
undinet_poll().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/drivers/net/undinet.c

index d7a632da3f89d82255ccd9a556dd37f4abd222a0..82dd8d2f9fafd5f9dd41a8ba16003e4a6d914a6c 100644 (file)
@@ -72,6 +72,9 @@ struct undi_nic {
 /** Delay between retries of PXENV_UNDI_INITIALIZE */
 #define UNDI_INITIALIZE_RETRY_DELAY_MS 200
 
+/** Maximum number of calls to PXENV_UNDI_ISR per poll */
+#define UNDI_POLL_QUOTA 4
+
 /** Alignment of received frame payload */
 #define UNDI_RX_ALIGN 16
 
@@ -328,6 +331,7 @@ static void undinet_poll ( struct net_device *netdev ) {
        struct undi_nic *undinic = netdev->priv;
        struct s_PXENV_UNDI_ISR undi_isr;
        struct io_buffer *iobuf = NULL;
+       unsigned int quota = UNDI_POLL_QUOTA;
        size_t len;
        size_t reserve_len;
        size_t frag_len;
@@ -366,7 +370,7 @@ static void undinet_poll ( struct net_device *netdev ) {
        }
 
        /* Run through the ISR loop */
-       while ( 1 ) {
+       while ( quota-- ) {
                profile_start ( &undinet_isr_call_profiler );
                if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
                                             &undi_isr,