From 3633bb246cf0ba420322a507989ec6031375075e Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 20 Nov 2010 05:03:06 +0000 Subject: [PATCH] [lotest] Use network device receive queue freezing Signed-off-by: Michael Brown --- src/usr/lotest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/usr/lotest.c b/src/usr/lotest.c index 407f6844..6c87923c 100644 --- a/src/usr/lotest.c +++ b/src/usr/lotest.c @@ -119,6 +119,11 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver, ifstat ( sender ); ifstat ( receiver ); + /* Freeze receive queue processing on the receiver, so that we + * can extract all received packets. + */ + netdev_rx_freeze ( receiver ); + /* Perform loopback test */ for ( successes = 0 ; ; successes++ ) { @@ -155,8 +160,7 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver, goto done; } /* Poll network devices */ - netdev_poll ( sender ); - netdev_poll ( receiver ); + net_poll(); } while ( ( iobuf = netdev_rx_dequeue ( receiver ) ) == NULL ); /* Check received packet */ @@ -203,6 +207,7 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver, done: printf ( "\n"); free_iob ( iobuf ); + netdev_rx_unfreeze ( receiver ); /* Dump final statistics */ ifstat ( sender );