Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- 8139too.c.orig 2021-06-07 23:26:50.000000000 +0300
- +++ 8139too.c 2021-06-13 16:01:10.961650399 +0300
- @@ -140,6 +140,7 @@
- }
- #endif
- +#define TUNE8139_BIG_LOOP 1
- /* A few user-configurable values. */
- /* media options */
- @@ -356,6 +357,7 @@
- RxOK = 0x01,
- RxAckBits = RxFIFOOver | RxOverflow | RxOK,
- + OtherAckBits = PCIErr | PCSTimeout | RxUnderrun | RxErr | TxOK | TxErr,
- };
- enum TxStatusBits {
- @@ -2128,21 +2130,62 @@
- struct rtl8139_private *tp = container_of(napi, struct rtl8139_private, napi);
- struct net_device *dev = tp->dev;
- void __iomem *ioaddr = tp->mmio_addr;
- + int link_changed = 0; /* avoid bogus "uninit" warning */
- + unsigned long flags;
- + u32 status;
- + u16 ackstat;
- +#if TUNE8139_BIG_LOOP
- + int boguscnt = max(NUM_TX_DESC, 4 /* Implying PCIErr, PCSTimeout, RxUnderrun, RxErr */);
- +#endif
- int work_done;
- spin_lock(&tp->rx_lock);
- + spin_lock_irqsave(&tp->lock, flags);
- work_done = 0;
- - if (likely(RTL_R16(IntrStatus) & RxAckBits))
- - work_done += rtl8139_rx(dev, tp, budget);
- - if (work_done < budget) {
- - unsigned long flags;
- + status = RTL_R16(IntrStatus);
- +#if TUNE8139_BIG_LOOP
- + while (((status & RxAckBits) && (work_done < budget)) || ((status & OtherAckBits) && (boguscnt > 0))) {
- +#endif
- + if (status & RxAckBits)
- + work_done += rtl8139_rx(dev, tp, budget);
- +
- + if (status & OtherAckBits) {
- + /* 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;
- +
- + ackstat = status & ~(RxAckBits | TxErr);
- + if (ackstat)
- + RTL_W16 (IntrStatus, ackstat);
- +
- + /* Check uncommon events with one test. */
- + if (unlikely(status & (PCIErr | PCSTimeout | RxUnderrun | RxErr)))
- + rtl8139_weird_interrupt (dev, tp, ioaddr,
- + status, link_changed);
- +
- + if (status & (TxOK | TxErr)) {
- + rtl8139_tx_interrupt (dev, tp, ioaddr);
- + if (status & TxErr)
- + RTL_W16 (IntrStatus, TxErr);
- + }
- +#if TUNE8139_BIG_LOOP
- + boguscnt--;
- +#endif
- + }
- +#if TUNE8139_BIG_LOOP
- + status = RTL_R16 (IntrStatus);
- + }
- +#endif
- - spin_lock_irqsave(&tp->lock, flags);
- - if (napi_complete_done(napi, work_done))
- + if (work_done < budget) {
- + if (napi_complete_done(napi, work_done)) {
- RTL_W16_F(IntrMask, rtl8139_intr_mask);
- - spin_unlock_irqrestore(&tp->lock, flags);
- + }
- }
- +
- + spin_unlock_irqrestore(&tp->lock, flags);
- spin_unlock(&tp->rx_lock);
- return work_done;
- @@ -2155,8 +2198,7 @@
- struct net_device *dev = (struct net_device *) dev_instance;
- struct rtl8139_private *tp = netdev_priv(dev);
- void __iomem *ioaddr = tp->mmio_addr;
- - u16 status, ackstat;
- - int link_changed = 0; /* avoid bogus "uninit" warning */
- + u16 status;
- int handled = 0;
- spin_lock (&tp->lock);
- @@ -2178,33 +2220,9 @@
- goto out;
- }
- - /* 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;
- -
- - ackstat = status & ~(RxAckBits | TxErr);
- - if (ackstat)
- - RTL_W16 (IntrStatus, ackstat);
- -
- - /* Receive packets are processed by poll routine.
- - If not running start it now. */
- - if (status & RxAckBits){
- - if (napi_schedule_prep(&tp->napi)) {
- - RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
- - __napi_schedule(&tp->napi);
- - }
- - }
- -
- - /* Check uncommon events with one test. */
- - if (unlikely(status & (PCIErr | PCSTimeout | RxUnderrun | RxErr)))
- - rtl8139_weird_interrupt (dev, tp, ioaddr,
- - status, link_changed);
- -
- - if (status & (TxOK | TxErr)) {
- - rtl8139_tx_interrupt (dev, tp, ioaddr);
- - if (status & TxErr)
- - RTL_W16 (IntrStatus, TxErr);
- + if (napi_schedule_prep(&tp->napi)) {
- + RTL_W16_F (IntrMask, 0);
- + __napi_schedule(&tp->napi);
- }
- out:
- spin_unlock (&tp->lock);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement