瀏覽代碼

[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 年之前
父節點
當前提交
69313edad8
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      src/arch/i386/drivers/net/undinet.c

+ 5
- 1
src/arch/i386/drivers/net/undinet.c 查看文件

@@ -72,6 +72,9 @@ struct undi_nic {
72 72
 /** Delay between retries of PXENV_UNDI_INITIALIZE */
73 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 78
 /** Alignment of received frame payload */
76 79
 #define UNDI_RX_ALIGN 16
77 80
 
@@ -328,6 +331,7 @@ static void undinet_poll ( struct net_device *netdev ) {
328 331
 	struct undi_nic *undinic = netdev->priv;
329 332
 	struct s_PXENV_UNDI_ISR undi_isr;
330 333
 	struct io_buffer *iobuf = NULL;
334
+	unsigned int quota = UNDI_POLL_QUOTA;
331 335
 	size_t len;
332 336
 	size_t reserve_len;
333 337
 	size_t frag_len;
@@ -366,7 +370,7 @@ static void undinet_poll ( struct net_device *netdev ) {
366 370
 	}
367 371
 
368 372
 	/* Run through the ISR loop */
369
-	while ( 1 ) {
373
+	while ( quota-- ) {
370 374
 		profile_start ( &undinet_isr_call_profiler );
371 375
 		if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
372 376
 					     &undi_isr,

Loading…
取消
儲存