From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>,
Ben Hutchings <bhutchings@solarflare•com>,
Matt Carlson <mcarlson@broadcom•com>,
Michael Chan <mchan@broadcom•com>
Cc: netdev@vger•kernel.org
Subject: [PATCH net-next-2.6 10/12] tg3: implement ethtool set_phys_id
Date: Mon, 04 Apr 2011 11:43:50 -0700 [thread overview]
Message-ID: <20110404184502.194825403@linuxplumber.net> (raw)
In-Reply-To: 20110404184340.604594357@linuxplumber.net
[-- Attachment #1: tg3-set-phys-id.patch --]
[-- Type: text/plain, Size: 2073 bytes --]
Implement control of LED via set_phys_id.
Note: since PHY is powered off if device is down, this board
only allows blinking if device is up.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/drivers/net/tg3.c 2011-04-04 11:04:20.373199183 -0700
+++ b/drivers/net/tg3.c 2011-04-04 11:05:19.485863394 -0700
@@ -10317,35 +10317,38 @@ static void tg3_get_strings(struct net_d
}
}
-static int tg3_phys_id(struct net_device *dev, u32 data)
+static int tg3_set_phys_id(struct net_device *dev,
+ enum ethtool_phys_id_state state)
{
struct tg3 *tp = netdev_priv(dev);
- int i;
if (!netif_running(tp->dev))
return -EAGAIN;
- if (data == 0)
- data = UINT_MAX / 2;
+ switch (state) {
+ case ETHTOOL_ID_ACTIVE:
+ return -EINVAL;
- for (i = 0; i < (data * 2); i++) {
- if ((i % 2) == 0)
- tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE |
- LED_CTRL_1000MBPS_ON |
- LED_CTRL_100MBPS_ON |
- LED_CTRL_10MBPS_ON |
- LED_CTRL_TRAFFIC_OVERRIDE |
- LED_CTRL_TRAFFIC_BLINK |
- LED_CTRL_TRAFFIC_LED);
+ case ETHTOOL_ID_ON:
+ tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE |
+ LED_CTRL_1000MBPS_ON |
+ LED_CTRL_100MBPS_ON |
+ LED_CTRL_10MBPS_ON |
+ LED_CTRL_TRAFFIC_OVERRIDE |
+ LED_CTRL_TRAFFIC_BLINK |
+ LED_CTRL_TRAFFIC_LED);
+ break;
- else
- tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE |
- LED_CTRL_TRAFFIC_OVERRIDE);
+ case ETHTOOL_ID_OFF:
+ tw32(MAC_LED_CTRL, LED_CTRL_LNKLED_OVERRIDE |
+ LED_CTRL_TRAFFIC_OVERRIDE);
+ break;
- if (msleep_interruptible(500))
- break;
+ case ETHTOOL_ID_INACTIVE:
+ tw32(MAC_LED_CTRL, tp->led_ctrl);
+ break;
}
- tw32(MAC_LED_CTRL, tp->led_ctrl);
+
return 0;
}
@@ -11371,7 +11374,7 @@ static const struct ethtool_ops tg3_etht
.set_tso = tg3_set_tso,
.self_test = tg3_self_test,
.get_strings = tg3_get_strings,
- .phys_id = tg3_phys_id,
+ .set_phys_id = tg3_set_phys_id,
.get_ethtool_stats = tg3_get_ethtool_stats,
.get_coalesce = tg3_get_coalesce,
.set_coalesce = tg3_set_coalesce,
next prev parent reply other threads:[~2011-04-04 18:51 UTC|newest]
Thread overview: 39+ 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 ` Stephen Hemminger [this message]
2011-04-06 21:32 ` [PATCH net-next-2.6 10/12] tg3: implement ethtool set_phys_id 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 ` [PATCH net-next-2.6 12/12] qlcnic: convert to set_phys_id Stephen Hemminger
2011-04-06 10:47 ` 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
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.194825403@linuxplumber.net \
--to=shemminger@vyatta$(echo .)com \
--cc=bhutchings@solarflare$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=mcarlson@broadcom$(echo .)com \
--cc=mchan@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