[gPXE] [PATCH RESUBMIT] UNDI code for Interrupt vs Polling
Silver, Geoffrey
Geoffrey.Silver at citadelgroup.com
Fri Jan 7 13:19:43 EST 2011
The patch you attached at the bottom of this e-mail is in fact the patch that I have successfully applied and tested (and am using in production).
--
Geoffrey Silver
Global Infrastructure
131 South Dearborn Street, Chicago, Illinois 60603
T: 312-395-3032 | C: 312-925-3512
gsilver at citadelgroup.com
-----Original Message-----
From: Eduardo Habkost [mailto:ehabkost at redhat.com]
Sent: Friday, January 07, 2011 12:17 PM
To: gpxe at etherboot.org
Cc: Muralidhar.Appalla at emulex.com; Silver, Geoffrey
Subject: [PATCH RESUBMIT] UNDI code for Interrupt vs Polling
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
CONFIDENTIALITY AND SECURITY NOTICE
The contents of this message and any attachments may be confidential and proprietary and also may be covered by the Electronic Communications Privacy Act. This message is not intended to be used by, and should not be relied upon in any way, by any third party. If you are not an intended recipient, please inform the sender of the transmission error and delete this message immediately without reading, disseminating, distributing or copying the contents. Citadel makes no assurances that this e-mail and any attachments are free of viruses and other harmful code.
More information about the gPXE
mailing list