diff options
author | Michael Brown <mcb30@etherboot.org> | 2007-07-07 16:43:39 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2007-07-07 16:43:39 +0100 |
commit | 4c418d2100228b1c478908c08f51811a474e0e1e (patch) | |
tree | e55c3fc14b82a642f1a3cf08c2356b0aad907536 /src/interface/pxe | |
parent | 2823688a923b84d1a5683dc153c2ed1c9ecff275 (diff) | |
download | ipxe-4c418d2100228b1c478908c08f51811a474e0e1e.tar.gz |
Use net_device_operations structure and netdev_nullify() to allow for
safe dropping of the netdev ref by the driver while other refs still
exist.
Add netdev_irq() method. Net device open()/close() methods should no
longer enable or disable IRQs.
Remove rx_quota; it wasn't used anywhere and added too much complexity
to implementing correct interrupt-masking behaviour in pxe_undi.c.
Diffstat (limited to 'src/interface/pxe')
-rw-r--r-- | src/interface/pxe/pxe_undi.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/interface/pxe/pxe_undi.c b/src/interface/pxe/pxe_undi.c index cc23de70c..f19dfcc54 100644 --- a/src/interface/pxe/pxe_undi.c +++ b/src/interface/pxe/pxe_undi.c @@ -69,7 +69,13 @@ void pxe_set_netdev ( struct net_device *netdev ) { * @ret rc Return status code */ static int pxe_netdev_open ( void ) { - return netdev_open ( pxe_netdev ); + int rc; + + if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 ) + return rc; + + netdev_irq ( pxe_netdev, 1 ); + return 0; } /** @@ -77,6 +83,7 @@ static int pxe_netdev_open ( void ) { * */ static void pxe_netdev_close ( void ) { + netdev_irq ( pxe_netdev, 0 ); netdev_close ( pxe_netdev ); undi_tx_count = 0; } @@ -543,14 +550,13 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) { /* Call poll(). This should acknowledge the device * interrupt and queue up any received packet. */ - if ( netdev_poll ( pxe_netdev, -1U ) ) { - /* Packet waiting in queue */ - DBG ( " OURS" ); - undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_OURS; - } else { - DBG ( " NOT_OURS" ); - undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_NOT_OURS; - } + netdev_poll ( pxe_netdev ); + + /* Disable interrupts to avoid interrupt storm */ + netdev_irq ( pxe_netdev, 0 ); + + /* Always say it was ours for the sake of simplicity */ + undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_OURS; break; case PXENV_UNDI_ISR_IN_PROCESS : case PXENV_UNDI_ISR_IN_GET_NEXT : @@ -570,6 +576,8 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) { if ( ! iobuf ) { /* No more packets remaining */ undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE; + /* Re-enable interrupts */ + netdev_irq ( pxe_netdev, 1 ); break; } |