📄 1014.rtl8139.patch
字号:
+ /* Since this board has a small fixed rx_ring,+ * it is better to toss packets than hold them+ * in the ring.+ */+ if (net_ratelimit())+ printk (KERN_WARNING+ "%s: Memory squeeze, dropping packet.\n",+ dev->name); tp->stats.rx_dropped++; } + spin_lock_irqsave(&tp->lock, flags); cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; RTL_W16 (RxBufPtr, cur_rx - 16); - if (RTL_R16 (IntrStatus) & RxAckBits)+ status = RTL_R16 (IntrStatus) & RxAckBits;+ if (status & (RxFIFOOver | RxOverflow))+ tp->stats.rx_errors++;++ if (status) RTL_W16_F (IntrStatus, RxAckBits);++ if (++rx >= dev->quota)+ break; } DPRINTK ("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x,"@@ -2007,6 +2021,23 @@ RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); tp->cur_rx = cur_rx;+ err:+ *budget -= rx;++ if ((dev->quota -= rx) <= 0) {+ spin_unlock_irqrestore(&tp->lock, flags);+ return 1; /* not done */+ }++ /* last gasp check if interrupt still pending */+ if (RTL_R16 (IntrStatus) & RxAckBits) {+ DPRINTK("%s: going back for more work\n", dev->name);+ goto rescan;+ }+ netif_rx_complete(dev);+ RTL_W16 (IntrMask, rtl8139_intr_mask);+ spin_unlock_irqrestore(&tp->lock, flags);+ return 0; /* done */ } @@ -2032,9 +2063,7 @@ status &= ~RxUnderrun; } - /* XXX along with rtl8139_rx_err, are we double-counting errors? */- if (status &- (RxUnderrun | RxOverflow | RxErr | RxFIFOOver))+ if (status & RxUnderrun) tp->stats.rx_errors++; if (status & PCSTimeout)@@ -2051,7 +2080,6 @@ } } - /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,@@ -2059,74 +2087,66 @@ { struct net_device *dev = (struct net_device *) dev_instance; struct rtl8139_private *tp = dev->priv;- int boguscnt = max_interrupt_work; void *ioaddr = tp->mmio_addr; int ackstat, status; int link_changed = 0; /* avoid bogus "uninit" warning */- int handled = 0; spin_lock (&tp->lock); - do {- status = RTL_R16 (IntrStatus);-- /* h/w no longer present (hotplug?) or major error, bail */- if (status == 0xFFFF)- break;-- if ((status &- (PCIErr | PCSTimeout | RxUnderrun | RxOverflow |- RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0)- break;-- handled = 1;+ status = RTL_R16 (IntrStatus); - /* Acknowledge all of the current interrupt sources ASAP, but- an first get an additional status bit from CSCR. */- if (status & RxUnderrun)- link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;+ /* h/w no longer present (hotplug?) or major error, bail */+ if (unlikely(status == 0xFFFF)) {+ spin_unlock(&tp->lock);+ return IRQ_HANDLED;+ } - /* The chip takes special action when we clear RxAckBits,- * so we clear them later in rtl8139_rx_interrupt- */- ackstat = status & ~(RxAckBits | TxErr);- RTL_W16 (IntrStatus, ackstat);+ /* no interrupt source present */+ if (unlikely((status & rtl8139_intr_mask) == 0)) {+ spin_unlock(&tp->lock);+ return IRQ_NONE;+ } - if (netif_msg_intr(tp))- printk (KERN_DEBUG "%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.\n",- dev->name, status, ackstat, RTL_R16 (IntrStatus));-- if (netif_running (dev) && (status & RxAckBits))- rtl8139_rx_interrupt (dev, tp, ioaddr);-- /* Check uncommon events with one test. */- if (status & (PCIErr | PCSTimeout | RxUnderrun | RxOverflow |- RxFIFOOver | RxErr))- rtl8139_weird_interrupt (dev, tp, ioaddr,- status, link_changed);-- if (netif_running (dev) && (status & (TxOK | TxErr))) {- rtl8139_tx_interrupt (dev, tp, ioaddr);- if (status & TxErr)- RTL_W16 (IntrStatus, TxErr);- }+ /* Acknowledge all of the current interrupt sources ASAP, but+ an first get an additional status bit from CSCR. */+ if (unlikely(status & RxUnderrun))+ link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit; - boguscnt--;- } while (boguscnt > 0);+ /* The chip takes special action when we clear RxAckBits,+ * so we clear them later in poll+ */+ ackstat = status & ~(RxAckBits | TxErr);+ RTL_W16 (IntrStatus, ackstat); - if (boguscnt <= 0) {- printk (KERN_WARNING "%s: Too much work at interrupt, "- "IntrStatus=0x%4.4x.\n", dev->name, status);+ DPRINTK ("%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.\n",+ dev->name, status, ackstat, RTL_R16 (IntrStatus)); - /* Clear all interrupt sources. */- RTL_W16 (IntrStatus, 0xffff);+ /* If received interrupt, then disable furthur interrupts+ * and enable NAPI polling.+ */+ if (netif_running (dev) && (status & RxAckBits)) {+ /* disable more receive interrupts */+ RTL_W16 (IntrMask, rtl8139_intr_mask & ~RxAckBits);+ netif_rx_schedule(dev);+ }++ /* Check uncommon events with one test. */+ if (unlikely(status & (PCIErr|PCSTimeout|RxUnderrun|RxOverflow))) {+ rtl8139_weird_interrupt (dev, tp, ioaddr,+ status, link_changed);+ }++ if (netif_running (dev) && (status & (TxOK | TxErr))) {+ rtl8139_tx_interrupt (dev, tp, ioaddr);+ if (status & TxErr)+ RTL_W16 (IntrStatus, TxErr); } spin_unlock (&tp->lock); DPRINTK ("%s: exiting interrupt, intr_status=%#4.4x.\n", dev->name, RTL_R16 (IntrStatus));- return IRQ_RETVAL(handled);+ return IRQ_HANDLED; } @@ -2149,9 +2169,8 @@ } wait_for_completion (&tp->thr_exited); }- - if (netif_msg_ifdown(tp))- printk(KERN_DEBUG "%s: Shutting down ethercard, status was 0x%4.4x.\n",++ DPRINTK ("%s: Shutting down ethercard, status was 0x%4.4x.\n", dev->name, RTL_R16 (IntrStatus)); spin_lock_irqsave (&tp->lock, flags);@@ -2309,14 +2328,12 @@ static u32 rtl8139_get_msglevel(struct net_device *dev) {- struct rtl8139_private *np = dev->priv;- return np->msg_enable;+ return debug; } static void rtl8139_set_msglevel(struct net_device *dev, u32 datum) {- struct rtl8139_private *np = dev->priv;- np->msg_enable = datum;+ debug = datum; } /* TODO: we are too slack to do reg dumping for pio, for now */@@ -2362,6 +2379,8 @@ memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys)); } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,23) static struct ethtool_ops rtl8139_ethtool_ops = { .get_drvinfo = rtl8139_get_drvinfo, .get_settings = rtl8139_get_settings,@@ -2378,6 +2397,7 @@ .get_stats_count = rtl8139_get_stats_count, .get_ethtool_stats = rtl8139_get_ethtool_stats, };+#endif static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/README.1014.rtl8139.patch linuxmips-2.4.30/README.1014.rtl8139.patch--- linuxmips-2.4.30.ref/README.1014.rtl8139.patch 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/README.1014.rtl8139.patch 2005-03-25 20:09:57.000000000 -0800@@ -0,0 +1,18 @@+Feature:+--------+Updated RTL8139 driver (0.9.27).++Prerequisite patch numbers:+---------------------------+none++Primary author:+---------------+YH Lin++Related to which chip version SMP863x x=?+-----------------------------------------+all++(linux patches) which CONFIG_... are provided:+----------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -