Re: [PATCH 6/n] forcedeth: protect slow path with mutex
From: Jeff Garzik
Date: Sun Oct 07 2007 - 10:40:50 EST
Jeff Garzik wrote:
commit abca163a14b28c234df9bf38034bc967ff81c3aa
Author: Jeff Garzik <jeff@xxxxxxxxxx>
Date: Sun Oct 7 07:22:14 2007 -0400
[netdrvr] forcedeth: wrap slow path hw manipulation inside hw_mutex
* This makes sure everybody who wants to start/stop the RX and TX engines
first acquires this mutex.
* tx_timeout code was deleted, replaced by scheduling reset_task.
* linkchange moved to a workqueue (always inside hw_mutex)
* simplified irq handling a bit
* make sure to disable workqueues before NAPI
Signed-off-by: Jeff Garzik <jgarzik@xxxxxxxxxx>
drivers/net/forcedeth.c | 272 ++++++++++++++++++++++++++++++------------------
1 file changed, 175 insertions(+), 97 deletions(-)
You will need the attached patch to even build (oops).
Also, testing shows there is a mutex deadlock somewhere.
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index d1c1efa..91926b1 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2929,6 +2929,7 @@ static void nv_linkchange_task(struct work_struct *work)
static void nv_link_irq(struct net_device *dev)
{
+ struct fe_priv *np = netdev_priv(dev);
u8 __iomem *base = get_hwbase(dev);
u32 miistat;
@@ -4378,6 +4379,7 @@ static int nv_ethtool_begin (struct net_device *dev)
struct fe_priv *np = get_nvpriv(dev);
mutex_lock(&np->hw_mutex);
+ return 0;
}
static void nv_ethtool_complete (struct net_device *dev)