Patchwork [02/21,next] qlge: Add new functions for signaling link up/down.

login
register
mail settings
Submitter Ron Mercer
Date Jan. 23, 2009, 3:16 p.m.
Message ID <1232723799-8620-2-git-send-email-ron.mercer@qlogic.com>
Download mbox | patch
Permalink /patch/20061/
State Rejected
Delegated to: David Miller
Headers show

Comments

Ron Mercer - Jan. 23, 2009, 3:16 p.m.
Centralize this call as it will also be used by firmware events.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qlge/qlge_main.c |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)
Ben Hutchings - Jan. 23, 2009, 11:23 p.m.
On Fri, 2009-01-23 at 07:16 -0800, Ron Mercer wrote:
> Centralize this call as it will also be used by firmware events.
> 
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
> ---
>  drivers/net/qlge/qlge_main.c |   38 ++++++++++++++++++++++++--------------
>  1 files changed, 24 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
> index a530f5b..e6f9146 100644
> --- a/drivers/net/qlge/qlge_main.c
> +++ b/drivers/net/qlge/qlge_main.c
> @@ -240,6 +240,24 @@ exit:
>  	return status;
>  }
>  
> +static void ql_link_on(struct ql_adapter *qdev)
> +{
> +	if (!netif_carrier_ok(qdev->ndev)) {
> +		QPRINTK(qdev, LINK, INFO, "Link is Up.\n");
> +		netif_carrier_on(qdev->ndev);
> +		netif_wake_queue(qdev->ndev);
> +	}
> +}
> +
> +static void ql_link_off(struct ql_adapter *qdev)
> +{
> +	if (netif_carrier_ok(qdev->ndev)) {
> +		QPRINTK(qdev, LINK, INFO, "Link is Down.\n");
> +		netif_carrier_off(qdev->ndev);
> +		netif_stop_queue(qdev->ndev);
> +	}
> +}
> +

netif_{wake,stop_queue}() are redundant with netif_carrier_{on,off}() so
I think this patch is (mostly?) unnecessary.

Ben.
Ron Mercer - Jan. 24, 2009, 7:32 p.m.
On Fri, Jan 23, 2009 at 03:23:33PM -0800, Ben Hutchings wrote:
> On Fri, 2009-01-23 at 07:16 -0800, Ron Mercer wrote:
> > Centralize this call as it will also be used by firmware events.
> > 
> > Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
> > ---
> >  drivers/net/qlge/qlge_main.c |   38 ++++++++++++++++++++++++--------------
> >  1 files changed, 24 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
> > index a530f5b..e6f9146 100644
> > --- a/drivers/net/qlge/qlge_main.c
> > +++ b/drivers/net/qlge/qlge_main.c
> > @@ -240,6 +240,24 @@ exit:
> >  	return status;
> >  }
> >  
> > +static void ql_link_on(struct ql_adapter *qdev)
> > +{
> > +	if (!netif_carrier_ok(qdev->ndev)) {
> > +		QPRINTK(qdev, LINK, INFO, "Link is Up.\n");
> > +		netif_carrier_on(qdev->ndev);
> > +		netif_wake_queue(qdev->ndev);
> > +	}
> > +}
> > +
> > +static void ql_link_off(struct ql_adapter *qdev)
> > +{
> > +	if (netif_carrier_ok(qdev->ndev)) {
> > +		QPRINTK(qdev, LINK, INFO, "Link is Down.\n");
> > +		netif_carrier_off(qdev->ndev);
> > +		netif_stop_queue(qdev->ndev);
> > +	}
> > +}
> > +
> 
> netif_{wake,stop_queue}() are redundant with netif_carrier_{on,off}() so
> I think this patch is (mostly?) unnecessary.
> 
> Ben.
> 
> -- 
> Ben Hutchings, Senior Software Engineer, Solarflare Communications
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.

Yes, I see that some of the other drivers got rid of the
start/stop/wake.  If I have to re-submit this patch series I will remove
those lines.  If Dave accepts these patches then I will remove the lines
in my next series.

Thanks,
Ron
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index a530f5b..e6f9146 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -240,6 +240,24 @@  exit:
 	return status;
 }
 
+static void ql_link_on(struct ql_adapter *qdev)
+{
+	if (!netif_carrier_ok(qdev->ndev)) {
+		QPRINTK(qdev, LINK, INFO, "Link is Up.\n");
+		netif_carrier_on(qdev->ndev);
+		netif_wake_queue(qdev->ndev);
+	}
+}
+
+static void ql_link_off(struct ql_adapter *qdev)
+{
+	if (netif_carrier_ok(qdev->ndev)) {
+		QPRINTK(qdev, LINK, INFO, "Link is Down.\n");
+		netif_carrier_off(qdev->ndev);
+		netif_stop_queue(qdev->ndev);
+	}
+}
+
 /* Get a specific MAC address from the CAM.  Used for debug and reg dump. */
 int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index,
 			u32 *value)
@@ -1524,15 +1542,13 @@  static void ql_process_mac_tx_intr(struct ql_adapter *qdev,
 /* Fire up a handler to reset the MPI processor. */
 void ql_queue_fw_error(struct ql_adapter *qdev)
 {
-	netif_stop_queue(qdev->ndev);
-	netif_carrier_off(qdev->ndev);
+	ql_link_off(qdev);
 	queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0);
 }
 
 void ql_queue_asic_error(struct ql_adapter *qdev)
 {
-	netif_stop_queue(qdev->ndev);
-	netif_carrier_off(qdev->ndev);
+	ql_link_off(qdev);
 	ql_disable_interrupts(qdev);
 	queue_delayed_work(qdev->workqueue, &qdev->asic_reset_work, 0);
 }
@@ -3116,12 +3132,10 @@  static void ql_display_dev_info(struct net_device *ndev)
 
 static int ql_adapter_down(struct ql_adapter *qdev)
 {
-	struct net_device *ndev = qdev->ndev;
 	int i, status = 0;
 	struct rx_ring *rx_ring;
 
-	netif_stop_queue(ndev);
-	netif_carrier_off(ndev);
+	ql_link_off(qdev);
 
 	cancel_delayed_work_sync(&qdev->asic_reset_work);
 	cancel_delayed_work_sync(&qdev->mpi_reset_work);
@@ -3179,11 +3193,8 @@  static int ql_adapter_up(struct ql_adapter *qdev)
 	set_bit(QL_ADAPTER_UP, &qdev->flags);
 	ql_enable_interrupts(qdev);
 	ql_enable_all_completion_interrupts(qdev);
-	if ((ql_read32(qdev, STS) & qdev->port_init)) {
-		netif_carrier_on(qdev->ndev);
-		netif_start_queue(qdev->ndev);
-	}
-
+	if ((ql_read32(qdev, STS) & qdev->port_init))
+		ql_link_on(qdev);
 	return 0;
 err_init:
 	ql_adapter_reset(qdev);
@@ -3816,8 +3827,7 @@  static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
 
 	pci_set_master(pdev);
 
-	netif_carrier_off(ndev);
-	netif_stop_queue(ndev);
+	ql_link_off(qdev);
 	ql_adapter_reset(qdev);
 
 	/* Make sure the EEPROM is good */