|  | @@ -40,6 +40,7 @@
 | 
		
	
		
			
			| 40 | 40 |  #include <linux/if_tun.h>
 | 
		
	
		
			
			| 41 | 41 |  
 | 
		
	
		
			
			| 42 | 42 |  #define RX_BUF_SIZE 1536
 | 
		
	
		
			
			|  | 43 | +#define RX_QUOTA 4
 | 
		
	
		
			
			| 43 | 44 |  
 | 
		
	
		
			
			| 44 | 45 |  /** @file
 | 
		
	
		
			
			| 45 | 46 |   *
 | 
		
	
	
		
			
			|  | @@ -127,6 +128,7 @@ static void tap_poll(struct net_device *netdev)
 | 
		
	
		
			
			| 127 | 128 |  	struct tap_nic * nic = netdev->priv;
 | 
		
	
		
			
			| 128 | 129 |  	struct pollfd pfd;
 | 
		
	
		
			
			| 129 | 130 |  	struct io_buffer * iobuf;
 | 
		
	
		
			
			|  | 131 | +	unsigned int quota = RX_QUOTA;
 | 
		
	
		
			
			| 130 | 132 |  	int r;
 | 
		
	
		
			
			| 131 | 133 |  
 | 
		
	
		
			
			| 132 | 134 |  	pfd.fd = nic->fd;
 | 
		
	
	
		
			
			|  | @@ -144,7 +146,8 @@ static void tap_poll(struct net_device *netdev)
 | 
		
	
		
			
			| 144 | 146 |  	if (! iobuf)
 | 
		
	
		
			
			| 145 | 147 |  		goto allocfail;
 | 
		
	
		
			
			| 146 | 148 |  
 | 
		
	
		
			
			| 147 |  | -	while ((r = linux_read(nic->fd, iobuf->data, RX_BUF_SIZE)) > 0) {
 | 
		
	
		
			
			|  | 149 | +	while (quota-- &&
 | 
		
	
		
			
			|  | 150 | +	       ((r = linux_read(nic->fd, iobuf->data, RX_BUF_SIZE)) > 0)) {
 | 
		
	
		
			
			| 148 | 151 |  		DBGC2(nic, "tap %p read %d bytes\n", nic, r);
 | 
		
	
		
			
			| 149 | 152 |  
 | 
		
	
		
			
			| 150 | 153 |  		iob_put(iobuf, r);
 |