diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2011-05-16 03:36:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-16 14:13:52 -0400 |
commit | 89a88ab84b946a90839fb66ca3583a2504c11292 (patch) | |
tree | 68ee672b503efdcd24a94500229bbde1393cd402 /drivers/net/benet | |
parent | 538dd2e3976a7c572ee927d6bbebe01bf4d6f128 (diff) |
be2net: Support for version 1 of stats for BE3
Added support to get version 1 of the stats for BE3.
Use old stats command for BE2.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r-- | drivers/net/benet/be.h | 38 | ||||
-rw-r--r-- | drivers/net/benet/be_cmds.c | 32 | ||||
-rw-r--r-- | drivers/net/benet/be_cmds.h | 181 | ||||
-rw-r--r-- | drivers/net/benet/be_ethtool.c | 108 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 182 |
5 files changed, 413 insertions, 128 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 41bbc32123f8..0da0384efee7 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -244,6 +244,43 @@ struct be_rx_obj { | |||
244 | 244 | ||
245 | struct be_drv_stats { | 245 | struct be_drv_stats { |
246 | u8 be_on_die_temperature; | 246 | u8 be_on_die_temperature; |
247 | u32 be_tx_events; | ||
248 | u32 eth_red_drops; | ||
249 | u32 rx_drops_no_pbuf; | ||
250 | u32 rx_drops_no_txpb; | ||
251 | u32 rx_drops_no_erx_descr; | ||
252 | u32 rx_drops_no_tpre_descr; | ||
253 | u32 rx_drops_too_many_frags; | ||
254 | u32 rx_drops_invalid_ring; | ||
255 | u32 forwarded_packets; | ||
256 | u32 rx_drops_mtu; | ||
257 | u32 rx_crc_errors; | ||
258 | u32 rx_alignment_symbol_errors; | ||
259 | u32 rx_pause_frames; | ||
260 | u32 rx_priority_pause_frames; | ||
261 | u32 rx_control_frames; | ||
262 | u32 rx_in_range_errors; | ||
263 | u32 rx_out_range_errors; | ||
264 | u32 rx_frame_too_long; | ||
265 | u32 rx_address_match_errors; | ||
266 | u32 rx_dropped_too_small; | ||
267 | u32 rx_dropped_too_short; | ||
268 | u32 rx_dropped_header_too_small; | ||
269 | u32 rx_dropped_tcp_length; | ||
270 | u32 rx_dropped_runt; | ||
271 | u32 rx_ip_checksum_errs; | ||
272 | u32 rx_tcp_checksum_errs; | ||
273 | u32 rx_udp_checksum_errs; | ||
274 | u32 rx_switched_unicast_packets; | ||
275 | u32 rx_switched_multicast_packets; | ||
276 | u32 rx_switched_broadcast_packets; | ||
277 | u32 tx_pauseframes; | ||
278 | u32 tx_priority_pauseframes; | ||
279 | u32 tx_controlframes; | ||
280 | u32 rxpp_fifo_overflow_drop; | ||
281 | u32 rx_input_fifo_overflow_drop; | ||
282 | u32 pmem_fifo_overflow_drop; | ||
283 | u32 jabber_events; | ||
247 | }; | 284 | }; |
248 | 285 | ||
249 | struct be_vf_cfg { | 286 | struct be_vf_cfg { |
@@ -483,5 +520,6 @@ extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, | |||
483 | u16 num_popped); | 520 | u16 num_popped); |
484 | extern void be_link_status_update(struct be_adapter *adapter, bool link_up); | 521 | extern void be_link_status_update(struct be_adapter *adapter, bool link_up); |
485 | extern void netdev_stats_update(struct be_adapter *adapter); | 522 | extern void netdev_stats_update(struct be_adapter *adapter); |
523 | extern void be_parse_stats(struct be_adapter *adapter); | ||
486 | extern int be_load_fw(struct be_adapter *adapter, u8 *func); | 524 | extern int be_load_fw(struct be_adapter *adapter, u8 *func); |
487 | #endif /* BE_H */ | 525 | #endif /* BE_H */ |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index f2c90997fabd..08e09388789a 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -80,10 +80,20 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
80 | if (compl_status == MCC_STATUS_SUCCESS) { | 80 | if (compl_status == MCC_STATUS_SUCCESS) { |
81 | if ((compl->tag0 == OPCODE_ETH_GET_STATISTICS) && | 81 | if ((compl->tag0 == OPCODE_ETH_GET_STATISTICS) && |
82 | (compl->tag1 == CMD_SUBSYSTEM_ETH)) { | 82 | (compl->tag1 == CMD_SUBSYSTEM_ETH)) { |
83 | struct be_cmd_resp_get_stats *resp = | 83 | if (adapter->generation == BE_GEN3) { |
84 | adapter->stats_cmd.va; | 84 | struct be_cmd_resp_get_stats_v1 *resp = |
85 | be_dws_le_to_cpu(&resp->hw_stats, | 85 | adapter->stats_cmd.va; |
86 | sizeof(resp->hw_stats)); | 86 | |
87 | be_dws_le_to_cpu(&resp->hw_stats, | ||
88 | sizeof(resp->hw_stats)); | ||
89 | } else { | ||
90 | struct be_cmd_resp_get_stats_v0 *resp = | ||
91 | adapter->stats_cmd.va; | ||
92 | |||
93 | be_dws_le_to_cpu(&resp->hw_stats, | ||
94 | sizeof(resp->hw_stats)); | ||
95 | } | ||
96 | be_parse_stats(adapter); | ||
87 | netdev_stats_update(adapter); | 97 | netdev_stats_update(adapter); |
88 | adapter->stats_cmd_sent = false; | 98 | adapter->stats_cmd_sent = false; |
89 | } | 99 | } |
@@ -1075,7 +1085,7 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id, u32 domain) | |||
1075 | int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) | 1085 | int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) |
1076 | { | 1086 | { |
1077 | struct be_mcc_wrb *wrb; | 1087 | struct be_mcc_wrb *wrb; |
1078 | struct be_cmd_req_get_stats *req; | 1088 | struct be_cmd_req_hdr *hdr; |
1079 | struct be_sge *sge; | 1089 | struct be_sge *sge; |
1080 | int status = 0; | 1090 | int status = 0; |
1081 | 1091 | ||
@@ -1089,14 +1099,18 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) | |||
1089 | status = -EBUSY; | 1099 | status = -EBUSY; |
1090 | goto err; | 1100 | goto err; |
1091 | } | 1101 | } |
1092 | req = nonemb_cmd->va; | 1102 | hdr = nonemb_cmd->va; |
1093 | sge = nonembedded_sgl(wrb); | 1103 | sge = nonembedded_sgl(wrb); |
1094 | 1104 | ||
1095 | be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, | 1105 | be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1, |
1096 | OPCODE_ETH_GET_STATISTICS); | 1106 | OPCODE_ETH_GET_STATISTICS); |
1097 | 1107 | ||
1098 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, | 1108 | be_cmd_hdr_prepare(hdr, CMD_SUBSYSTEM_ETH, |
1099 | OPCODE_ETH_GET_STATISTICS, sizeof(*req)); | 1109 | OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size); |
1110 | |||
1111 | if (adapter->generation == BE_GEN3) | ||
1112 | hdr->version = 1; | ||
1113 | |||
1100 | wrb->tag1 = CMD_SUBSYSTEM_ETH; | 1114 | wrb->tag1 = CMD_SUBSYSTEM_ETH; |
1101 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); | 1115 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); |
1102 | sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); | 1116 | sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 78256b65cb03..bcf816d76521 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -568,7 +568,7 @@ struct be_cmd_req_if_destroy { | |||
568 | }; | 568 | }; |
569 | 569 | ||
570 | /*************** HW Stats Get **********************************/ | 570 | /*************** HW Stats Get **********************************/ |
571 | struct be_port_rxf_stats { | 571 | struct be_port_rxf_stats_v0 { |
572 | u32 rx_bytes_lsd; /* dword 0*/ | 572 | u32 rx_bytes_lsd; /* dword 0*/ |
573 | u32 rx_bytes_msd; /* dword 1*/ | 573 | u32 rx_bytes_msd; /* dword 1*/ |
574 | u32 rx_total_frames; /* dword 2*/ | 574 | u32 rx_total_frames; /* dword 2*/ |
@@ -637,8 +637,8 @@ struct be_port_rxf_stats { | |||
637 | u32 rx_input_fifo_overflow; /* dword 65*/ | 637 | u32 rx_input_fifo_overflow; /* dword 65*/ |
638 | }; | 638 | }; |
639 | 639 | ||
640 | struct be_rxf_stats { | 640 | struct be_rxf_stats_v0 { |
641 | struct be_port_rxf_stats port[2]; | 641 | struct be_port_rxf_stats_v0 port[2]; |
642 | u32 rx_drops_no_pbuf; /* dword 132*/ | 642 | u32 rx_drops_no_pbuf; /* dword 132*/ |
643 | u32 rx_drops_no_txpb; /* dword 133*/ | 643 | u32 rx_drops_no_txpb; /* dword 133*/ |
644 | u32 rx_drops_no_erx_descr; /* dword 134*/ | 644 | u32 rx_drops_no_erx_descr; /* dword 134*/ |
@@ -661,34 +661,31 @@ struct be_rxf_stats { | |||
661 | u32 rsvd1[6]; | 661 | u32 rsvd1[6]; |
662 | }; | 662 | }; |
663 | 663 | ||
664 | struct be_erx_stats { | 664 | struct be_erx_stats_v0 { |
665 | u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/ | 665 | u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/ |
666 | u32 debug_wdma_sent_hold; /* dword 44*/ | 666 | u32 rsvd[4]; |
667 | u32 debug_wdma_pbfree_sent_hold; /* dword 45*/ | ||
668 | u32 debug_wdma_zerobyte_pbfree_sent_hold; /* dword 46*/ | ||
669 | u32 debug_pmem_pbuf_dealloc; /* dword 47*/ | ||
670 | }; | 667 | }; |
671 | 668 | ||
672 | struct be_pmem_stats { | 669 | struct be_pmem_stats { |
673 | u32 eth_red_drops; | 670 | u32 eth_red_drops; |
674 | u32 rsvd[4]; | 671 | u32 rsvd[5]; |
675 | }; | 672 | }; |
676 | 673 | ||
677 | struct be_hw_stats { | 674 | struct be_hw_stats_v0 { |
678 | struct be_rxf_stats rxf; | 675 | struct be_rxf_stats_v0 rxf; |
679 | u32 rsvd[48]; | 676 | u32 rsvd[48]; |
680 | struct be_erx_stats erx; | 677 | struct be_erx_stats_v0 erx; |
681 | struct be_pmem_stats pmem; | 678 | struct be_pmem_stats pmem; |
682 | }; | 679 | }; |
683 | 680 | ||
684 | struct be_cmd_req_get_stats { | 681 | struct be_cmd_req_get_stats_v0 { |
685 | struct be_cmd_req_hdr hdr; | 682 | struct be_cmd_req_hdr hdr; |
686 | u8 rsvd[sizeof(struct be_hw_stats)]; | 683 | u8 rsvd[sizeof(struct be_hw_stats_v0)]; |
687 | }; | 684 | }; |
688 | 685 | ||
689 | struct be_cmd_resp_get_stats { | 686 | struct be_cmd_resp_get_stats_v0 { |
690 | struct be_cmd_resp_hdr hdr; | 687 | struct be_cmd_resp_hdr hdr; |
691 | struct be_hw_stats hw_stats; | 688 | struct be_hw_stats_v0 hw_stats; |
692 | }; | 689 | }; |
693 | 690 | ||
694 | struct be_cmd_req_get_cntl_addnl_attribs { | 691 | struct be_cmd_req_get_cntl_addnl_attribs { |
@@ -728,13 +725,6 @@ struct be_cmd_req_mcast_mac_config { | |||
728 | struct macaddr mac[BE_MAX_MC]; | 725 | struct macaddr mac[BE_MAX_MC]; |
729 | } __packed; | 726 | } __packed; |
730 | 727 | ||
731 | static inline struct be_hw_stats * | ||
732 | hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd) | ||
733 | { | ||
734 | return &cmd->hw_stats; | ||
735 | } | ||
736 | |||
737 | |||
738 | /******************* RX FILTER ******************************/ | 728 | /******************* RX FILTER ******************************/ |
739 | struct be_cmd_req_rx_filter { | 729 | struct be_cmd_req_rx_filter { |
740 | struct be_cmd_req_hdr hdr; | 730 | struct be_cmd_req_hdr hdr; |
@@ -1087,6 +1077,151 @@ struct be_cmd_resp_set_func_cap { | |||
1087 | u8 rsvd[212]; | 1077 | u8 rsvd[212]; |
1088 | }; | 1078 | }; |
1089 | 1079 | ||
1080 | /*************** HW Stats Get v1 **********************************/ | ||
1081 | #define BE_TXP_SW_SZ 48 | ||
1082 | struct be_port_rxf_stats_v1 { | ||
1083 | u32 rsvd0[12]; | ||
1084 | u32 rx_crc_errors; | ||
1085 | u32 rx_alignment_symbol_errors; | ||
1086 | u32 rx_pause_frames; | ||
1087 | u32 rx_priority_pause_frames; | ||
1088 | u32 rx_control_frames; | ||
1089 | u32 rx_in_range_errors; | ||
1090 | u32 rx_out_range_errors; | ||
1091 | u32 rx_frame_too_long; | ||
1092 | u32 rx_address_match_errors; | ||
1093 | u32 rx_dropped_too_small; | ||
1094 | u32 rx_dropped_too_short; | ||
1095 | u32 rx_dropped_header_too_small; | ||
1096 | u32 rx_dropped_tcp_length; | ||
1097 | u32 rx_dropped_runt; | ||
1098 | u32 rsvd1[10]; | ||
1099 | u32 rx_ip_checksum_errs; | ||
1100 | u32 rx_tcp_checksum_errs; | ||
1101 | u32 rx_udp_checksum_errs; | ||
1102 | u32 rsvd2[7]; | ||
1103 | u32 rx_switched_unicast_packets; | ||
1104 | u32 rx_switched_multicast_packets; | ||
1105 | u32 rx_switched_broadcast_packets; | ||
1106 | u32 rsvd3[3]; | ||
1107 | u32 tx_pauseframes; | ||
1108 | u32 tx_priority_pauseframes; | ||
1109 | u32 tx_controlframes; | ||
1110 | u32 rsvd4[10]; | ||
1111 | u32 rxpp_fifo_overflow_drop; | ||
1112 | u32 rx_input_fifo_overflow_drop; | ||
1113 | u32 pmem_fifo_overflow_drop; | ||
1114 | u32 jabber_events; | ||
1115 | u32 rsvd5[3]; | ||
1116 | }; | ||
1117 | |||
1118 | |||
1119 | struct be_rxf_stats_v1 { | ||
1120 | struct be_port_rxf_stats_v1 port[4]; | ||
1121 | u32 rsvd0[2]; | ||
1122 | u32 rx_drops_no_pbuf; | ||
1123 | u32 rx_drops_no_txpb; | ||
1124 | u32 rx_drops_no_erx_descr; | ||
1125 | u32 rx_drops_no_tpre_descr; | ||
1126 | u32 rsvd1[6]; | ||
1127 | u32 rx_drops_too_many_frags; | ||
1128 | u32 rx_drops_invalid_ring; | ||
1129 | u32 forwarded_packets; | ||
1130 | u32 rx_drops_mtu; | ||
1131 | u32 rsvd2[14]; | ||
1132 | }; | ||
1133 | |||
1134 | struct be_erx_stats_v1 { | ||
1135 | u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/ | ||
1136 | u32 rsvd[4]; | ||
1137 | }; | ||
1138 | |||
1139 | struct be_hw_stats_v1 { | ||
1140 | struct be_rxf_stats_v1 rxf; | ||
1141 | u32 rsvd0[BE_TXP_SW_SZ]; | ||
1142 | struct be_erx_stats_v1 erx; | ||
1143 | struct be_pmem_stats pmem; | ||
1144 | u32 rsvd1[3]; | ||
1145 | }; | ||
1146 | |||
1147 | struct be_cmd_req_get_stats_v1 { | ||
1148 | struct be_cmd_req_hdr hdr; | ||
1149 | u8 rsvd[sizeof(struct be_hw_stats_v1)]; | ||
1150 | }; | ||
1151 | |||
1152 | struct be_cmd_resp_get_stats_v1 { | ||
1153 | struct be_cmd_resp_hdr hdr; | ||
1154 | struct be_hw_stats_v1 hw_stats; | ||
1155 | }; | ||
1156 | |||
1157 | static inline void * | ||
1158 | hw_stats_from_cmd(struct be_adapter *adapter) | ||
1159 | { | ||
1160 | if (adapter->generation == BE_GEN3) { | ||
1161 | struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va; | ||
1162 | |||
1163 | return &cmd->hw_stats; | ||
1164 | } else { | ||
1165 | struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va; | ||
1166 | |||
1167 | return &cmd->hw_stats; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static inline void *be_port_rxf_stats_from_cmd(struct be_adapter *adapter) | ||
1172 | { | ||
1173 | if (adapter->generation == BE_GEN3) { | ||
1174 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); | ||
1175 | struct be_rxf_stats_v1 *rxf_stats = &hw_stats->rxf; | ||
1176 | |||
1177 | return &rxf_stats->port[adapter->port_num]; | ||
1178 | } else { | ||
1179 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); | ||
1180 | struct be_rxf_stats_v0 *rxf_stats = &hw_stats->rxf; | ||
1181 | |||
1182 | return &rxf_stats->port[adapter->port_num]; | ||
1183 | } | ||
1184 | } | ||
1185 | |||
1186 | static inline void *be_rxf_stats_from_cmd(struct be_adapter *adapter) | ||
1187 | { | ||
1188 | if (adapter->generation == BE_GEN3) { | ||
1189 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); | ||
1190 | |||
1191 | return &hw_stats->rxf; | ||
1192 | } else { | ||
1193 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); | ||
1194 | |||
1195 | return &hw_stats->rxf; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter) | ||
1200 | { | ||
1201 | if (adapter->generation == BE_GEN3) { | ||
1202 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); | ||
1203 | |||
1204 | return &hw_stats->erx; | ||
1205 | } else { | ||
1206 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); | ||
1207 | |||
1208 | return &hw_stats->erx; | ||
1209 | } | ||
1210 | } | ||
1211 | |||
1212 | static inline void *be_pmem_stats_from_cmd(struct be_adapter *adapter) | ||
1213 | { | ||
1214 | if (adapter->generation == BE_GEN3) { | ||
1215 | struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); | ||
1216 | |||
1217 | return &hw_stats->pmem; | ||
1218 | } else { | ||
1219 | struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); | ||
1220 | |||
1221 | return &hw_stats->pmem; | ||
1222 | } | ||
1223 | } | ||
1224 | |||
1090 | extern int be_pci_fnum_get(struct be_adapter *adapter); | 1225 | extern int be_pci_fnum_get(struct be_adapter *adapter); |
1091 | extern int be_cmd_POST(struct be_adapter *adapter); | 1226 | extern int be_cmd_POST(struct be_adapter *adapter); |
1092 | extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | 1227 | extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 8e770e8275df..facfe3ca5c40 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -26,8 +26,8 @@ struct be_ethtool_stat { | |||
26 | int offset; | 26 | int offset; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, | 29 | enum {NETSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, |
30 | PMEMSTAT, DRVSTAT}; | 30 | DRVSTAT}; |
31 | #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ | 31 | #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ |
32 | offsetof(_struct, field) | 32 | offsetof(_struct, field) |
33 | #define NETSTAT_INFO(field) #field, NETSTAT,\ | 33 | #define NETSTAT_INFO(field) #field, NETSTAT,\ |
@@ -37,15 +37,8 @@ enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, | |||
37 | FIELDINFO(struct be_tx_stats, field) | 37 | FIELDINFO(struct be_tx_stats, field) |
38 | #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\ | 38 | #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\ |
39 | FIELDINFO(struct be_rx_stats, field) | 39 | FIELDINFO(struct be_rx_stats, field) |
40 | #define MISCSTAT_INFO(field) #field, MISCSTAT,\ | 40 | #define ERXSTAT_INFO(field) #field, ERXSTAT,\ |
41 | FIELDINFO(struct be_rxf_stats, field) | 41 | FIELDINFO(struct be_erx_stats_v1, field) |
42 | #define PORTSTAT_INFO(field) #field, PORTSTAT,\ | ||
43 | FIELDINFO(struct be_port_rxf_stats, \ | ||
44 | field) | ||
45 | #define ERXSTAT_INFO(field) #field, ERXSTAT,\ | ||
46 | FIELDINFO(struct be_erx_stats, field) | ||
47 | #define PMEMSTAT_INFO(field) #field, PMEMSTAT,\ | ||
48 | FIELDINFO(struct be_pmem_stats, field) | ||
49 | #define DRVSTAT_INFO(field) #field, DRVSTAT,\ | 42 | #define DRVSTAT_INFO(field) #field, DRVSTAT,\ |
50 | FIELDINFO(struct be_drv_stats, \ | 43 | FIELDINFO(struct be_drv_stats, \ |
51 | field) | 44 | field) |
@@ -65,50 +58,41 @@ static const struct be_ethtool_stat et_stats[] = { | |||
65 | {DRVSTAT_TX_INFO(be_tx_stops)}, | 58 | {DRVSTAT_TX_INFO(be_tx_stops)}, |
66 | {DRVSTAT_TX_INFO(be_tx_events)}, | 59 | {DRVSTAT_TX_INFO(be_tx_events)}, |
67 | {DRVSTAT_TX_INFO(be_tx_compl)}, | 60 | {DRVSTAT_TX_INFO(be_tx_compl)}, |
68 | {PORTSTAT_INFO(rx_unicast_frames)}, | 61 | {DRVSTAT_INFO(rx_crc_errors)}, |
69 | {PORTSTAT_INFO(rx_multicast_frames)}, | 62 | {DRVSTAT_INFO(rx_alignment_symbol_errors)}, |
70 | {PORTSTAT_INFO(rx_broadcast_frames)}, | 63 | {DRVSTAT_INFO(rx_pause_frames)}, |
71 | {PORTSTAT_INFO(rx_crc_errors)}, | 64 | {DRVSTAT_INFO(rx_control_frames)}, |
72 | {PORTSTAT_INFO(rx_alignment_symbol_errors)}, | 65 | {DRVSTAT_INFO(rx_in_range_errors)}, |
73 | {PORTSTAT_INFO(rx_pause_frames)}, | 66 | {DRVSTAT_INFO(rx_out_range_errors)}, |
74 | {PORTSTAT_INFO(rx_control_frames)}, | 67 | {DRVSTAT_INFO(rx_frame_too_long)}, |
75 | {PORTSTAT_INFO(rx_in_range_errors)}, | 68 | {DRVSTAT_INFO(rx_address_match_errors)}, |
76 | {PORTSTAT_INFO(rx_out_range_errors)}, | 69 | {DRVSTAT_INFO(rx_dropped_too_small)}, |
77 | {PORTSTAT_INFO(rx_frame_too_long)}, | 70 | {DRVSTAT_INFO(rx_dropped_too_short)}, |
78 | {PORTSTAT_INFO(rx_address_match_errors)}, | 71 | {DRVSTAT_INFO(rx_dropped_header_too_small)}, |
79 | {PORTSTAT_INFO(rx_vlan_mismatch)}, | 72 | {DRVSTAT_INFO(rx_dropped_tcp_length)}, |
80 | {PORTSTAT_INFO(rx_dropped_too_small)}, | 73 | {DRVSTAT_INFO(rx_dropped_runt)}, |
81 | {PORTSTAT_INFO(rx_dropped_too_short)}, | 74 | {DRVSTAT_INFO(rxpp_fifo_overflow_drop)}, |
82 | {PORTSTAT_INFO(rx_dropped_header_too_small)}, | 75 | {DRVSTAT_INFO(rx_input_fifo_overflow_drop)}, |
83 | {PORTSTAT_INFO(rx_dropped_tcp_length)}, | 76 | {DRVSTAT_INFO(rx_ip_checksum_errs)}, |
84 | {PORTSTAT_INFO(rx_dropped_runt)}, | 77 | {DRVSTAT_INFO(rx_tcp_checksum_errs)}, |
85 | {PORTSTAT_INFO(rx_fifo_overflow)}, | 78 | {DRVSTAT_INFO(rx_udp_checksum_errs)}, |
86 | {PORTSTAT_INFO(rx_input_fifo_overflow)}, | 79 | {DRVSTAT_INFO(rx_switched_unicast_packets)}, |
87 | {PORTSTAT_INFO(rx_ip_checksum_errs)}, | 80 | {DRVSTAT_INFO(rx_switched_multicast_packets)}, |
88 | {PORTSTAT_INFO(rx_tcp_checksum_errs)}, | 81 | {DRVSTAT_INFO(rx_switched_broadcast_packets)}, |
89 | {PORTSTAT_INFO(rx_udp_checksum_errs)}, | 82 | {DRVSTAT_INFO(tx_pauseframes)}, |
90 | {PORTSTAT_INFO(rx_non_rss_packets)}, | 83 | {DRVSTAT_INFO(tx_controlframes)}, |
91 | {PORTSTAT_INFO(rx_ipv4_packets)}, | 84 | {DRVSTAT_INFO(rx_priority_pause_frames)}, |
92 | {PORTSTAT_INFO(rx_ipv6_packets)}, | 85 | {DRVSTAT_INFO(pmem_fifo_overflow_drop)}, |
93 | {PORTSTAT_INFO(rx_switched_unicast_packets)}, | 86 | {DRVSTAT_INFO(jabber_events)}, |
94 | {PORTSTAT_INFO(rx_switched_multicast_packets)}, | 87 | {DRVSTAT_INFO(rx_drops_no_pbuf)}, |
95 | {PORTSTAT_INFO(rx_switched_broadcast_packets)}, | 88 | {DRVSTAT_INFO(rx_drops_no_txpb)}, |
96 | {PORTSTAT_INFO(tx_unicastframes)}, | 89 | {DRVSTAT_INFO(rx_drops_no_erx_descr)}, |
97 | {PORTSTAT_INFO(tx_multicastframes)}, | 90 | {DRVSTAT_INFO(rx_drops_no_tpre_descr)}, |
98 | {PORTSTAT_INFO(tx_broadcastframes)}, | 91 | {DRVSTAT_INFO(rx_drops_too_many_frags)}, |
99 | {PORTSTAT_INFO(tx_pauseframes)}, | 92 | {DRVSTAT_INFO(rx_drops_invalid_ring)}, |
100 | {PORTSTAT_INFO(tx_controlframes)}, | 93 | {DRVSTAT_INFO(forwarded_packets)}, |
101 | {MISCSTAT_INFO(rx_drops_no_pbuf)}, | 94 | {DRVSTAT_INFO(rx_drops_mtu)}, |
102 | {MISCSTAT_INFO(rx_drops_no_txpb)}, | 95 | {DRVSTAT_INFO(eth_red_drops)}, |
103 | {MISCSTAT_INFO(rx_drops_no_erx_descr)}, | ||
104 | {MISCSTAT_INFO(rx_drops_no_tpre_descr)}, | ||
105 | {MISCSTAT_INFO(rx_drops_too_many_frags)}, | ||
106 | {MISCSTAT_INFO(rx_drops_invalid_ring)}, | ||
107 | {MISCSTAT_INFO(forwarded_packets)}, | ||
108 | {MISCSTAT_INFO(rx_drops_mtu)}, | ||
109 | {MISCSTAT_INFO(port0_jabber_events)}, | ||
110 | {MISCSTAT_INFO(port1_jabber_events)}, | ||
111 | {PMEMSTAT_INFO(eth_red_drops)}, | ||
112 | {DRVSTAT_INFO(be_on_die_temperature)} | 96 | {DRVSTAT_INFO(be_on_die_temperature)} |
113 | }; | 97 | }; |
114 | #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) | 98 | #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) |
@@ -268,8 +252,6 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
268 | struct ethtool_stats *stats, uint64_t *data) | 252 | struct ethtool_stats *stats, uint64_t *data) |
269 | { | 253 | { |
270 | struct be_adapter *adapter = netdev_priv(netdev); | 254 | struct be_adapter *adapter = netdev_priv(netdev); |
271 | struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats_cmd.va); | ||
272 | struct be_erx_stats *erx_stats = &hw_stats->erx; | ||
273 | struct be_rx_obj *rxo; | 255 | struct be_rx_obj *rxo; |
274 | void *p = NULL; | 256 | void *p = NULL; |
275 | int i, j; | 257 | int i, j; |
@@ -282,15 +264,6 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
282 | case DRVSTAT_TX: | 264 | case DRVSTAT_TX: |
283 | p = &adapter->tx_stats; | 265 | p = &adapter->tx_stats; |
284 | break; | 266 | break; |
285 | case PORTSTAT: | ||
286 | p = &hw_stats->rxf.port[adapter->port_num]; | ||
287 | break; | ||
288 | case MISCSTAT: | ||
289 | p = &hw_stats->rxf; | ||
290 | break; | ||
291 | case PMEMSTAT: | ||
292 | p = &hw_stats->pmem; | ||
293 | break; | ||
294 | case DRVSTAT: | 267 | case DRVSTAT: |
295 | p = &adapter->drv_stats; | 268 | p = &adapter->drv_stats; |
296 | break; | 269 | break; |
@@ -308,7 +281,8 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
308 | p = (u8 *)&rxo->stats + et_rx_stats[i].offset; | 281 | p = (u8 *)&rxo->stats + et_rx_stats[i].offset; |
309 | break; | 282 | break; |
310 | case ERXSTAT: | 283 | case ERXSTAT: |
311 | p = (u32 *)erx_stats + rxo->q.id; | 284 | p = (u32 *)be_erx_stats_from_cmd(adapter) + |
285 | rxo->q.id; | ||
312 | break; | 286 | break; |
313 | } | 287 | } |
314 | data[ETHTOOL_STATS_NUM + j * ETHTOOL_RXSTATS_NUM + i] = | 288 | data[ETHTOOL_STATS_NUM + j * ETHTOOL_RXSTATS_NUM + i] = |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 243172bedfa6..cff2cca3087d 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -245,14 +245,126 @@ netdev_addr: | |||
245 | return status; | 245 | return status; |
246 | } | 246 | } |
247 | 247 | ||
248 | static void populate_be2_stats(struct be_adapter *adapter) | ||
249 | { | ||
250 | |||
251 | struct be_drv_stats *drvs = &adapter->drv_stats; | ||
252 | struct be_pmem_stats *pmem_sts = be_pmem_stats_from_cmd(adapter); | ||
253 | struct be_port_rxf_stats_v0 *port_stats = | ||
254 | be_port_rxf_stats_from_cmd(adapter); | ||
255 | struct be_rxf_stats_v0 *rxf_stats = | ||
256 | be_rxf_stats_from_cmd(adapter); | ||
257 | |||
258 | drvs->rx_pause_frames = port_stats->rx_pause_frames; | ||
259 | drvs->rx_crc_errors = port_stats->rx_crc_errors; | ||
260 | drvs->rx_control_frames = port_stats->rx_control_frames; | ||
261 | drvs->rx_in_range_errors = port_stats->rx_in_range_errors; | ||
262 | drvs->rx_frame_too_long = port_stats->rx_frame_too_long; | ||
263 | drvs->rx_dropped_runt = port_stats->rx_dropped_runt; | ||
264 | drvs->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs; | ||
265 | drvs->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs; | ||
266 | drvs->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs; | ||
267 | drvs->rxpp_fifo_overflow_drop = port_stats->rx_fifo_overflow; | ||
268 | drvs->rx_dropped_tcp_length = port_stats->rx_dropped_tcp_length; | ||
269 | drvs->rx_dropped_too_small = port_stats->rx_dropped_too_small; | ||
270 | drvs->rx_dropped_too_short = port_stats->rx_dropped_too_short; | ||
271 | drvs->rx_out_range_errors = port_stats->rx_out_range_errors; | ||
272 | drvs->rx_input_fifo_overflow_drop = | ||
273 | port_stats->rx_input_fifo_overflow; | ||
274 | drvs->rx_dropped_header_too_small = | ||
275 | port_stats->rx_dropped_header_too_small; | ||
276 | drvs->rx_address_match_errors = | ||
277 | port_stats->rx_address_match_errors; | ||
278 | drvs->rx_alignment_symbol_errors = | ||
279 | port_stats->rx_alignment_symbol_errors; | ||
280 | |||
281 | drvs->tx_pauseframes = port_stats->tx_pauseframes; | ||
282 | drvs->tx_controlframes = port_stats->tx_controlframes; | ||
283 | |||
284 | if (adapter->port_num) | ||
285 | drvs->jabber_events = | ||
286 | rxf_stats->port1_jabber_events; | ||
287 | else | ||
288 | drvs->jabber_events = | ||
289 | rxf_stats->port0_jabber_events; | ||
290 | drvs->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; | ||
291 | drvs->rx_drops_no_txpb = rxf_stats->rx_drops_no_txpb; | ||
292 | drvs->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; | ||
293 | drvs->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; | ||
294 | drvs->forwarded_packets = rxf_stats->forwarded_packets; | ||
295 | drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu; | ||
296 | drvs->rx_drops_no_tpre_descr = | ||
297 | rxf_stats->rx_drops_no_tpre_descr; | ||
298 | drvs->rx_drops_too_many_frags = | ||
299 | rxf_stats->rx_drops_too_many_frags; | ||
300 | adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; | ||
301 | } | ||
302 | |||
303 | static void populate_be3_stats(struct be_adapter *adapter) | ||
304 | { | ||
305 | struct be_drv_stats *drvs = &adapter->drv_stats; | ||
306 | struct be_pmem_stats *pmem_sts = be_pmem_stats_from_cmd(adapter); | ||
307 | |||
308 | struct be_rxf_stats_v1 *rxf_stats = | ||
309 | be_rxf_stats_from_cmd(adapter); | ||
310 | struct be_port_rxf_stats_v1 *port_stats = | ||
311 | be_port_rxf_stats_from_cmd(adapter); | ||
312 | |||
313 | drvs->rx_priority_pause_frames = 0; | ||
314 | drvs->pmem_fifo_overflow_drop = 0; | ||
315 | drvs->rx_pause_frames = port_stats->rx_pause_frames; | ||
316 | drvs->rx_crc_errors = port_stats->rx_crc_errors; | ||
317 | drvs->rx_control_frames = port_stats->rx_control_frames; | ||
318 | drvs->rx_in_range_errors = port_stats->rx_in_range_errors; | ||
319 | drvs->rx_frame_too_long = port_stats->rx_frame_too_long; | ||
320 | drvs->rx_dropped_runt = port_stats->rx_dropped_runt; | ||
321 | drvs->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs; | ||
322 | drvs->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs; | ||
323 | drvs->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs; | ||
324 | drvs->rx_dropped_tcp_length = port_stats->rx_dropped_tcp_length; | ||
325 | drvs->rx_dropped_too_small = port_stats->rx_dropped_too_small; | ||
326 | drvs->rx_dropped_too_short = port_stats->rx_dropped_too_short; | ||
327 | drvs->rx_out_range_errors = port_stats->rx_out_range_errors; | ||
328 | drvs->rx_dropped_header_too_small = | ||
329 | port_stats->rx_dropped_header_too_small; | ||
330 | drvs->rx_input_fifo_overflow_drop = | ||
331 | port_stats->rx_input_fifo_overflow_drop; | ||
332 | drvs->rx_address_match_errors = | ||
333 | port_stats->rx_address_match_errors; | ||
334 | drvs->rx_alignment_symbol_errors = | ||
335 | port_stats->rx_alignment_symbol_errors; | ||
336 | drvs->rxpp_fifo_overflow_drop = | ||
337 | port_stats->rxpp_fifo_overflow_drop; | ||
338 | drvs->tx_pauseframes = port_stats->tx_pauseframes; | ||
339 | drvs->tx_controlframes = port_stats->tx_controlframes; | ||
340 | drvs->jabber_events = port_stats->jabber_events; | ||
341 | drvs->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; | ||
342 | drvs->rx_drops_no_txpb = rxf_stats->rx_drops_no_txpb; | ||
343 | drvs->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; | ||
344 | drvs->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; | ||
345 | drvs->forwarded_packets = rxf_stats->forwarded_packets; | ||
346 | drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu; | ||
347 | drvs->rx_drops_no_tpre_descr = | ||
348 | rxf_stats->rx_drops_no_tpre_descr; | ||
349 | drvs->rx_drops_too_many_frags = | ||
350 | rxf_stats->rx_drops_too_many_frags; | ||
351 | adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; | ||
352 | } | ||
353 | |||
354 | |||
355 | |||
356 | void be_parse_stats(struct be_adapter *adapter) | ||
357 | { | ||
358 | if (adapter->generation == BE_GEN3) | ||
359 | populate_be3_stats(adapter); | ||
360 | else | ||
361 | populate_be2_stats(adapter); | ||
362 | } | ||
363 | |||
248 | void netdev_stats_update(struct be_adapter *adapter) | 364 | void netdev_stats_update(struct be_adapter *adapter) |
249 | { | 365 | { |
250 | struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats_cmd.va); | 366 | struct be_drv_stats *drvs = &adapter->drv_stats; |
251 | struct be_rxf_stats *rxf_stats = &hw_stats->rxf; | ||
252 | struct be_port_rxf_stats *port_stats = | ||
253 | &rxf_stats->port[adapter->port_num]; | ||
254 | struct net_device_stats *dev_stats = &adapter->netdev->stats; | 367 | struct net_device_stats *dev_stats = &adapter->netdev->stats; |
255 | struct be_erx_stats *erx_stats = &hw_stats->erx; | ||
256 | struct be_rx_obj *rxo; | 368 | struct be_rx_obj *rxo; |
257 | int i; | 369 | int i; |
258 | 370 | ||
@@ -262,43 +374,52 @@ void netdev_stats_update(struct be_adapter *adapter) | |||
262 | dev_stats->rx_bytes += rx_stats(rxo)->rx_bytes; | 374 | dev_stats->rx_bytes += rx_stats(rxo)->rx_bytes; |
263 | dev_stats->multicast += rx_stats(rxo)->rx_mcast_pkts; | 375 | dev_stats->multicast += rx_stats(rxo)->rx_mcast_pkts; |
264 | /* no space in linux buffers: best possible approximation */ | 376 | /* no space in linux buffers: best possible approximation */ |
265 | dev_stats->rx_dropped += | 377 | if (adapter->generation == BE_GEN3) { |
266 | erx_stats->rx_drops_no_fragments[rxo->q.id]; | 378 | struct be_erx_stats_v1 *erx_stats = |
379 | be_erx_stats_from_cmd(adapter); | ||
380 | dev_stats->rx_dropped += | ||
381 | erx_stats->rx_drops_no_fragments[rxo->q.id]; | ||
382 | } else { | ||
383 | struct be_erx_stats_v0 *erx_stats = | ||
384 | be_erx_stats_from_cmd(adapter); | ||
385 | dev_stats->rx_dropped += | ||
386 | erx_stats->rx_drops_no_fragments[rxo->q.id]; | ||
387 | } | ||
267 | } | 388 | } |
268 | 389 | ||
269 | dev_stats->tx_packets = tx_stats(adapter)->be_tx_pkts; | 390 | dev_stats->tx_packets = tx_stats(adapter)->be_tx_pkts; |
270 | dev_stats->tx_bytes = tx_stats(adapter)->be_tx_bytes; | 391 | dev_stats->tx_bytes = tx_stats(adapter)->be_tx_bytes; |
271 | 392 | ||
272 | /* bad pkts received */ | 393 | /* bad pkts received */ |
273 | dev_stats->rx_errors = port_stats->rx_crc_errors + | 394 | dev_stats->rx_errors = drvs->rx_crc_errors + |
274 | port_stats->rx_alignment_symbol_errors + | 395 | drvs->rx_alignment_symbol_errors + |
275 | port_stats->rx_in_range_errors + | 396 | drvs->rx_in_range_errors + |
276 | port_stats->rx_out_range_errors + | 397 | drvs->rx_out_range_errors + |
277 | port_stats->rx_frame_too_long + | 398 | drvs->rx_frame_too_long + |
278 | port_stats->rx_dropped_too_small + | 399 | drvs->rx_dropped_too_small + |
279 | port_stats->rx_dropped_too_short + | 400 | drvs->rx_dropped_too_short + |
280 | port_stats->rx_dropped_header_too_small + | 401 | drvs->rx_dropped_header_too_small + |
281 | port_stats->rx_dropped_tcp_length + | 402 | drvs->rx_dropped_tcp_length + |
282 | port_stats->rx_dropped_runt + | 403 | drvs->rx_dropped_runt + |
283 | port_stats->rx_tcp_checksum_errs + | 404 | drvs->rx_tcp_checksum_errs + |
284 | port_stats->rx_ip_checksum_errs + | 405 | drvs->rx_ip_checksum_errs + |
285 | port_stats->rx_udp_checksum_errs; | 406 | drvs->rx_udp_checksum_errs; |
286 | 407 | ||
287 | /* detailed rx errors */ | 408 | /* detailed rx errors */ |
288 | dev_stats->rx_length_errors = port_stats->rx_in_range_errors + | 409 | dev_stats->rx_length_errors = drvs->rx_in_range_errors + |
289 | port_stats->rx_out_range_errors + | 410 | drvs->rx_out_range_errors + |
290 | port_stats->rx_frame_too_long; | 411 | drvs->rx_frame_too_long; |
291 | 412 | ||
292 | dev_stats->rx_crc_errors = port_stats->rx_crc_errors; | 413 | dev_stats->rx_crc_errors = drvs->rx_crc_errors; |
293 | 414 | ||
294 | /* frame alignment errors */ | 415 | /* frame alignment errors */ |
295 | dev_stats->rx_frame_errors = port_stats->rx_alignment_symbol_errors; | 416 | dev_stats->rx_frame_errors = drvs->rx_alignment_symbol_errors; |
296 | 417 | ||
297 | /* receiver fifo overrun */ | 418 | /* receiver fifo overrun */ |
298 | /* drops_no_pbuf is no per i/f, it's per BE card */ | 419 | /* drops_no_pbuf is no per i/f, it's per BE card */ |
299 | dev_stats->rx_fifo_errors = port_stats->rx_fifo_overflow + | 420 | dev_stats->rx_fifo_errors = drvs->rxpp_fifo_overflow_drop + |
300 | port_stats->rx_input_fifo_overflow + | 421 | drvs->rx_input_fifo_overflow_drop + |
301 | rxf_stats->rx_drops_no_pbuf; | 422 | drvs->rx_drops_no_pbuf; |
302 | } | 423 | } |
303 | 424 | ||
304 | void be_link_status_update(struct be_adapter *adapter, bool link_up) | 425 | void be_link_status_update(struct be_adapter *adapter, bool link_up) |
@@ -2823,7 +2944,10 @@ static int be_stats_init(struct be_adapter *adapter) | |||
2823 | { | 2944 | { |
2824 | struct be_dma_mem *cmd = &adapter->stats_cmd; | 2945 | struct be_dma_mem *cmd = &adapter->stats_cmd; |
2825 | 2946 | ||
2826 | cmd->size = sizeof(struct be_cmd_req_get_stats); | 2947 | if (adapter->generation == BE_GEN2) |
2948 | cmd->size = sizeof(struct be_cmd_req_get_stats_v0); | ||
2949 | else | ||
2950 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); | ||
2827 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, | 2951 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, |
2828 | GFP_KERNEL); | 2952 | GFP_KERNEL); |
2829 | if (cmd->va == NULL) | 2953 | if (cmd->va == NULL) |