summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/drivers/net/undinet.c
diff options
context:
space:
mode:
authorMichael Brown2014-05-03 13:53:20 +0200
committerMichael Brown2014-05-03 20:52:10 +0200
commit69313edad85f8958acc8a47272b3c3da494835ec (patch)
tree3702e608385e32e8cb7bc02d07979687f0589e11 /src/arch/i386/drivers/net/undinet.c
parent[undi] Do not switch to real mode to check for NIC interrupt (diff)
downloadipxe-69313edad85f8958acc8a47272b3c3da494835ec.tar.gz
ipxe-69313edad85f8958acc8a47272b3c3da494835ec.tar.xz
ipxe-69313edad85f8958acc8a47272b3c3da494835ec.zip
[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>
Diffstat (limited to 'src/arch/i386/drivers/net/undinet.c')
-rw-r--r--src/arch/i386/drivers/net/undinet.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/i386/drivers/net/undinet.c b/src/arch/i386/drivers/net/undinet.c
index d7a632da..82dd8d2f 100644
--- a/src/arch/i386/drivers/net/undinet.c
+++ b/src/arch/i386/drivers/net/undinet.c
@@ -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,