aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/benet/be_ethtool.c')
-rw-r--r--drivers/net/benet/be_ethtool.c79
1 files changed, 74 insertions, 5 deletions
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index f0fd95b43c07..e8f92831021a 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -234,7 +234,7 @@ be_get_ethtool_stats(struct net_device *netdev,
234 struct be_rxf_stats *rxf_stats = &hw_stats->rxf; 234 struct be_rxf_stats *rxf_stats = &hw_stats->rxf;
235 struct be_port_rxf_stats *port_stats = 235 struct be_port_rxf_stats *port_stats =
236 &rxf_stats->port[adapter->port_num]; 236 &rxf_stats->port[adapter->port_num];
237 struct net_device_stats *net_stats = &adapter->stats.net_stats; 237 struct net_device_stats *net_stats = &netdev->stats;
238 struct be_erx_stats *erx_stats = &hw_stats->erx; 238 struct be_erx_stats *erx_stats = &hw_stats->erx;
239 void *p = NULL; 239 void *p = NULL;
240 int i; 240 int i;
@@ -281,16 +281,55 @@ be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
281 } 281 }
282} 282}
283 283
284static int be_get_stats_count(struct net_device *netdev) 284static int be_get_sset_count(struct net_device *netdev, int stringset)
285{ 285{
286 return ETHTOOL_STATS_NUM; 286 switch (stringset) {
287 case ETH_SS_STATS:
288 return ETHTOOL_STATS_NUM;
289 default:
290 return -EINVAL;
291 }
287} 292}
288 293
289static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) 294static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
290{ 295{
291 ecmd->speed = SPEED_10000; 296 struct be_adapter *adapter = netdev_priv(netdev);
297 u8 mac_speed = 0, connector = 0;
298 u16 link_speed = 0;
299 bool link_up = false;
300
301 be_cmd_link_status_query(adapter, &link_up, &mac_speed, &link_speed);
302
303 /* link_speed is in units of 10 Mbps */
304 if (link_speed) {
305 ecmd->speed = link_speed*10;
306 } else {
307 switch (mac_speed) {
308 case PHY_LINK_SPEED_1GBPS:
309 ecmd->speed = SPEED_1000;
310 break;
311 case PHY_LINK_SPEED_10GBPS:
312 ecmd->speed = SPEED_10000;
313 break;
314 }
315 }
292 ecmd->duplex = DUPLEX_FULL; 316 ecmd->duplex = DUPLEX_FULL;
293 ecmd->autoneg = AUTONEG_DISABLE; 317 ecmd->autoneg = AUTONEG_DISABLE;
318 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
319
320 be_cmd_read_port_type(adapter, adapter->port_num, &connector);
321 switch (connector) {
322 case 7:
323 ecmd->port = PORT_FIBRE;
324 break;
325 default:
326 ecmd->port = PORT_TP;
327 break;
328 }
329
330 ecmd->phy_address = adapter->port_num;
331 ecmd->transceiver = XCVR_INTERNAL;
332
294 return 0; 333 return 0;
295} 334}
296 335
@@ -335,6 +374,35 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
335} 374}
336 375
337static int 376static int
377be_phys_id(struct net_device *netdev, u32 data)
378{
379 struct be_adapter *adapter = netdev_priv(netdev);
380 int status;
381 u32 cur;
382
383 if (!netif_running(netdev))
384 return 0;
385
386 be_cmd_get_beacon_state(adapter, adapter->port_num, &cur);
387
388 if (cur == BEACON_STATE_ENABLED)
389 return 0;
390
391 if (data < 2)
392 data = 2;
393
394 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
395 BEACON_STATE_ENABLED);
396 set_current_state(TASK_INTERRUPTIBLE);
397 schedule_timeout(data*HZ);
398
399 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
400 BEACON_STATE_DISABLED);
401
402 return status;
403}
404
405static int
338be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) 406be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
339{ 407{
340 struct be_adapter *adapter = netdev_priv(netdev); 408 struct be_adapter *adapter = netdev_priv(netdev);
@@ -366,7 +434,8 @@ const struct ethtool_ops be_ethtool_ops = {
366 .get_tso = ethtool_op_get_tso, 434 .get_tso = ethtool_op_get_tso,
367 .set_tso = ethtool_op_set_tso, 435 .set_tso = ethtool_op_set_tso,
368 .get_strings = be_get_stat_strings, 436 .get_strings = be_get_stat_strings,
369 .get_stats_count = be_get_stats_count, 437 .phys_id = be_phys_id,
438 .get_sset_count = be_get_sset_count,
370 .get_ethtool_stats = be_get_ethtool_stats, 439 .get_ethtool_stats = be_get_ethtool_stats,
371 .flash_device = be_do_flash, 440 .flash_device = be_do_flash,
372}; 441};