diff options
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be_main.c')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 74 |
1 files changed, 66 insertions, 8 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9daee2e8db04..6e3a141c7a67 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -306,10 +306,14 @@ static void *hw_stats_from_cmd(struct be_adapter *adapter) | |||
306 | struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va; | 306 | struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va; |
307 | 307 | ||
308 | return &cmd->hw_stats; | 308 | return &cmd->hw_stats; |
309 | } else { | 309 | } else if (BE3_chip(adapter)) { |
310 | struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va; | 310 | struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va; |
311 | 311 | ||
312 | return &cmd->hw_stats; | 312 | return &cmd->hw_stats; |
313 | } else { | ||
314 | struct be_cmd_resp_get_stats_v2 *cmd = adapter->stats_cmd.va; | ||
315 | |||
316 | return &cmd->hw_stats; | ||
313 | } | 317 | } |
314 | } | 318 | } |
315 | 319 | ||
@@ -320,10 +324,14 @@ static void *be_erx_stats_from_cmd(struct be_adapter *adapter) | |||
320 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); | 324 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); |
321 | 325 | ||
322 | return &hw_stats->erx; | 326 | return &hw_stats->erx; |
323 | } else { | 327 | } else if (BE3_chip(adapter)) { |
324 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); | 328 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); |
325 | 329 | ||
326 | return &hw_stats->erx; | 330 | return &hw_stats->erx; |
331 | } else { | ||
332 | struct be_hw_stats_v2 *hw_stats = hw_stats_from_cmd(adapter); | ||
333 | |||
334 | return &hw_stats->erx; | ||
327 | } | 335 | } |
328 | } | 336 | } |
329 | 337 | ||
@@ -422,6 +430,52 @@ static void populate_be_v1_stats(struct be_adapter *adapter) | |||
422 | adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; | 430 | adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; |
423 | } | 431 | } |
424 | 432 | ||
433 | static void populate_be_v2_stats(struct be_adapter *adapter) | ||
434 | { | ||
435 | struct be_hw_stats_v2 *hw_stats = hw_stats_from_cmd(adapter); | ||
436 | struct be_pmem_stats *pmem_sts = &hw_stats->pmem; | ||
437 | struct be_rxf_stats_v2 *rxf_stats = &hw_stats->rxf; | ||
438 | struct be_port_rxf_stats_v2 *port_stats = | ||
439 | &rxf_stats->port[adapter->port_num]; | ||
440 | struct be_drv_stats *drvs = &adapter->drv_stats; | ||
441 | |||
442 | be_dws_le_to_cpu(hw_stats, sizeof(*hw_stats)); | ||
443 | drvs->pmem_fifo_overflow_drop = port_stats->pmem_fifo_overflow_drop; | ||
444 | drvs->rx_priority_pause_frames = port_stats->rx_priority_pause_frames; | ||
445 | drvs->rx_pause_frames = port_stats->rx_pause_frames; | ||
446 | drvs->rx_crc_errors = port_stats->rx_crc_errors; | ||
447 | drvs->rx_control_frames = port_stats->rx_control_frames; | ||
448 | drvs->rx_in_range_errors = port_stats->rx_in_range_errors; | ||
449 | drvs->rx_frame_too_long = port_stats->rx_frame_too_long; | ||
450 | drvs->rx_dropped_runt = port_stats->rx_dropped_runt; | ||
451 | drvs->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs; | ||
452 | drvs->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs; | ||
453 | drvs->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs; | ||
454 | drvs->rx_dropped_tcp_length = port_stats->rx_dropped_tcp_length; | ||
455 | drvs->rx_dropped_too_small = port_stats->rx_dropped_too_small; | ||
456 | drvs->rx_dropped_too_short = port_stats->rx_dropped_too_short; | ||
457 | drvs->rx_out_range_errors = port_stats->rx_out_range_errors; | ||
458 | drvs->rx_dropped_header_too_small = | ||
459 | port_stats->rx_dropped_header_too_small; | ||
460 | drvs->rx_input_fifo_overflow_drop = | ||
461 | port_stats->rx_input_fifo_overflow_drop; | ||
462 | drvs->rx_address_filtered = port_stats->rx_address_filtered; | ||
463 | drvs->rx_alignment_symbol_errors = | ||
464 | port_stats->rx_alignment_symbol_errors; | ||
465 | drvs->rxpp_fifo_overflow_drop = port_stats->rxpp_fifo_overflow_drop; | ||
466 | drvs->tx_pauseframes = port_stats->tx_pauseframes; | ||
467 | drvs->tx_controlframes = port_stats->tx_controlframes; | ||
468 | drvs->tx_priority_pauseframes = port_stats->tx_priority_pauseframes; | ||
469 | drvs->jabber_events = port_stats->jabber_events; | ||
470 | drvs->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; | ||
471 | drvs->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; | ||
472 | drvs->forwarded_packets = rxf_stats->forwarded_packets; | ||
473 | drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu; | ||
474 | drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr; | ||
475 | drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags; | ||
476 | adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; | ||
477 | } | ||
478 | |||
425 | static void populate_lancer_stats(struct be_adapter *adapter) | 479 | static void populate_lancer_stats(struct be_adapter *adapter) |
426 | { | 480 | { |
427 | 481 | ||
@@ -489,7 +543,7 @@ static void populate_erx_stats(struct be_adapter *adapter, | |||
489 | 543 | ||
490 | void be_parse_stats(struct be_adapter *adapter) | 544 | void be_parse_stats(struct be_adapter *adapter) |
491 | { | 545 | { |
492 | struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter); | 546 | struct be_erx_stats_v2 *erx = be_erx_stats_from_cmd(adapter); |
493 | struct be_rx_obj *rxo; | 547 | struct be_rx_obj *rxo; |
494 | int i; | 548 | int i; |
495 | u32 erx_stat; | 549 | u32 erx_stat; |
@@ -499,11 +553,13 @@ void be_parse_stats(struct be_adapter *adapter) | |||
499 | } else { | 553 | } else { |
500 | if (BE2_chip(adapter)) | 554 | if (BE2_chip(adapter)) |
501 | populate_be_v0_stats(adapter); | 555 | populate_be_v0_stats(adapter); |
502 | else | 556 | else if (BE3_chip(adapter)) |
503 | /* for BE3 and Skyhawk */ | 557 | /* for BE3 */ |
504 | populate_be_v1_stats(adapter); | 558 | populate_be_v1_stats(adapter); |
559 | else | ||
560 | populate_be_v2_stats(adapter); | ||
505 | 561 | ||
506 | /* as erx_v1 is longer than v0, ok to use v1 for v0 access */ | 562 | /* erx_v2 is longer than v0, v1. use v2 for v0, v1 access */ |
507 | for_all_rx_queues(adapter, rxo, i) { | 563 | for_all_rx_queues(adapter, rxo, i) { |
508 | erx_stat = erx->rx_drops_no_fragments[rxo->q.id]; | 564 | erx_stat = erx->rx_drops_no_fragments[rxo->q.id]; |
509 | populate_erx_stats(adapter, rxo, erx_stat); | 565 | populate_erx_stats(adapter, rxo, erx_stat); |
@@ -4102,9 +4158,11 @@ static int be_stats_init(struct be_adapter *adapter) | |||
4102 | cmd->size = sizeof(struct lancer_cmd_req_pport_stats); | 4158 | cmd->size = sizeof(struct lancer_cmd_req_pport_stats); |
4103 | else if (BE2_chip(adapter)) | 4159 | else if (BE2_chip(adapter)) |
4104 | cmd->size = sizeof(struct be_cmd_req_get_stats_v0); | 4160 | cmd->size = sizeof(struct be_cmd_req_get_stats_v0); |
4105 | else | 4161 | else if (BE3_chip(adapter)) |
4106 | /* BE3 and Skyhawk */ | ||
4107 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); | 4162 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); |
4163 | else | ||
4164 | /* ALL non-BE ASICs */ | ||
4165 | cmd->size = sizeof(struct be_cmd_req_get_stats_v2); | ||
4108 | 4166 | ||
4109 | cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, | 4167 | cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, |
4110 | GFP_KERNEL); | 4168 | GFP_KERNEL); |