* [PATCH] pcmcia: worklimit reaches -1
@ 2009-02-25 12:26 Roel Kluin
2009-03-04 8:06 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-02-25 12:26 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-pcmcia, Andrew Morton
------------------------------>8-------------8<---------------------------------
with while (--worklimit >= 0); worklimit reaches -1 after the loop. In
3c589_cs.c this caused a warning not to be printed.
In 3c574_cs.c contrastingly, el3_rx() treats worklimit differently:
static int el3_rx(struct net_device *dev, int worklimit)
{
while (--worklimit >= 0) { ... }
return worklimit;
}
el3_rx() is only called by function el3_interrupt(): twice:
static irqreturn_t el3_interrupt(int irq, void *dev_id)
{
int work_budget = max_interrupt_work;
while(...) {
if (...)
work_budget = el3_rx(dev, work_budget);
if (...)
work_budget = el3_rx(dev, work_budget);
if (--work_budget < 0) {
...
break;
}
}
}
The error path can occur 2 too early.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
el3_rx() calls: lines 839 and 856
el3_interrupt(): line 810
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index e5cb6b1..2404a83 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -1035,7 +1035,8 @@ static int el3_rx(struct net_device *dev, int worklimit)
DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
- (--worklimit >= 0)) {
+ worklimit > 0) {
+ worklimit--;
if (rx_status & 0x4000) { /* Error, update stats. */
short error = rx_status & 0x3800;
dev->stats.rx_errors++;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 73ecc65..1e01b8a 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -857,7 +857,8 @@ static int el3_rx(struct net_device *dev)
DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
- (--worklimit >= 0)) {
+ worklimit > 0) {
+ worklimit--;
if (rx_status & 0x4000) { /* Error, update stats. */
short error = rx_status & 0x3800;
dev->stats.rx_errors++;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] pcmcia: worklimit reaches -1
@ 2009-02-26 21:37 Komuro
0 siblings, 0 replies; 3+ messages in thread
From: Komuro @ 2009-02-26 21:37 UTC (permalink / raw)
To: netdev; +Cc: roel.kluin
In 3c574_cs.c,
workslimit becomes -2 ,so it works.
> if (--work_budget < 0) {
> ...
> break;
el3_interrupt() returns true, if it handled at least one interrupt.
Best Regards
Komuro
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pcmcia: worklimit reaches -1
2009-02-25 12:26 [PATCH] pcmcia: worklimit reaches -1 Roel Kluin
@ 2009-03-04 8:06 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-03-04 8:06 UTC (permalink / raw)
To: roel.kluin; +Cc: netdev, linux-pcmcia, akpm
From: Roel Kluin <roel.kluin@gmail.com>
Date: Wed, 25 Feb 2009 13:26:19 +0100
> with while (--worklimit >= 0); worklimit reaches -1 after the loop. In
> 3c589_cs.c this caused a warning not to be printed.
...
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-04 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 12:26 [PATCH] pcmcia: worklimit reaches -1 Roel Kluin
2009-03-04 8:06 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2009-02-26 21:37 Komuro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).