Browse Source

[pxe] Use network device receive queue freezing

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 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
  * @v netdev		Network device, or NULL
58
  * @v netdev		Network device, or NULL
59
  */
59
  */
60
 void pxe_set_netdev ( struct net_device *netdev ) {
60
 void pxe_set_netdev ( struct net_device *netdev ) {
61
-	if ( pxe_netdev )
61
+	if ( pxe_netdev ) {
62
+		netdev_rx_unfreeze ( pxe_netdev );
62
 		netdev_put ( pxe_netdev );
63
 		netdev_put ( pxe_netdev );
64
+	}
63
 	pxe_netdev = NULL;
65
 	pxe_netdev = NULL;
64
 	if ( netdev )
66
 	if ( netdev )
65
 		pxe_netdev = netdev_get ( netdev );
67
 		pxe_netdev = netdev_get ( netdev );
76
 	if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 )
78
 	if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 )
77
 		return rc;
79
 		return rc;
78
 
80
 
81
+	netdev_rx_freeze ( pxe_netdev );
79
 	netdev_irq ( pxe_netdev, 1 );
82
 	netdev_irq ( pxe_netdev, 1 );
80
 	return 0;
83
 	return 0;
81
 }
84
 }
85
  *
88
  *
86
  */
89
  */
87
 static void pxe_netdev_close ( void ) {
90
 static void pxe_netdev_close ( void ) {
91
+	netdev_rx_unfreeze ( pxe_netdev );
88
 	netdev_irq ( pxe_netdev, 0 );
92
 	netdev_irq ( pxe_netdev, 0 );
89
 	netdev_close ( pxe_netdev );
93
 	netdev_close ( pxe_netdev );
90
 	undi_tx_count = 0;
94
 	undi_tx_count = 0;
234
 
238
 
235
 	DBG2 ( "PXENV_UNDI_TRANSMIT" );
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
 	netdev_irq ( pxe_netdev, 1 );
246
 	netdev_irq ( pxe_netdev, 1 );
242
 
247
 
243
 	/* Identify network-layer protocol */
248
 	/* Identify network-layer protocol */
670
 		/* Call poll().  This should acknowledge the device
675
 		/* Call poll().  This should acknowledge the device
671
 		 * interrupt and queue up any received packet.
676
 		 * interrupt and queue up any received packet.
672
 		 */
677
 		 */
673
-		netdev_poll ( pxe_netdev );
678
+		net_poll();
674
 
679
 
675
 		/* A 100% accurate determination of "OURS" vs "NOT
680
 		/* A 100% accurate determination of "OURS" vs "NOT
676
 		 * OURS" is difficult to achieve without invasive and
681
 		 * OURS" is difficult to achieve without invasive and
709
 		 * PXENV_UNDI_ISR_IN_PROCESS.  Force extra polls to
714
 		 * PXENV_UNDI_ISR_IN_PROCESS.  Force extra polls to
710
 		 * cope with these out-of-spec clients.
715
 		 * cope with these out-of-spec clients.
711
 		 */
716
 		 */
712
-		netdev_poll ( pxe_netdev );
717
+		net_poll();
713
 
718
 
714
 		/* If we have not yet marked a TX as complete, and the
719
 		/* If we have not yet marked a TX as complete, and the
715
 		 * netdev TX queue is empty, report the TX completion.
720
 		 * netdev TX queue is empty, report the TX completion.

Loading…
Cancel
Save