public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>,
	Ben Hutchings <bhutchings@solarflare•com>,
	Amit Kumar Salecha <amit.salecha@qlogic•com>,
	Anirban Chakraborty <anirban.chakraborty@qlogic•com>
Cc: netdev@vger•kernel.org
Subject: [PATCH net-next-2.6 12/12] qlcnic: convert to set_phys_id
Date: Mon, 04 Apr 2011 11:43:52 -0700	[thread overview]
Message-ID: <20110404184502.382340801@linuxplumber.net> (raw)
In-Reply-To: 20110404184340.604594357@linuxplumber.net

[-- Attachment #1: qlcnic-set-phys.patch --]
[-- Type: text/plain, Size: 2635 bytes --]

Convert driver to use new ethtool set_phys_id.
Not completely sure that this is correct for all cases of device
up/down and doing operation. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>

--- a/drivers/net/qlcnic/qlcnic_ethtool.c	2011-04-04 11:30:54.689092370 -0700
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c	2011-04-04 11:36:55.776744627 -0700
@@ -831,48 +831,51 @@ static int qlcnic_set_tso(struct net_dev
 	return 0;
 }
 
-static int qlcnic_blink_led(struct net_device *dev, u32 val)
+static int qlcnic_set_led(struct net_device *dev,
+			  enum ethtool_phys_id_state state)
 {
 	struct qlcnic_adapter *adapter = netdev_priv(dev);
 	int max_sds_rings = adapter->max_sds_rings;
-	int dev_down = 0;
 	int ret;
 
-	if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
-		dev_down = 1;
-		if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
-			return -EIO;
-
-		ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST);
+	switch (state) {
+	case ETHTOOL_ID_ACTIVE:
+		if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
+			if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
+				return -EIO;
+
+			ret = qlcnic_diag_alloc_res(dev, QLCNIC_LED_TEST);
+			if (ret) {
+				clear_bit(__QLCNIC_RESETTING, &adapter->state);
+				return ret;
+			}
+		}
+
+		ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
 		if (ret) {
-			clear_bit(__QLCNIC_RESETTING, &adapter->state);
-			return ret;
+			dev_err(&adapter->pdev->dev,
+				"Failed to set LED blink state.\n");
+			break;
 		}
-	}
-
-	ret = adapter->nic_ops->config_led(adapter, 1, 0xf);
-	if (ret) {
-		dev_err(&adapter->pdev->dev,
-			"Failed to set LED blink state.\n");
-		goto done;
-	}
+		return 0;
 
-	msleep_interruptible(val * 1000);
+	case ETHTOOL_ID_INACTIVE:
+		ret = adapter->nic_ops->config_led(adapter, 0, 0xf);
+		if (ret)
+			dev_err(&adapter->pdev->dev,
+				"Failed to reset LED blink state.\n");
+		break;
 
-	ret = adapter->nic_ops->config_led(adapter, 0, 0xf);
-	if (ret) {
-		dev_err(&adapter->pdev->dev,
-			"Failed to reset LED blink state.\n");
-		goto done;
+	default:
+		return -EINVAL;
 	}
 
-done:
-	if (dev_down) {
+	if (!netif_running(dev)) {
 		qlcnic_diag_free_res(dev, max_sds_rings);
 		clear_bit(__QLCNIC_RESETTING, &adapter->state);
 	}
-	return ret;
 
+	return ret;
 }
 
 static void
@@ -1080,7 +1083,7 @@ const struct ethtool_ops qlcnic_ethtool_
 	.set_coalesce = qlcnic_set_intr_coalesce,
 	.get_flags = ethtool_op_get_flags,
 	.set_flags = qlcnic_set_flags,
-	.phys_id = qlcnic_blink_led,
+	.set_phys_id = qlcnic_set_led,
 	.set_msglevel = qlcnic_set_msglevel,
 	.get_msglevel = qlcnic_get_msglevel,
 };



  parent reply	other threads:[~2011-04-04 18:51 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 18:43 [PATCH net-next-2.6 00/12] Convert more drivers to ethtool set_phys_id Stephen Hemminger
2011-04-04 18:43 ` [PATCH net-next-2.6 01/12] sky2: support " Stephen Hemminger
2011-04-06 21:30   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 02/12] skge: implement set_phys_id Stephen Hemminger
2011-04-04 22:57   ` Ben Hutchings
2011-04-06 21:37     ` David Miller
2011-04-06 21:30   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 03/12] e100: implemenet set_phys_id Stephen Hemminger
2011-04-06 21:31   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 04/12] e1000: convert to set_phys_id Stephen Hemminger
2011-04-06 21:31   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 05/12] e1000e: implement ethtool set_phys_id Stephen Hemminger
2011-04-06 21:31   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 06/12] igb: convert to " Stephen Hemminger
2011-04-06 21:31   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 07/12] igbvf: remove bogus phys_id Stephen Hemminger
2011-04-04 21:27   ` Rose, Gregory V
2011-04-06 21:31   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 08/12] ixgbe: convert to ethtool set_phys_id Stephen Hemminger
2011-04-06 21:32   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 09/12] ixgb: convert to set_phys_id Stephen Hemminger
2011-04-06 21:32   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 10/12] tg3: implement ethtool set_phys_id Stephen Hemminger
2011-04-06 21:32   ` David Miller
2011-04-04 18:43 ` [PATCH net-next-2.6 11/12] cxgb3: implement set_phys_id Stephen Hemminger
2011-04-06 21:32   ` David Miller
2011-04-04 18:43 ` Stephen Hemminger [this message]
2011-04-06 10:47   ` [PATCH net-next-2.6 12/12] qlcnic: convert to set_phys_id Amit Salecha
2011-04-06 21:32   ` David Miller
2011-04-06 21:47     ` Stephen Hemminger
2011-04-06 22:06       ` David Miller
2011-04-04 19:53 ` [PATCH net-next-2.6 00/12] Convert more drivers to ethtool set_phys_id Jeff Kirsher
2011-04-04 20:06   ` David Miller
2011-04-04 20:35     ` Jeff Kirsher
2011-04-04 20:14   ` Stephen Hemminger
2011-04-04 20:28     ` Ben Hutchings
2011-04-04 20:32     ` Jeff Kirsher
2011-04-04 20:52       ` Stephen Hemminger
2011-04-04 23:07 ` Ben Hutchings
     [not found] <99737F4847ED0A48AECC9F4A1974A4B80FD1383A55@MNEXMB2.qlogic.org>
2011-04-06 12:56 ` [PATCH net-next-2.6 12/12] qlcnic: convert to set_phys_id Sucheta Chakraborty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110404184502.382340801@linuxplumber.net \
    --to=shemminger@vyatta$(echo .)com \
    --cc=amit.salecha@qlogic$(echo .)com \
    --cc=anirban.chakraborty@qlogic$(echo .)com \
    --cc=bhutchings@solarflare$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox