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>,
	Eilon Greenstein <eilong@broadcom•com>
Cc: netdev@vger•kernel.org
Subject: [PATCH 3/8] bnx2x: convert to set_phys_id
Date: Mon, 04 Apr 2011 14:06:37 -0700	[thread overview]
Message-ID: <20110404210805.493178297@linuxplumber.net> (raw)
In-Reply-To: 20110404210634.840793593@linuxplumber.net

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

Also cleanup error codes to no lie about things that driver doesn't
support. If device is down report -EAGAIN (same as Broadcom), and 
if port doesn't blink then error as well.

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


--- a/drivers/net/bnx2x/bnx2x_ethtool.c	2011-04-04 12:54:28.927607342 -0700
+++ b/drivers/net/bnx2x/bnx2x_ethtool.c	2011-04-04 12:55:43.108429058 -0700
@@ -2097,36 +2097,38 @@ static void bnx2x_get_ethtool_stats(stru
 	}
 }
 
-static int bnx2x_phys_id(struct net_device *dev, u32 data)
+static int bnx2x_set_phys_id(struct net_device *dev,
+			     enum ethtool_phys_id_state state)
 {
 	struct bnx2x *bp = netdev_priv(dev);
-	int i;
 
 	if (!netif_running(dev))
-		return 0;
+		return -EAGAIN;
 
 	if (!bp->port.pmf)
-		return 0;
+		return -EOPNOTSUPP;
 
-	if (data == 0)
-		data = 2;
+	switch (state) {
+	case ETHTOOL_ID_ACTIVE:
+		return -EINVAL;
 
-	for (i = 0; i < (data * 2); i++) {
-		if ((i % 2) == 0)
-			bnx2x_set_led(&bp->link_params, &bp->link_vars,
-				      LED_MODE_OPER, SPEED_1000);
-		else
-			bnx2x_set_led(&bp->link_params, &bp->link_vars,
-				      LED_MODE_OFF, 0);
+	case ETHTOOL_ID_ON:
+		bnx2x_set_led(&bp->link_params, &bp->link_vars,
+			      LED_MODE_OPER, SPEED_1000);
+		break;
+
+	case ETHTOOL_ID_OFF:
+		bnx2x_set_led(&bp->link_params, &bp->link_vars,
+			      LED_MODE_OFF, 0);
 
-		msleep_interruptible(500);
-		if (signal_pending(current))
-			break;
-	}
+		break;
 
-	if (bp->link_vars.link_up)
-		bnx2x_set_led(&bp->link_params, &bp->link_vars, LED_MODE_OPER,
-			      bp->link_vars.line_speed);
+	case ETHTOOL_ID_INACTIVE:
+		if (bp->link_vars.link_up)
+			bnx2x_set_led(&bp->link_params, &bp->link_vars,
+				      LED_MODE_OPER,
+				      bp->link_vars.line_speed);
+	}
 
 	return 0;
 }
@@ -2218,7 +2220,7 @@ static const struct ethtool_ops bnx2x_et
 	.self_test		= bnx2x_self_test,
 	.get_sset_count		= bnx2x_get_sset_count,
 	.get_strings		= bnx2x_get_strings,
-	.phys_id		= bnx2x_phys_id,
+	.set_phys_id		= bnx2x_set_phys_id,
 	.get_ethtool_stats	= bnx2x_get_ethtool_stats,
 	.get_rxnfc		= bnx2x_get_rxnfc,
 	.get_rxfh_indir		= bnx2x_get_rxfh_indir,



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

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 21:06 [PATCH 0/8] Convert even more drivers to set_phys_id Stephen Hemminger
2011-04-04 21:06 ` [PATCH 1/8] vxge: convert " Stephen Hemminger
2011-04-06 21:36   ` David Miller
2011-04-04 21:06 ` [PATCH 2/8] bnx2: " Stephen Hemminger
2011-04-06 21:36   ` David Miller
2011-04-04 21:06 ` Stephen Hemminger [this message]
2011-04-06 21:36   ` [PATCH 3/8] bnx2x: " David Miller
2011-04-04 21:06 ` [PATCH 4/8] s2io: " Stephen Hemminger
2011-04-04 23:17   ` Ben Hutchings
2011-04-05  1:08     ` Stephen Hemminger
2011-04-05  1:09     ` [PATCH 4/8] s2io: convert to set_phys_id (v2) Stephen Hemminger
2011-04-06 21:36   ` [PATCH 4/8] s2io: convert to set_phys_id David Miller
2011-04-04 21:06 ` [PATCH 5/8] --- drivers/net/niu.c | 33 ++++++++++++++++++--------------- drivers/net/niu.h | 1 + 2 files changed, 19 insertions(+), 15 deletions(-) Stephen Hemminger
2011-04-04 22:31   ` [PATCH 5/8] niu: convert to new ethtool set_phys_id Stephen Hemminger
2011-04-06 21:36     ` David Miller
2011-04-04 21:06 ` [PATCH 6/8] benet: convert to set_phys_id Stephen Hemminger
2011-04-04 22:32   ` Ajit.Khaparde
2011-04-06 21:36   ` David Miller
2011-04-04 21:06 ` [PATCH 7/8] pcnet32: " Stephen Hemminger
2011-04-06 21:36   ` David Miller
2011-04-04 21:06 ` [PATCH 8/8] ewrk3: " Stephen Hemminger
2011-04-04 23:21   ` Ben Hutchings
2011-04-06 21:37   ` David Miller
2011-04-06 21:58     ` Stephen Hemminger
2011-04-06 22:06       ` David Miller

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=20110404210805.493178297@linuxplumber.net \
    --to=shemminger@vyatta$(echo .)com \
    --cc=bhutchings@solarflare$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eilong@broadcom$(echo .)com \
    --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