Hi!
> Don't understand yet what you mean, but the original locking at the
> interrupt handler tail is correct and should not be changed by your
patch.
Forget it. I thought I saw the saved_state variable outside that
function.
I've been seeing the kernel driver and it has some differences, namely,
it has support for the BUF_IDX different from 2 (which I included).
Don't know if that is necessary.
But, for now I don't have time for more. I think that this patch should
solve the situation, but I still have to test with a system.
Next week, maybe I'll have some spare time to port the kernel driver.
Thanks for the help,
Marcelo
Index: stack/include/rtnet.h
===================================================================
--- stack/include/rtnet.h (revision 1106)
+++ stack/include/rtnet.h (working copy)
@@ -36,8 +36,8 @@
#include <stdint.h>
#endif /* !__KERNEL__ */
-typedef uint64_t nanosecs_abs_t;
-typedef int64_t nanosecs_rel_t;
+//typedef uint64_t nanosecs_abs_t;
+//typedef int64_t nanosecs_rel_t;
#define RTDM_TIMEOUT_INFINITE 0
#define RTDM_TIMEOUT_NONE (-1)
Index: drivers/rt_8139too.c
===================================================================
--- drivers/rt_8139too.c (revision 1106)
+++ drivers/rt_8139too.c (working copy)
@@ -379,7 +379,7 @@
/* Twister tuning parameters from RealTek.
- Completely undocumented, but required to tune bad links. */
+ Completely undocumented, but required to tune bad links on some boards. */
enum CSCRBits {
CSCR_LinkOKBit = 0x0400,
CSCR_LinkChangeBit = 0x0800,
@@ -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);
@@ -595,11 +596,34 @@
PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
TxErr | TxOK | RxErr | RxOK;
+
+#if RX_BUF_LEN_IDX == 0
static const unsigned int rtl8139_rx_config =
- RxCfgRcv32K | RxNoWrap |
- (RX_FIFO_THRESH << RxCfgFIFOShift) |
- (RX_DMA_BURST << RxCfgDMAShift);
+ RxCfgRcv8K | RxNoWrap |
+ (RX_FIFO_THRESH << RxCfgFIFOShift) |
+ (RX_DMA_BURST << RxCfgDMAShift);
+#elif RX_BUF_LEN_IDX == 1
+static const unsigned int rtl8139_rx_config =
+ RxCfgRcv16K | RxNoWrap |
+ (RX_FIFO_THRESH << RxCfgFIFOShift) |
+ (RX_DMA_BURST << RxCfgDMAShift);
+#elif RX_BUF_LEN_IDX == 2
+static const unsigned int rtl8139_rx_config =
+ RxCfgRcv32K | RxNoWrap |
+ (RX_FIFO_THRESH << RxCfgFIFOShift) |
+ (RX_DMA_BURST << RxCfgDMAShift);
+#elif RX_BUF_LEN_IDX == 3
+static const unsigned int rtl8139_rx_config =
+ RxCfgRcv64K |
+ (RX_FIFO_THRESH << RxCfgFIFOShift) |
+ (RX_DMA_BURST << RxCfgDMAShift);
+#else
+#error "Invalid configuration for 8139_RX_BUF_LEN_IDX"
+#endif
+
+
+
static const unsigned int rtl8139_tx_config =
TxIFG96 | (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
@@ -1656,6 +1680,26 @@
}
}
+
+
+/* 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 )
+{
+ /* 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 +1718,33 @@
int saved_status = 0;
+
rtdm_lock_get(&tp->lock);
+
+ status = RTL_R16 (IntrStatus);
+ if (rtl8139_check_interrupt_triggered( ioaddr, status ) < 0 )
+ return RTDM_IRQ_NONE;
+
do {
- status = RTL_R16 (IntrStatus);
+ status = RTL_R16 (IntrStatus);
+ if (rtl8139_check_interrupt_triggered( ioaddr, status ) < 0 )
+ break;
/* h/w no longer present (hotplug?) or major error, bail */
- if (status == 0xFFFF)
- break;
+// if (status == 0xFFFF) {
+// return_value = RTDM_IRQ_NONE;
+// break;
+// }
- if ((status &
- (PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0)
- break;
+// if ((status &
+// (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 +1777,14 @@
boguscnt--;
} while (boguscnt > 0);
- if (boguscnt <= 0) {
- rtdm_printk(KERN_WARNING "%s: Too much work at interrupt, "
- "IntrStatus=0x%4.4x.\n", rtdev->name, status);
+ //if (boguscnt <= 0) {
+ //rtdm_printk(KERN_WARNING "%s: Too much work at interrupt, "
+ // "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);
+ rtdm_lock_put(&tp->lock);
if (saved_status & RxAckBits) {
rt_mark_stack_mgr(rtdev);
@@ -1738,6 +1794,7 @@
rtnetif_err_tx(rtdev);
}
+
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