From: Stephen Hemminger <shemminger@vyatta.com>
To: "David S. Miller" <davem@davemloft.net>,
Ben Hutchings <bhutchings@solarflare.com>,
Sathya Perla <sathya.perla@emulex.com>,
Subbu Seetharaman <subbu.seetharaman@emulex.com>,
Ajit Kha
Cc: netdev@vger.kernel.org
Subject: [PATCH 6/8] benet: convert to set_phys_id
Date: Mon, 04 Apr 2011 14:06:40 -0700 [thread overview]
Message-ID: <20110404210805.802043416@linuxplumber.net> (raw)
In-Reply-To: 20110404210634.840793593@linuxplumber.net
[-- Attachment #1: benet-set-phys.patch --]
[-- Type: text/plain, Size: 2410 bytes --]
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/net/benet/be.h | 1
drivers/net/benet/be_ethtool.c | 42 ++++++++++++++++++++++-------------------
2 files changed, 24 insertions(+), 19 deletions(-)
--- a/drivers/net/benet/be.h 2011-04-04 13:27:59.285137429 -0700
+++ b/drivers/net/benet/be.h 2011-04-04 13:31:08.107089776 -0700
@@ -313,6 +313,7 @@ struct be_adapter {
char fw_ver[FW_VER_LEN];
u32 if_handle; /* Used to configure filtering */
u32 pmac_id; /* MAC addr handle used by BE card */
+ u32 beacon_state; /* for set_phys_id */
bool eeh_err;
bool link_up;
--- a/drivers/net/benet/be_ethtool.c 2011-04-04 13:24:55.943254754 -0700
+++ b/drivers/net/benet/be_ethtool.c 2011-04-04 13:32:35.043991789 -0700
@@ -526,29 +526,33 @@ be_set_pauseparam(struct net_device *net
}
static int
-be_phys_id(struct net_device *netdev, u32 data)
+be_set_phys_id(struct net_device *netdev,
+ enum ethtool_phys_id_state state)
{
struct be_adapter *adapter = netdev_priv(netdev);
- int status;
- u32 cur;
-
- be_cmd_get_beacon_state(adapter, adapter->hba_port_num, &cur);
-
- if (cur == BEACON_STATE_ENABLED)
- return 0;
-
- if (data < 2)
- data = 2;
- status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
- BEACON_STATE_ENABLED);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(data*HZ);
+ switch (state) {
+ case ETHTOOL_ID_ACTIVE:
+ be_cmd_get_beacon_state(adapter, adapter->hba_port_num,
+ &adapter->beacon_state);
+ return -EINVAL;
- status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
- BEACON_STATE_DISABLED);
+ case ETHTOOL_ID_ON:
+ be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
+ BEACON_STATE_ENABLED);
+ break;
+
+ case ETHTOOL_ID_OFF:
+ be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
+ BEACON_STATE_DISABLED);
+ break;
+
+ case ETHTOOL_ID_INACTIVE:
+ be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
+ adapter->beacon_state);
+ }
- return status;
+ return 0;
}
static bool
@@ -753,7 +757,7 @@ const struct ethtool_ops be_ethtool_ops
.get_tso = ethtool_op_get_tso,
.set_tso = ethtool_op_set_tso,
.get_strings = be_get_stat_strings,
- .phys_id = be_phys_id,
+ .set_phys_id = be_set_phys_id,
.get_sset_count = be_get_sset_count,
.get_ethtool_stats = be_get_ethtool_stats,
.get_regs_len = be_get_reg_len,
next prev 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 ` [PATCH 3/8] bnx2x: " Stephen Hemminger
2011-04-06 21:36 ` 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 ` Stephen Hemminger [this message]
2011-04-04 22:32 ` [PATCH 6/8] benet: convert to set_phys_id 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.802043416@linuxplumber.net \
--to=shemminger@vyatta.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sathya.perla@emulex.com \
--cc=subbu.seetharaman@emulex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.