* [PATCH 2.6.30 2/2] cxgb3: link fault fixes
@ 2009-05-28 21:23 Divy Le Ray
2009-05-29 8:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Divy Le Ray @ 2009-05-28 21:23 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, swise
From: Divy Le Ray <divy@chelsio.com>
Do not call t3_link_fault() under spinlock, as it calls msleep().
Besides, only the access to pi->link_fault needs to be serialized.
Also initialize local variables before checking the link status,
link state fields might otherwise end up containing garbage.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
---
drivers/net/cxgb3/cxgb3_main.c | 8 +++++---
drivers/net/cxgb3/t3_hw.c | 5 +++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 7ea4841..17858b9 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2496,14 +2496,16 @@ static void check_link_status(struct adapter *adapter)
for_each_port(adapter, i) {
struct net_device *dev = adapter->port[i];
struct port_info *p = netdev_priv(dev);
+ int link_fault;
spin_lock_irq(&adapter->work_lock);
- if (p->link_fault) {
+ link_fault = p->link_fault;
+ spin_unlock_irq(&adapter->work_lock);
+
+ if (link_fault) {
t3_link_fault(adapter, i);
- spin_unlock_irq(&adapter->work_lock);
continue;
}
- spin_unlock_irq(&adapter->work_lock);
if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) {
t3_xgm_intr_disable(adapter, i);
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 4f68aeb..4950d5d 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -1274,6 +1274,11 @@ void t3_link_fault(struct adapter *adapter, int port_id)
A_XGM_INT_STATUS + mac->offset);
link_fault &= F_LINKFAULTCHANGE;
+ link_ok = lc->link_ok;
+ speed = lc->speed;
+ duplex = lc->duplex;
+ fc = lc->fc;
+
phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc);
if (link_fault) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.30 2/2] cxgb3: link fault fixes
2009-05-28 21:23 [PATCH 2.6.30 2/2] cxgb3: link fault fixes Divy Le Ray
@ 2009-05-29 8:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-05-29 8:56 UTC (permalink / raw)
To: divy; +Cc: netdev, linux-kernel, swise
From: Divy Le Ray <divy@chelsio.com>
Date: Thu, 28 May 2009 14:23:08 -0700
> From: Divy Le Ray <divy@chelsio.com>
>
> Do not call t3_link_fault() under spinlock, as it calls msleep().
> Besides, only the access to pi->link_fault needs to be serialized.
>
> Also initialize local variables before checking the link status,
> link state fields might otherwise end up containing garbage.
>
> Signed-off-by: Divy Le Ray <divy@chelsio.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-29 8:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 21:23 [PATCH 2.6.30 2/2] cxgb3: link fault fixes Divy Le Ray
2009-05-29 8:56 ` David Miller
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).