netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [sungem] proposal for a new locking strategy
@ 2006-11-05 13:00 Eric Lemoine
  2006-11-05 13:05 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Lemoine @ 2006-11-05 13:00 UTC (permalink / raw)
  To: David S. Miller, Benjamin Herrenschmidt; +Cc: netdev

Hi!

Some (long) time ago benh wrote a blaming comment in sungem.c about
that driver's locking strategy. That comment basically says that we
probably don't need two spinlocks.

I agree!

Proposal:

Today's sungem effectively uses two spinlock's: "lock" and "tx_lock".

"tx_lock" is held by the xmit function when sending out a packet. Lots
of functions grab "tx_lock" not to mess up with xmit (gem_stop_phy(),
gem_change_mtu(), etc.).

All of these funcs also take "lock"!

What we could do is remove "lx_lock", have the above functions take
only "lock", and rely on dev->_xmit_lock to protect the xmit func from
reentrance. In that case, obviously, the driver wouldn't feature LLTX
anymore.

When (re-)configuring we'd now quiesce the device, with the new
functions gem_netif_stop() and gem_full_lock(), in the same way as tg3
does.

gem_interrupt(), gem_poll(), and gem_start_xmit() could become lockless. Fast!

Basically this proposal makes the data path faster, the control path
slower, and simplifies the code by using one single spinlock within
the driver.

If the idea seems reasonable to you guys I can go ahead and cook up something...

Thanks,

-- 
Eric

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2006-11-06 21:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).