Browse Source

Avoid causing TX overflow on small TX queues.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
cd3ecac809
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      src/net/netdevice.c

+ 9
- 3
src/net/netdevice.c View File

@@ -294,7 +294,13 @@ int net_rx_process ( struct pk_buff *pkb ) {
294 294
  * @v process		Network stack process
295 295
  *
296 296
  * This polls all interfaces for any received packets, and processes
297
- * any packets that are received during this poll.
297
+ * at most one packet from the RX queue.
298
+ *
299
+ * We avoid processing all received packets, because processing the
300
+ * received packet can trigger transmission of a new packet (e.g. an
301
+ * ARP response).  Since TX completions will be processed as part of
302
+ * the poll operation, it is easy to overflow small TX queues if
303
+ * multiple packets are processed per poll.
298 304
  */
299 305
 static void net_step ( struct process *process ) {
300 306
 	struct pk_buff *pkb;
@@ -302,8 +308,8 @@ static void net_step ( struct process *process ) {
302 308
 	/* Poll for new packets */
303 309
 	net_poll();
304 310
 
305
-	/* Handle any received packets */
306
-	while ( ( pkb = net_rx_dequeue () ) ) {
311
+	/* Handle at most one received packet */
312
+	if ( ( pkb = net_rx_dequeue () ) ) {
307 313
 		net_rx_process ( pkb );
308 314
 		DBG ( "Processed received packet\n" );
309 315
 	}

Loading…
Cancel
Save