From: Francois Romieu <romieu@fr.zoreil.com>
To: jgarzik@pobox.com
Cc: netdev@oss.sgi.com
Subject: [patch 1/2] 2.6.6-rc1-mm1 - spin_unlock_irqrestore avoidance in epic100
Date: Mon, 19 Apr 2004 23:50:14 +0200 [thread overview]
Message-ID: <20040419235014.A20504@electric-eye.fr.zoreil.com> (raw)
This patch avoids to duplicate a spin_unlock:
- it is mostly an artifact due to wild goto;
- it makes the generated code smaller.
diff -puN drivers/net/epic100.c~epic100-napi-40 drivers/net/epic100.c
--- linux-2.6.6-rc1/drivers/net/epic100.c~epic100-napi-40 2004-04-20 00:37:05.000000000 +0200
+++ linux-2.6.6-rc1-fr/drivers/net/epic100.c 2004-04-20 00:37:05.000000000 +0200
@@ -632,7 +632,8 @@ static inline void __epic_pci_commit(lon
#endif
}
-static void epic_napi_irq_off(struct net_device *dev, struct epic_private *ep)
+static inline void epic_napi_irq_off(struct net_device *dev,
+ struct epic_private *ep)
{
long ioaddr = dev->base_addr;
@@ -640,7 +641,8 @@ static void epic_napi_irq_off(struct net
__epic_pci_commit(ioaddr);
}
-static void epic_napi_irq_on(struct net_device *dev, struct epic_private *ep)
+static inline void epic_napi_irq_on(struct net_device *dev,
+ struct epic_private *ep)
{
long ioaddr = dev->base_addr;
@@ -1370,20 +1372,24 @@ rx_action:
if (netif_running(dev) && (work_done < orig_budget)) {
unsigned long flags;
+ int more;
+
+ /* A bit baroque but it avoids a (space hungry) spin_unlock */
spin_lock_irqsave(&ep->napi_lock, flags);
- if (ep->reschedule_in_poll) {
+ more = ep->reschedule_in_poll;
+ if (!more) {
+ __netif_rx_complete(dev);
+ outl(EpicNapiEvent, ioaddr + INTSTAT);
+ epic_napi_irq_on(dev, ep);
+ } else
ep->reschedule_in_poll--;
- spin_unlock_irqrestore(&ep->napi_lock, flags);
- goto rx_action;
- }
-
- outl(EpicNapiEvent, ioaddr + INTSTAT);
- epic_napi_irq_on(dev, ep);
- __netif_rx_complete(dev);
spin_unlock_irqrestore(&ep->napi_lock, flags);
+
+ if (more)
+ goto rx_action;
}
return (work_done >= orig_budget);
_
next reply other threads:[~2004-04-19 21:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-19 21:50 Francois Romieu [this message]
2004-04-19 21:52 ` [patch 2/2] 2.6.6-rc1-mm1 - code removal in the epic100 irq handler Francois Romieu
2004-04-22 3:31 ` [patch 1/2] 2.6.6-rc1-mm1 - spin_unlock_irqrestore avoidance in epic100 Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040419235014.A20504@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).