1 /******************************************************************************* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 * 21 * Copyright 2014 QLogic Corporation 22 * The contents of this file are subject to the terms of the 23 * QLogic End User License (the "License"). 24 * You may not use this file except in compliance with the License. 25 * 26 * You can obtain a copy of the License at 27 * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/ 28 * QLogic_End_User_Software_License.txt 29 * See the License for the specific language governing permissions 30 * and limitations under the License. 31 * 32 * 33 * Module Description: 34 * 35 * 36 * History: 37 * 02/05/07 Alon Elhanani Inception. 38 ******************************************************************************/ 39 40 #ifndef _LM_STATS_H 41 #define _LM_STATS_H 42 43 #include "common_uif.h" 44 #include "mac_stx.h" 45 46 /******************************************************************************* 47 * Forward definition. 48 ******************************************************************************/ 49 /* structure for DCBX statistic */ 50 struct _lm_dcbx_stat; 51 52 // defines 53 #define DMAE_SGL_STATS_NUM_OF_EMAC_COMMANDS 4 // includes NIG (3+1(nig)=4) 54 #define DMAE_SGL_STATS_NUM_OF_BIGMAC_COMMANDS 3 // includes NIG (2+1(nig)=3) 55 #define DMAE_SGL_STATS_NUM_OF_MSTAT_COMMANDS 3 // MSTAT requires 2 DMAE transactions (Rx/Tx) + 1 for the NIG stats 56 57 #define LM_STATS_FW_DONE_FLAG 0xffffffff 58 #define MAX_STATS_TIMER_WAKEUP_NO_COMPLETION 50 // Might be a real problem with SW/FW HSI 59 #define MAX_STATS_TIMER_WAKEUP_COMP_NOT_HANDLED 600 // probably due to DPC starvation by the OS, this timeout can be large (currently 5 minutes) 60 61 #define HAS_MSTAT(_pdev) CHIP_IS_E3(_pdev) 62 63 typedef enum 64 { 65 STATS_MACS_IDX_CURRENT = 0, 66 STATS_MACS_IDX_TOTAL = 1, 67 STATS_MACS_IDX_MAX = 2 68 } stats_macs_idx_t; 69 70 #define STATS_IP_4_IDX 0 71 #define STATS_IP_6_IDX 1 72 #define STATS_IP_IDX_MAX 2 73 74 75 // converts reg_pair_t to u64_t 76 #define REGPAIR_TO_U64( val_64, val_regpair ) val_64 = ((u64_t)(mm_le32_to_cpu(val_regpair.hi))<<32) + mm_le32_to_cpu(val_regpair.lo) ; 77 78 79 #define LM_STATS_HW_GET_MACS_U64(_pdev, field_name) ( _pdev->vars.stats.stats_mirror.stats_hw.macs[STATS_MACS_IDX_TOTAL].field_name ) 80 81 82 // LM_STATS_FLAGS_XXX defines 83 #define LM_STATS_FLAG_XSTORM 0x0001 84 #define LM_STATS_FLAG_TSTORM 0x0002 85 #define LM_STATS_FLAG_USTORM 0x0020 86 #define LM_STATS_FLAG_CSTORM 0x0100 87 88 #define LM_STATS_FLAGS_ALL (LM_STATS_FLAG_XSTORM | LM_STATS_FLAG_TSTORM | LM_STATS_FLAG_USTORM | LM_STATS_FLAG_CSTORM ) 89 90 // Check that done flags are set 91 #define LM_STATS_REGPAIR_CHECK_DONE(done_regpair) (( LM_STATS_FW_DONE_FLAG == done_regpair.lo ) && \ 92 ( LM_STATS_FW_DONE_FLAG == done_regpair.hi )) 93 94 #define LM_STATS_VERIFY_COUNTER(_pdev, _counter ) ( _pdev->vars.stats.stats_collect.stats_fw.drv_counter == mm_le16_to_cpu(pdev->vars.stats.stats_collect.stats_fw._counter) ) 95 96 97 98 // Check that done flags are set 99 #define LM_STATS_REGPAIR_CLEAR_DONE(done_regpair) done_regpair.lo = done_regpair.hi = 0 ; 100 101 102 // Do we need to assign (done is true assigned is false) 103 #define LM_STATS_DO_ASSIGN(flag_done, flag_assigned, flag_type) ( 0 == GET_FLAGS(flag_assigned,flag_type) && \ 104 0 != GET_FLAGS(flag_done,flag_type) ) 105 // do we need to assign any of the flags 106 #define LM_STATS_DO_ASSIGN_ANY(flag_done, flag_assigned) ( LM_STATS_DO_ASSIGN(flag_done,flag_assigned,LM_STATS_FLAG_XSTORM) || \ 107 LM_STATS_DO_ASSIGN(flag_done,flag_assigned,LM_STATS_FLAG_TSTORM) || \ 108 LM_STATS_DO_ASSIGN(flag_done,flag_assigned,LM_STATS_FLAG_USTORM) || \ 109 LM_STATS_DO_ASSIGN(flag_done,flag_assigned,LM_STATS_FLAG_CSTORM) ) 110 // mapping of client id to statistics entry 111 // the imporance of this macro is that it'll return a unique number per function. 112 #define LM_STATS_CNT_ID(_pdev) (IS_VFDEV(_pdev) ? (_pdev)->params.base_fw_stats_id : FUNC_ID(_pdev)) 113 114 // Functions prototypes 115 void lm_stats_on_timer ( struct _lm_device_t* pdev) ; 116 lm_status_t lm_stats_dmae ( struct _lm_device_t* pdev) ; 117 lm_status_t lm_stats_hw_setup ( struct _lm_device_t* pdev) ; 118 void lm_stats_fw_setup ( struct _lm_device_t* pdev) ; 119 void lm_stats_fw_reset ( struct _lm_device_t* pdev) ; 120 lm_status_t lm_stats_alloc_fw_resc (struct _lm_device_t *pdev); 121 lm_status_t lm_stats_alloc_resc( struct _lm_device_t* pdev) ; 122 lm_status_t lm_stats_on_link_update( struct _lm_device_t *pdev, const u8_t b_is_link_up ); 123 124 void lm_stats_fw_assign ( struct _lm_device_t* pdev, IN u32_t stats_flags_done, OUT u32_t* ptr_stats_flags_assigned ) ; 125 126 #ifdef VF_INVOLVED 127 void lm_pf_stats_vf_fw_assign(struct _lm_device_t *pdev, u32_t stats_flags_done, u32_t* ptr_stats_flags_assigned); 128 #endif 129 130 void lm_stats_hw_assign ( struct _lm_device_t* pdev ) ; 131 void lm_stats_fw_check_update_done( struct _lm_device_t *pdev, OUT u32_t* ptr_stats_flags_done ) ; 132 lm_status_t lm_stats_fw_complete( struct _lm_device_t *pdev ) ; 133 void lm_stats_mgmt_assign( IN struct _lm_device_t* pdev ) ; 134 lm_status_t lm_stats_drv_info_to_mfw_assign( struct _lm_device_t *pdev, const enum drv_info_opcode drv_info_op ); 135 136 137 void lm_stats_get_dcb_stats ( IN struct _lm_device_t* pdev, OUT struct _lm_dcbx_stat *stats ) ; 138 void lm_stats_get_driver_stats ( IN struct _lm_device_t* pdev, OUT b10_driver_statistics_t *stats ) ; 139 void lm_stats_get_l2_driver_stats( IN struct _lm_device_t* pdev, OUT b10_l2_driver_statistics_t *stats ) ; 140 void lm_stats_get_l4_driver_stats( IN struct _lm_device_t* pdev, OUT b10_l4_driver_statistics_t *stats ) ; 141 void lm_stats_get_l2_chip_stats ( IN struct _lm_device_t* pdev, OUT void *stats, u8_t version ) ; 142 void lm_stats_get_l4_chip_stats ( IN struct _lm_device_t* pdev, OUT b10_l4_chip_statistics_t *stats ) ; 143 void lm_stats_hw_config_stats ( struct _lm_device_t* pdev, u8_t b_enabled ) ; 144 void lm_stats_fw_config_stats ( struct _lm_device_t* pdev, u8_t b_enabled ) ; 145 void lm_stats_init_port_part ( IN struct _lm_device_t* pdev ); 146 void lm_stats_init_func_part ( IN struct _lm_device_t* pdev ); 147 148 lm_status_t lm_stats_on_pmf_update( struct _lm_device_t* pdev, IN u8_t b_on ) ; 149 lm_status_t lm_stats_on_pmf_init( struct _lm_device_t* pdev ) ; 150 151 lm_status_t lm_stats_drv_info_to_mfw_event( struct _lm_device_t* pdev ) ; 152 153 #ifdef VF_INVOLVED 154 void lm_stats_prep_vf_fw_stats_req( struct _lm_device_t* pdev ); 155 #endif 156 157 // hw statistics structures (as read from GRC) 158 159 // bmac 160 struct _stats_bmac1_query_t 161 { 162 struct 163 { 164 u64_t tx_gtpkt ; 165 u64_t tx_gtxpf ; 166 u64_t tx_gtfcs ; 167 u64_t tx_gtmca ; 168 u64_t tx_gtgca ; 169 u64_t tx_gtfrg ; 170 u64_t tx_gtovr ; 171 u64_t tx_gt64 ; 172 u64_t tx_gt127 ; 173 u64_t tx_gt255 ; 174 u64_t tx_gt511 ; 175 u64_t tx_gt1023 ; 176 u64_t tx_gt1518 ; 177 u64_t tx_gt2047 ; 178 u64_t tx_gt4095 ; 179 u64_t tx_gt9216 ; 180 u64_t tx_gt16383 ; 181 u64_t tx_gtmax ; 182 u64_t tx_gtufl ; 183 u64_t tx_gterr ; 184 u64_t tx_gtbyt ; // 42 bit 185 } stats_tx ; 186 struct 187 { 188 u64_t rx_gr64 ; 189 u64_t rx_gr127 ; 190 u64_t rx_gr255 ; 191 u64_t rx_gr511 ; 192 u64_t rx_gr1023 ; 193 u64_t rx_gr1518 ; 194 u64_t rx_gr2047 ; 195 u64_t rx_gr4095 ; 196 u64_t rx_gr9216 ; 197 u64_t rx_gr16383 ; 198 u64_t rx_grmax ; 199 u64_t rx_grpkt ; 200 u64_t rx_grfcs ; 201 u64_t rx_grmca ; 202 u64_t rx_grbca ; 203 u64_t rx_grxcf ; 204 u64_t rx_grxpf ; 205 u64_t rx_grxuo ; 206 u64_t rx_grjbr ; 207 u64_t rx_grovr ; 208 u64_t rx_grflr ; 209 u64_t rx_grmeg ; 210 u64_t rx_grmeb ; 211 u64_t rx_grbyt ; // 42 bit 212 u64_t rx_grund ; 213 u64_t rx_grfrg ; 214 u64_t rx_grerb ; 215 u64_t rx_grfre ; // 42 bit 216 u64_t rx_gripj ; // 42 bit 217 } stats_rx ; 218 }; //stats_bmac_query_t 219 220 // bmac2 221 struct _stats_bmac2_query_t 222 { 223 struct 224 { 225 u64_t tx_gtpkt ; // tx_itpok 226 u64_t tx_gtxpf ; 227 u64_t tx_gtxpp ; // NEW BMAC2 228 u64_t tx_gtfcs ; 229 u64_t tx_gtuca ; // NEW BMAC2 230 u64_t tx_gtmca ; 231 u64_t tx_gtgca ; 232 u64_t tx_gtovr ; // SWAPPED with below in BMAC1 233 u64_t tx_gtfrg ; 234 u64_t tx_itpkt ; // NEW BMAC2 235 u64_t tx_gt64 ; 236 u64_t tx_gt127 ; 237 u64_t tx_gt255 ; 238 u64_t tx_gt511 ; 239 u64_t tx_gt1023 ; 240 u64_t tx_gt1518 ; 241 u64_t tx_gt2047 ; 242 u64_t tx_gt4095 ; 243 u64_t tx_gt9216 ; 244 u64_t tx_gt16383 ; 245 u64_t tx_gtmax ; 246 u64_t tx_gtufl ; 247 u64_t tx_gterr ; 248 u64_t tx_gtbyt ; // 42 bit 249 } stats_tx ; 250 struct 251 { 252 u64_t rx_gr64 ; 253 u64_t rx_gr127 ; 254 u64_t rx_gr255 ; 255 u64_t rx_gr511 ; 256 u64_t rx_gr1023 ; 257 u64_t rx_gr1518 ; 258 u64_t rx_gr2047 ; 259 u64_t rx_gr4095 ; 260 u64_t rx_gr9216 ; 261 u64_t rx_gr16383 ; 262 u64_t rx_grmax ; 263 u64_t rx_grpkt ; 264 u64_t rx_grfcs ; 265 u64_t rx_gruca ; // NEW BMAC2 266 u64_t rx_grmca ; 267 u64_t rx_grbca ; 268 //u64_t rx_grxcf ; // MOVED BMAC2 269 u64_t rx_grxpf ; 270 u64_t rx_grxpp ; // NEW BMAC2 271 u64_t rx_grxuo ; 272 u64_t rx_grjbr ; 273 u64_t rx_grovr ; 274 u64_t rx_grxcf ; // MOVED BMAC2 275 u64_t rx_grflr ; 276 u64_t rx_grpok ; // NEW BMAC2 277 u64_t rx_grmeg ; 278 u64_t rx_grmeb ; 279 u64_t rx_grbyt ; // 42 bit 280 u64_t rx_grund ; 281 u64_t rx_grfrg ; 282 u64_t rx_grerb ; 283 u64_t rx_grfre ; // 42 bit - BMAC2: IRERPKT 284 u64_t rx_gripj ; // 42 bit - BMAC2: IRJUNK 285 } stats_rx ; 286 }; //stats_bmac_query_t 287 288 // emac 289 struct _stats_emac_query_t 290 { 291 struct 292 { 293 u32_t rx_stat_ifhcinoctets ; 294 u32_t rx_stat_ifhcinbadoctets ; 295 u32_t rx_stat_etherstatsfragments ; 296 u32_t rx_stat_ifhcinucastpkts ; 297 u32_t rx_stat_ifhcinmulticastpkts ; 298 u32_t rx_stat_ifhcinbroadcastpkts ; 299 u32_t rx_stat_dot3statsfcserrors ; 300 u32_t rx_stat_dot3statsalignmenterrors ; 301 u32_t rx_stat_dot3statscarriersenseerrors ; 302 u32_t rx_stat_xonpauseframesreceived ; 303 u32_t rx_stat_xoffpauseframesreceived ; 304 u32_t rx_stat_maccontrolframesreceived ; 305 u32_t rx_stat_xoffstateentered ; 306 u32_t rx_stat_dot3statsframestoolong ; 307 u32_t rx_stat_etherstatsjabbers ; 308 u32_t rx_stat_etherstatsundersizepkts ; 309 u32_t rx_stat_etherstatspkts64octets ; 310 u32_t rx_stat_etherstatspkts65octetsto127octets ; 311 u32_t rx_stat_etherstatspkts128octetsto255octets ; 312 u32_t rx_stat_etherstatspkts256octetsto511octets ; 313 u32_t rx_stat_etherstatspkts512octetsto1023octets ; 314 u32_t rx_stat_etherstatspkts1024octetsto1522octets; 315 u32_t rx_stat_etherstatspktsover1522octets ; 316 } stats_rx ; 317 struct 318 { 319 u32_t rx_stat_falsecarriererrors ; 320 } stats_rx_err ; 321 struct 322 { 323 u32_t tx_stat_ifhcoutoctets ; 324 u32_t tx_stat_ifhcoutbadoctets ; 325 u32_t tx_stat_etherstatscollisions ; 326 u32_t tx_stat_outxonsent ; 327 u32_t tx_stat_outxoffsent ; 328 u32_t tx_stat_flowcontroldone ; 329 u32_t tx_stat_dot3statssinglecollisionframes ; 330 u32_t tx_stat_dot3statsmultiplecollisionframes ; 331 u32_t tx_stat_dot3statsdeferredtransmissions ; 332 u32_t tx_stat_dot3statsexcessivecollisions ; 333 u32_t tx_stat_dot3statslatecollisions ; 334 u32_t tx_stat_ifhcoutucastpkts ; 335 u32_t tx_stat_ifhcoutmulticastpkts ; 336 u32_t tx_stat_ifhcoutbroadcastpkts ; 337 u32_t tx_stat_etherstatspkts64octets ; 338 u32_t tx_stat_etherstatspkts65octetsto127octets ; 339 u32_t tx_stat_etherstatspkts128octetsto255octets ; 340 u32_t tx_stat_etherstatspkts256octetsto511octets ; 341 u32_t tx_stat_etherstatspkts512octetsto1023octets ; 342 u32_t tx_stat_etherstatspkts1024octetsto1522octet ; 343 u32_t tx_stat_etherstatspktsover1522octets ; 344 u32_t tx_stat_dot3statsinternalmactransmiterrors ; 345 } stats_tx ; 346 347 }; // stats_emac_query_t 348 349 struct _stats_mstat_query_t 350 { 351 struct { 352 u64_t tx_gtxpok ; ///NOTE MSTAT on E3 has a bug where this register's contents are actually tx_gtxpok + tx_gtxpf + (possibly)tx_gtxpp 353 u64_t tx_gtxpf ; 354 u64_t tx_gtxpp ; 355 u64_t tx_gtfcs ; 356 u64_t tx_gtuca ; 357 u64_t tx_gtmca ; 358 u64_t tx_gtgca ; 359 u64_t tx_gtpkt ; 360 u64_t tx_gt64 ; 361 u64_t tx_gt127 ; 362 u64_t tx_gt255 ; 363 u64_t tx_gt511 ; 364 u64_t tx_gt1023 ; 365 u64_t tx_gt1518 ; 366 u64_t tx_gt2047 ; 367 u64_t tx_gt4095 ; 368 u64_t tx_gt9216 ; 369 u64_t tx_gt16383 ; 370 u64_t tx_gtufl ; 371 u64_t tx_gterr ; 372 u64_t tx_gtbyt ; 373 374 u64_t tx_collisions; 375 u64_t tx_singlecollision; 376 u64_t tx_multiplecollisions; 377 u64_t tx_deferred; 378 u64_t tx_excessivecollisions; 379 u64_t tx_latecollisions; 380 }stats_tx; 381 382 struct{ 383 u64_t rx_gr64 ; 384 u64_t rx_gr127 ; 385 u64_t rx_gr255 ; 386 u64_t rx_gr511 ; 387 u64_t rx_gr1023 ; 388 u64_t rx_gr1518 ; 389 u64_t rx_gr2047 ; 390 u64_t rx_gr4095 ; 391 u64_t rx_gr9216 ; 392 u64_t rx_gr16383 ; 393 u64_t rx_grpkt ; 394 u64_t rx_grfcs ; 395 u64_t rx_gruca ; 396 u64_t rx_grmca ; 397 u64_t rx_grbca ; 398 u64_t rx_grxpf ; 399 u64_t rx_grxpp ; 400 u64_t rx_grxuo ; 401 u64_t rx_grovr ; 402 u64_t rx_grxcf ; 403 u64_t rx_grflr ; 404 u64_t rx_grpok ; 405 u64_t rx_grbyt ; 406 u64_t rx_grund ; 407 u64_t rx_grfrg ; 408 u64_t rx_grerb ; 409 u64_t rx_grfre ; 410 411 u64_t rx_alignmenterrors; 412 u64_t rx_falsecarrier; 413 u64_t rx_llfcmsgcnt; 414 }stats_rx; 415 }; 416 417 // Nig 418 struct _stats_nig_query_t 419 { 420 u32_t brb_discard ; 421 u32_t brb_packet ; 422 u32_t brb_truncate ; 423 u32_t flow_ctrl_discard ; 424 u32_t flow_ctrl_octets ; 425 u32_t flow_ctrl_packet ; 426 u32_t mng_discard ; 427 u32_t mng_octet_inp ; 428 u32_t mng_octet_out ; 429 u32_t mng_packet_inp ; 430 u32_t mng_packet_out ; 431 u32_t pbf_octets ; 432 u32_t pbf_packet ; 433 u32_t safc_inp ; 434 }; 435 436 typedef struct _stats_nig_ex_t 437 { 438 u64_t egress_mac_pkt0 ; // Spec. 23 439 u64_t egress_mac_pkt1 ; // Spec. 24 440 } stats_nig_ex_t ; 441 442 typedef struct _misc_stats_t 443 { 444 u64_t tx_lpi_count; 445 } misc_stats_t; 446 447 union _stats_bmac_query_t 448 { 449 struct _stats_bmac1_query_t bmac1_stats; 450 struct _stats_bmac2_query_t bmac2_stats; 451 }; 452 typedef struct _lm_stats_hw_collect_t 453 { 454 union{ 455 struct{ 456 volatile struct _stats_emac_query_t* addr_emac_stats_query ; 457 volatile struct _stats_bmac1_query_t* addr_bmac1_stats_query ; 458 volatile struct _stats_bmac2_query_t* addr_bmac2_stats_query ; 459 } s; 460 volatile struct _stats_mstat_query_t* addr_mstat_stats_query ; 461 } u; 462 volatile struct _stats_nig_query_t* addr_nig_stats_query ; 463 464 void* non_emac_dmae_operation; 465 void* emac_dmae_operation; 466 467 struct _stats_nig_ex_t nig_ex_stats_query ; 468 u8_t b_is_link_up ; 469 u8_t b_collect_enabled ; // enable collection? 470 lm_address_t mac_stats_phys_addr; // physical address of the beginning of the MAC stats structure (either EMAC or MSTAT) 471 lm_address_t bmac_stats_phys_addr; //physical address of the beginning of the MAC stats structure (BMAC1/BMAC2) 472 lm_address_t nig_stats_phys_addr; // physical address of the beginning of the NIG stats structure 473 474 struct _misc_stats_t misc_stats_query; 475 476 }lm_stats_hw_collect_t; 477 478 typedef struct _lm_stats_drv_info_to_mfw_t 479 { 480 union 481 { 482 volatile eth_stats_info_t* eth_stats; 483 volatile fcoe_stats_info_t* fcoe_stats ; 484 volatile iscsi_stats_info_t* iscsi_stats ; 485 } addr; 486 487 lm_address_t drv_info_to_mfw_phys_addr; // physical address of the beginning of the drv_info_to_mfw stats 488 489 } lm_stats_drv_info_to_mfw_t; 490 491 492 /************************FW Statistic Structures **************************/ 493 typedef enum { 494 LM_STATS_PORT_QUERY_IDX, 495 LM_STATS_PF_QUERY_IDX, 496 LM_STATS_FIRST_QUEUE_QUERY_IDX, 497 LM_STATS_TOE_IDX, 498 LM_STATS_FCOE_IDX, 499 LM_STATS_FIRST_VF_QUEUE_QUERY_IDX 500 } lm_stats_query_idx ; 501 502 typedef struct _lm_stats_fw_stats_req_t { 503 struct stats_query_header hdr; 504 struct stats_query_entry query[STATS_QUERY_CMD_COUNT]; 505 } lm_stats_fw_stats_req_t; 506 507 typedef struct _lm_stats_fw_stats_data_t { 508 struct stats_counter storm_counters; 509 struct per_port_stats port; 510 struct per_pf_stats pf; 511 struct toe_stats_query toe; 512 struct fcoe_statistics_params fcoe; 513 struct per_queue_stats queue_stats; 514 /* TODO: more queue stats? VF? */ 515 } lm_stats_fw_stats_data_t; 516 517 typedef struct _lm_stats_fw_collect_t 518 { 519 /* Total number of FW statistics requests */ 520 u8_t fw_stats_num; 521 /* Total number of FW statistics static (PF) requests */ 522 u8_t fw_static_stats_num; 523 u8_t pad[2]; 524 525 526 /* This is a memory buffer that will contain both statistics 527 * ramrod request and data. 528 */ 529 void * fw_stats; 530 lm_address_t fw_stats_mapping; 531 532 /* FW statistics request shortcut (points at the 533 * beginning of fw_stats buffer). 534 */ 535 lm_stats_fw_stats_req_t * fw_stats_req; 536 lm_address_t fw_stats_req_mapping; 537 u32_t fw_stats_req_sz; 538 539 /* FW statistics data shortcut (points at the begining of 540 * fw_stats buffer + fw_stats_req_sz). 541 */ 542 lm_stats_fw_stats_data_t * fw_stats_data; 543 lm_address_t fw_stats_data_mapping; 544 u32_t fw_stats_data_sz; 545 546 struct sq_pending_command stats_sp_list_command; // A pre allocated SPO pending command 547 u16_t drv_counter; 548 volatile u8_t b_completion_done ; // 0 if stats ramrod completion haven't been done yet 549 volatile u8_t b_ramrod_completed ; // 0 if stats ramrod completion haven't been done yet 550 volatile u8_t b_collect_enabled ; // enable collection? 551 u32_t timer_wakeup_no_completion_current ; // times that current timer wakeup without stats ramrod completion 552 u32_t timer_wakeup_no_completion_total ; // times that timers wakeup without stats ramrod completion (total count - for debugging) 553 u32_t timer_wakeup_no_completion_max ; // max consecutive times timers wakeup without stats ramrod completion 554 u32_t stats_ramrod_cnt ; // number of times ramrod was called 555 }lm_stats_fw_collect_t ; 556 557 typedef struct _lm_fcoe_stats_t 558 { 559 //XSTORM 560 u64_t fcoe_tx_pkt_cnt /* Number of transmitted FCoE packets */; 561 u64_t fcoe_tx_byte_cnt /* Number of transmitted FCoE bytes */; 562 u64_t fcp_tx_pkt_cnt /* Number of transmitted FCP packets */; 563 //TSTORM section 0 564 u64_t fcoe_rx_pkt_cnt /* Number of FCoE packets that were legally received */; 565 u64_t fcoe_rx_byte_cnt /* Number of FCoE bytes that were legally received */; 566 //TSTORM section 1 567 u64_t fcoe_ver_cnt /* Number of packets with wrong FCoE version */; 568 u64_t fcoe_rx_drop_pkt_cnt_tstorm /* Number of FCoE packets that were dropped */; 569 //USTORM 570 u64_t fc_crc_cnt /* Number of packets with FC CRC error */; 571 u64_t eofa_del_cnt /* Number of packets with EOFa delimiter */; 572 u64_t miss_frame_cnt /* Number of missing packets */; 573 u64_t seq_timeout_cnt /* Number of sequence timeout expirations (E_D_TOV) */; 574 u64_t drop_seq_cnt /* Number of Sequences that were sropped */; 575 u64_t fcoe_rx_drop_pkt_cnt_ustorm /* Number of FCoE packets that were dropped */; 576 u64_t fcp_rx_pkt_cnt /* Number of FCP packets that were legally received */; 577 }lm_fcoe_stats_t; 578 579 // duplicate of fw HSI structures (using u64 instead u32) 580 typedef struct _lm_stats_fw_t 581 { 582 struct //eth_xstorm_common 583 { 584 struct 585 { 586 u64_t total_sent_bytes ; 587 u64_t total_sent_pkts ; 588 u64_t unicast_pkts_sent ; 589 u64_t unicast_bytes_sent ; 590 u64_t multicast_bytes_sent ; 591 u64_t multicast_pkts_sent ; 592 u64_t broadcast_pkts_sent ; 593 u64_t broadcast_bytes_sent ; 594 u64_t error_drop_pkts ; 595 } client_statistics[LM_CLI_IDX_MAX] ; 596 } eth_xstorm_common ; 597 598 struct //eth_tstorm_common 599 { 600 struct 601 { 602 u64_t rcv_unicast_bytes /* number of bytes in unicast packets received without errors and pass the filter */; 603 u64_t rcv_broadcast_bytes /* number of bytes in broadcast packets received without errors and pass the filter */; 604 u64_t rcv_multicast_bytes /* number of bytes in multicast packets received without errors and pass the filter */; 605 u64_t rcv_error_bytes /* number of bytes in dropped packets */; 606 u64_t checksum_discard /* number of bytes in dropped packets */; 607 u64_t packets_too_big_discard /* number of bytes in dropped packets */; 608 u64_t rcv_unicast_pkts /* number of packets in unicast packets received without errors and pass the filter */; 609 u64_t rcv_broadcast_pkts /* number of packets in broadcast packets received without errors and pass the filter */; 610 u64_t rcv_multicast_pkts /* number of packets in multicast packets received without errors and pass the filter */; 611 u64_t no_buff_discard /* the number of frames received from network dropped because of no buffer at host */; 612 u64_t ttl0_discard /* the number of good frames dropped because of TTL=0 */; 613 } client_statistics[LM_CLI_IDX_MAX] ; 614 615 struct 616 { 617 u64_t mac_filter_discard /* the number of good frames dropped because of no perfect match to MAC/VLAN address */; 618 u64_t xxoverflow_discard /* the number of good frames dropped because of xxOverflow in Tstorm */; 619 u64_t brb_truncate_discard /* the number of packtes that were dropped because they were truncated in BRB */; 620 u64_t mac_discard /* the number of received frames dropped because of errors in packet */; 621 } port_statistics; 622 } eth_tstorm_common ; 623 624 struct //eth_ustorm_common 625 { 626 struct 627 { 628 u64_t ucast_no_buff_bytes /* the number of unicast bytes received from network dropped because of no buffer at host */; 629 u64_t mcast_no_buff_bytes /* the number of multicast bytes received from network dropped because of no buffer at host */; 630 u64_t bcast_no_buff_bytes /* the number of broadcast bytes received from network dropped because of no buffer at host */; 631 u64_t ucast_no_buff_pkts /* the number of unicast frames received from network dropped because of no buffer at host */; 632 u64_t mcast_no_buff_pkts /* the number of unicast frames received from network dropped because of no buffer at host */; 633 u64_t bcast_no_buff_pkts /* the number of unicast frames received from network dropped because of no buffer at host */; 634 u64_t coalesced_pkts /* the number of packets coalesced in all aggregations */; 635 u64_t coalesced_bytes /* the number of bytes coalesced in all aggregations */; 636 u64_t coalesced_events /* the number of aggregations */; 637 u64_t coalesced_aborts /* the number of exception which avoid aggregation */; 638 } client_statistics[LM_CLI_IDX_MAX] ; 639 } eth_ustorm_common ; 640 641 struct // toe_xstorm_common 642 { 643 struct 644 { u64_t tcp_out_segments; 645 u64_t tcp_retransmitted_segments; 646 u64_t ip_out_octets; 647 u64_t ip_out_requests; 648 } statistics[STATS_IP_IDX_MAX] ; 649 } toe_xstorm_toe ; 650 651 struct // toe_tstorm_common 652 { 653 struct 654 { 655 u64_t ip_in_receives; 656 u64_t ip_in_delivers; 657 u64_t ip_in_octets; 658 u64_t tcp_in_errors /* all discards except discards already counted by Ipv4 stats */; 659 u64_t ip_in_header_errors /* IP checksum */; 660 u64_t ip_in_discards /* no resources */; 661 u64_t ip_in_truncated_packets; 662 } statistics[STATS_IP_IDX_MAX] ; 663 } toe_tstorm_toe ; 664 665 struct 666 { 667 u64_t no_tx_cqes /* count the number of time storm find that there are no more CQEs */; 668 } toe_cstorm_toe ; 669 670 lm_fcoe_stats_t fcoe; 671 672 }lm_stats_fw_t; 673 674 // duplicate of hw structures (using u64 instead u32 when needed) 675 typedef struct _stats_macs_t 676 { 677 struct 678 { 679 u64_t rx_stat_ifhcinoctets ; 680 u64_t rx_stat_ifhcinbadoctets ; // HW_MAND_28 E1H_Spec.32 681 u64_t rx_stat_etherstatsfragments ; // Spec. 38 // HW_MAND_21 E1H_Spec.25 682 u64_t rx_stat_ifhcinucastpkts ; 683 u64_t rx_stat_ifhcinmulticastpkts ; 684 u64_t rx_stat_ifhcinbroadcastpkts ; 685 u64_t rx_stat_dot3statsfcserrors ; // Spec. 9 // HW_MAND_00 E1H_Spec.4 686 u64_t rx_stat_dot3statsalignmenterrors ; // Spec. 10 // HW_MAND_01 E1H_Spec.5 687 u64_t rx_stat_dot3statscarriersenseerrors ; // HW_MAND_31 E1H_Spec.35 688 u64_t rx_stat_xonpauseframesreceived ; // HW_MAND_05 E1H_Spec.9 689 u64_t rx_stat_xoffpauseframesreceived ; // Spec. 15 // HW_MAND_06 E1H_Spec.10 690 u64_t rx_stat_maccontrolframesreceived ; // Spec. 22 // HW_MAND_13 E1H_Spec.17 691 u64_t rx_stat_maccontrolframesreceived_bmac_xpf ; // Spec. 22 xpf // HW_MAND_13 E1H_Spec.17 * 692 u64_t rx_stat_maccontrolframesreceived_bmac_xcf ; // Spec. 22 xcf // HW_MAND_13 E1H_Spec.17 * 693 u64_t rx_stat_xoffstateentered ; // Spec. 44 // HW_MAND_27 E1H_Spec.31 694 u64_t rx_stat_dot3statsframestoolong ; // Spec. 13 // HW_MAND_04 E1H_Spec.8 695 u64_t rx_stat_etherstatsjabbers ; // Spec. 39 // HW_MAND_22 E1H_Spec.26 696 u64_t rx_stat_etherstatsundersizepkts ; // Spec. 12 // HW_MAND_03 E1H_Spec.7 697 u64_t rx_stat_etherstatspkts64octets ; 698 u64_t rx_stat_etherstatspkts65octetsto127octets ; 699 u64_t rx_stat_etherstatspkts128octetsto255octets ; 700 u64_t rx_stat_etherstatspkts256octetsto511octets ; 701 u64_t rx_stat_etherstatspkts512octetsto1023octets ; 702 u64_t rx_stat_etherstatspkts1024octetsto1522octets ; 703 u64_t rx_stat_etherstatspktsover1522octets ; // Spec. (29) 704 u64_t rx_stat_pfcPacketCounter ; // Rx PFC Packet Counter 705 } stats_rx ; 706 707 struct 708 { 709 u64_t rx_stat_falsecarriererrors ; // HW_MAND_02 E1H_Spec.6 710 } stats_rx_err ; 711 712 struct 713 { 714 u64_t tx_stat_ifhcoutoctets ; 715 u64_t tx_stat_ifhcoutbadoctets ; // Spec. 46 // HW_MAND_29 E1H_Spec.33 716 u64_t tx_stat_etherstatscollisions ; // HW_MAND_25 E1H_Spec.29 717 u64_t tx_stat_outxonsent ; // HW_MAND_07 E1H_Spec.11 718 u64_t tx_stat_outxoffsent ; // Spec. 17 // HW_MAND_08 E1H_Spec.12 719 u64_t tx_stat_flowcontroldone ; // Spec. 43 // HW_MAND_26 E1H_Spec.30 720 u64_t tx_stat_dot3statssinglecollisionframes ; // Spec. 18 // HW_MAND_09 E1H_Spec.13 721 u64_t tx_stat_dot3statsmultiplecollisionframes ; // HW_MAND_10 E1H_Spec.14 722 u64_t tx_stat_dot3statsdeferredtransmissions ; // Spec. 40 // HW_MAND_23 E1H_Spec.27 723 u64_t tx_stat_dot3statsexcessivecollisions ; // Spec. 21 // HW_MAND_12 E1H_Spec.16 724 u64_t tx_stat_dot3statslatecollisions ; // HW_MAND_11 E1H_Spec.15 725 u64_t tx_stat_ifhcoutucastpkts ; // Spec. 6 726 u64_t tx_stat_ifhcoutucastpkts_bmac_pkt ; // Spec. 6 pkt 727 u64_t tx_stat_ifhcoutucastpkts_bmac_mca ; // Spec. 6 mca 728 u64_t tx_stat_ifhcoutucastpkts_bmac_bca ; // Spec. 6 bca 729 u64_t tx_stat_ifhcoutmulticastpkts ; // Spec. 7 730 u64_t tx_stat_ifhcoutbroadcastpkts ; // Spec. 8 731 u64_t tx_stat_etherstatspkts64octets ; // Spec. 30 // HW_MAND_14 E1H_Spec.18 732 u64_t tx_stat_etherstatspkts65octetsto127octets ; // Spec. 31 // HW_MAND_15 E1H_Spec.19 733 u64_t tx_stat_etherstatspkts128octetsto255octets ; // Spec. 32 // HW_MAND_16 E1H_Spec.20 734 u64_t tx_stat_etherstatspkts256octetsto511octets ; // Spec. 33 // HW_MAND_17 E1H_Spec.21 735 u64_t tx_stat_etherstatspkts512octetsto1023octets ; // Spec. 34 // HW_MAND_18 E1H_Spec.22 736 u64_t tx_stat_etherstatspkts1024octetsto1522octet ; // Spec. 35 // HW_MAND_19 E1H_Spec.23 737 u64_t tx_stat_etherstatspktsover1522octets ; // Spec. 36 // HW_MAND_20 E1H_Spec.24 738 u64_t tx_stat_etherstatspktsover1522octets_bmac_2047 ; // Spec. 36 2047 // HW_MAND_20 E1H_Spec.24 739 u64_t tx_stat_etherstatspktsover1522octets_bmac_4095 ; // Spec. 36 4095 // HW_MAND_20 E1H_Spec.24 740 u64_t tx_stat_etherstatspktsover1522octets_bmac_9216 ; // Spec. 36 9216 // HW_MAND_20 E1H_Spec.24 741 u64_t tx_stat_etherstatspktsover1522octets_bmac_16383 ; // Spec. 36 16383// HW_MAND_20 E1H_Spec.24 742 u64_t tx_stat_dot3statsinternalmactransmiterrors ; // Spec. 41 // HW_MAND_24 E1H_Spec.28 743 u64_t tx_stat_ifhcoutdiscards ; // Spec. 47 // HW_MAND_30 E1H_Spec.34 744 u64_t tx_stat_pfcPacketCounter ; // Tx PFC Packet Counter 745 } stats_tx ; 746 747 } stats_macs_t ; 748 749 typedef struct _stats_nig_t 750 { 751 u64_t brb_discard ; // Spec. 49 // HW_MAND_32 E1H_Spec.36 752 u64_t brb_packet ; // All the rest we'll need for mcp 753 u64_t brb_truncate ; 754 u64_t flow_ctrl_discard ; 755 u64_t flow_ctrl_octets ; 756 u64_t flow_ctrl_packet ; 757 u64_t mng_discard ; 758 u64_t mng_octet_inp ; 759 u64_t mng_octet_out ; 760 u64_t mng_packet_inp ; 761 u64_t mng_packet_out ; 762 u64_t pbf_octets ; 763 u64_t pbf_packet ; 764 u64_t safc_inp ; 765 } stats_nig_t ; 766 767 typedef struct _lm_stats_hw_t 768 { 769 stats_macs_t macs[STATS_MACS_IDX_MAX] ; // 2 copies, one for pre-reset values, one for updating 770 stats_nig_t nig ; // nig is always available - no need for 2 copies 771 stats_nig_ex_t nig_ex ; 772 misc_stats_t misc; 773 } lm_stats_hw_t ; 774 775 typedef struct _lm_stats_drv_t 776 { 777 // L2 statistics collected by driver 778 struct 779 { 780 u32_t rx_ipv4_frag_count; // Spec 6.2.1: IPv4 Fragment received packets - (indication from RCQ WQE) 781 u32_t rx_ip_cs_error_count; // Spec 6.2.2: IPv4 CS error received packets - (indication from RCQ WQE) 782 u32_t rx_tcp_cs_error_count; // Spec 6.2.3: TCP CS error received packets - (indication from RCQ WQE) 783 u32_t rx_llc_snap_count; // Spec 6.2.4: LLC/SNAP received packets - (indication from RCQ WQE) 784 u32_t rx_phy_error_count; // Spec 6.2.5: PHY error received packets - (indication from RCQ WQE) 785 u32_t rx_ipv6_ext_count ; // Spec 6.2.6: IPv6 Ext header received packets (indication from RCQ WQE) 786 u32_t rx_aborted ; 787 u32_t tx_no_l2_bd ; // Spec 6.2.7: Event counter: No free BD in the BD chain 788 u32_t tx_no_sq_wqe ; // Spec 6.2.8: Event counter: No free WQE for sending slow path command 789 u32_t tx_l2_assembly_buf_use ; // Spec 6.2.9: The number of packets on which the driver used the assembly buffer 790 u32_t tx_lso_frames ; 791 u32_t tx_aborted ; 792 u32_t tx_no_coalesce_buf ; 793 794 } drv_eth ; 795 796 // L4 statistics collected by driver 797 struct 798 { 799 struct 800 { 801 // for NDIS (per ipv) 802 u32_t currently_established; // Spec 6.3: Number of TCP which the current state is either ESTABLISHED or CLOSE-WAIT 803 u32_t out_resets; // Spec 6.3: Number of times that offloaded TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state 804 u32_t out_discards; // Spec 6.3: The number of output IP datagrams that the offload target supplied to its IP layer for which no problem was encountered to prevent their transmission but that were discarded for run-time reasons, such as a lack of memory or other resources 805 // Note: driver will always return '0' since it doesn't drop packets due to resourcse (stats email) 806 u32_t out_no_routes; // Spec 6.3: The number of output IP datagrams that the offload target supplied to its IP layer that were discarded because no route (such as an offloaded path state object) could be found to transmit them to their destination 807 // Note: driver will always return '0' (similar to above. see stats email) 808 809 // additional (per ipv) 810 u32_t out_fin ; // Spec 6.4.1-2: Number of Fin requests 811 u32_t in_fin ; // Spec 6.4.3-4: Number of Fin received 812 u32_t in_reset ; // Spec 6.4.5-6: Number of Reset received 813 814 } ipv[STATS_IP_IDX_MAX] ; 815 816 u32_t tx_no_l4_bd ; // Spec 6.4.: Event counter: No free BD in the BD chain 817 u32_t tx_l4_assembly_buf_use ; // Spec 6.4: The number of times that assembly buffer was used 818 u32_t rx_indicate_return_pending_cnt ; // Spec 6.4: The number of return pending indications 819 u32_t rx_indicate_return_done_cnt ; // Spec 6.4: The number of return done indications 820 u32_t rx_active_gen_buf_cnt; // Spec 6.4: The occupancy of generic buffer 821 822 } drv_toe ; 823 824 struct 825 { 826 eth_stats_info_t eth_stats; 827 fcoe_stats_info_t fcoe_stats; 828 iscsi_stats_info_t iscsi_stats; 829 830 } drv_info_to_mfw; 831 832 struct 833 { 834 fcoe_capabilities_t fcoe_capabilities; 835 } drv_info_to_shmem; 836 837 } lm_stats_drv_t ; 838 839 // main statistics structure inside lm_device 840 typedef struct _lm_stats_all_t 841 { 842 // device updated copy of statistics colected from fw/hw/driver? 843 struct 844 { 845 lm_stats_fw_t stats_fw ; // stats collected from fw using ramrod 846 lm_stats_hw_t stats_hw ; // stats collected from hw using DMAE 847 lm_stats_drv_t stats_drv; // stats collected from VBD driver 848 849 host_port_stats_t stats_mcp_port ; // stats need to be preserved on PMF migration 850 host_func_stats_t stats_mcp_func ; // stats need to be saved to mgmt periodically 851 host_func_stats_t stats_mcp_func_base ; // stats mgmt base for a funciton 852 853 } stats_mirror ; 854 855 // struct used to collect stats from fw & hw 856 struct 857 { 858 // fw shared memory copy of stats data 859 lm_stats_fw_collect_t stats_fw ; 860 861 // hw shared memory copy of stats data 862 lm_stats_hw_collect_t stats_hw ; 863 864 lm_stats_drv_info_to_mfw_t drv_info_to_mfw; 865 866 u32_t timer_wakeup ; // how many times timer was wake 867 868 u32_t shmem_disabled; // how many times stats were not collected due to shmem disable command 869 870 u32_t sp_record_disabled; // how many times stats were not collected due to FW SP trace 871 872 u64_t next_timer_ms ; // represents next stats timer wakeup (system time in milliseconds) 873 874 u8_t b_last_called ; // last call of timer ended 875 876 } stats_collect ; 877 878 } lm_stats_all_t; 879 880 #endif // _LM_STATS_H 881