aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSarveshwar Bandi <sarveshwarb@serverengines.com>2009-10-12 07:23:15 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-12 16:26:38 -0400
commitfad9ab2cefd3a3b4754f49eb41e2f43ea314cdce (patch)
tree9eb3a5729fdad7fe2c1746556c0f3328e8a07ee2 /drivers/net
parent3b885787ea4112eaa80945999ea0901bf742707f (diff)
be2net: Implement ethtool get_phys_id function.
Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be_cmds.c59
-rw-r--r--drivers/net/benet/be_cmds.h37
-rw-r--r--drivers/net/benet/be_ethtool.c30
3 files changed, 126 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 89876ade5e33..25b6602e464c 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1118,6 +1118,65 @@ int be_cmd_reset_function(struct be_adapter *adapter)
1118 return status; 1118 return status;
1119} 1119}
1120 1120
1121/* Uses sync mcc */
1122int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num,
1123 u8 bcn, u8 sts, u8 state)
1124{
1125 struct be_mcc_wrb *wrb;
1126 struct be_cmd_req_enable_disable_beacon *req;
1127 int status;
1128
1129 spin_lock_bh(&adapter->mcc_lock);
1130
1131 wrb = wrb_from_mccq(adapter);
1132 req = embedded_payload(wrb);
1133
1134 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1135
1136 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1137 OPCODE_COMMON_ENABLE_DISABLE_BEACON, sizeof(*req));
1138
1139 req->port_num = port_num;
1140 req->beacon_state = state;
1141 req->beacon_duration = bcn;
1142 req->status_duration = sts;
1143
1144 status = be_mcc_notify_wait(adapter);
1145
1146 spin_unlock_bh(&adapter->mcc_lock);
1147 return status;
1148}
1149
1150/* Uses sync mcc */
1151int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state)
1152{
1153 struct be_mcc_wrb *wrb;
1154 struct be_cmd_req_get_beacon_state *req;
1155 int status;
1156
1157 spin_lock_bh(&adapter->mcc_lock);
1158
1159 wrb = wrb_from_mccq(adapter);
1160 req = embedded_payload(wrb);
1161
1162 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1163
1164 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1165 OPCODE_COMMON_GET_BEACON_STATE, sizeof(*req));
1166
1167 req->port_num = port_num;
1168
1169 status = be_mcc_notify_wait(adapter);
1170 if (!status) {
1171 struct be_cmd_resp_get_beacon_state *resp =
1172 embedded_payload(wrb);
1173 *state = resp->beacon_state;
1174 }
1175
1176 spin_unlock_bh(&adapter->mcc_lock);
1177 return status;
1178}
1179
1121int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, 1180int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
1122 u32 flash_type, u32 flash_opcode, u32 buf_size) 1181 u32 flash_type, u32 flash_opcode, u32 buf_size)
1123{ 1182{
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index a86f917f85f4..a1e78cc3e171 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -138,6 +138,8 @@ struct be_mcc_mailbox {
138#define OPCODE_COMMON_NTWK_PMAC_ADD 59 138#define OPCODE_COMMON_NTWK_PMAC_ADD 59
139#define OPCODE_COMMON_NTWK_PMAC_DEL 60 139#define OPCODE_COMMON_NTWK_PMAC_DEL 60
140#define OPCODE_COMMON_FUNCTION_RESET 61 140#define OPCODE_COMMON_FUNCTION_RESET 61
141#define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
142#define OPCODE_COMMON_GET_BEACON_STATE 70
141 143
142#define OPCODE_ETH_ACPI_CONFIG 2 144#define OPCODE_ETH_ACPI_CONFIG 2
143#define OPCODE_ETH_PROMISCUOUS 3 145#define OPCODE_ETH_PROMISCUOUS 3
@@ -699,6 +701,37 @@ struct be_cmd_resp_query_fw_cfg {
699 u32 rsvd[26]; 701 u32 rsvd[26];
700}; 702};
701 703
704/******************** Port Beacon ***************************/
705
706#define BEACON_STATE_ENABLED 0x1
707#define BEACON_STATE_DISABLED 0x0
708
709struct be_cmd_req_enable_disable_beacon {
710 struct be_cmd_req_hdr hdr;
711 u8 port_num;
712 u8 beacon_state;
713 u8 beacon_duration;
714 u8 status_duration;
715} __packed;
716
717struct be_cmd_resp_enable_disable_beacon {
718 struct be_cmd_resp_hdr resp_hdr;
719 u32 rsvd0;
720} __packed;
721
722struct be_cmd_req_get_beacon_state {
723 struct be_cmd_req_hdr hdr;
724 u8 port_num;
725 u8 rsvd0;
726 u16 rsvd1;
727} __packed;
728
729struct be_cmd_resp_get_beacon_state {
730 struct be_cmd_resp_hdr resp_hdr;
731 u8 beacon_state;
732 u8 rsvd0[3];
733} __packed;
734
702/****************** Firmware Flash ******************/ 735/****************** Firmware Flash ******************/
703struct flashrom_params { 736struct flashrom_params {
704 u32 op_code; 737 u32 op_code;
@@ -764,6 +797,10 @@ extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
764 u32 *port_num, u32 *cap); 797 u32 *port_num, u32 *cap);
765extern int be_cmd_reset_function(struct be_adapter *adapter); 798extern int be_cmd_reset_function(struct be_adapter *adapter);
766extern int be_process_mcc(struct be_adapter *adapter); 799extern int be_process_mcc(struct be_adapter *adapter);
800extern int be_cmd_set_beacon_state(struct be_adapter *adapter,
801 u8 port_num, u8 beacon, u8 status, u8 state);
802extern int be_cmd_get_beacon_state(struct be_adapter *adapter,
803 u8 port_num, u32 *state);
767extern int be_cmd_write_flashrom(struct be_adapter *adapter, 804extern int be_cmd_write_flashrom(struct be_adapter *adapter,
768 struct be_dma_mem *cmd, u32 flash_oper, 805 struct be_dma_mem *cmd, u32 flash_oper,
769 u32 flash_opcode, u32 buf_size); 806 u32 flash_opcode, u32 buf_size);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 333729bd6d92..280471e18695 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -338,6 +338,35 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
338} 338}
339 339
340static int 340static int
341be_phys_id(struct net_device *netdev, u32 data)
342{
343 struct be_adapter *adapter = netdev_priv(netdev);
344 int status;
345 u32 cur;
346
347 if (!netif_running(netdev))
348 return 0;
349
350 be_cmd_get_beacon_state(adapter, adapter->port_num, &cur);
351
352 if (cur == BEACON_STATE_ENABLED)
353 return 0;
354
355 if (data < 2)
356 data = 2;
357
358 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
359 BEACON_STATE_ENABLED);
360 set_current_state(TASK_INTERRUPTIBLE);
361 schedule_timeout(data*HZ);
362
363 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
364 BEACON_STATE_DISABLED);
365
366 return status;
367}
368
369static int
341be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) 370be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
342{ 371{
343 struct be_adapter *adapter = netdev_priv(netdev); 372 struct be_adapter *adapter = netdev_priv(netdev);
@@ -369,6 +398,7 @@ const struct ethtool_ops be_ethtool_ops = {
369 .get_tso = ethtool_op_get_tso, 398 .get_tso = ethtool_op_get_tso,
370 .set_tso = ethtool_op_set_tso, 399 .set_tso = ethtool_op_set_tso,
371 .get_strings = be_get_stat_strings, 400 .get_strings = be_get_stat_strings,
401 .phys_id = be_phys_id,
372 .get_sset_count = be_get_sset_count, 402 .get_sset_count = be_get_sset_count,
373 .get_ethtool_stats = be_get_ethtool_stats, 403 .get_ethtool_stats = be_get_ethtool_stats,
374 .flash_device = be_do_flash, 404 .flash_device = be_do_flash,