netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] qla3xxx: bugfixes to link management.
@ 2007-11-07 21:56 Ron Mercer
  2007-11-07 21:59 ` [PATCH 1/2] qla3xxx: bugfix: Move link state machine into a worker thread Ron Mercer
  2007-11-07 21:59 ` [PATCH 2/2] qla3xxx: bugfix: Fix bad logical operation in link state machine Ron Mercer
  0 siblings, 2 replies; 4+ messages in thread
From: Ron Mercer @ 2007-11-07 21:56 UTC (permalink / raw)
  To: jeff; +Cc: netdev

Hi Jeff,

The attached two patches fix a couple of problems in the link management.
Built and tested on today's netdev/upstream.
Regards,
Ron Mercer

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>



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

* [PATCH 1/2] qla3xxx:  bugfix: Move link state machine into a worker thread
  2007-11-07 21:56 [PATCH 0/2] qla3xxx: bugfixes to link management Ron Mercer
@ 2007-11-07 21:59 ` Ron Mercer
  2007-11-08 17:47   ` Jeff Garzik
  2007-11-07 21:59 ` [PATCH 2/2] qla3xxx: bugfix: Fix bad logical operation in link state machine Ron Mercer
  1 sibling, 1 reply; 4+ messages in thread
From: Ron Mercer @ 2007-11-07 21:59 UTC (permalink / raw)
  To: jeff; +Cc: netdev, Ron Mercer

The link state machine requires access to some resources that
are shared with the iSCSI function on the chip.  (See iSCSI
driver at drivers/scsi/qla4xxx)  If the interface is being
up/downed at a rapid pace this driver may need to sleep
waiting to get access to the common resources. For this we
are moving the state machine to run as a work thread.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qla3xxx.c |   27 +++++++++++++--------------
 drivers/net/qla3xxx.h |    1 +
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 30adf72..4f0fd41 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1645,8 +1645,11 @@ static int ql_finish_auto_neg(struct ql3_adapter *qdev)
 	return 0;
 }
 
-static void ql_link_state_machine(struct ql3_adapter *qdev)
+static void ql_link_state_machine_work(struct work_struct *work)
 {
+	struct ql3_adapter *qdev =
+		container_of(work, struct ql3_adapter, link_state_work.work);
+
 	u32 curr_link_state;
 	unsigned long hw_flags;
 
@@ -1661,6 +1664,10 @@ static void ql_link_state_machine(struct ql3_adapter *qdev)
 			       "state.\n", qdev->ndev->name);
 
 		spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
+
+		/* Restart timer on 2 second interval. */
+		mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);\
+
 		return;
 	}
 
@@ -1705,6 +1712,9 @@ static void ql_link_state_machine(struct ql3_adapter *qdev)
 		break;
 	}
 	spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
+
+	/* Restart timer on 2 second interval. */
+	mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);
 }
 
 /*
@@ -3941,19 +3951,7 @@ static void ql_get_board_info(struct ql3_adapter *qdev)
 static void ql3xxx_timer(unsigned long ptr)
 {
 	struct ql3_adapter *qdev = (struct ql3_adapter *)ptr;
-
-	if (test_bit(QL_RESET_ACTIVE,&qdev->flags)) {
-		printk(KERN_DEBUG PFX
-		       "%s: Reset in progress.\n",
-		       qdev->ndev->name);
-		goto end;
-	}
-
-	ql_link_state_machine(qdev);
-
-	/* Restart timer on 2 second interval. */
-end:
-	mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);
+	queue_delayed_work(qdev->workqueue, &qdev->link_state_work, 0);
 }
 
 static int __devinit ql3xxx_probe(struct pci_dev *pdev,
@@ -4103,6 +4101,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
 	qdev->workqueue = create_singlethread_workqueue(ndev->name);
 	INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work);
 	INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work);
+	INIT_DELAYED_WORK(&qdev->link_state_work, ql_link_state_machine_work);
 
 	init_timer(&qdev->adapter_timer);
 	qdev->adapter_timer.function = ql3xxx_timer;
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h
index fbcb0b9..d0ffb30 100644
--- a/drivers/net/qla3xxx.h
+++ b/drivers/net/qla3xxx.h
@@ -1286,6 +1286,7 @@ struct ql3_adapter {
 	struct workqueue_struct *workqueue;
 	struct delayed_work reset_work;
 	struct delayed_work tx_timeout_work;
+	struct delayed_work link_state_work;
 	u32 max_frame_size;
 	u32 device_id;
 	u16 phyType;
-- 
1.5.0.rc4.16.g9e258


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

* [PATCH 2/2] qla3xxx: bugfix: Fix bad logical operation in link state machine.
  2007-11-07 21:56 [PATCH 0/2] qla3xxx: bugfixes to link management Ron Mercer
  2007-11-07 21:59 ` [PATCH 1/2] qla3xxx: bugfix: Move link state machine into a worker thread Ron Mercer
@ 2007-11-07 21:59 ` Ron Mercer
  1 sibling, 0 replies; 4+ messages in thread
From: Ron Mercer @ 2007-11-07 21:59 UTC (permalink / raw)
  To: jeff; +Cc: netdev, Ron Mercer

Luckily, this wasn't reported or reproduced. The logical operation for
setting duplex had wrong grouping.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qla3xxx.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 4f0fd41..a579111 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1456,16 +1456,11 @@ static void ql_phy_start_neg_ex(struct ql3_adapter *qdev)
 			   PHYAddr[qdev->mac_index]);
 	reg &= ~PHY_GIG_ALL_PARAMS;
 
-	if(portConfiguration &
-	   PORT_CONFIG_FULL_DUPLEX_ENABLED &
-	   PORT_CONFIG_1000MB_SPEED) {
-		reg |= PHY_GIG_ADV_1000F;
-	}
-
-	if(portConfiguration &
-	   PORT_CONFIG_HALF_DUPLEX_ENABLED &
-	   PORT_CONFIG_1000MB_SPEED) {
-		reg |= PHY_GIG_ADV_1000H;
+	if(portConfiguration & PORT_CONFIG_1000MB_SPEED) {
+		if(portConfiguration & PORT_CONFIG_FULL_DUPLEX_ENABLED) 
+			reg |= PHY_GIG_ADV_1000F;
+		else 
+			reg |= PHY_GIG_ADV_1000H;
 	}
 
 	ql_mii_write_reg_ex(qdev, PHY_GIG_CONTROL, reg,
-- 
1.5.0.rc4.16.g9e258


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

* Re: [PATCH 1/2] qla3xxx:  bugfix: Move link state machine into a worker thread
  2007-11-07 21:59 ` [PATCH 1/2] qla3xxx: bugfix: Move link state machine into a worker thread Ron Mercer
@ 2007-11-08 17:47   ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2007-11-08 17:47 UTC (permalink / raw)
  To: Ron Mercer; +Cc: netdev

On Wed, Nov 07, 2007 at 01:59:06PM -0800, Ron Mercer wrote:
> The link state machine requires access to some resources that
> are shared with the iSCSI function on the chip.  (See iSCSI
> driver at drivers/scsi/qla4xxx)  If the interface is being
> up/downed at a rapid pace this driver may need to sleep
> waiting to get access to the common resources. For this we
> are moving the state machine to run as a work thread.
> 
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
> ---
>  drivers/net/qla3xxx.c |   27 +++++++++++++--------------
>  drivers/net/qla3xxx.h |    1 +
>  2 files changed, 14 insertions(+), 14 deletions(-)

applied 1-2


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

end of thread, other threads:[~2007-11-08 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 21:56 [PATCH 0/2] qla3xxx: bugfixes to link management Ron Mercer
2007-11-07 21:59 ` [PATCH 1/2] qla3xxx: bugfix: Move link state machine into a worker thread Ron Mercer
2007-11-08 17:47   ` Jeff Garzik
2007-11-07 21:59 ` [PATCH 2/2] qla3xxx: bugfix: Fix bad logical operation in link state machine Ron Mercer

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