From: Stephen Hemminger <shemminger@osdl.org>
To: "Eric Lemoine" <eric.lemoine@gmail.com>
Cc: "Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [sungem] proposal for a new locking strategy
Date: Sun, 5 Nov 2006 09:41:36 -0800 [thread overview]
Message-ID: <20061105094136.75677aa4@localhost.localdomain> (raw)
In-Reply-To: <5cac192f0611050928w50127396l2a88978bf97b2bff@mail.gmail.com>
On Sun, 5 Nov 2006 18:28:33 +0100
"Eric Lemoine" <eric.lemoine@gmail.com> wrote:
> > You could also just use net_tx_lock() now.
>
> You mean netif_tx_lock()?
>
> Thanks for letting me know about that function. Yes, I may need it.
> tg3 and bnx2 use it to wake up the transmit queue:
>
> if (unlikely(netif_queue_stopped(tp->dev) &&
> (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH))) {
> netif_tx_lock(tp->dev);
> if (netif_queue_stopped(tp->dev) &&
> (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH))
> netif_wake_queue(tp->dev);
> netif_tx_unlock(tp->dev);
> }
>
> 2.6.17 didn't use it. Was it a bug?
>
> Thanks,
No, it was introduced in 2.6.18. The functions are just a wrapper
around the network device transmit lock that is normally held.
If the device does not need to acquire the lock during IRQ, it
is a good alternative and avoids a second lock.
For transmit locking there are three common alternatives:
Method A: dev->queue_xmit_lock and per-device tx_lock
send: dev->xmit_lock held by caller
dev->hard_start_xmit acquires netdev_priv(dev)->tx_lock
irq: netdev_priv(dev)->tx_lock acquired
Method B: dev->queue_xmit_lock only
send: dev->xmit_lock held by caller
irq: schedules softirq (NAPI)
napi_poll: calls netif_tx_lock() which acquires dev->xmit_lock
Method C: LLTX
set dev->features LLTX
send: no locks held by caller
dev->hard_start_xmit acquires netdev_priv(dev)->tx_lock
irq: netdev_priv(dev)->tx_lock acquired
Method A is the only one that works with 2.4 and early (2.6.8?) kernels.
next prev parent reply other threads:[~2006-11-05 17:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-05 13:00 [sungem] proposal for a new locking strategy Eric Lemoine
2006-11-05 13:05 ` Benjamin Herrenschmidt
2006-11-05 13:17 ` Eric Lemoine
2006-11-05 17:02 ` Stephen Hemminger
2006-11-05 17:28 ` Eric Lemoine
2006-11-05 17:41 ` Stephen Hemminger [this message]
2006-11-05 17:52 ` Eric Lemoine
2006-11-05 18:49 ` Stephen Hemminger
2006-11-05 20:11 ` Eric Lemoine
2006-11-06 17:55 ` Stephen Hemminger
2006-11-06 20:55 ` Eric Lemoine
2006-11-06 20:57 ` Stephen Hemminger
2006-11-06 21:10 ` Eric Lemoine
2006-11-06 21:49 ` Stephen Hemminger
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=20061105094136.75677aa4@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=eric.lemoine@gmail.com \
--cc=netdev@vger.kernel.org \
/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).