summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/pnic.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-09 22:47:01 +0100
committerMichael Brown2007-01-09 22:47:01 +0100
commitc65fae2475ca652ef7948f286881b0c06bce861b (patch)
tree5588ec4b947ecc79201ee613d1cd0a0a7ca6d1d8 /src/drivers/net/pnic.c
parentAutopadding was sometimes overwriting the struct list_head at the end (diff)
downloadipxe-c65fae2475ca652ef7948f286881b0c06bce861b.tar.gz
ipxe-c65fae2475ca652ef7948f286881b0c06bce861b.tar.xz
ipxe-c65fae2475ca652ef7948f286881b0c06bce861b.zip
Add RX quotas to the net device poll() method. This avoids the problem
of alloc_pkb() exhaustion when e.g. an iSCSI-booted DOS session is left idle for a long time at the C:\ prompt and builds up a huge packet backlog.
Diffstat (limited to 'src/drivers/net/pnic.c')
-rw-r--r--src/drivers/net/pnic.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/drivers/net/pnic.c b/src/drivers/net/pnic.c
index 09ac92a4..c74e7b50 100644
--- a/src/drivers/net/pnic.c
+++ b/src/drivers/net/pnic.c
@@ -112,14 +112,14 @@ static int pnic_api_check ( uint16_t api_version ) {
/**************************************************************************
POLL - Wait for a frame
***************************************************************************/
-static void pnic_poll ( struct net_device *netdev ) {
+static void pnic_poll ( struct net_device *netdev, unsigned int rx_quota ) {
struct pnic *pnic = netdev->priv;
struct pk_buff *pkb;
uint16_t length;
uint16_t qlen;
/* Fetch all available packets */
- while ( 1 ) {
+ while ( rx_quota ) {
if ( pnic_command ( pnic, PNIC_CMD_RECV_QLEN, NULL, 0,
&qlen, sizeof ( qlen ), NULL )
!= PNIC_STATUS_OK )
@@ -139,6 +139,7 @@ static void pnic_poll ( struct net_device *netdev ) {
}
pkb_put ( pkb, length );
netdev_rx ( netdev, pkb );
+ --rx_quota;
}
}