Browse Source

[undi] Place an upper limit on the number of PXENV_UNDI_ISR calls per poll

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>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
69313edad8
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      src/arch/i386/drivers/net/undinet.c

+ 5
- 1
src/arch/i386/drivers/net/undinet.c View File

72
 /** Delay between retries of PXENV_UNDI_INITIALIZE */
72
 /** Delay between retries of PXENV_UNDI_INITIALIZE */
73
 #define UNDI_INITIALIZE_RETRY_DELAY_MS 200
73
 #define UNDI_INITIALIZE_RETRY_DELAY_MS 200
74
 
74
 
75
+/** Maximum number of calls to PXENV_UNDI_ISR per poll */
76
+#define UNDI_POLL_QUOTA 4
77
+
75
 /** Alignment of received frame payload */
78
 /** Alignment of received frame payload */
76
 #define UNDI_RX_ALIGN 16
79
 #define UNDI_RX_ALIGN 16
77
 
80
 
328
 	struct undi_nic *undinic = netdev->priv;
331
 	struct undi_nic *undinic = netdev->priv;
329
 	struct s_PXENV_UNDI_ISR undi_isr;
332
 	struct s_PXENV_UNDI_ISR undi_isr;
330
 	struct io_buffer *iobuf = NULL;
333
 	struct io_buffer *iobuf = NULL;
334
+	unsigned int quota = UNDI_POLL_QUOTA;
331
 	size_t len;
335
 	size_t len;
332
 	size_t reserve_len;
336
 	size_t reserve_len;
333
 	size_t frag_len;
337
 	size_t frag_len;
366
 	}
370
 	}
367
 
371
 
368
 	/* Run through the ISR loop */
372
 	/* Run through the ISR loop */
369
-	while ( 1 ) {
373
+	while ( quota-- ) {
370
 		profile_start ( &undinet_isr_call_profiler );
374
 		profile_start ( &undinet_isr_call_profiler );
371
 		if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
375
 		if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
372
 					     &undi_isr,
376
 					     &undi_isr,

Loading…
Cancel
Save