Browse Source

[pxe] Use network device receive queue freezing

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
69d1e6cf57
1 changed files with 11 additions and 6 deletions
  1. 11
    6
      src/arch/i386/interface/pxe/pxe_undi.c

+ 11
- 6
src/arch/i386/interface/pxe/pxe_undi.c View File

@@ -58,8 +58,10 @@ struct net_device *pxe_netdev = NULL;
58 58
  * @v netdev		Network device, or NULL
59 59
  */
60 60
 void pxe_set_netdev ( struct net_device *netdev ) {
61
-	if ( pxe_netdev )
61
+	if ( pxe_netdev ) {
62
+		netdev_rx_unfreeze ( pxe_netdev );
62 63
 		netdev_put ( pxe_netdev );
64
+	}
63 65
 	pxe_netdev = NULL;
64 66
 	if ( netdev )
65 67
 		pxe_netdev = netdev_get ( netdev );
@@ -76,6 +78,7 @@ static int pxe_netdev_open ( void ) {
76 78
 	if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 )
77 79
 		return rc;
78 80
 
81
+	netdev_rx_freeze ( pxe_netdev );
79 82
 	netdev_irq ( pxe_netdev, 1 );
80 83
 	return 0;
81 84
 }
@@ -85,6 +88,7 @@ static int pxe_netdev_open ( void ) {
85 88
  *
86 89
  */
87 90
 static void pxe_netdev_close ( void ) {
91
+	netdev_rx_unfreeze ( pxe_netdev );
88 92
 	netdev_irq ( pxe_netdev, 0 );
89 93
 	netdev_close ( pxe_netdev );
90 94
 	undi_tx_count = 0;
@@ -234,10 +238,11 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
234 238
 
235 239
 	DBG2 ( "PXENV_UNDI_TRANSMIT" );
236 240
 
237
-	/* Forcibly enable interrupts at this point, to work around
238
-	 * callers that never call PXENV_UNDI_OPEN before attempting
239
-	 * to use the UNDI API.
241
+	/* Forcibly enable interrupts and freeze receive queue
242
+	 * processing at this point, to work around callers that never
243
+	 * call PXENV_UNDI_OPEN before attempting to use the UNDI API.
240 244
 	 */
245
+	netdev_rx_freeze ( pxe_netdev );
241 246
 	netdev_irq ( pxe_netdev, 1 );
242 247
 
243 248
 	/* Identify network-layer protocol */
@@ -670,7 +675,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
670 675
 		/* Call poll().  This should acknowledge the device
671 676
 		 * interrupt and queue up any received packet.
672 677
 		 */
673
-		netdev_poll ( pxe_netdev );
678
+		net_poll();
674 679
 
675 680
 		/* A 100% accurate determination of "OURS" vs "NOT
676 681
 		 * OURS" is difficult to achieve without invasive and
@@ -709,7 +714,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
709 714
 		 * PXENV_UNDI_ISR_IN_PROCESS.  Force extra polls to
710 715
 		 * cope with these out-of-spec clients.
711 716
 		 */
712
-		netdev_poll ( pxe_netdev );
717
+		net_poll();
713 718
 
714 719
 		/* If we have not yet marked a TX as complete, and the
715 720
 		 * netdev TX queue is empty, report the TX completion.

Loading…
Cancel
Save