aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2013-10-03 17:16:33 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-09 15:50:51 -0400
commit61000861e860baf5f21b8d2bcd784810bfb0ad06 (patch)
tree5180e87b8f7c5f5b60d0f50334b5d24d77bf2b73
parent3d7d562ca4a884089344eb13451b5903a18d3817 (diff)
be2net: Call version 2 of GET_STATS ioctl for Skyhawk-R
Moving to version 2 of GET_STATS command as SkyHawk-R supports higher number of rings. Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c6
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h84
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c74
3 files changed, 155 insertions, 9 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 787bce8c5246..2d554366b342 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1436,8 +1436,12 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
1436 OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, nonemb_cmd); 1436 OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, nonemb_cmd);
1437 1437
1438 /* version 1 of the cmd is not supported only by BE2 */ 1438 /* version 1 of the cmd is not supported only by BE2 */
1439 if (!BE2_chip(adapter)) 1439 if (BE2_chip(adapter))
1440 hdr->version = 0;
1441 if (BE3_chip(adapter) || lancer_chip(adapter))
1440 hdr->version = 1; 1442 hdr->version = 1;
1443 else
1444 hdr->version = 2;
1441 1445
1442 be_mcc_notify(adapter); 1446 be_mcc_notify(adapter);
1443 adapter->stats_cmd_sent = true; 1447 adapter->stats_cmd_sent = true;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 337ef1f96f0b..88708372d5e5 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1662,6 +1662,67 @@ struct be_erx_stats_v1 {
1662 u32 rsvd[4]; 1662 u32 rsvd[4];
1663}; 1663};
1664 1664
1665struct be_port_rxf_stats_v2 {
1666 u32 rsvd0[10];
1667 u32 roce_bytes_received_lsd;
1668 u32 roce_bytes_received_msd;
1669 u32 rsvd1[5];
1670 u32 roce_frames_received;
1671 u32 rx_crc_errors;
1672 u32 rx_alignment_symbol_errors;
1673 u32 rx_pause_frames;
1674 u32 rx_priority_pause_frames;
1675 u32 rx_control_frames;
1676 u32 rx_in_range_errors;
1677 u32 rx_out_range_errors;
1678 u32 rx_frame_too_long;
1679 u32 rx_address_filtered;
1680 u32 rx_dropped_too_small;
1681 u32 rx_dropped_too_short;
1682 u32 rx_dropped_header_too_small;
1683 u32 rx_dropped_tcp_length;
1684 u32 rx_dropped_runt;
1685 u32 rsvd2[10];
1686 u32 rx_ip_checksum_errs;
1687 u32 rx_tcp_checksum_errs;
1688 u32 rx_udp_checksum_errs;
1689 u32 rsvd3[7];
1690 u32 rx_switched_unicast_packets;
1691 u32 rx_switched_multicast_packets;
1692 u32 rx_switched_broadcast_packets;
1693 u32 rsvd4[3];
1694 u32 tx_pauseframes;
1695 u32 tx_priority_pauseframes;
1696 u32 tx_controlframes;
1697 u32 rsvd5[10];
1698 u32 rxpp_fifo_overflow_drop;
1699 u32 rx_input_fifo_overflow_drop;
1700 u32 pmem_fifo_overflow_drop;
1701 u32 jabber_events;
1702 u32 rsvd6[3];
1703 u32 rx_drops_payload_size;
1704 u32 rx_drops_clipped_header;
1705 u32 rx_drops_crc;
1706 u32 roce_drops_payload_len;
1707 u32 roce_drops_crc;
1708 u32 rsvd7[19];
1709};
1710
1711struct be_rxf_stats_v2 {
1712 struct be_port_rxf_stats_v2 port[4];
1713 u32 rsvd0[2];
1714 u32 rx_drops_no_pbuf;
1715 u32 rx_drops_no_txpb;
1716 u32 rx_drops_no_erx_descr;
1717 u32 rx_drops_no_tpre_descr;
1718 u32 rsvd1[6];
1719 u32 rx_drops_too_many_frags;
1720 u32 rx_drops_invalid_ring;
1721 u32 forwarded_packets;
1722 u32 rx_drops_mtu;
1723 u32 rsvd2[35];
1724};
1725
1665struct be_hw_stats_v1 { 1726struct be_hw_stats_v1 {
1666 struct be_rxf_stats_v1 rxf; 1727 struct be_rxf_stats_v1 rxf;
1667 u32 rsvd0[BE_TXP_SW_SZ]; 1728 u32 rsvd0[BE_TXP_SW_SZ];
@@ -1680,6 +1741,29 @@ struct be_cmd_resp_get_stats_v1 {
1680 struct be_hw_stats_v1 hw_stats; 1741 struct be_hw_stats_v1 hw_stats;
1681}; 1742};
1682 1743
1744struct be_erx_stats_v2 {
1745 u32 rx_drops_no_fragments[136]; /* dwordS 0 to 135*/
1746 u32 rsvd[3];
1747};
1748
1749struct be_hw_stats_v2 {
1750 struct be_rxf_stats_v2 rxf;
1751 u32 rsvd0[BE_TXP_SW_SZ];
1752 struct be_erx_stats_v2 erx;
1753 struct be_pmem_stats pmem;
1754 u32 rsvd1[18];
1755};
1756
1757struct be_cmd_req_get_stats_v2 {
1758 struct be_cmd_req_hdr hdr;
1759 u8 rsvd[sizeof(struct be_hw_stats_v2)];
1760};
1761
1762struct be_cmd_resp_get_stats_v2 {
1763 struct be_cmd_resp_hdr hdr;
1764 struct be_hw_stats_v2 hw_stats;
1765};
1766
1683/************** get fat capabilites *******************/ 1767/************** get fat capabilites *******************/
1684#define MAX_MODULES 27 1768#define MAX_MODULES 27
1685#define MAX_MODES 4 1769#define MAX_MODES 4
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
433static 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
425static void populate_lancer_stats(struct be_adapter *adapter) 479static 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
490void be_parse_stats(struct be_adapter *adapter) 544void 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);