[gPXE] [PATCH RESUBMIT] UNDI code for Interrupt vs Polling
Eduardo Habkost
ehabkost at redhat.com
Fri Jan 7 13:16:32 EST 2011
Hi,
I have noticed that the submission for the patch above had some issues
(the initial submission was a reversed patch, and the fixed version had
tab vs spaces corruption).
As I am not sure if a proper version of patch is already queued, so I am
resubmitting it just to make sure a good version of the patch is queued
for inclusion.
Original patch submission is at:
http://etherboot.org/pipermail/gpxe/2010-November/001544.html
Test report is at:
http://etherboot.org/pipermail/gpxe/2010-November/001562.html
Description from the original patch submission:
From: Muralidhar Appalla <Muralidhar.Appalla at emulex.com>
Hi,
Problem Description:
We have noticed that gPXE UNDI code is always expecting interrupt(s) to be
generated by the underlying NIC HW to process the receive path in
undinet_poll() routine. This is causing problem on some of the PCI NIC
controllers where though the NIC device supports IRQ and able to generate
interrupts, during PXE UNDI code some devices do not enable interrupts on
their device and run in polling mode. Those devices expect upper layer UNDI
drivers to poll for the receive packets instead of waiting for interrupt
from the device. But in undinet_poll() routine the code checks for ISR
triggered or not if not it just returns. [(please check "if
(undinet_isr_triggered)" statement ) in undinet_poll()]
Solution Description:
I have attached a patch here to take care of this so that gPXE UNDI code
will work on both types of devices (interrupt & polling supported devices).
The patch is to check whether the device supports IRQ or not in
"ServiceFlags" returned by the API call PXENV_UNDI_GET_IFACE_INFO in
undinet_probe() routine. If the underlying device supports IRQ then enable
the newly introduced flag "irq_supported" in undi_nic structure.
Later in undinet_open() & undinet_close() routines check this flag
(irq_supported) to decide to hook the interrupts or to unhook the
interrupts. Also in undinet_poll() routine check whether interrupt got
generated or not, only if the device supports interrupts otherwise get the
packet from underlying UNDI NIC drivers by calling PXENV_UNDI_ISR using
FuncFlag PXEENV_UNDI_ISR_GET_NEXT.
I am attaching here the patch for review and acceptance.
Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
---
src/arch/i386/drivers/net/undinet.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
Index: gpxe/src/arch/i386/drivers/net/undinet.c
===================================================================
--- gpxe.orig/src/arch/i386/drivers/net/undinet.c
+++ gpxe/src/arch/i386/drivers/net/undinet.c
@@ -46,6 +46,8 @@ struct undi_nic {
int isr_processing;
/** Bug workarounds */
int hacks;
+ /** Flag to indicate device supports IRQ or not */
+ int irq_supported;
};
/**
@@ -421,7 +423,7 @@ static void undinet_poll ( struct net_de
if ( ! undinic->isr_processing ) {
/* Do nothing unless ISR has been triggered */
- if ( ! undinet_isr_triggered() ) {
+ if ( undinic->irq_supported && ! undinet_isr_triggered() ) {
/* Allow interrupt to occur */
__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
"nop\n\t"
@@ -525,10 +527,12 @@ static int undinet_open ( struct net_dev
struct s_PXENV_UNDI_OPEN undi_open;
int rc;
- /* Hook interrupt service routine and enable interrupt */
- undinet_hook_isr ( undinic->irq );
- enable_irq ( undinic->irq );
- send_eoi ( undinic->irq );
+ /* Hook interrupt service routine and enable interrupt if supported */
+ if (undinic->irq_supported) {
+ undinet_hook_isr ( undinic->irq );
+ enable_irq ( undinic->irq );
+ send_eoi ( undinic->irq );
+ }
/* Set station address. Required for some PXE stacks; will
* spuriously fail on others. Ignore failures. We only ever
@@ -592,9 +596,11 @@ static void undinet_close ( struct net_d
undinet_call ( undinic, PXENV_UNDI_CLOSE, &undi_close,
sizeof ( undi_close ) );
- /* Disable interrupt and unhook ISR */
- disable_irq ( undinic->irq );
- undinet_unhook_isr ( undinic->irq );
+ /* Disable interrupt and unhook ISR if supported */
+ if (undinic->irq_supported) {
+ disable_irq ( undinic->irq );
+ undinet_unhook_isr ( undinic->irq );
+ }
DBGC ( undinic, "UNDINIC %p closed\n", undinic );
}
@@ -713,6 +719,8 @@ int undinet_probe ( struct undi_device *
undinic->hacks |= UNDI_HACK_EB54;
}
+ undinic->irq_supported = (undi_iface.ServiceFlags &
+ SUPPORTED_IRQ) ? 1 : 0;
/* Mark as link up; we don't handle link state */
netdev_link_up ( netdev );
--
Eduardo
More information about the gPXE
mailing list