Hi!
Here comes the first pre-pre-patch. I'm having lots of abnormal
interrupts (other pcs are using the network) so I probably did something
wrong. What do you think?
The rt_8139too driver was coded using documentation besides the driver
inside the kernel?
Thanks for the help,
Marcelo
Index: drivers/rt_8139too.c
===================================================================
--- drivers/rt_8139too.c (revision 1106)
+++ drivers/rt_8139too.c (working copy)
@@ -523,6 +523,7 @@
static int rtl8139_open (struct rtnet_device *rtdev);
static int rtl8139_close (struct rtnet_device *rtdev);
+static int rtl8139_check_interrupt_triggered(void *ioaddr);
static int rtl8139_interrupt (rtdm_irq_t *irq_handle);
static int rtl8139_start_xmit (struct rtskb *skb, struct rtnet_device *rtdev);
@@ -1656,6 +1657,28 @@
}
}
+
+
+/* Function to detect if this device triggered the interrupt.
+ return == 0, => true; return < 0, => false */
+static int rtl8139_check_interrupt_triggered( void *ioaddr)
+{
+ int status = RTL_R16 (IntrStatus);
+
+ /* h/w no longer present (hotplug?) or major error, bail */
+ if (status == 0xFFFF) {
+ return -1;
+ }
+
+ if ((status &
+ (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+
/* The interrupt handler does all of the Rx thread work and cleans up
after the Tx thread. */
static int rtl8139_interrupt(rtdm_irq_t *irq_handle)
@@ -1674,21 +1697,33 @@
int saved_status = 0;
+
rtdm_lock_get(&tp->lock);
+
+ if (rtl8139_check_interrupt_triggered( ioaddr ) == RTDM_IRQ_NONE)
+ return RTDM_IRQ_NONE;
+
do {
- status = RTL_R16 (IntrStatus);
+ if (rtl8139_check_interrupt_triggered( ioaddr ) == RTDM_IRQ_NONE)
+ break;
- /* h/w no longer present (hotplug?) or major error, bail */
- if (status == 0xFFFF)
+ /*status = RTL_R16 (IntrStatus);
+
+ *//* h/w no longer present (hotplug?) or major error, bail */
+ /*if (status == 0xFFFF) {
+ return_value = RTDM_IRQ_NONE;
break;
+ }
if ((status &
- (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0)
+ (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0) {
+ return_value = RTDM_IRQ_NONE;
break;
+ }*/
/* Acknowledge all of the current interrupt sources ASAP, but
- an first get an additional status bit from CSCR. */
+ first get an additional status bit from CSCR. */
if (status & RxUnderrun)
link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;
@@ -1721,14 +1756,13 @@
boguscnt--;
} while (boguscnt > 0);
- if (boguscnt <= 0) {
+ /*if (boguscnt <= 0) {
rtdm_printk(KERN_WARNING "%s: Too much work at interrupt, "
- "IntrStatus=0x%4.4x.\n", rtdev->name, status);
+ "IntrStatus=0x%4.4x.\n", rtdev->name, status);*/
/* Clear all interrupt sources. */
- RTL_W16 (IntrStatus, 0xffff);
- }
+ /*RTL_W16 (IntrStatus, 0xffff);
+ }*/
- rtdm_lock_put(&tp->lock);
if (saved_status & RxAckBits) {
rt_mark_stack_mgr(rtdev);
@@ -1738,6 +1772,8 @@
rtnetif_err_tx(rtdev);
}
+ rtdm_lock_put(&tp->lock);
+
return RTDM_IRQ_HANDLED;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
RTnet-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-developers