Create a gist now

Instantly share code, notes, and snippets.

--- linux-source-2.6.26/drivers/net/via-velocity.c.1.14a 2009-09-26 21:08:00.000000000 +0900
+++ linux-source-2.6.26/drivers/net/via-velocity.c 2009-09-29 01:09:42.000000000 +0900
@@ -362,7 +362,7 @@
#define INT_WORKS_DEF 20
#define INT_WORKS_MIN 10
-#define INT_WORKS_MAX 64
+#define INT_WORKS_MAX 256
VELOCITY_PARAM(int_works, "Number of packets per interrupt services");
@@ -1445,7 +1445,7 @@
rd_curr++;
if (rd_curr >= vptr->options.numrx)
rd_curr = 0;
- } while (++works <= 15);
+ } while (++works <= vptr->options.int_works);
vptr->rd_curr = rd_curr;
@@ -1686,7 +1686,7 @@
if (td->tdesc0.len & OWNED_BY_NIC)
break;
- if ((works++ > 15))
+ if (works > vptr->options.int_works)
break;
if (td->tdesc0.TSR & TSR0_TERR) {
@@ -1706,12 +1706,16 @@
}
velocity_free_tx_buf(vptr, tdinfo);
vptr->td_used[qnum]--;
+ works++;
}
vptr->td_tail[qnum] = idx;
if (AVAIL_TD(vptr, qnum) < 1) {
full = 1;
}
+
+ if (works > vptr->options.int_works)
+ break;
}
/*
* Look to see if we should kick the transmit network
@@ -2224,8 +2228,7 @@
struct net_device *dev = dev_instance;
struct velocity_info *vptr = netdev_priv(dev);
u32 isr_status;
- int max_count = 0;
-
+ int rx_works = 0, tx_works = 0;
spin_lock(&vptr->lock);
isr_status = mac_read_isr(vptr->mac_regs);
@@ -2237,28 +2240,27 @@
}
mac_disable_int(vptr->mac_regs);
-
+
/*
- * Keep processing the ISR until we have completed
- * processing and the isr_status becomes zero
*/
- while (isr_status != 0) {
- mac_write_isr(vptr->mac_regs, isr_status);
- if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
- velocity_error(vptr, isr_status);
- if (isr_status & (ISR_PRXI | ISR_PPRXI))
- max_count += velocity_rx_srv(vptr, isr_status);
- if (isr_status & (ISR_PTXI | ISR_PPTXI))
- max_count += velocity_tx_srv(vptr, isr_status);
- isr_status = mac_read_isr(vptr->mac_regs);
- if (max_count > vptr->options.int_works)
- {
- printk(KERN_WARNING "%s: excessive work at interrupt.\n",
- dev->name);
- max_count = 0;
- }
+ mac_write_isr(vptr->mac_regs, isr_status);
+
+ if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
+ velocity_error(vptr, isr_status);
+ if (isr_status & (ISR_PRXI | ISR_PPRXI))
+ rx_works = velocity_rx_srv(vptr, isr_status);
+ if (isr_status & (ISR_PTXI | ISR_PPTXI))
+ tx_works = velocity_tx_srv(vptr, isr_status);
+
+ if ((tx_works > vptr->options.int_works
+ || rx_works > vptr->options.int_works)
+ && net_ratelimit())
+ {
+ printk(KERN_WARNING "%s: excessive work at interrupt.\n",
+ dev->name);
}
+
spin_unlock(&vptr->lock);
mac_enable_int(vptr->mac_regs);
return IRQ_HANDLED;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment