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 22 /* 23 * Copyright 2014 QLogic Corporation 24 * The contents of this file are subject to the terms of the 25 * QLogic End User License (the "License"). 26 * You may not use this file except in compliance with the License. 27 * 28 * You can obtain a copy of the License at 29 * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/ 30 * QLogic_End_User_Software_License.txt 31 * See the License for the specific language governing permissions 32 * and limitations under the License. 33 */ 34 35 /* 36 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 37 */ 38 39 #include "bnxe.h" 40 41 typedef struct _BnxeKstat 42 { 43 kstat_named_t umdev_hi; 44 kstat_named_t umdev_lo; 45 kstat_named_t version; 46 kstat_named_t versionFW; 47 kstat_named_t versionBC; 48 kstat_named_t chipName; 49 kstat_named_t chipID; 50 kstat_named_t devBDF; 51 kstat_named_t devID; 52 kstat_named_t multiFunction; 53 kstat_named_t multiFunctionVnics; 54 kstat_named_t macAddr; 55 kstat_named_t hwInitDone; 56 kstat_named_t clientsHw; 57 kstat_named_t clientsDevi; 58 kstat_named_t clientsBound; 59 kstat_named_t txMsgPullUp; 60 kstat_named_t intrAlloc; 61 kstat_named_t intrFired; 62 kstat_named_t timerFired; 63 kstat_named_t timerReply; 64 kstat_named_t timerNoReplyTotal; 65 kstat_named_t timerNoReplyCurrent; 66 kstat_named_t timerDone; 67 kstat_named_t workQueueInstCnt; 68 kstat_named_t workItemInstQueued; 69 kstat_named_t workItemInstError; 70 kstat_named_t workItemInstComplete; 71 kstat_named_t workItemInstHighWater; 72 kstat_named_t workQueueDelayCnt; 73 kstat_named_t workItemDelayQueued; 74 kstat_named_t workItemDelayError; 75 kstat_named_t workItemDelayComplete; 76 kstat_named_t workItemDelayHighWater; 77 kstat_named_t memAllocBlocks; 78 kstat_named_t memAllocDMAs; 79 kstat_named_t memAllocBARs; 80 } BnxeKstat; 81 82 #define BNXE_KSTAT_SIZE (sizeof(BnxeKstat) / sizeof(kstat_named_t)) 83 84 typedef struct _BnxeKstatLink 85 { 86 kstat_named_t clients; 87 kstat_named_t uptime; 88 kstat_named_t mtuL2; 89 kstat_named_t mtuFCOE; 90 kstat_named_t speed; 91 kstat_named_t link; 92 kstat_named_t duplex; 93 kstat_named_t pauseRx; 94 kstat_named_t pauseTx; 95 } BnxeKstatLink; 96 97 #define BNXE_KSTAT_LINK_SIZE (sizeof(BnxeKstatLink) / sizeof(kstat_named_t)) 98 99 typedef struct _BnxeKstatIntr 100 { 101 kstat_named_t intrAlloc; 102 kstat_named_t intrFired; 103 kstat_named_t intrWrongState; 104 kstat_named_t intrInDisabled; 105 kstat_named_t intrZeroStatus; 106 kstat_named_t sb_00; 107 kstat_named_t sb_01; 108 kstat_named_t sb_02; 109 kstat_named_t sb_03; 110 kstat_named_t sb_04; 111 kstat_named_t sb_05; 112 kstat_named_t sb_06; 113 kstat_named_t sb_07; 114 kstat_named_t sb_08; 115 kstat_named_t sb_09; 116 kstat_named_t sb_10; 117 kstat_named_t sb_11; 118 kstat_named_t sb_12; 119 kstat_named_t sb_13; 120 kstat_named_t sb_14; 121 kstat_named_t sb_15; 122 kstat_named_t sb_16; 123 kstat_named_t sb_nc_00; 124 kstat_named_t sb_nc_01; 125 kstat_named_t sb_nc_02; 126 kstat_named_t sb_nc_03; 127 kstat_named_t sb_nc_04; 128 kstat_named_t sb_nc_05; 129 kstat_named_t sb_nc_06; 130 kstat_named_t sb_nc_07; 131 kstat_named_t sb_nc_08; 132 kstat_named_t sb_nc_09; 133 kstat_named_t sb_nc_10; 134 kstat_named_t sb_nc_11; 135 kstat_named_t sb_nc_12; 136 kstat_named_t sb_nc_13; 137 kstat_named_t sb_nc_14; 138 kstat_named_t sb_nc_15; 139 kstat_named_t sb_nc_16; 140 kstat_named_t sb_poll_00; 141 kstat_named_t sb_poll_01; 142 kstat_named_t sb_poll_02; 143 kstat_named_t sb_poll_03; 144 kstat_named_t sb_poll_04; 145 kstat_named_t sb_poll_05; 146 kstat_named_t sb_poll_06; 147 kstat_named_t sb_poll_07; 148 kstat_named_t sb_poll_08; 149 kstat_named_t sb_poll_09; 150 kstat_named_t sb_poll_10; 151 kstat_named_t sb_poll_11; 152 kstat_named_t sb_poll_12; 153 kstat_named_t sb_poll_13; 154 kstat_named_t sb_poll_14; 155 kstat_named_t sb_poll_15; 156 kstat_named_t sb_poll_16; 157 kstat_named_t sb_poll_nc_00; 158 kstat_named_t sb_poll_nc_01; 159 kstat_named_t sb_poll_nc_02; 160 kstat_named_t sb_poll_nc_03; 161 kstat_named_t sb_poll_nc_04; 162 kstat_named_t sb_poll_nc_05; 163 kstat_named_t sb_poll_nc_06; 164 kstat_named_t sb_poll_nc_07; 165 kstat_named_t sb_poll_nc_08; 166 kstat_named_t sb_poll_nc_09; 167 kstat_named_t sb_poll_nc_10; 168 kstat_named_t sb_poll_nc_11; 169 kstat_named_t sb_poll_nc_12; 170 kstat_named_t sb_poll_nc_13; 171 kstat_named_t sb_poll_nc_14; 172 kstat_named_t sb_poll_nc_15; 173 kstat_named_t sb_poll_nc_16; 174 } BnxeKstatIntr; 175 176 #define BNXE_KSTAT_INTR_SIZE (sizeof(BnxeKstatIntr) / sizeof(kstat_named_t)) 177 178 typedef struct _BnxeKstatL2Chip 179 { 180 kstat_named_t IfHCInOctets; 181 kstat_named_t IfHCInBadOctets; 182 kstat_named_t IfHCOutOctets; 183 kstat_named_t IfHCOutBadOctets; 184 kstat_named_t IfHCOutPkts; 185 kstat_named_t IfHCInPkts; 186 kstat_named_t IfHCInUcastPkts; 187 kstat_named_t IfHCInMulticastPkts; 188 kstat_named_t IfHCInBroadcastPkts; 189 kstat_named_t IfHCOutUcastPkts; 190 kstat_named_t IfHCOutMulticastPkts; 191 kstat_named_t IfHCOutBroadcastPkts; 192 kstat_named_t IfHCInUcastOctets; 193 kstat_named_t IfHCInMulticastOctets; 194 kstat_named_t IfHCInBroadcastOctets; 195 kstat_named_t IfHCOutUcastOctets; 196 kstat_named_t IfHCOutMulticastOctets; 197 kstat_named_t IfHCOutBroadcastOctets; 198 kstat_named_t IfHCOutDiscards; 199 kstat_named_t IfHCInFalseCarrierErrors; 200 kstat_named_t Dot3StatsInternalMacTransmitErrors; 201 kstat_named_t Dot3StatsCarrierSenseErrors; 202 kstat_named_t Dot3StatsFCSErrors; 203 kstat_named_t Dot3StatsAlignmentErrors; 204 kstat_named_t Dot3StatsSingleCollisionFrames; 205 kstat_named_t Dot3StatsMultipleCollisionFrames; 206 kstat_named_t Dot3StatsDeferredTransmissions; 207 kstat_named_t Dot3StatsExcessiveCollisions; 208 kstat_named_t Dot3StatsLateCollisions; 209 kstat_named_t EtherStatsCollisions; 210 kstat_named_t EtherStatsFragments; 211 kstat_named_t EtherStatsJabbers; 212 kstat_named_t EtherStatsUndersizePkts; 213 kstat_named_t EtherStatsOverrsizePkts; 214 kstat_named_t EtherStatsTx64Octets; 215 kstat_named_t EtherStatsTx65to127Octets; 216 kstat_named_t EtherStatsTx128to255Octets; 217 kstat_named_t EtherStatsTx256to511Octets; 218 kstat_named_t EtherStatsTx512to1023Octets; 219 kstat_named_t EtherStatsTx1024to1522Octets; 220 kstat_named_t EtherStatsTxOver1522Octets; 221 kstat_named_t XonPauseFramesReceived; 222 kstat_named_t XoffPauseFramesReceived; 223 kstat_named_t OutXonSent; 224 kstat_named_t OutXoffSent; 225 kstat_named_t FlowControlDone; 226 kstat_named_t MacControlFramesReceived; 227 kstat_named_t XoffStateEntered; 228 kstat_named_t IfInFramesL2FilterDiscards; 229 kstat_named_t IfInTTL0Discards; 230 kstat_named_t IfInxxOverflowDiscards; 231 kstat_named_t IfInMBUFDiscards; 232 kstat_named_t IfInErrors; 233 kstat_named_t IfInErrorsOctets; 234 kstat_named_t IfInNoBrbBuffer; 235 kstat_named_t NigBrbPacket; 236 kstat_named_t NigBrbTruncate; 237 kstat_named_t NigFlowCtrlDiscard; 238 kstat_named_t NigFlowCtrlOctets; 239 kstat_named_t NigFlowCtrlPacket; 240 kstat_named_t NigMngDiscard; 241 kstat_named_t NigMngOctetInp; 242 kstat_named_t NigMngOctetOut; 243 kstat_named_t NigMngPacketInp; 244 kstat_named_t NigMngPacketOut; 245 kstat_named_t NigPbfOctets; 246 kstat_named_t NigPbfPacket; 247 kstat_named_t NigSafcInp; 248 } BnxeKstatL2Chip; 249 250 #define BNXE_KSTAT_L2_CHIP_SIZE (sizeof(BnxeKstatL2Chip) / sizeof(kstat_named_t)) 251 252 typedef struct _BnxeKstatL2Driver 253 { 254 kstat_named_t RxIPv4FragCount; 255 kstat_named_t RxIpCsErrorCount; 256 kstat_named_t RxTcpCsErrorCount; 257 kstat_named_t RxLlcSnapCount; 258 kstat_named_t RxPhyErrorCount; 259 kstat_named_t RxIpv6ExtCount; 260 kstat_named_t TxNoL2Bd; 261 kstat_named_t TxNoSqWqe; 262 kstat_named_t TxL2AssemblyBufUse; 263 } BnxeKstatL2Driver; 264 265 #define BNXE_KSTAT_L2_DRIVER_SIZE (sizeof(BnxeKstatL2Driver) / sizeof(kstat_named_t)) 266 267 typedef struct _BnxeKstatEthStats 268 { 269 /* lm_stats_t */ 270 kstat_named_t txFramesOk; // LM_STATS_FRAMES_XMITTED_OK 271 kstat_named_t rxFramesOk; // LM_STATS_FRAMES_RECEIVED_OK 272 kstat_named_t txErr; // LM_STATS_ERRORED_TRANSMIT_CNT 273 kstat_named_t rxErr; // LM_STATS_ERRORED_RECEIVE_CNT 274 kstat_named_t rxCrcErr; // LM_STATS_RCV_CRC_ERROR 275 kstat_named_t alignErr; // LM_STATS_ALIGNMENT_ERROR 276 kstat_named_t collisionsSingle; // LM_STATS_SINGLE_COLLISION_FRAMES 277 kstat_named_t collisionsMultiple; // LM_STATS_MULTIPLE_COLLISION_FRAMES 278 kstat_named_t framesDeferred; // LM_STATS_FRAMES_DEFERRED 279 kstat_named_t collisonsMax; // LM_STATS_MAX_COLLISIONS 280 kstat_named_t rxOverrun; // LM_STATS_RCV_OVERRUN 281 kstat_named_t txOverrun; // LM_STATS_XMIT_UNDERRUN 282 kstat_named_t txFramesUnicast; // LM_STATS_UNICAST_FRAMES_XMIT 283 kstat_named_t txFramesMulticast; // LM_STATS_MULTICAST_FRAMES_XMIT 284 kstat_named_t txFramesBroadcast; // LM_STATS_BROADCAST_FRAMES_XMIT 285 kstat_named_t rxFramesUnicast; // LM_STATS_UNICAST_FRAMES_RCV 286 kstat_named_t rxFramesMulticast; // LM_STATS_MULTICAST_FRAMES_RCV 287 kstat_named_t rxFramesBroadcast; // LM_STATS_BROADCAST_FRAMES_RCV 288 kstat_named_t rxNoBufferDrop; // LM_STATS_RCV_NO_BUFFER_DROP 289 kstat_named_t rxBytes; // LM_STATS_BYTES_RCV 290 kstat_named_t txBytes; // LM_STATS_BYTES_XMIT 291 kstat_named_t offloadIP4; // LM_STATS_IP4_OFFLOAD 292 kstat_named_t offloadTCP; // LM_STATS_TCP_OFFLOAD 293 kstat_named_t ifInDiscards; // LM_STATS_IF_IN_DISCARDS 294 kstat_named_t ifInErrors; // LM_STATS_IF_IN_ERRORS 295 kstat_named_t ifOutErrors; // LM_STATS_IF_OUT_ERRORS 296 kstat_named_t offloadIP6; // LM_STATS_IP6_OFFLOAD 297 kstat_named_t offloadTCP6; // LM_STATS_TCP6_OFFLOAD 298 kstat_named_t txDiscards; // LM_STATS_XMIT_DISCARDS 299 kstat_named_t rxBytesUnicast; // LM_STATS_DIRECTED_BYTES_RCV 300 kstat_named_t rxBytesMulticast; // LM_STATS_MULTICAST_BYTES_RCV 301 kstat_named_t rxBytesBroadcast; // LM_STATS_BROADCAST_BYTES_RCV 302 kstat_named_t txBytesUnicast; // LM_STATS_DIRECTED_BYTES_XMIT 303 kstat_named_t txBytesMulticast; // LM_STATS_MULTICAST_BYTES_XMIT 304 kstat_named_t txBytesBroadcast; // LM_STATS_BROADCAST_BYTES_XMIT 305 } BnxeKstatEthStats; 306 307 #define BNXE_KSTAT_ETH_STATS_SIZE (sizeof(BnxeKstatEthStats) / sizeof(kstat_named_t)) 308 309 typedef struct _BnxeKstatFcoe 310 { 311 kstat_named_t pdev_hi; 312 kstat_named_t pdev_lo; 313 kstat_named_t instance; 314 kstat_named_t macAddr; 315 kstat_named_t pwwn_hi; 316 kstat_named_t pwwn_lo; 317 kstat_named_t mtu; 318 kstat_named_t initWqeTx; 319 kstat_named_t initWqeTxErr; 320 kstat_named_t initCqeRx; 321 kstat_named_t initCqeRxErr; 322 kstat_named_t offloadConnWqeTx; 323 kstat_named_t offloadConnWqeTxErr; 324 kstat_named_t offloadConnCqeRx; 325 kstat_named_t offloadConnCqeRxErr; 326 kstat_named_t enableConnWqeTx; 327 kstat_named_t enableConnWqeTxErr; 328 kstat_named_t enableConnCqeRx; 329 kstat_named_t enableConnCqeRxErr; 330 kstat_named_t disableConnWqeTx; 331 kstat_named_t disableConnWqeTxErr; 332 kstat_named_t disableConnCqeRx; 333 kstat_named_t disableConnCqeRxErr; 334 kstat_named_t destroyConnWqeTx; 335 kstat_named_t destroyConnWqeTxErr; 336 kstat_named_t destroyConnCqeRx; 337 kstat_named_t destroyConnCqeRxErr; 338 kstat_named_t destroyWqeTx; 339 kstat_named_t destroyWqeTxErr; 340 kstat_named_t destroyCqeRx; 341 kstat_named_t destroyCqeRxErr; 342 kstat_named_t compRequestCqeRx; 343 kstat_named_t compRequestCqeRxErr; 344 kstat_named_t statWqeTx; 345 kstat_named_t statWqeTxErr; 346 kstat_named_t statCqeRx; 347 kstat_named_t statCqeRxErr; 348 } BnxeKstatFcoe; 349 350 #define BNXE_KSTAT_FCOE_SIZE (sizeof(BnxeKstatFcoe) / sizeof(kstat_named_t)) 351 352 typedef struct _BnxeKstatDcbx 353 { 354 kstat_named_t dcbx_sync; 355 kstat_named_t dcbx_vers; 356 kstat_named_t overwrite_settings; 357 kstat_named_t prio_tag; 358 kstat_named_t prio_tag_fcoe; 359 kstat_named_t prio_tag_iscsi; 360 kstat_named_t prio_tag_net; 361 kstat_named_t pfc; 362 kstat_named_t pfc_prio_0; 363 kstat_named_t pfc_prio_1; 364 kstat_named_t pfc_prio_2; 365 kstat_named_t pfc_prio_3; 366 kstat_named_t pfc_prio_4; 367 kstat_named_t pfc_prio_5; 368 kstat_named_t pfc_prio_6; 369 kstat_named_t pfc_prio_7; 370 kstat_named_t ets; 371 kstat_named_t ets_prio_0_pg; 372 kstat_named_t ets_prio_1_pg; 373 kstat_named_t ets_prio_2_pg; 374 kstat_named_t ets_prio_3_pg; 375 kstat_named_t ets_prio_4_pg; 376 kstat_named_t ets_prio_5_pg; 377 kstat_named_t ets_prio_6_pg; 378 kstat_named_t ets_prio_7_pg; 379 kstat_named_t ets_pg_0_bw; 380 kstat_named_t ets_pg_1_bw; 381 kstat_named_t ets_pg_2_bw; 382 kstat_named_t ets_pg_3_bw; 383 kstat_named_t ets_pg_4_bw; 384 kstat_named_t ets_pg_5_bw; 385 kstat_named_t ets_pg_6_bw; 386 kstat_named_t ets_pg_7_bw; 387 kstat_named_t lldp; 388 kstat_named_t lldp_tx_interval; 389 kstat_named_t lldp_tx_fast_interval; 390 kstat_named_t amib_apptlv_willing; 391 kstat_named_t amib_apptlv_tx; 392 kstat_named_t amib_apptlv_net_prio; 393 kstat_named_t amib_apptlv_tbl_0_prio; 394 kstat_named_t amib_apptlv_tbl_0_appid; 395 kstat_named_t amib_apptlv_tbl_1_prio; 396 kstat_named_t amib_apptlv_tbl_1_appid; 397 kstat_named_t amib_apptlv_tbl_2_prio; 398 kstat_named_t amib_apptlv_tbl_2_appid; 399 kstat_named_t amib_apptlv_tbl_3_prio; 400 kstat_named_t amib_apptlv_tbl_3_appid; 401 kstat_named_t amib_pgtlv_willing; 402 kstat_named_t amib_pgtlv_tx; 403 kstat_named_t amib_pgtlv_tc_supported; 404 kstat_named_t amib_pgtlv_ets; 405 kstat_named_t amib_pgtlv_pg_0_bw; 406 kstat_named_t amib_pgtlv_pg_1_bw; 407 kstat_named_t amib_pgtlv_pg_2_bw; 408 kstat_named_t amib_pgtlv_pg_3_bw; 409 kstat_named_t amib_pgtlv_pg_4_bw; 410 kstat_named_t amib_pgtlv_pg_5_bw; 411 kstat_named_t amib_pgtlv_pg_6_bw; 412 kstat_named_t amib_pgtlv_pg_7_bw; 413 kstat_named_t amib_pgtlv_prio_0_map; 414 kstat_named_t amib_pgtlv_prio_1_map; 415 kstat_named_t amib_pgtlv_prio_2_map; 416 kstat_named_t amib_pgtlv_prio_3_map; 417 kstat_named_t amib_pgtlv_prio_4_map; 418 kstat_named_t amib_pgtlv_prio_5_map; 419 kstat_named_t amib_pgtlv_prio_6_map; 420 kstat_named_t amib_pgtlv_prio_7_map; 421 kstat_named_t amib_pfctlv_willing; 422 kstat_named_t amib_pfctlv_tx; 423 kstat_named_t amib_pfctlv_pfc; 424 kstat_named_t amib_pfctlv_pfc_map; 425 kstat_named_t rmib_apptlv_willing; 426 kstat_named_t rmib_apptlv_tbl_0_prio; 427 kstat_named_t rmib_apptlv_tbl_0_appid; 428 kstat_named_t rmib_apptlv_tbl_1_prio; 429 kstat_named_t rmib_apptlv_tbl_1_appid; 430 kstat_named_t rmib_apptlv_tbl_2_prio; 431 kstat_named_t rmib_apptlv_tbl_2_appid; 432 kstat_named_t rmib_apptlv_tbl_3_prio; 433 kstat_named_t rmib_apptlv_tbl_3_appid; 434 kstat_named_t rmib_pgtlv_willing; 435 kstat_named_t rmib_pgtlv_tc_supported; 436 kstat_named_t rmib_pgtlv_pg_0_bw; 437 kstat_named_t rmib_pgtlv_pg_1_bw; 438 kstat_named_t rmib_pgtlv_pg_2_bw; 439 kstat_named_t rmib_pgtlv_pg_3_bw; 440 kstat_named_t rmib_pgtlv_pg_4_bw; 441 kstat_named_t rmib_pgtlv_pg_5_bw; 442 kstat_named_t rmib_pgtlv_pg_6_bw; 443 kstat_named_t rmib_pgtlv_pg_7_bw; 444 kstat_named_t rmib_pgtlv_prio_0_map; 445 kstat_named_t rmib_pgtlv_prio_1_map; 446 kstat_named_t rmib_pgtlv_prio_2_map; 447 kstat_named_t rmib_pgtlv_prio_3_map; 448 kstat_named_t rmib_pgtlv_prio_4_map; 449 kstat_named_t rmib_pgtlv_prio_5_map; 450 kstat_named_t rmib_pgtlv_prio_6_map; 451 kstat_named_t rmib_pgtlv_prio_7_map; 452 kstat_named_t rmib_pfctlv_willing; 453 kstat_named_t rmib_pfctlv_pfc_map; 454 kstat_named_t rmib_pfctlv_capable; 455 kstat_named_t lmib_apptlv_tbl_0_prio; 456 kstat_named_t lmib_apptlv_tbl_0_appid; 457 kstat_named_t lmib_apptlv_tbl_1_prio; 458 kstat_named_t lmib_apptlv_tbl_1_appid; 459 kstat_named_t lmib_apptlv_tbl_2_prio; 460 kstat_named_t lmib_apptlv_tbl_2_appid; 461 kstat_named_t lmib_apptlv_tbl_3_prio; 462 kstat_named_t lmib_apptlv_tbl_3_appid; 463 kstat_named_t lmib_apptlv_mismatch; 464 kstat_named_t lmib_pgtlv_ets; 465 kstat_named_t lmib_pgtlv_tc_supported; 466 kstat_named_t lmib_pgtlv_pg_0_bw; 467 kstat_named_t lmib_pgtlv_pg_1_bw; 468 kstat_named_t lmib_pgtlv_pg_2_bw; 469 kstat_named_t lmib_pgtlv_pg_3_bw; 470 kstat_named_t lmib_pgtlv_pg_4_bw; 471 kstat_named_t lmib_pgtlv_pg_5_bw; 472 kstat_named_t lmib_pgtlv_pg_6_bw; 473 kstat_named_t lmib_pgtlv_pg_7_bw; 474 kstat_named_t lmib_pgtlv_prio_0_map; 475 kstat_named_t lmib_pgtlv_prio_1_map; 476 kstat_named_t lmib_pgtlv_prio_2_map; 477 kstat_named_t lmib_pgtlv_prio_3_map; 478 kstat_named_t lmib_pgtlv_prio_4_map; 479 kstat_named_t lmib_pgtlv_prio_5_map; 480 kstat_named_t lmib_pgtlv_prio_6_map; 481 kstat_named_t lmib_pgtlv_prio_7_map; 482 kstat_named_t lmib_pfctlv_pfc; 483 kstat_named_t lmib_pfctlv_pfc_map; 484 kstat_named_t lmib_pfctlv_capable; 485 kstat_named_t lmib_pfctlv_mismatch; 486 kstat_named_t dcbx_frames_rx; 487 kstat_named_t dcbx_frames_tx; 488 kstat_named_t pfc_frames_rx; 489 kstat_named_t pfc_frames_tx; 490 } BnxeKstatDcbx; 491 492 #define BNXE_KSTAT_DCBX_SIZE (sizeof(BnxeKstatDcbx) / sizeof(kstat_named_t)) 493 494 typedef struct _BnxeKstatRxq 495 { 496 kstat_named_t rxqBdTotal; 497 kstat_named_t rxqBdLeft; 498 kstat_named_t rxqBdPageCnt; 499 kstat_named_t rxqBdsPerPage; 500 kstat_named_t rxqBdSize; 501 kstat_named_t rxqBdsSkipEop; 502 kstat_named_t rxqBdProdIdx; 503 kstat_named_t rxqBdConsIdx; 504 kstat_named_t hwRxqConIdx; 505 kstat_named_t sgeBdTotal; 506 kstat_named_t sgeBdLeft; 507 kstat_named_t sgeBdPageCnt; 508 kstat_named_t sgeBdsPerPage; 509 kstat_named_t sgeBdSize; 510 kstat_named_t sgeBdsSkipEop; 511 kstat_named_t sgeBdProdIdx; 512 kstat_named_t sgeBdConsIdx; 513 kstat_named_t rcqBdTotal; 514 kstat_named_t rcqBdLeft; 515 kstat_named_t rcqBdPageCnt; 516 kstat_named_t rcqBdsPerPage; 517 kstat_named_t rcqBdSize; 518 kstat_named_t rcqBdsSkipEop; 519 kstat_named_t rcqBdProdIdx; 520 kstat_named_t rcqBdConsIdx; 521 kstat_named_t hwRcqConIdx; 522 kstat_named_t rxFreeDescs; 523 kstat_named_t rxActiveDescs; 524 kstat_named_t rxDoneDescs; 525 kstat_named_t rxWaitingDescs; 526 kstat_named_t rxCopied; 527 kstat_named_t rxDiscards; 528 kstat_named_t rxBufUpInStack; 529 kstat_named_t rxLowWater; 530 kstat_named_t inPollMode; 531 kstat_named_t pollCnt; 532 kstat_named_t intrDisableCnt; 533 kstat_named_t intrEnableCnt; 534 kstat_named_t genNumber; 535 } BnxeKstatRxq; 536 537 #define BNXE_KSTAT_RXQ_SIZE (sizeof(BnxeKstatRxq) / sizeof(kstat_named_t)) 538 539 typedef struct _BnxeKstatTxq 540 { 541 kstat_named_t txBdTotal; 542 kstat_named_t txBdLeft; 543 kstat_named_t txBdPageCnt; 544 kstat_named_t txBdsPerPage; 545 kstat_named_t txBdSize; 546 kstat_named_t txBdsSkipEop; 547 kstat_named_t hwTxqConIdx; 548 kstat_named_t txPktIdx; 549 kstat_named_t txBdProdIdx; 550 kstat_named_t txBdConsIdx; 551 kstat_named_t txSentPkts; 552 kstat_named_t txFreeDesc; 553 kstat_named_t txWaitingPkts; 554 kstat_named_t txLowWater; 555 kstat_named_t txFailed; 556 kstat_named_t txDiscards; 557 kstat_named_t txRecycle; 558 kstat_named_t txCopied; 559 kstat_named_t txBlocked; 560 kstat_named_t txWait; 561 } BnxeKstatTxq; 562 563 #define BNXE_KSTAT_TXQ_SIZE (sizeof(BnxeKstatTxq) / sizeof(kstat_named_t)) 564 565 566 static int BnxeKstatUpdate(kstat_t * kstats, 567 int rw) 568 { 569 BnxeKstat * pStats = (BnxeKstat *)kstats->ks_data; 570 um_device_t * pUM = (um_device_t *)kstats->ks_private; 571 lm_device_t * pLM = (lm_device_t *)pUM; 572 char buf[17]; /* 16 max for kstat string */ 573 574 if (rw == KSTAT_WRITE) 575 { 576 return EACCES; 577 } 578 579 BNXE_LOCK_ENTER_STATS(pUM); 580 581 snprintf(buf, sizeof(buf), "%p", (void *)pUM); 582 strncpy(pStats->umdev_hi.value.c, &buf[0], 8); 583 pStats->umdev_hi.value.c[8] = 0; 584 strncpy(pStats->umdev_lo.value.c, &buf[8], 8); 585 pStats->umdev_lo.value.c[8] = 0; 586 587 strncpy(pStats->version.value.c, pUM->version, sizeof(pStats->version.value.c)); 588 strncpy(pStats->versionFW.value.c, pUM->versionFW, sizeof(pStats->versionFW.value.c)); 589 strncpy(pStats->versionBC.value.c, pUM->versionBC, sizeof(pStats->versionBC.value.c)); 590 591 strncpy(pStats->chipName.value.c, pUM->chipName, sizeof(pStats->chipName.value.c)); 592 strncpy(pStats->chipID.value.c, pUM->chipID, sizeof(pStats->chipID.value.c)); 593 594 strncpy(pStats->devBDF.value.c, pUM->bus_dev_func, sizeof(pStats->devBDF.value.c)); 595 strncpy(pStats->devID.value.c, pUM->vendor_device, sizeof(pStats->devID.value.c)); 596 597 strncpy(pStats->multiFunction.value.c, 598 ((pUM->lm_dev.params.mf_mode == SINGLE_FUNCTION) ? "Single" : 599 (pUM->lm_dev.params.mf_mode == MULTI_FUNCTION_SD) ? "MF-SD" : 600 (pUM->lm_dev.params.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" : 601 (pUM->lm_dev.params.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : 602 "Unknown"), 603 sizeof(pStats->multiFunction.value.c)); 604 pStats->multiFunctionVnics.value.ui64 = IS_MULTI_VNIC(&pUM->lm_dev) ? pLM->params.vnics_per_port : 0; 605 606 snprintf(pStats->macAddr.value.c, 16, "%02x%02x%02x%02x%02x%02x", 607 pLM->params.mac_addr[0], pLM->params.mac_addr[1], 608 pLM->params.mac_addr[2], pLM->params.mac_addr[3], 609 pLM->params.mac_addr[4], pLM->params.mac_addr[5]); 610 611 pStats->hwInitDone.value.ui64 = pUM->hwInitDone; 612 613 snprintf(pStats->clientsHw.value.c, 16, BnxeClientsHw(pUM)); 614 snprintf(pStats->clientsDevi.value.c, 16, BnxeClientsDevi(pUM)); 615 snprintf(pStats->clientsBound.value.c, 16, BnxeClientsBound(pUM)); 616 617 pStats->txMsgPullUp.value.ui64 = pUM->txMsgPullUp; 618 619 strncpy(pStats->intrAlloc.value.c, pUM->intrAlloc, sizeof(pStats->intrAlloc.value.c)); 620 pStats->intrFired.value.ui64 = pUM->intrFired; 621 622 pStats->timerFired.value.ui64 = pLM->vars.stats.stats_collect.timer_wakeup; 623 pStats->timerReply.value.ui64 = pLM->vars.stats.stats_collect.stats_fw.drv_counter; 624 pStats->timerNoReplyTotal.value.ui64 = pLM->vars.stats.stats_collect.stats_fw.timer_wakeup_no_completion_total; 625 pStats->timerNoReplyCurrent.value.ui64 = pLM->vars.stats.stats_collect.stats_fw.timer_wakeup_no_completion_current; 626 pStats->timerDone.value.ui64 = pLM->vars.stats.stats_collect.stats_fw.b_completion_done; 627 628 pStats->workQueueInstCnt.value.ui64 = s_list_entry_cnt(&pUM->workqs.instq.workQueue); 629 pStats->workItemInstQueued.value.ui64 = pUM->workqs.instq.workItemQueued; 630 pStats->workItemInstError.value.ui64 = pUM->workqs.instq.workItemError; 631 pStats->workItemInstComplete.value.ui64 = pUM->workqs.instq.workItemComplete; 632 pStats->workItemInstHighWater.value.ui64 = pUM->workqs.instq.highWater; 633 634 pStats->workQueueDelayCnt.value.ui64 = s_list_entry_cnt(&pUM->workqs.delayq.workQueue); 635 pStats->workItemDelayQueued.value.ui64 = pUM->workqs.delayq.workItemQueued; 636 pStats->workItemDelayError.value.ui64 = pUM->workqs.delayq.workItemError; 637 pStats->workItemDelayComplete.value.ui64 = pUM->workqs.delayq.workItemComplete; 638 pStats->workItemDelayHighWater.value.ui64 = pUM->workqs.delayq.highWater; 639 640 pStats->memAllocBlocks.value.ui64 = d_list_entry_cnt(&pUM->memBlockList); 641 pStats->memAllocDMAs.value.ui64 = d_list_entry_cnt(&pUM->memDmaList); 642 pStats->memAllocBARs.value.ui64 = d_list_entry_cnt(&pUM->memRegionList); 643 644 BNXE_LOCK_EXIT_STATS(pUM); 645 646 return 0; 647 } 648 649 650 static int BnxeKstatLinkUpdate(kstat_t * kstats, 651 int rw) 652 { 653 BnxeKstatLink * pStats = (BnxeKstatLink *)kstats->ks_data; 654 um_device_t * pUM = (um_device_t *)kstats->ks_private; 655 lm_device_t * pLM = (lm_device_t *)pUM; 656 657 if (rw == KSTAT_WRITE) 658 { 659 return EACCES; 660 } 661 662 BNXE_LOCK_ENTER_STATS(pUM); 663 664 snprintf(pStats->clients.value.c, 16, BnxeClientsBound(pUM)); 665 pStats->uptime.value.ui64 = (pUM->props.link_speed) ? 666 (ddi_get_time() - pUM->props.uptime) : 0; 667 pStats->mtuL2.value.ui64 = pUM->lm_dev.params.mtu[LM_CLI_IDX_NDIS]; 668 pStats->mtuFCOE.value.ui64 = (BNXE_FCOE(pUM)) ? 669 pUM->lm_dev.params.mtu[LM_CLI_IDX_FCOE] : 670 0; 671 pStats->speed.value.ui64 = pUM->props.link_speed; 672 pStats->link.value.ui64 = (!pUM->props.link_speed) ? 0 : 1; 673 pStats->duplex.value.ui64 = pUM->props.link_duplex; 674 pStats->pauseRx.value.ui64 = pUM->props.link_rxpause; 675 pStats->pauseTx.value.ui64 = pUM->props.link_txpause; 676 677 BNXE_LOCK_EXIT_STATS(pUM); 678 679 return 0; 680 } 681 682 683 static int BnxeKstatIntrUpdate(kstat_t * kstats, 684 int rw) 685 { 686 BnxeKstatIntr * pStats = (BnxeKstatIntr *)kstats->ks_data; 687 um_device_t * pUM = (um_device_t *)kstats->ks_private; 688 lm_device_t * pLM = (lm_device_t *)pUM; 689 690 if (rw == KSTAT_WRITE) 691 { 692 return EACCES; 693 } 694 695 BNXE_LOCK_ENTER_STATS(pUM); 696 697 strncpy(pStats->intrAlloc.value.c, pUM->intrAlloc, sizeof(pStats->intrAlloc.value.c)); 698 pStats->intrFired.value.ui64 = pUM->intrFired; 699 pStats->intrWrongState.value.ui64 = pLM->vars.dbg_intr_in_wrong_state; 700 pStats->intrInDisabled.value.ui64 = pLM->vars.dbg_intr_in_disabled; 701 pStats->intrZeroStatus.value.ui64 = pLM->vars.dbg_intr_zero_status; 702 pStats->sb_00.value.ui64 = pUM->intrSbCnt[0]; 703 pStats->sb_01.value.ui64 = pUM->intrSbCnt[1]; 704 pStats->sb_02.value.ui64 = pUM->intrSbCnt[2]; 705 pStats->sb_03.value.ui64 = pUM->intrSbCnt[3]; 706 pStats->sb_04.value.ui64 = pUM->intrSbCnt[4]; 707 pStats->sb_05.value.ui64 = pUM->intrSbCnt[5]; 708 pStats->sb_06.value.ui64 = pUM->intrSbCnt[6]; 709 pStats->sb_07.value.ui64 = pUM->intrSbCnt[7]; 710 pStats->sb_08.value.ui64 = pUM->intrSbCnt[8]; 711 pStats->sb_09.value.ui64 = pUM->intrSbCnt[9]; 712 pStats->sb_10.value.ui64 = pUM->intrSbCnt[10]; 713 pStats->sb_11.value.ui64 = pUM->intrSbCnt[11]; 714 pStats->sb_12.value.ui64 = pUM->intrSbCnt[12]; 715 pStats->sb_13.value.ui64 = pUM->intrSbCnt[13]; 716 pStats->sb_14.value.ui64 = pUM->intrSbCnt[14]; 717 pStats->sb_15.value.ui64 = pUM->intrSbCnt[15]; 718 pStats->sb_16.value.ui64 = pUM->intrSbCnt[16]; 719 pStats->sb_nc_00.value.ui64 = pUM->intrSbNoChangeCnt[0]; 720 pStats->sb_nc_01.value.ui64 = pUM->intrSbNoChangeCnt[1]; 721 pStats->sb_nc_02.value.ui64 = pUM->intrSbNoChangeCnt[2]; 722 pStats->sb_nc_03.value.ui64 = pUM->intrSbNoChangeCnt[3]; 723 pStats->sb_nc_04.value.ui64 = pUM->intrSbNoChangeCnt[4]; 724 pStats->sb_nc_05.value.ui64 = pUM->intrSbNoChangeCnt[5]; 725 pStats->sb_nc_06.value.ui64 = pUM->intrSbNoChangeCnt[6]; 726 pStats->sb_nc_07.value.ui64 = pUM->intrSbNoChangeCnt[7]; 727 pStats->sb_nc_08.value.ui64 = pUM->intrSbNoChangeCnt[8]; 728 pStats->sb_nc_09.value.ui64 = pUM->intrSbNoChangeCnt[9]; 729 pStats->sb_nc_10.value.ui64 = pUM->intrSbNoChangeCnt[10]; 730 pStats->sb_nc_11.value.ui64 = pUM->intrSbNoChangeCnt[11]; 731 pStats->sb_nc_12.value.ui64 = pUM->intrSbNoChangeCnt[12]; 732 pStats->sb_nc_13.value.ui64 = pUM->intrSbNoChangeCnt[13]; 733 pStats->sb_nc_14.value.ui64 = pUM->intrSbNoChangeCnt[14]; 734 pStats->sb_nc_15.value.ui64 = pUM->intrSbNoChangeCnt[15]; 735 pStats->sb_nc_16.value.ui64 = pUM->intrSbNoChangeCnt[16]; 736 pStats->sb_poll_00.value.ui64 = pUM->intrSbPollCnt[0]; 737 pStats->sb_poll_01.value.ui64 = pUM->intrSbPollCnt[1]; 738 pStats->sb_poll_02.value.ui64 = pUM->intrSbPollCnt[2]; 739 pStats->sb_poll_03.value.ui64 = pUM->intrSbPollCnt[3]; 740 pStats->sb_poll_04.value.ui64 = pUM->intrSbPollCnt[4]; 741 pStats->sb_poll_05.value.ui64 = pUM->intrSbPollCnt[5]; 742 pStats->sb_poll_06.value.ui64 = pUM->intrSbPollCnt[6]; 743 pStats->sb_poll_07.value.ui64 = pUM->intrSbPollCnt[7]; 744 pStats->sb_poll_08.value.ui64 = pUM->intrSbPollCnt[8]; 745 pStats->sb_poll_09.value.ui64 = pUM->intrSbPollCnt[9]; 746 pStats->sb_poll_10.value.ui64 = pUM->intrSbPollCnt[10]; 747 pStats->sb_poll_11.value.ui64 = pUM->intrSbPollCnt[11]; 748 pStats->sb_poll_12.value.ui64 = pUM->intrSbPollCnt[12]; 749 pStats->sb_poll_13.value.ui64 = pUM->intrSbPollCnt[13]; 750 pStats->sb_poll_14.value.ui64 = pUM->intrSbPollCnt[14]; 751 pStats->sb_poll_15.value.ui64 = pUM->intrSbPollCnt[15]; 752 pStats->sb_poll_16.value.ui64 = pUM->intrSbPollCnt[16]; 753 pStats->sb_poll_nc_00.value.ui64 = pUM->intrSbPollNoChangeCnt[0]; 754 pStats->sb_poll_nc_01.value.ui64 = pUM->intrSbPollNoChangeCnt[1]; 755 pStats->sb_poll_nc_02.value.ui64 = pUM->intrSbPollNoChangeCnt[2]; 756 pStats->sb_poll_nc_03.value.ui64 = pUM->intrSbPollNoChangeCnt[3]; 757 pStats->sb_poll_nc_04.value.ui64 = pUM->intrSbPollNoChangeCnt[4]; 758 pStats->sb_poll_nc_05.value.ui64 = pUM->intrSbPollNoChangeCnt[5]; 759 pStats->sb_poll_nc_06.value.ui64 = pUM->intrSbPollNoChangeCnt[6]; 760 pStats->sb_poll_nc_07.value.ui64 = pUM->intrSbPollNoChangeCnt[7]; 761 pStats->sb_poll_nc_08.value.ui64 = pUM->intrSbPollNoChangeCnt[8]; 762 pStats->sb_poll_nc_09.value.ui64 = pUM->intrSbPollNoChangeCnt[9]; 763 pStats->sb_poll_nc_10.value.ui64 = pUM->intrSbPollNoChangeCnt[10]; 764 pStats->sb_poll_nc_11.value.ui64 = pUM->intrSbPollNoChangeCnt[11]; 765 pStats->sb_poll_nc_12.value.ui64 = pUM->intrSbPollNoChangeCnt[12]; 766 pStats->sb_poll_nc_13.value.ui64 = pUM->intrSbPollNoChangeCnt[13]; 767 pStats->sb_poll_nc_14.value.ui64 = pUM->intrSbPollNoChangeCnt[14]; 768 pStats->sb_poll_nc_15.value.ui64 = pUM->intrSbPollNoChangeCnt[15]; 769 pStats->sb_poll_nc_16.value.ui64 = pUM->intrSbPollNoChangeCnt[16]; 770 771 BNXE_LOCK_EXIT_STATS(pUM); 772 773 return 0; 774 } 775 776 777 static int BnxeKstatL2ChipUpdate(kstat_t * kstats, 778 int rw) 779 { 780 BnxeKstatL2Chip * pStats = (BnxeKstatL2Chip *)kstats->ks_data; 781 um_device_t * pUM = (um_device_t *)kstats->ks_private; 782 lm_device_t * pLM = (lm_device_t *)pUM; 783 b10_l2_chip_statistics_t b10_l2_stats; 784 785 if (rw == KSTAT_WRITE) 786 { 787 return EACCES; 788 } 789 790 BNXE_LOCK_ENTER_STATS(pUM); 791 792 lm_stats_get_l2_chip_stats(pLM, &b10_l2_stats, 793 L2_CHIP_STATISTICS_VER_NUM_1); 794 795 pStats->IfHCInOctets.value.ui64 = b10_l2_stats.IfHCInOctets; 796 pStats->IfHCInBadOctets.value.ui64 = b10_l2_stats.IfHCInBadOctets; 797 pStats->IfHCOutOctets.value.ui64 = b10_l2_stats.IfHCOutOctets; 798 pStats->IfHCOutBadOctets.value.ui64 = b10_l2_stats.IfHCOutBadOctets; 799 pStats->IfHCOutPkts.value.ui64 = b10_l2_stats.IfHCOutPkts; 800 pStats->IfHCInPkts.value.ui64 = b10_l2_stats.IfHCInPkts; 801 pStats->IfHCInUcastPkts.value.ui64 = b10_l2_stats.IfHCInUcastPkts; 802 pStats->IfHCInMulticastPkts.value.ui64 = b10_l2_stats.IfHCInMulticastPkts; 803 pStats->IfHCInBroadcastPkts.value.ui64 = b10_l2_stats.IfHCInBroadcastPkts; 804 pStats->IfHCOutUcastPkts.value.ui64 = b10_l2_stats.IfHCOutUcastPkts; 805 pStats->IfHCOutMulticastPkts.value.ui64 = b10_l2_stats.IfHCOutMulticastPkts; 806 pStats->IfHCOutBroadcastPkts.value.ui64 = b10_l2_stats.IfHCOutBroadcastPkts; 807 pStats->IfHCInUcastOctets.value.ui64 = b10_l2_stats.IfHCInUcastOctets; 808 pStats->IfHCInMulticastOctets.value.ui64 = b10_l2_stats.IfHCInMulticastOctets; 809 pStats->IfHCInBroadcastOctets.value.ui64 = b10_l2_stats.IfHCInBroadcastOctets; 810 pStats->IfHCOutUcastOctets.value.ui64 = b10_l2_stats.IfHCOutUcastOctets; 811 pStats->IfHCOutMulticastOctets.value.ui64 = b10_l2_stats.IfHCOutMulticastOctets; 812 pStats->IfHCOutBroadcastOctets.value.ui64 = b10_l2_stats.IfHCOutBroadcastOctets; 813 pStats->IfHCOutDiscards.value.ui64 = b10_l2_stats.IfHCOutDiscards; 814 pStats->IfHCInFalseCarrierErrors.value.ui64 = b10_l2_stats.IfHCInFalseCarrierErrors; 815 pStats->Dot3StatsInternalMacTransmitErrors.value.ui64 = b10_l2_stats.Dot3StatsInternalMacTransmitErrors; 816 pStats->Dot3StatsCarrierSenseErrors.value.ui64 = b10_l2_stats.Dot3StatsCarrierSenseErrors; 817 pStats->Dot3StatsFCSErrors.value.ui64 = b10_l2_stats.Dot3StatsFCSErrors; 818 pStats->Dot3StatsAlignmentErrors.value.ui64 = b10_l2_stats.Dot3StatsAlignmentErrors; 819 pStats->Dot3StatsSingleCollisionFrames.value.ui64 = b10_l2_stats.Dot3StatsSingleCollisionFrames; 820 pStats->Dot3StatsMultipleCollisionFrames.value.ui64 = b10_l2_stats.Dot3StatsMultipleCollisionFrames; 821 pStats->Dot3StatsDeferredTransmissions.value.ui64 = b10_l2_stats.Dot3StatsDeferredTransmissions; 822 pStats->Dot3StatsExcessiveCollisions.value.ui64 = b10_l2_stats.Dot3StatsExcessiveCollisions; 823 pStats->Dot3StatsLateCollisions.value.ui64 = b10_l2_stats.Dot3StatsLateCollisions; 824 pStats->EtherStatsCollisions.value.ui64 = b10_l2_stats.EtherStatsCollisions; 825 pStats->EtherStatsFragments.value.ui64 = b10_l2_stats.EtherStatsFragments; 826 pStats->EtherStatsJabbers.value.ui64 = b10_l2_stats.EtherStatsJabbers; 827 pStats->EtherStatsUndersizePkts.value.ui64 = b10_l2_stats.EtherStatsUndersizePkts; 828 pStats->EtherStatsOverrsizePkts.value.ui64 = b10_l2_stats.EtherStatsOverrsizePkts; 829 pStats->EtherStatsTx64Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx64Octets; 830 pStats->EtherStatsTx65to127Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx65Octetsto127Octets; 831 pStats->EtherStatsTx128to255Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx128Octetsto255Octets; 832 pStats->EtherStatsTx256to511Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx256Octetsto511Octets; 833 pStats->EtherStatsTx512to1023Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx512Octetsto1023Octets; 834 pStats->EtherStatsTx1024to1522Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTx1024Octetsto1522Octets; 835 pStats->EtherStatsTxOver1522Octets.value.ui64 = b10_l2_stats.EtherStatsPktsTxOver1522Octets; 836 pStats->XonPauseFramesReceived.value.ui64 = b10_l2_stats.XonPauseFramesReceived; 837 pStats->XoffPauseFramesReceived.value.ui64 = b10_l2_stats.XoffPauseFramesReceived; 838 pStats->OutXonSent.value.ui64 = b10_l2_stats.OutXonSent; 839 pStats->OutXoffSent.value.ui64 = b10_l2_stats.OutXoffSent; 840 pStats->FlowControlDone.value.ui64 = b10_l2_stats.FlowControlDone; 841 pStats->MacControlFramesReceived.value.ui64 = b10_l2_stats.MacControlFramesReceived; 842 pStats->XoffStateEntered.value.ui64 = b10_l2_stats.XoffStateEntered; 843 pStats->IfInFramesL2FilterDiscards.value.ui64 = b10_l2_stats.IfInFramesL2FilterDiscards; 844 pStats->IfInTTL0Discards.value.ui64 = b10_l2_stats.IfInTTL0Discards; 845 pStats->IfInxxOverflowDiscards.value.ui64 = b10_l2_stats.IfInxxOverflowDiscards; 846 pStats->IfInMBUFDiscards.value.ui64 = b10_l2_stats.IfInMBUFDiscards; 847 pStats->IfInErrors.value.ui64 = b10_l2_stats.IfInErrors; 848 pStats->IfInErrorsOctets.value.ui64 = b10_l2_stats.IfInErrorsOctets; 849 pStats->IfInNoBrbBuffer.value.ui64 = b10_l2_stats.IfInNoBrbBuffer; 850 pStats->NigBrbPacket.value.ui64 = b10_l2_stats.Nig_brb_packet; 851 pStats->NigBrbTruncate.value.ui64 = b10_l2_stats.Nig_brb_truncate; 852 pStats->NigFlowCtrlDiscard.value.ui64 = b10_l2_stats.Nig_flow_ctrl_discard; 853 pStats->NigFlowCtrlOctets.value.ui64 = b10_l2_stats.Nig_flow_ctrl_octets; 854 pStats->NigFlowCtrlPacket.value.ui64 = b10_l2_stats.Nig_flow_ctrl_packet; 855 pStats->NigMngDiscard.value.ui64 = b10_l2_stats.Nig_mng_discard; 856 pStats->NigMngOctetInp.value.ui64 = b10_l2_stats.Nig_mng_octet_inp; 857 pStats->NigMngOctetOut.value.ui64 = b10_l2_stats.Nig_mng_octet_out; 858 pStats->NigMngPacketInp.value.ui64 = b10_l2_stats.Nig_mng_packet_inp; 859 pStats->NigMngPacketOut.value.ui64 = b10_l2_stats.Nig_mng_packet_out; 860 pStats->NigPbfOctets.value.ui64 = b10_l2_stats.Nig_pbf_octets; 861 pStats->NigPbfPacket.value.ui64 = b10_l2_stats.Nig_pbf_packet; 862 pStats->NigSafcInp.value.ui64 = b10_l2_stats.Nig_safc_inp; 863 864 BNXE_LOCK_EXIT_STATS(pUM); 865 866 return 0; 867 } 868 869 870 static int BnxeKstatL2DriverUpdate(kstat_t * kstats, 871 int rw) 872 { 873 BnxeKstatL2Driver * pStats = (BnxeKstatL2Driver *)kstats->ks_data; 874 um_device_t * pUM = (um_device_t *)kstats->ks_private; 875 lm_device_t * pLM = (lm_device_t *)pUM; 876 b10_l2_driver_statistics_t b10_l2_stats; 877 878 if (rw == KSTAT_WRITE) 879 { 880 return EACCES; 881 } 882 883 BNXE_LOCK_ENTER_STATS(pUM); 884 885 lm_stats_get_l2_driver_stats(pLM, &b10_l2_stats); 886 887 pStats->RxIPv4FragCount.value.ui64 = b10_l2_stats.RxIPv4FragCount; 888 pStats->RxIpCsErrorCount.value.ui64 = b10_l2_stats.RxIpCsErrorCount; 889 pStats->RxTcpCsErrorCount.value.ui64 = b10_l2_stats.RxTcpCsErrorCount; 890 pStats->RxLlcSnapCount.value.ui64 = b10_l2_stats.RxLlcSnapCount; 891 pStats->RxPhyErrorCount.value.ui64 = b10_l2_stats.RxPhyErrorCount; 892 pStats->RxIpv6ExtCount.value.ui64 = b10_l2_stats.RxIpv6ExtCount; 893 pStats->TxNoL2Bd.value.ui64 = b10_l2_stats.TxNoL2Bd; 894 pStats->TxNoSqWqe.value.ui64 = b10_l2_stats.TxNoSqWqe; 895 pStats->TxL2AssemblyBufUse.value.ui64 = b10_l2_stats.TxL2AssemblyBufUse; 896 897 BNXE_LOCK_EXIT_STATS(pUM); 898 899 return 0; 900 } 901 902 903 static int BnxeKstatL2StatsUpdate(kstat_t * kstats, 904 int rw) 905 { 906 BnxeKstatEthStats * pStats = (BnxeKstatEthStats *)kstats->ks_data; 907 um_device_t * pUM = (um_device_t *)kstats->ks_private; 908 lm_device_t * pLM = (lm_device_t *)pUM; 909 910 if (rw == KSTAT_WRITE) 911 { 912 return EACCES; 913 } 914 915 BNXE_LOCK_ENTER_STATS(pUM); 916 917 lm_get_stats(pLM, LM_STATS_FRAMES_XMITTED_OK, (u64_t *)&pStats->txFramesOk.value.ui64); 918 lm_get_stats(pLM, LM_STATS_FRAMES_RECEIVED_OK, (u64_t *)&pStats->rxFramesOk.value.ui64); 919 lm_get_stats(pLM, LM_STATS_ERRORED_TRANSMIT_CNT, (u64_t *)&pStats->txErr.value.ui64); 920 lm_get_stats(pLM, LM_STATS_ERRORED_RECEIVE_CNT, (u64_t *)&pStats->rxErr.value.ui64); 921 lm_get_stats(pLM, LM_STATS_RCV_CRC_ERROR, (u64_t *)&pStats->rxCrcErr.value.ui64); 922 lm_get_stats(pLM, LM_STATS_ALIGNMENT_ERROR, (u64_t *)&pStats->alignErr.value.ui64); 923 lm_get_stats(pLM, LM_STATS_SINGLE_COLLISION_FRAMES, (u64_t *)&pStats->collisionsSingle.value.ui64); 924 lm_get_stats(pLM, LM_STATS_MULTIPLE_COLLISION_FRAMES, (u64_t *)&pStats->collisionsMultiple.value.ui64); 925 lm_get_stats(pLM, LM_STATS_FRAMES_DEFERRED, (u64_t *)&pStats->framesDeferred.value.ui64); 926 lm_get_stats(pLM, LM_STATS_MAX_COLLISIONS, (u64_t *)&pStats->collisonsMax.value.ui64); 927 lm_get_stats(pLM, LM_STATS_RCV_OVERRUN, (u64_t *)&pStats->rxOverrun.value.ui64); 928 lm_get_stats(pLM, LM_STATS_XMIT_UNDERRUN, (u64_t *)&pStats->txOverrun.value.ui64); 929 lm_get_stats(pLM, LM_STATS_UNICAST_FRAMES_XMIT, (u64_t *)&pStats->txFramesUnicast.value.ui64); 930 lm_get_stats(pLM, LM_STATS_MULTICAST_FRAMES_XMIT, (u64_t *)&pStats->txFramesMulticast.value.ui64); 931 lm_get_stats(pLM, LM_STATS_BROADCAST_FRAMES_XMIT, (u64_t *)&pStats->txFramesBroadcast.value.ui64); 932 lm_get_stats(pLM, LM_STATS_UNICAST_FRAMES_RCV, (u64_t *)&pStats->rxFramesUnicast.value.ui64); 933 lm_get_stats(pLM, LM_STATS_MULTICAST_FRAMES_RCV, (u64_t *)&pStats->rxFramesMulticast.value.ui64); 934 lm_get_stats(pLM, LM_STATS_BROADCAST_FRAMES_RCV, (u64_t *)&pStats->rxFramesBroadcast.value.ui64); 935 lm_get_stats(pLM, LM_STATS_RCV_NO_BUFFER_DROP, (u64_t *)&pStats->rxNoBufferDrop.value.ui64); 936 lm_get_stats(pLM, LM_STATS_BYTES_RCV, (u64_t *)&pStats->rxBytes.value.ui64); 937 lm_get_stats(pLM, LM_STATS_BYTES_XMIT, (u64_t *)&pStats->txBytes.value.ui64); 938 lm_get_stats(pLM, LM_STATS_IP4_OFFLOAD, (u64_t *)&pStats->offloadIP4.value.ui64); 939 lm_get_stats(pLM, LM_STATS_TCP_OFFLOAD, (u64_t *)&pStats->offloadTCP.value.ui64); 940 lm_get_stats(pLM, LM_STATS_IF_IN_DISCARDS, (u64_t *)&pStats->ifInDiscards.value.ui64); 941 lm_get_stats(pLM, LM_STATS_IF_IN_ERRORS, (u64_t *)&pStats->ifInErrors.value.ui64); 942 lm_get_stats(pLM, LM_STATS_IF_OUT_ERRORS, (u64_t *)&pStats->ifOutErrors.value.ui64); 943 lm_get_stats(pLM, LM_STATS_IP6_OFFLOAD, (u64_t *)&pStats->offloadIP6.value.ui64); 944 lm_get_stats(pLM, LM_STATS_TCP6_OFFLOAD, (u64_t *)&pStats->offloadTCP6.value.ui64); 945 lm_get_stats(pLM, LM_STATS_XMIT_DISCARDS, (u64_t *)&pStats->txDiscards.value.ui64); 946 lm_get_stats(pLM, LM_STATS_DIRECTED_BYTES_RCV, (u64_t *)&pStats->rxBytesUnicast.value.ui64); 947 lm_get_stats(pLM, LM_STATS_MULTICAST_BYTES_RCV, (u64_t *)&pStats->rxBytesMulticast.value.ui64); 948 lm_get_stats(pLM, LM_STATS_BROADCAST_BYTES_RCV, (u64_t *)&pStats->rxBytesBroadcast.value.ui64); 949 lm_get_stats(pLM, LM_STATS_DIRECTED_BYTES_XMIT, (u64_t *)&pStats->txBytesUnicast.value.ui64); 950 lm_get_stats(pLM, LM_STATS_MULTICAST_BYTES_XMIT, (u64_t *)&pStats->txBytesMulticast.value.ui64); 951 lm_get_stats(pLM, LM_STATS_BROADCAST_BYTES_XMIT, (u64_t *)&pStats->txBytesBroadcast.value.ui64); 952 953 BNXE_LOCK_EXIT_STATS(pUM); 954 955 return 0; 956 } 957 958 959 static int BnxeKstatFcoeUpdate(kstat_t * kstats, 960 int rw) 961 { 962 BnxeKstatFcoe * pStats = (BnxeKstatFcoe *)kstats->ks_data; 963 um_device_t * pUM = (um_device_t *)kstats->ks_private; 964 lm_device_t * pLM = (lm_device_t *)pUM; 965 char buf[17]; /* 16 max for kstat string */ 966 967 if (rw == KSTAT_WRITE) 968 { 969 return EACCES; 970 } 971 972 BNXE_LOCK_ENTER_STATS(pUM); 973 974 if (pUM->fcoe.pDev) 975 { 976 snprintf(buf, sizeof(buf), "%p", (void *)pUM->fcoe.pDev); 977 strncpy(pStats->pdev_hi.value.c, &buf[0], 8); 978 pStats->pdev_hi.value.c[8] = 0; 979 strncpy(pStats->pdev_lo.value.c, &buf[8], 8); 980 pStats->pdev_lo.value.c[8] = 0; 981 982 snprintf(pStats->instance.value.c, 16, "bnxef%d", 983 ddi_get_instance(pUM->fcoe.pDev)); 984 985 if ((pUM->fcoe.wwn.fcp_pwwn[0] == 0) && 986 (pUM->fcoe.wwn.fcp_pwwn[1] == 0) && 987 (pUM->fcoe.wwn.fcp_pwwn[2] == 0) && 988 (pUM->fcoe.wwn.fcp_pwwn[3] == 0) && 989 (pUM->fcoe.wwn.fcp_pwwn[4] == 0) && 990 (pUM->fcoe.wwn.fcp_pwwn[5] == 0) && 991 (pUM->fcoe.wwn.fcp_pwwn[6] == 0) && 992 (pUM->fcoe.wwn.fcp_pwwn[7] == 0)) 993 { 994 snprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x%02x%02x", 995 0x20, 0x00, 996 pLM->hw_info.fcoe_mac_addr[0], 997 pLM->hw_info.fcoe_mac_addr[1], 998 pLM->hw_info.fcoe_mac_addr[2], 999 pLM->hw_info.fcoe_mac_addr[3], 1000 pLM->hw_info.fcoe_mac_addr[4], 1001 pLM->hw_info.fcoe_mac_addr[5]); 1002 } 1003 else 1004 { 1005 snprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x%02x%02x", 1006 pUM->fcoe.wwn.fcp_pwwn[0], 1007 pUM->fcoe.wwn.fcp_pwwn[1], 1008 pUM->fcoe.wwn.fcp_pwwn[2], 1009 pUM->fcoe.wwn.fcp_pwwn[3], 1010 pUM->fcoe.wwn.fcp_pwwn[4], 1011 pUM->fcoe.wwn.fcp_pwwn[5], 1012 pUM->fcoe.wwn.fcp_pwwn[7], 1013 pUM->fcoe.wwn.fcp_pwwn[7]); 1014 } 1015 strncpy(pStats->pwwn_hi.value.c, &buf[0], 8); 1016 pStats->pwwn_hi.value.c[8] = 0; 1017 strncpy(pStats->pwwn_lo.value.c, &buf[8], 8); 1018 pStats->pwwn_lo.value.c[8] = 0; 1019 } 1020 else 1021 { 1022 strncpy(pStats->pdev_hi.value.c, "none", sizeof(pStats->pdev_hi.value.c)); 1023 strncpy(pStats->pdev_lo.value.c, "none", sizeof(pStats->pdev_lo.value.c)); 1024 strncpy(pStats->instance.value.c, "none", sizeof(pStats->instance.value.c)); 1025 strncpy(pStats->pwwn_hi.value.c, "none", sizeof(pStats->pwwn_hi.value.c)); 1026 strncpy(pStats->pwwn_lo.value.c, "none", sizeof(pStats->pwwn_lo.value.c)); 1027 } 1028 1029 snprintf(pStats->macAddr.value.c, 16, "%02x%02x%02x%02x%02x%02x", 1030 pLM->hw_info.fcoe_mac_addr[0], pLM->hw_info.fcoe_mac_addr[1], 1031 pLM->hw_info.fcoe_mac_addr[2], pLM->hw_info.fcoe_mac_addr[3], 1032 pLM->hw_info.fcoe_mac_addr[4], pLM->hw_info.fcoe_mac_addr[5]); 1033 1034 pStats->mtu.value.ui64 = pUM->lm_dev.params.mtu[LM_CLI_IDX_FCOE]; 1035 pStats->initWqeTx.value.ui64 = pUM->fcoe.stats.initWqeTx; 1036 pStats->initWqeTxErr.value.ui64 = pUM->fcoe.stats.initWqeTxErr; 1037 pStats->initCqeRx.value.ui64 = pUM->fcoe.stats.initCqeRx; 1038 pStats->initCqeRxErr.value.ui64 = pUM->fcoe.stats.initCqeRxErr; 1039 pStats->offloadConnWqeTx.value.ui64 = pUM->fcoe.stats.offloadConnWqeTx; 1040 pStats->offloadConnWqeTxErr.value.ui64 = pUM->fcoe.stats.offloadConnWqeTxErr; 1041 pStats->offloadConnCqeRx.value.ui64 = pUM->fcoe.stats.offloadConnCqeRx; 1042 pStats->offloadConnCqeRxErr.value.ui64 = pUM->fcoe.stats.offloadConnCqeRxErr; 1043 pStats->enableConnWqeTx.value.ui64 = pUM->fcoe.stats.enableConnWqeTx; 1044 pStats->enableConnWqeTxErr.value.ui64 = pUM->fcoe.stats.enableConnWqeTxErr; 1045 pStats->enableConnCqeRx.value.ui64 = pUM->fcoe.stats.enableConnCqeRx; 1046 pStats->enableConnCqeRxErr.value.ui64 = pUM->fcoe.stats.enableConnCqeRxErr; 1047 pStats->disableConnWqeTx.value.ui64 = pUM->fcoe.stats.disableConnWqeTx; 1048 pStats->disableConnWqeTxErr.value.ui64 = pUM->fcoe.stats.disableConnWqeTxErr; 1049 pStats->disableConnCqeRx.value.ui64 = pUM->fcoe.stats.disableConnCqeRx; 1050 pStats->disableConnCqeRxErr.value.ui64 = pUM->fcoe.stats.disableConnCqeRxErr; 1051 pStats->destroyConnWqeTx.value.ui64 = pUM->fcoe.stats.destroyConnWqeTx; 1052 pStats->destroyConnWqeTxErr.value.ui64 = pUM->fcoe.stats.destroyConnWqeTxErr; 1053 pStats->destroyConnCqeRx.value.ui64 = pUM->fcoe.stats.destroyConnCqeRx; 1054 pStats->destroyConnCqeRxErr.value.ui64 = pUM->fcoe.stats.destroyConnCqeRxErr; 1055 pStats->destroyWqeTx.value.ui64 = pUM->fcoe.stats.destroyWqeTx; 1056 pStats->destroyWqeTxErr.value.ui64 = pUM->fcoe.stats.destroyWqeTxErr; 1057 pStats->destroyCqeRx.value.ui64 = pUM->fcoe.stats.destroyCqeRx; 1058 pStats->destroyCqeRxErr.value.ui64 = pUM->fcoe.stats.destroyCqeRxErr; 1059 pStats->compRequestCqeRx.value.ui64 = pUM->fcoe.stats.compRequestCqeRx; 1060 pStats->compRequestCqeRxErr.value.ui64 = pUM->fcoe.stats.compRequestCqeRxErr; 1061 pStats->statWqeTx.value.ui64 = pUM->fcoe.stats.statWqeTx; 1062 pStats->statWqeTxErr.value.ui64 = pUM->fcoe.stats.statWqeTxErr; 1063 pStats->statCqeRx.value.ui64 = pUM->fcoe.stats.statCqeRx; 1064 pStats->statCqeRxErr.value.ui64 = pUM->fcoe.stats.statCqeRxErr; 1065 1066 BNXE_LOCK_EXIT_STATS(pUM); 1067 1068 return 0; 1069 } 1070 1071 1072 static int count_trailing_zeros(int number) 1073 { 1074 int x, y, z; 1075 1076 x = y = z = 0; 1077 1078 for (y = 7; y >= 0; y--) 1079 { 1080 x = number / (1 << y); 1081 number = number - x * (1 << y); 1082 z++; 1083 1084 if (x == 1) 1085 { 1086 z = 0; 1087 } 1088 } 1089 1090 /* Add fix for all zero value */ 1091 if (z == 8) 1092 { 1093 z = 0; 1094 } 1095 1096 return z; 1097 } 1098 1099 1100 static int BnxeKstatDcbxUpdate(kstat_t * kstats, 1101 int rw) 1102 { 1103 BnxeKstatDcbx * pStats = (BnxeKstatDcbx *)kstats->ks_data; 1104 um_device_t * pUM = (um_device_t *)kstats->ks_private; 1105 lm_device_t * pLM = (lm_device_t *)pUM; 1106 b10_lldp_params_get_t lldp_params; 1107 b10_dcbx_params_get_t dcbx_params; 1108 int fcoe_priority = -1; 1109 int iscsi_priority = -1; 1110 admin_priority_app_table_t * app_table; 1111 char buf[17]; /* 16 max for kstat string */ 1112 int i; 1113 1114 if (rw == KSTAT_WRITE) 1115 { 1116 return EACCES; 1117 } 1118 1119 lm_dcbx_lldp_read_params(pLM, &lldp_params); 1120 lm_dcbx_read_params(pLM, &dcbx_params); 1121 1122 BNXE_LOCK_ENTER_STATS(pUM); 1123 1124 snprintf(pStats->dcbx_sync.value.c, 16, "%s", 1125 (!dcbx_params.config_dcbx_params.dcb_enable) ? "disabled" : 1126 (dcbx_params.dcb_current_oper_state_bitmap & 1127 DCBX_CURRENT_STATE_IS_SYNC) ? "IN SYNC" : "OUT OF SYNC"); 1128 1129 snprintf(pStats->dcbx_vers.value.c, 16, "%s", 1130 (dcbx_params.config_dcbx_params.admin_dcbx_version) ? 1131 "IEEE" : "CEE"); 1132 1133 snprintf(pStats->overwrite_settings.value.c, 16, "%s", 1134 (dcbx_params.config_dcbx_params.overwrite_settings) ? 1135 "yes" : "no"); 1136 1137 if (dcbx_params.dcb_current_oper_state_bitmap & 1138 PRIORITY_TAGGING_IS_CURRENTLY_OPERATIONAL) 1139 { 1140 snprintf(pStats->prio_tag.value.c, 16, "operational"); 1141 1142 app_table = dcbx_params.local_priority_app_table; 1143 1144 for (i = 0; i <= 3; i++) 1145 { 1146 if (app_table[i].valid) 1147 { 1148 if ((app_table[i].traffic_type == TRAFFIC_TYPE_ETH) && 1149 (app_table[i].app_id == 0x8906)) 1150 { 1151 fcoe_priority = count_trailing_zeros(app_table[i].priority); 1152 } 1153 1154 if ((app_table[i].traffic_type != TRAFFIC_TYPE_ETH) && 1155 (app_table[i].app_id == 3260)) 1156 { 1157 iscsi_priority = count_trailing_zeros(app_table[i].priority); 1158 } 1159 } 1160 } 1161 1162 snprintf(pStats->prio_tag_fcoe.value.c, 16, "%d", fcoe_priority); 1163 snprintf(pStats->prio_tag_iscsi.value.c, 16, "%d", iscsi_priority); 1164 snprintf(pStats->prio_tag_net.value.c, 16, "%d", 1165 dcbx_params.config_dcbx_params.admin_default_priority); 1166 } 1167 else 1168 { 1169 snprintf(pStats->prio_tag.value.c, 16, "not operational"); 1170 1171 snprintf(pStats->prio_tag_fcoe.value.c, 16, "-"); 1172 snprintf(pStats->prio_tag_iscsi.value.c, 16, "-"); 1173 snprintf(pStats->prio_tag_net.value.c, 16, "-"); 1174 } 1175 1176 if (dcbx_params.dcb_current_oper_state_bitmap & 1177 PFC_IS_CURRENTLY_OPERATIONAL) 1178 { 1179 snprintf(pStats->pfc.value.c, 16, "operational"); 1180 1181 #define GET_PFC_PRIO(f, p) \ 1182 snprintf(pStats->f.value.c, 16, "%s", \ 1183 ((dcbx_params.local_pfc_bitmap >> (p)) & 1) ? \ 1184 "enabled" : "disabled") 1185 1186 GET_PFC_PRIO(pfc_prio_0, 0); 1187 GET_PFC_PRIO(pfc_prio_1, 1); 1188 GET_PFC_PRIO(pfc_prio_2, 2); 1189 GET_PFC_PRIO(pfc_prio_3, 3); 1190 GET_PFC_PRIO(pfc_prio_4, 4); 1191 GET_PFC_PRIO(pfc_prio_5, 5); 1192 GET_PFC_PRIO(pfc_prio_6, 6); 1193 GET_PFC_PRIO(pfc_prio_7, 7); 1194 } 1195 else 1196 { 1197 snprintf(pStats->pfc.value.c, 16, "not operational"); 1198 1199 #define NO_PFC_PRIO(f) \ 1200 snprintf(pStats->f.value.c, 16, "-") 1201 1202 NO_PFC_PRIO(pfc_prio_0); 1203 NO_PFC_PRIO(pfc_prio_1); 1204 NO_PFC_PRIO(pfc_prio_2); 1205 NO_PFC_PRIO(pfc_prio_3); 1206 NO_PFC_PRIO(pfc_prio_4); 1207 NO_PFC_PRIO(pfc_prio_5); 1208 NO_PFC_PRIO(pfc_prio_6); 1209 NO_PFC_PRIO(pfc_prio_7); 1210 } 1211 1212 if (dcbx_params.dcb_current_oper_state_bitmap & 1213 ETS_IS_CURRENTLY_OPERATIONAL) 1214 { 1215 snprintf(pStats->ets.value.c, 16, "operational"); 1216 1217 #define GET_PRIO_PG(f, p) \ 1218 snprintf(pStats->f.value.c, 16, "%d", \ 1219 dcbx_params.local_configuration_ets_pg[p]) 1220 1221 GET_PRIO_PG(ets_prio_0_pg, 0); 1222 GET_PRIO_PG(ets_prio_1_pg, 1); 1223 GET_PRIO_PG(ets_prio_2_pg, 2); 1224 GET_PRIO_PG(ets_prio_3_pg, 3); 1225 GET_PRIO_PG(ets_prio_4_pg, 4); 1226 GET_PRIO_PG(ets_prio_5_pg, 5); 1227 GET_PRIO_PG(ets_prio_6_pg, 6); 1228 GET_PRIO_PG(ets_prio_7_pg, 7); 1229 1230 #define GET_PG_BW(f, p) \ 1231 snprintf(pStats->f.value.c, 16, "%d", \ 1232 dcbx_params.local_configuration_bw_percentage[p]) 1233 1234 GET_PG_BW(ets_pg_0_bw, 0); 1235 GET_PG_BW(ets_pg_1_bw, 1); 1236 GET_PG_BW(ets_pg_2_bw, 2); 1237 GET_PG_BW(ets_pg_3_bw, 3); 1238 GET_PG_BW(ets_pg_4_bw, 4); 1239 GET_PG_BW(ets_pg_5_bw, 5); 1240 GET_PG_BW(ets_pg_6_bw, 6); 1241 GET_PG_BW(ets_pg_7_bw, 7); 1242 } 1243 else 1244 { 1245 snprintf(pStats->ets.value.c, 16, "not operational"); 1246 1247 #define NO_PRIO_PG(f) \ 1248 snprintf(pStats->f.value.c, 16, "-") 1249 1250 NO_PRIO_PG(ets_prio_0_pg); 1251 NO_PRIO_PG(ets_prio_1_pg); 1252 NO_PRIO_PG(ets_prio_2_pg); 1253 NO_PRIO_PG(ets_prio_3_pg); 1254 NO_PRIO_PG(ets_prio_4_pg); 1255 NO_PRIO_PG(ets_prio_5_pg); 1256 NO_PRIO_PG(ets_prio_6_pg); 1257 NO_PRIO_PG(ets_prio_7_pg); 1258 1259 #define NO_PG_BW(f) \ 1260 snprintf(pStats->f.value.c, 16, "-") 1261 1262 NO_PG_BW(ets_pg_0_bw); 1263 NO_PG_BW(ets_pg_1_bw); 1264 NO_PG_BW(ets_pg_2_bw); 1265 NO_PG_BW(ets_pg_3_bw); 1266 NO_PG_BW(ets_pg_4_bw); 1267 NO_PG_BW(ets_pg_5_bw); 1268 NO_PG_BW(ets_pg_6_bw); 1269 NO_PG_BW(ets_pg_7_bw); 1270 } 1271 1272 if (lldp_params.admin_status && (lldp_params.admin_status != LLDP_DISABLED)) 1273 { 1274 snprintf(pStats->lldp.value.c, 16, "%s", 1275 (lldp_params.admin_status == LLDP_TX_ONLY) ? "tx only" : 1276 (lldp_params.admin_status == LLDP_RX_ONLY) ? "rx only" : 1277 (lldp_params.admin_status == LLDP_TX_RX) ? "tx and rx" : 1278 "unknown"); 1279 snprintf(pStats->lldp_tx_interval.value.c, 16, "%d seconds", 1280 lldp_params.config_lldp_params.msg_tx_interval); 1281 snprintf(pStats->lldp_tx_fast_interval.value.c, 16, "%d seconds", 1282 lldp_params.config_lldp_params.msg_fast_tx); 1283 } 1284 else 1285 { 1286 snprintf(pStats->lldp.value.c, 16, "disabled"); 1287 snprintf(pStats->lldp_tx_interval.value.c, 16, "-"); 1288 snprintf(pStats->lldp_tx_fast_interval.value.c, 16, "-"); 1289 } 1290 1291 /* -------------------- ADMIN MIB -------------------- */ 1292 1293 snprintf(pStats->amib_apptlv_willing.value.c, 16, "%s", 1294 (dcbx_params.config_dcbx_params.admin_app_priority_willing) ? 1295 "willing" : "not willing"); 1296 snprintf(pStats->amib_apptlv_tx.value.c, 16, "%s", 1297 (dcbx_params.config_dcbx_params.admin_application_priority_tx_enable) ? 1298 "enabled" : "disabled"); 1299 snprintf(pStats->amib_apptlv_net_prio.value.c, 16, "%d", 1300 dcbx_params.config_dcbx_params.admin_default_priority); 1301 1302 #define GET_PRIO_APP_TABLE(table, f1, f2) \ 1303 if (table.valid) \ 1304 { \ 1305 snprintf(pStats->f1.value.c, 16, "%d", \ 1306 count_trailing_zeros(table.priority)); \ 1307 snprintf(pStats->f2.value.c, 16, \ 1308 (table.traffic_type == TRAFFIC_TYPE_ETH) ? \ 1309 "ether=0x%x" : "port=%d", \ 1310 table.app_id); \ 1311 } \ 1312 else \ 1313 { \ 1314 snprintf(pStats->f1.value.c, 16, "-"); \ 1315 snprintf(pStats->f2.value.c, 16, "-"); \ 1316 } 1317 1318 GET_PRIO_APP_TABLE(dcbx_params.config_dcbx_params. 1319 admin_priority_app_table[0], 1320 amib_apptlv_tbl_0_prio, 1321 amib_apptlv_tbl_0_appid); 1322 GET_PRIO_APP_TABLE(dcbx_params.config_dcbx_params. 1323 admin_priority_app_table[1], 1324 amib_apptlv_tbl_1_prio, 1325 amib_apptlv_tbl_1_appid); 1326 GET_PRIO_APP_TABLE(dcbx_params.config_dcbx_params. 1327 admin_priority_app_table[2], 1328 amib_apptlv_tbl_2_prio, 1329 amib_apptlv_tbl_2_appid); 1330 GET_PRIO_APP_TABLE(dcbx_params.config_dcbx_params. 1331 admin_priority_app_table[3], 1332 amib_apptlv_tbl_3_prio, 1333 amib_apptlv_tbl_3_appid); 1334 1335 snprintf(pStats->amib_pgtlv_willing.value.c, 16, "%s", 1336 (dcbx_params.config_dcbx_params.admin_ets_willing) ? 1337 "willing" : "not willing"); 1338 snprintf(pStats->amib_pgtlv_tx.value.c, 16, "%s", 1339 (dcbx_params.config_dcbx_params.admin_ets_configuration_tx_enable) ? 1340 "enabled" : "disabled"); 1341 snprintf(pStats->amib_pgtlv_tc_supported.value.c, 16, "%s", 1342 (dcbx_params.config_dcbx_params.admin_tc_supported_tx_enable) ? 1343 "advertised" : "not advertised"); 1344 snprintf(pStats->amib_pgtlv_ets.value.c, 16, "%s", 1345 (dcbx_params.config_dcbx_params.admin_ets_enable) ? 1346 "enabled" : "disabled"); 1347 1348 #define AMIB_GET_PG_TLV_BW(f, p) \ 1349 snprintf(pStats->f.value.c, 16, "%d", \ 1350 dcbx_params.config_dcbx_params. \ 1351 admin_configuration_bw_percentage[p]) 1352 1353 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_0_bw, 0); 1354 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_1_bw, 1); 1355 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_2_bw, 2); 1356 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_3_bw, 3); 1357 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_4_bw, 4); 1358 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_5_bw, 5); 1359 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_6_bw, 6); 1360 AMIB_GET_PG_TLV_BW(amib_pgtlv_pg_7_bw, 7); 1361 1362 #define AMIB_GET_PG_TLV_MAP(f, p) \ 1363 snprintf(pStats->f.value.c, 16, "%d", \ 1364 dcbx_params.config_dcbx_params. \ 1365 admin_configuration_ets_pg[p]) 1366 1367 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_0_map, 0); 1368 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_1_map, 1); 1369 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_2_map, 2); 1370 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_3_map, 3); 1371 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_4_map, 4); 1372 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_5_map, 5); 1373 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_6_map, 6); 1374 AMIB_GET_PG_TLV_MAP(amib_pgtlv_prio_7_map, 7); 1375 1376 snprintf(pStats->amib_pfctlv_willing.value.c, 16, "%s", 1377 (dcbx_params.config_dcbx_params.admin_pfc_willing) ? 1378 "willing" : "not willing"); 1379 snprintf(pStats->amib_pfctlv_tx.value.c, 16, "%s", 1380 (dcbx_params.config_dcbx_params.admin_pfc_tx_enable) ? 1381 "enabled" : "disabled"); 1382 1383 if (dcbx_params.config_dcbx_params.admin_pfc_enable) 1384 { 1385 snprintf(pStats->amib_pfctlv_pfc.value.c, 16, "enabled"); 1386 snprintf(pStats->amib_pfctlv_pfc_map.value.c, 16, "%d%d%d%d%d%d%d%d", 1387 (dcbx_params.config_dcbx_params.admin_pfc_bitmap % 2), 1388 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 2) % 2), 1389 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 4) % 2), 1390 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 8) % 2), 1391 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 16) % 2), 1392 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 32) % 2), 1393 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 64) % 2), 1394 ((dcbx_params.config_dcbx_params.admin_pfc_bitmap / 128) % 2)); 1395 } 1396 else 1397 { 1398 snprintf(pStats->amib_pfctlv_pfc.value.c, 16, "disabled"); 1399 snprintf(pStats->amib_pfctlv_pfc_map.value.c, 16, "-"); 1400 } 1401 1402 /* -------------------- REMOTE MIB -------------------- */ 1403 1404 snprintf(pStats->rmib_apptlv_willing.value.c, 16, "%s", 1405 (dcbx_params.remote_app_priority_willing) ? 1406 "willing" : "not willing"); 1407 1408 GET_PRIO_APP_TABLE(dcbx_params.remote_priority_app_table[0], 1409 rmib_apptlv_tbl_0_prio, 1410 rmib_apptlv_tbl_0_appid); 1411 GET_PRIO_APP_TABLE(dcbx_params.remote_priority_app_table[1], 1412 rmib_apptlv_tbl_1_prio, 1413 rmib_apptlv_tbl_1_appid); 1414 GET_PRIO_APP_TABLE(dcbx_params.remote_priority_app_table[2], 1415 rmib_apptlv_tbl_2_prio, 1416 rmib_apptlv_tbl_2_appid); 1417 GET_PRIO_APP_TABLE(dcbx_params.remote_priority_app_table[3], 1418 rmib_apptlv_tbl_3_prio, 1419 rmib_apptlv_tbl_3_appid); 1420 1421 snprintf(pStats->rmib_pgtlv_willing.value.c, 16, "%s", 1422 (dcbx_params.remote_ets_willing) ? 1423 "willing" : "not willing"); 1424 1425 #define RMIB_GET_PG_TLV_BW(f, p) \ 1426 snprintf(pStats->f.value.c, 16, "%d", \ 1427 dcbx_params.remote_configuration_bw_percentage[p]) 1428 1429 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_0_bw, 0); 1430 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_1_bw, 1); 1431 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_2_bw, 2); 1432 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_3_bw, 3); 1433 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_4_bw, 4); 1434 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_5_bw, 5); 1435 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_6_bw, 6); 1436 RMIB_GET_PG_TLV_BW(rmib_pgtlv_pg_7_bw, 7); 1437 1438 #define RMIB_GET_PG_TLV_MAP(f, p) \ 1439 snprintf(pStats->f.value.c, 16, "%d", \ 1440 dcbx_params.remote_configuration_ets_pg[p]) 1441 1442 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_0_map, 0); 1443 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_1_map, 1); 1444 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_2_map, 2); 1445 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_3_map, 3); 1446 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_4_map, 4); 1447 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_5_map, 5); 1448 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_6_map, 6); 1449 RMIB_GET_PG_TLV_MAP(rmib_pgtlv_prio_7_map, 7); 1450 1451 snprintf(pStats->rmib_pgtlv_tc_supported.value.c, 16, "%d", 1452 dcbx_params.remote_tc_supported); 1453 1454 snprintf(pStats->rmib_pfctlv_willing.value.c, 16, "%s", 1455 (dcbx_params.remote_pfc_willing) ? 1456 "willing" : "not willing"); 1457 1458 snprintf(pStats->rmib_pfctlv_pfc_map.value.c, 16, "%d%d%d%d%d%d%d%d", 1459 (dcbx_params.remote_pfc_bitmap % 2), 1460 ((dcbx_params.remote_pfc_bitmap / 2) % 2), 1461 ((dcbx_params.remote_pfc_bitmap / 4) % 2), 1462 ((dcbx_params.remote_pfc_bitmap / 8) % 2), 1463 ((dcbx_params.remote_pfc_bitmap / 16) % 2), 1464 ((dcbx_params.remote_pfc_bitmap / 32) % 2), 1465 ((dcbx_params.remote_pfc_bitmap / 64) % 2), 1466 ((dcbx_params.remote_pfc_bitmap / 128) % 2)); 1467 1468 snprintf(pStats->rmib_pfctlv_capable.value.c, 16, "%d", 1469 dcbx_params.remote_pfc_cap); 1470 1471 /* -------------------- LOCAL MIB -------------------- */ 1472 1473 GET_PRIO_APP_TABLE(dcbx_params.local_priority_app_table[0], 1474 lmib_apptlv_tbl_0_prio, 1475 lmib_apptlv_tbl_0_appid); 1476 GET_PRIO_APP_TABLE(dcbx_params.local_priority_app_table[1], 1477 lmib_apptlv_tbl_1_prio, 1478 lmib_apptlv_tbl_1_appid); 1479 GET_PRIO_APP_TABLE(dcbx_params.local_priority_app_table[2], 1480 lmib_apptlv_tbl_2_prio, 1481 lmib_apptlv_tbl_2_appid); 1482 GET_PRIO_APP_TABLE(dcbx_params.local_priority_app_table[3], 1483 lmib_apptlv_tbl_3_prio, 1484 lmib_apptlv_tbl_3_appid); 1485 1486 snprintf(pStats->lmib_apptlv_mismatch.value.c, 16, "%s", 1487 (dcbx_params.priority_app_mismatch) ? "yes" : "no"); 1488 1489 snprintf(pStats->lmib_pgtlv_ets.value.c, 16, "%s", 1490 (dcbx_params.local_ets_enable) ? 1491 "enabled" : "disabled"); 1492 1493 #define LMIB_GET_PG_TLV_BW(f, p) \ 1494 snprintf(pStats->f.value.c, 16, "%d", \ 1495 dcbx_params.local_configuration_bw_percentage[p]) 1496 1497 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_0_bw, 0); 1498 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_1_bw, 1); 1499 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_2_bw, 2); 1500 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_3_bw, 3); 1501 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_4_bw, 4); 1502 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_5_bw, 5); 1503 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_6_bw, 6); 1504 LMIB_GET_PG_TLV_BW(lmib_pgtlv_pg_7_bw, 7); 1505 1506 #define LMIB_GET_PG_TLV_MAP(f, p) \ 1507 snprintf(pStats->f.value.c, 16, "%d", \ 1508 dcbx_params.local_configuration_ets_pg[p]) 1509 1510 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_0_map, 0); 1511 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_1_map, 1); 1512 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_2_map, 2); 1513 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_3_map, 3); 1514 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_4_map, 4); 1515 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_5_map, 5); 1516 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_6_map, 6); 1517 LMIB_GET_PG_TLV_MAP(lmib_pgtlv_prio_7_map, 7); 1518 1519 snprintf(pStats->lmib_pgtlv_tc_supported.value.c, 16, "%d", 1520 dcbx_params.local_tc_supported); 1521 1522 if (dcbx_params.local_pfc_enable) 1523 { 1524 snprintf(pStats->lmib_pfctlv_pfc.value.c, 16, "enabled"); 1525 snprintf(pStats->lmib_pfctlv_pfc_map.value.c, 16, "%d%d%d%d%d%d%d%d", 1526 (dcbx_params.local_pfc_bitmap % 2), 1527 ((dcbx_params.local_pfc_bitmap / 2) % 2), 1528 ((dcbx_params.local_pfc_bitmap / 4) % 2), 1529 ((dcbx_params.local_pfc_bitmap / 8) % 2), 1530 ((dcbx_params.local_pfc_bitmap / 16) % 2), 1531 ((dcbx_params.local_pfc_bitmap / 32) % 2), 1532 ((dcbx_params.local_pfc_bitmap / 64) % 2), 1533 ((dcbx_params.local_pfc_bitmap / 128) % 2)); 1534 1535 snprintf(pStats->lmib_pfctlv_capable.value.c, 16, "%d", 1536 dcbx_params.local_pfc_caps); 1537 1538 snprintf(pStats->lmib_pfctlv_mismatch.value.c, 16, "%s", 1539 (dcbx_params.pfc_mismatch) ? "yes" : "no"); 1540 } 1541 else 1542 { 1543 snprintf(pStats->lmib_pfctlv_pfc.value.c, 16, "disabled"); 1544 snprintf(pStats->lmib_pfctlv_pfc_map.value.c, 16, "-"); 1545 snprintf(pStats->lmib_pfctlv_capable.value.c, 16, "-"); 1546 snprintf(pStats->lmib_pfctlv_mismatch.value.c, 16, "-"); 1547 } 1548 1549 /* --------------------------------------------------- */ 1550 1551 pStats->dcbx_frames_rx.value.ui64 = dcbx_params.dcbx_frames_received; 1552 pStats->dcbx_frames_tx.value.ui64 = dcbx_params.dcbx_frames_sent; 1553 pStats->pfc_frames_rx.value.ui64 = dcbx_params.pfc_frames_received; 1554 pStats->pfc_frames_tx.value.ui64 = dcbx_params.pfc_frames_sent; 1555 1556 BNXE_LOCK_EXIT_STATS(pUM); 1557 1558 return 0; 1559 } 1560 1561 1562 static int BnxeKstatRxRingUpdate(kstat_t * kstats, 1563 int rw) 1564 { 1565 BnxeKstatRxq * pStats = (BnxeKstatRxq *)kstats->ks_data; 1566 KstatRingMap * pMap = (KstatRingMap *)kstats->ks_private; 1567 um_device_t * pUM = (um_device_t *)pMap->pUM; 1568 int idx = pMap->idx; 1569 lm_device_t * pLM = (lm_device_t *)pUM; 1570 lm_tx_chain_t * pTxq = &LM_TXQ(pLM, idx); 1571 lm_rx_chain_t * pRxq = &LM_RXQ(pLM, idx); 1572 lm_rcq_chain_t * pRcq = &LM_RCQ(pLM, idx); 1573 1574 if (rw == KSTAT_WRITE) 1575 { 1576 return EACCES; 1577 } 1578 1579 BNXE_LOCK_ENTER_STATS(pUM); 1580 1581 pStats->rxqBdTotal.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].capacity; 1582 pStats->rxqBdLeft.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].bd_left; 1583 pStats->rxqBdPageCnt.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].page_cnt; 1584 pStats->rxqBdsPerPage.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].bds_per_page; 1585 pStats->rxqBdSize.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].bd_size; 1586 pStats->rxqBdsSkipEop.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].bds_skip_eop; 1587 pStats->rxqBdProdIdx.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].prod_idx; 1588 pStats->rxqBdConsIdx.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_BD].cons_idx; 1589 pStats->hwRxqConIdx.value.ui64 = 1590 (pRxq->hw_con_idx_ptr != NULL) ? 1591 mm_le16_to_cpu(*pRxq->hw_con_idx_ptr) : 0; 1592 pStats->sgeBdTotal.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].capacity; 1593 pStats->sgeBdLeft.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].bd_left; 1594 pStats->sgeBdPageCnt.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].page_cnt; 1595 pStats->sgeBdsPerPage.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].bds_per_page; 1596 pStats->sgeBdSize.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].bd_size; 1597 pStats->sgeBdsSkipEop.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].bds_skip_eop; 1598 pStats->sgeBdProdIdx.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].prod_idx; 1599 pStats->sgeBdConsIdx.value.ui64 = pRxq->chain_arr[LM_RXQ_CHAIN_IDX_SGE].cons_idx; 1600 pStats->rcqBdTotal.value.ui64 = pRcq->bd_chain.capacity; 1601 pStats->rcqBdLeft.value.ui64 = pRcq->bd_chain.bd_left; 1602 pStats->rcqBdPageCnt.value.ui64 = pRcq->bd_chain.page_cnt; 1603 pStats->rcqBdsPerPage.value.ui64 = pRcq->bd_chain.bds_per_page; 1604 pStats->rcqBdSize.value.ui64 = pRcq->bd_chain.bd_size; 1605 pStats->rcqBdsSkipEop.value.ui64 = pRcq->bd_chain.bds_skip_eop; 1606 pStats->rcqBdProdIdx.value.ui64 = pRcq->bd_chain.prod_idx; 1607 pStats->rcqBdConsIdx.value.ui64 = pRcq->bd_chain.cons_idx; 1608 pStats->hwRcqConIdx.value.ui64 = 1609 (pRcq->hw_con_idx_ptr != NULL) ? 1610 mm_le16_to_cpu(*pRcq->hw_con_idx_ptr) : 0; 1611 1612 pStats->rxFreeDescs.value.ui64 = s_list_entry_cnt(&LM_RXQ(pLM, idx).common.free_descq); 1613 pStats->rxActiveDescs.value.ui64 = s_list_entry_cnt(&LM_RXQ(pLM, idx).active_descq); 1614 pStats->rxDoneDescs.value.ui64 = s_list_entry_cnt(&pUM->rxq[idx].doneRxQ); 1615 pStats->rxWaitingDescs.value.ui64 = s_list_entry_cnt(&pUM->rxq[idx].waitRxQ); 1616 pStats->rxCopied.value.ui64 = pUM->rxq[idx].rxCopied; 1617 pStats->rxDiscards.value.ui64 = pUM->rxq[idx].rxDiscards; 1618 pStats->rxBufUpInStack.value.ui64 = pUM->rxq[idx].rxBufUpInStack; 1619 pStats->rxLowWater.value.ui64 = pUM->rxq[idx].rxLowWater; 1620 pStats->inPollMode.value.ui64 = pUM->rxq[idx].inPollMode; 1621 pStats->pollCnt.value.ui64 = pUM->rxq[idx].pollCnt; 1622 pStats->intrDisableCnt.value.ui64 = pUM->rxq[idx].intrDisableCnt; 1623 pStats->intrEnableCnt.value.ui64 = pUM->rxq[idx].intrEnableCnt; 1624 pStats->genNumber.value.ui64 = pUM->rxq[idx].genNumber; 1625 1626 BNXE_LOCK_EXIT_STATS(pUM); 1627 1628 return 0; 1629 } 1630 1631 1632 static int BnxeKstatTxRingUpdate(kstat_t * kstats, 1633 int rw) 1634 { 1635 BnxeKstatTxq * pStats = (BnxeKstatTxq *)kstats->ks_data; 1636 KstatRingMap * pMap = (KstatRingMap *)kstats->ks_private; 1637 um_device_t * pUM = (um_device_t *)pMap->pUM; 1638 int idx = pMap->idx; 1639 lm_device_t * pLM = (lm_device_t *)pUM; 1640 1641 if (rw == KSTAT_WRITE) 1642 { 1643 return EACCES; 1644 } 1645 1646 BNXE_LOCK_ENTER_STATS(pUM); 1647 1648 pStats->txBdTotal.value.ui64 = LM_TXQ(pLM, idx).bd_chain.capacity; 1649 pStats->txBdLeft.value.ui64 = LM_TXQ(pLM, idx).bd_chain.bd_left; 1650 pStats->txBdPageCnt.value.ui64 = LM_TXQ(pLM, idx).bd_chain.page_cnt; 1651 pStats->txBdsPerPage.value.ui64 = LM_TXQ(pLM, idx).bd_chain.bds_per_page; 1652 pStats->txBdSize.value.ui64 = LM_TXQ(pLM, idx).bd_chain.bd_size; 1653 pStats->txBdsSkipEop.value.ui64 = LM_TXQ(pLM, idx).bd_chain.bds_skip_eop; 1654 pStats->hwTxqConIdx.value.ui64 = 1655 (LM_TXQ(pLM, idx).hw_con_idx_ptr != NULL) ? 1656 mm_le16_to_cpu(*LM_TXQ(pLM, idx).hw_con_idx_ptr) : 0; 1657 pStats->txPktIdx.value.ui64 = LM_TXQ(pLM, idx).pkt_idx; 1658 pStats->txBdProdIdx.value.ui64 = LM_TXQ(pLM, idx).bd_chain.prod_idx; 1659 pStats->txBdConsIdx.value.ui64 = LM_TXQ(pLM, idx).bd_chain.cons_idx; 1660 pStats->txSentPkts.value.ui64 = s_list_entry_cnt(&pUM->txq[idx].sentTxQ); 1661 pStats->txFreeDesc.value.ui64 = s_list_entry_cnt(&pUM->txq[idx].freeTxDescQ); 1662 pStats->txWaitingPkts.value.ui64 = s_list_entry_cnt(&pUM->txq[idx].waitTxDescQ); 1663 pStats->txLowWater.value.ui64 = pUM->txq[idx].txLowWater; 1664 pStats->txFailed.value.ui64 = pUM->txq[idx].txFailed; 1665 pStats->txDiscards.value.ui64 = pUM->txq[idx].txDiscards; 1666 pStats->txRecycle.value.ui64 = pUM->txq[idx].txRecycle; 1667 pStats->txCopied.value.ui64 = pUM->txq[idx].txCopied; 1668 pStats->txBlocked.value.ui64 = pUM->txq[idx].txBlocked; 1669 pStats->txWait.value.ui64 = pUM->txq[idx].txWait; 1670 1671 BNXE_LOCK_EXIT_STATS(pUM); 1672 1673 return 0; 1674 } 1675 1676 1677 boolean_t BnxeKstatInitRxQ(um_device_t * pUM, 1678 int idx) 1679 { 1680 char buf[32]; 1681 1682 BnxeKstatRxq * pStatsRxq; 1683 #define BNXE_KSTAT_RXQ(f, t) kstat_named_init(&pStatsRxq->f, #f, t) 1684 1685 snprintf(buf, sizeof(buf), "rxq%d", idx); 1686 1687 if ((pUM->kstats_rxq[idx] = kstat_create("bnxe", 1688 pUM->instance, 1689 buf, 1690 "net", 1691 KSTAT_TYPE_NAMED, 1692 BNXE_KSTAT_RXQ_SIZE, 1693 0)) == NULL) 1694 { 1695 BnxeLogWarn(pUM, "Failed to create rxq%d kstat", idx); 1696 return B_FALSE; 1697 } 1698 1699 pStatsRxq = (BnxeKstatRxq *)pUM->kstats_rxq[idx]->ks_data; 1700 1701 BNXE_KSTAT_RXQ(rxqBdTotal, KSTAT_DATA_UINT64); 1702 BNXE_KSTAT_RXQ(rxqBdLeft, KSTAT_DATA_UINT64); 1703 BNXE_KSTAT_RXQ(rxqBdPageCnt, KSTAT_DATA_UINT64); 1704 BNXE_KSTAT_RXQ(rxqBdsPerPage, KSTAT_DATA_UINT64); 1705 BNXE_KSTAT_RXQ(rxqBdSize, KSTAT_DATA_UINT64); 1706 BNXE_KSTAT_RXQ(rxqBdsSkipEop, KSTAT_DATA_UINT64); 1707 BNXE_KSTAT_RXQ(rxqBdProdIdx, KSTAT_DATA_UINT64); 1708 BNXE_KSTAT_RXQ(rxqBdConsIdx, KSTAT_DATA_UINT64); 1709 BNXE_KSTAT_RXQ(hwRxqConIdx, KSTAT_DATA_UINT64); 1710 BNXE_KSTAT_RXQ(sgeBdTotal, KSTAT_DATA_UINT64); 1711 BNXE_KSTAT_RXQ(sgeBdLeft, KSTAT_DATA_UINT64); 1712 BNXE_KSTAT_RXQ(sgeBdPageCnt, KSTAT_DATA_UINT64); 1713 BNXE_KSTAT_RXQ(sgeBdsPerPage, KSTAT_DATA_UINT64); 1714 BNXE_KSTAT_RXQ(sgeBdSize, KSTAT_DATA_UINT64); 1715 BNXE_KSTAT_RXQ(sgeBdsSkipEop, KSTAT_DATA_UINT64); 1716 BNXE_KSTAT_RXQ(sgeBdProdIdx, KSTAT_DATA_UINT64); 1717 BNXE_KSTAT_RXQ(sgeBdConsIdx, KSTAT_DATA_UINT64); 1718 BNXE_KSTAT_RXQ(rcqBdTotal, KSTAT_DATA_UINT64); 1719 BNXE_KSTAT_RXQ(rcqBdLeft, KSTAT_DATA_UINT64); 1720 BNXE_KSTAT_RXQ(rcqBdPageCnt, KSTAT_DATA_UINT64); 1721 BNXE_KSTAT_RXQ(rcqBdsPerPage, KSTAT_DATA_UINT64); 1722 BNXE_KSTAT_RXQ(rcqBdSize, KSTAT_DATA_UINT64); 1723 BNXE_KSTAT_RXQ(rcqBdsSkipEop, KSTAT_DATA_UINT64); 1724 BNXE_KSTAT_RXQ(rcqBdProdIdx, KSTAT_DATA_UINT64); 1725 BNXE_KSTAT_RXQ(rcqBdConsIdx, KSTAT_DATA_UINT64); 1726 BNXE_KSTAT_RXQ(hwRcqConIdx, KSTAT_DATA_UINT64); 1727 BNXE_KSTAT_RXQ(rxFreeDescs, KSTAT_DATA_UINT64); 1728 BNXE_KSTAT_RXQ(rxActiveDescs, KSTAT_DATA_UINT64); 1729 BNXE_KSTAT_RXQ(rxDoneDescs, KSTAT_DATA_UINT64); 1730 BNXE_KSTAT_RXQ(rxWaitingDescs, KSTAT_DATA_UINT64); 1731 BNXE_KSTAT_RXQ(rxCopied, KSTAT_DATA_UINT64); 1732 BNXE_KSTAT_RXQ(rxDiscards, KSTAT_DATA_UINT64); 1733 BNXE_KSTAT_RXQ(rxBufUpInStack, KSTAT_DATA_UINT64); 1734 BNXE_KSTAT_RXQ(rxLowWater, KSTAT_DATA_UINT64); 1735 BNXE_KSTAT_RXQ(inPollMode, KSTAT_DATA_UINT64); 1736 BNXE_KSTAT_RXQ(pollCnt, KSTAT_DATA_UINT64); 1737 BNXE_KSTAT_RXQ(intrDisableCnt, KSTAT_DATA_UINT64); 1738 BNXE_KSTAT_RXQ(intrEnableCnt, KSTAT_DATA_UINT64); 1739 BNXE_KSTAT_RXQ(genNumber, KSTAT_DATA_UINT64); 1740 1741 pUM->kstats_rxq_map[idx].idx = idx; 1742 pUM->kstats_rxq_map[idx].pUM = pUM; 1743 1744 pUM->kstats_rxq[idx]->ks_update = BnxeKstatRxRingUpdate; 1745 pUM->kstats_rxq[idx]->ks_private = (void *)&pUM->kstats_rxq_map[idx]; 1746 1747 kstat_install(pUM->kstats_rxq[idx]); 1748 1749 return B_TRUE; 1750 } 1751 1752 1753 boolean_t BnxeKstatInitTxQ(um_device_t * pUM, 1754 int idx) 1755 { 1756 char buf[32]; 1757 1758 BnxeKstatTxq * pStatsTxq; 1759 #define BNXE_KSTAT_TXQ(f, t) kstat_named_init(&pStatsTxq->f, #f, t) 1760 1761 snprintf(buf, sizeof(buf), "txq%d", idx); 1762 1763 if ((pUM->kstats_txq[idx] = kstat_create("bnxe", 1764 pUM->instance, 1765 buf, 1766 "net", 1767 KSTAT_TYPE_NAMED, 1768 BNXE_KSTAT_TXQ_SIZE, 1769 0)) == NULL) 1770 { 1771 BnxeLogWarn(pUM, "Failed to create txq%d kstat", idx); 1772 return B_FALSE; 1773 } 1774 1775 pStatsTxq = (BnxeKstatTxq *)pUM->kstats_txq[idx]->ks_data; 1776 1777 BNXE_KSTAT_TXQ(txBdTotal, KSTAT_DATA_UINT64); 1778 BNXE_KSTAT_TXQ(txBdLeft, KSTAT_DATA_UINT64); 1779 BNXE_KSTAT_TXQ(txBdPageCnt, KSTAT_DATA_UINT64); 1780 BNXE_KSTAT_TXQ(txBdsPerPage, KSTAT_DATA_UINT64); 1781 BNXE_KSTAT_TXQ(txBdSize, KSTAT_DATA_UINT64); 1782 BNXE_KSTAT_TXQ(txBdsSkipEop, KSTAT_DATA_UINT64); 1783 BNXE_KSTAT_TXQ(hwTxqConIdx, KSTAT_DATA_UINT64); 1784 BNXE_KSTAT_TXQ(txPktIdx, KSTAT_DATA_UINT64); 1785 BNXE_KSTAT_TXQ(txBdProdIdx, KSTAT_DATA_UINT64); 1786 BNXE_KSTAT_TXQ(txBdConsIdx, KSTAT_DATA_UINT64); 1787 BNXE_KSTAT_TXQ(txSentPkts, KSTAT_DATA_UINT64); 1788 BNXE_KSTAT_TXQ(txFreeDesc, KSTAT_DATA_UINT64); 1789 BNXE_KSTAT_TXQ(txWaitingPkts, KSTAT_DATA_UINT64); 1790 BNXE_KSTAT_TXQ(txLowWater, KSTAT_DATA_UINT64); 1791 BNXE_KSTAT_TXQ(txFailed, KSTAT_DATA_UINT64); 1792 BNXE_KSTAT_TXQ(txDiscards, KSTAT_DATA_UINT64); 1793 BNXE_KSTAT_TXQ(txRecycle, KSTAT_DATA_UINT64); 1794 BNXE_KSTAT_TXQ(txCopied, KSTAT_DATA_UINT64); 1795 BNXE_KSTAT_TXQ(txBlocked, KSTAT_DATA_UINT64); 1796 BNXE_KSTAT_TXQ(txWait, KSTAT_DATA_UINT64); 1797 1798 pUM->kstats_txq_map[idx].idx = idx; 1799 pUM->kstats_txq_map[idx].pUM = pUM; 1800 1801 pUM->kstats_txq[idx]->ks_update = BnxeKstatTxRingUpdate; 1802 pUM->kstats_txq[idx]->ks_private = (void *)&pUM->kstats_txq_map[idx]; 1803 1804 kstat_install(pUM->kstats_txq[idx]); 1805 1806 return B_TRUE; 1807 } 1808 1809 1810 boolean_t BnxeKstatInit(um_device_t * pUM) 1811 { 1812 lm_device_t * pLM = (lm_device_t *)pUM; 1813 char buf[32]; 1814 int idx; 1815 1816 BnxeKstat * pStats; 1817 BnxeKstatLink * pStatsLink; 1818 BnxeKstatIntr * pStatsIntr; 1819 BnxeKstatL2Chip * pStatsL2Chip; 1820 BnxeKstatL2Driver * pStatsL2Driver; 1821 BnxeKstatEthStats * pStatsL2Stats; 1822 BnxeKstatFcoe * pStatsFcoe; 1823 BnxeKstatDcbx * pStatsDcbx; 1824 #define BNXE_KSTAT(f, t) kstat_named_init(&pStats->f, #f, t) 1825 #define BNXE_KSTAT_LINK(f, t) kstat_named_init(&pStatsLink->f, #f, t) 1826 #define BNXE_KSTAT_INTR(f, t) kstat_named_init(&pStatsIntr->f, #f, t) 1827 #define BNXE_KSTAT_L2_CHIP(f, t) kstat_named_init(&pStatsL2Chip->f, #f, t) 1828 #define BNXE_KSTAT_L2_DRIVER(f, t) kstat_named_init(&pStatsL2Driver->f, #f, t) 1829 #define BNXE_KSTAT_L2_STATS(f, t) kstat_named_init(&pStatsL2Stats->f, #f, t) 1830 #define BNXE_KSTAT_FCOE(f, t) kstat_named_init(&pStatsFcoe->f, #f, t) 1831 #define BNXE_KSTAT_DCBX(f, t) kstat_named_init(&pStatsDcbx->f, #f, t) 1832 1833 /****************************************************************/ 1834 1835 if ((pUM->kstats = kstat_create("bnxe", 1836 pUM->instance, 1837 "stats", 1838 "net", 1839 KSTAT_TYPE_NAMED, 1840 BNXE_KSTAT_SIZE, 1841 0)) == NULL) 1842 { 1843 BnxeLogWarn(pUM, "Failed to create kstat"); 1844 return B_FALSE; 1845 } 1846 1847 pStats = (BnxeKstat *)pUM->kstats->ks_data; 1848 1849 BNXE_KSTAT(umdev_hi, KSTAT_DATA_CHAR); 1850 BNXE_KSTAT(umdev_lo, KSTAT_DATA_CHAR); 1851 BNXE_KSTAT(version, KSTAT_DATA_CHAR); 1852 BNXE_KSTAT(versionFW, KSTAT_DATA_CHAR); 1853 BNXE_KSTAT(versionBC, KSTAT_DATA_CHAR); 1854 BNXE_KSTAT(chipName, KSTAT_DATA_CHAR); 1855 BNXE_KSTAT(chipID, KSTAT_DATA_CHAR); 1856 BNXE_KSTAT(devBDF, KSTAT_DATA_CHAR); 1857 BNXE_KSTAT(devID, KSTAT_DATA_CHAR); 1858 BNXE_KSTAT(multiFunction, KSTAT_DATA_CHAR); 1859 BNXE_KSTAT(multiFunctionVnics, KSTAT_DATA_UINT64); 1860 BNXE_KSTAT(macAddr, KSTAT_DATA_CHAR); 1861 BNXE_KSTAT(hwInitDone, KSTAT_DATA_UINT64); 1862 BNXE_KSTAT(clientsHw, KSTAT_DATA_CHAR); 1863 BNXE_KSTAT(clientsDevi, KSTAT_DATA_CHAR); 1864 BNXE_KSTAT(clientsBound, KSTAT_DATA_CHAR); 1865 BNXE_KSTAT(txMsgPullUp, KSTAT_DATA_UINT64); 1866 BNXE_KSTAT(intrAlloc, KSTAT_DATA_CHAR); 1867 BNXE_KSTAT(intrFired, KSTAT_DATA_UINT64); 1868 BNXE_KSTAT(timerFired, KSTAT_DATA_UINT64); 1869 BNXE_KSTAT(timerReply, KSTAT_DATA_UINT64); 1870 BNXE_KSTAT(timerNoReplyTotal, KSTAT_DATA_UINT64); 1871 BNXE_KSTAT(timerNoReplyCurrent, KSTAT_DATA_UINT64); 1872 BNXE_KSTAT(timerDone, KSTAT_DATA_UINT64); 1873 BNXE_KSTAT(workQueueInstCnt, KSTAT_DATA_UINT64); 1874 BNXE_KSTAT(workItemInstQueued, KSTAT_DATA_UINT64); 1875 BNXE_KSTAT(workItemInstError, KSTAT_DATA_UINT64); 1876 BNXE_KSTAT(workItemInstComplete, KSTAT_DATA_UINT64); 1877 BNXE_KSTAT(workItemInstHighWater, KSTAT_DATA_UINT64); 1878 BNXE_KSTAT(workQueueDelayCnt, KSTAT_DATA_UINT64); 1879 BNXE_KSTAT(workItemDelayQueued, KSTAT_DATA_UINT64); 1880 BNXE_KSTAT(workItemDelayError, KSTAT_DATA_UINT64); 1881 BNXE_KSTAT(workItemDelayComplete, KSTAT_DATA_UINT64); 1882 BNXE_KSTAT(workItemDelayHighWater, KSTAT_DATA_UINT64); 1883 BNXE_KSTAT(memAllocBlocks, KSTAT_DATA_UINT64); 1884 BNXE_KSTAT(memAllocDMAs, KSTAT_DATA_UINT64); 1885 BNXE_KSTAT(memAllocBARs, KSTAT_DATA_UINT64); 1886 1887 pUM->kstats->ks_update = BnxeKstatUpdate; 1888 pUM->kstats->ks_private = (void *)pUM; 1889 1890 kstat_install(pUM->kstats); 1891 1892 /****************************************************************/ 1893 1894 if ((pUM->kstatsLink = kstat_create("bnxe", 1895 pUM->instance, 1896 "link", 1897 "net", 1898 KSTAT_TYPE_NAMED, 1899 BNXE_KSTAT_LINK_SIZE, 1900 0)) == NULL) 1901 { 1902 BnxeLogWarn(pUM, "Failed to create link kstat"); 1903 return B_FALSE; 1904 } 1905 1906 pStatsLink = (BnxeKstatLink *)pUM->kstatsLink->ks_data; 1907 1908 BNXE_KSTAT_LINK(clients, KSTAT_DATA_CHAR); 1909 BNXE_KSTAT_LINK(uptime, KSTAT_DATA_UINT64); 1910 BNXE_KSTAT_LINK(mtuL2, KSTAT_DATA_UINT64); 1911 BNXE_KSTAT_LINK(mtuFCOE, KSTAT_DATA_UINT64); 1912 BNXE_KSTAT_LINK(speed, KSTAT_DATA_UINT64); 1913 BNXE_KSTAT_LINK(link, KSTAT_DATA_UINT64); 1914 BNXE_KSTAT_LINK(duplex, KSTAT_DATA_UINT64); 1915 BNXE_KSTAT_LINK(pauseRx, KSTAT_DATA_UINT64); 1916 BNXE_KSTAT_LINK(pauseTx, KSTAT_DATA_UINT64); 1917 1918 pUM->kstatsLink->ks_update = BnxeKstatLinkUpdate; 1919 pUM->kstatsLink->ks_private = (void *)pUM; 1920 1921 kstat_install(pUM->kstatsLink); 1922 1923 /****************************************************************/ 1924 1925 if ((pUM->kstatsIntr = kstat_create("bnxe", 1926 pUM->instance, 1927 "intr", 1928 "net", 1929 KSTAT_TYPE_NAMED, 1930 BNXE_KSTAT_INTR_SIZE, 1931 0)) == NULL) 1932 { 1933 BnxeLogWarn(pUM, "Failed to create intr kstat"); 1934 return B_FALSE; 1935 } 1936 1937 pStatsIntr = (BnxeKstatIntr *)pUM->kstatsIntr->ks_data; 1938 1939 BNXE_KSTAT_INTR(intrAlloc, KSTAT_DATA_CHAR); 1940 BNXE_KSTAT_INTR(intrFired, KSTAT_DATA_UINT64); 1941 BNXE_KSTAT_INTR(intrWrongState, KSTAT_DATA_UINT64); 1942 BNXE_KSTAT_INTR(intrInDisabled, KSTAT_DATA_UINT64); 1943 BNXE_KSTAT_INTR(intrZeroStatus, KSTAT_DATA_UINT64); 1944 BNXE_KSTAT_INTR(sb_00, KSTAT_DATA_UINT64); 1945 BNXE_KSTAT_INTR(sb_01, KSTAT_DATA_UINT64); 1946 BNXE_KSTAT_INTR(sb_02, KSTAT_DATA_UINT64); 1947 BNXE_KSTAT_INTR(sb_03, KSTAT_DATA_UINT64); 1948 BNXE_KSTAT_INTR(sb_04, KSTAT_DATA_UINT64); 1949 BNXE_KSTAT_INTR(sb_05, KSTAT_DATA_UINT64); 1950 BNXE_KSTAT_INTR(sb_06, KSTAT_DATA_UINT64); 1951 BNXE_KSTAT_INTR(sb_07, KSTAT_DATA_UINT64); 1952 BNXE_KSTAT_INTR(sb_08, KSTAT_DATA_UINT64); 1953 BNXE_KSTAT_INTR(sb_09, KSTAT_DATA_UINT64); 1954 BNXE_KSTAT_INTR(sb_10, KSTAT_DATA_UINT64); 1955 BNXE_KSTAT_INTR(sb_11, KSTAT_DATA_UINT64); 1956 BNXE_KSTAT_INTR(sb_12, KSTAT_DATA_UINT64); 1957 BNXE_KSTAT_INTR(sb_13, KSTAT_DATA_UINT64); 1958 BNXE_KSTAT_INTR(sb_14, KSTAT_DATA_UINT64); 1959 BNXE_KSTAT_INTR(sb_15, KSTAT_DATA_UINT64); 1960 BNXE_KSTAT_INTR(sb_16, KSTAT_DATA_UINT64); 1961 BNXE_KSTAT_INTR(sb_nc_00, KSTAT_DATA_UINT64); 1962 BNXE_KSTAT_INTR(sb_nc_01, KSTAT_DATA_UINT64); 1963 BNXE_KSTAT_INTR(sb_nc_02, KSTAT_DATA_UINT64); 1964 BNXE_KSTAT_INTR(sb_nc_03, KSTAT_DATA_UINT64); 1965 BNXE_KSTAT_INTR(sb_nc_04, KSTAT_DATA_UINT64); 1966 BNXE_KSTAT_INTR(sb_nc_05, KSTAT_DATA_UINT64); 1967 BNXE_KSTAT_INTR(sb_nc_06, KSTAT_DATA_UINT64); 1968 BNXE_KSTAT_INTR(sb_nc_07, KSTAT_DATA_UINT64); 1969 BNXE_KSTAT_INTR(sb_nc_08, KSTAT_DATA_UINT64); 1970 BNXE_KSTAT_INTR(sb_nc_09, KSTAT_DATA_UINT64); 1971 BNXE_KSTAT_INTR(sb_nc_10, KSTAT_DATA_UINT64); 1972 BNXE_KSTAT_INTR(sb_nc_11, KSTAT_DATA_UINT64); 1973 BNXE_KSTAT_INTR(sb_nc_12, KSTAT_DATA_UINT64); 1974 BNXE_KSTAT_INTR(sb_nc_13, KSTAT_DATA_UINT64); 1975 BNXE_KSTAT_INTR(sb_nc_14, KSTAT_DATA_UINT64); 1976 BNXE_KSTAT_INTR(sb_nc_15, KSTAT_DATA_UINT64); 1977 BNXE_KSTAT_INTR(sb_nc_16, KSTAT_DATA_UINT64); 1978 BNXE_KSTAT_INTR(sb_poll_00, KSTAT_DATA_UINT64); 1979 BNXE_KSTAT_INTR(sb_poll_01, KSTAT_DATA_UINT64); 1980 BNXE_KSTAT_INTR(sb_poll_02, KSTAT_DATA_UINT64); 1981 BNXE_KSTAT_INTR(sb_poll_03, KSTAT_DATA_UINT64); 1982 BNXE_KSTAT_INTR(sb_poll_04, KSTAT_DATA_UINT64); 1983 BNXE_KSTAT_INTR(sb_poll_05, KSTAT_DATA_UINT64); 1984 BNXE_KSTAT_INTR(sb_poll_06, KSTAT_DATA_UINT64); 1985 BNXE_KSTAT_INTR(sb_poll_07, KSTAT_DATA_UINT64); 1986 BNXE_KSTAT_INTR(sb_poll_08, KSTAT_DATA_UINT64); 1987 BNXE_KSTAT_INTR(sb_poll_09, KSTAT_DATA_UINT64); 1988 BNXE_KSTAT_INTR(sb_poll_10, KSTAT_DATA_UINT64); 1989 BNXE_KSTAT_INTR(sb_poll_11, KSTAT_DATA_UINT64); 1990 BNXE_KSTAT_INTR(sb_poll_12, KSTAT_DATA_UINT64); 1991 BNXE_KSTAT_INTR(sb_poll_13, KSTAT_DATA_UINT64); 1992 BNXE_KSTAT_INTR(sb_poll_14, KSTAT_DATA_UINT64); 1993 BNXE_KSTAT_INTR(sb_poll_15, KSTAT_DATA_UINT64); 1994 BNXE_KSTAT_INTR(sb_poll_16, KSTAT_DATA_UINT64); 1995 BNXE_KSTAT_INTR(sb_poll_nc_00, KSTAT_DATA_UINT64); 1996 BNXE_KSTAT_INTR(sb_poll_nc_01, KSTAT_DATA_UINT64); 1997 BNXE_KSTAT_INTR(sb_poll_nc_02, KSTAT_DATA_UINT64); 1998 BNXE_KSTAT_INTR(sb_poll_nc_03, KSTAT_DATA_UINT64); 1999 BNXE_KSTAT_INTR(sb_poll_nc_04, KSTAT_DATA_UINT64); 2000 BNXE_KSTAT_INTR(sb_poll_nc_05, KSTAT_DATA_UINT64); 2001 BNXE_KSTAT_INTR(sb_poll_nc_06, KSTAT_DATA_UINT64); 2002 BNXE_KSTAT_INTR(sb_poll_nc_07, KSTAT_DATA_UINT64); 2003 BNXE_KSTAT_INTR(sb_poll_nc_08, KSTAT_DATA_UINT64); 2004 BNXE_KSTAT_INTR(sb_poll_nc_09, KSTAT_DATA_UINT64); 2005 BNXE_KSTAT_INTR(sb_poll_nc_10, KSTAT_DATA_UINT64); 2006 BNXE_KSTAT_INTR(sb_poll_nc_11, KSTAT_DATA_UINT64); 2007 BNXE_KSTAT_INTR(sb_poll_nc_12, KSTAT_DATA_UINT64); 2008 BNXE_KSTAT_INTR(sb_poll_nc_13, KSTAT_DATA_UINT64); 2009 BNXE_KSTAT_INTR(sb_poll_nc_14, KSTAT_DATA_UINT64); 2010 BNXE_KSTAT_INTR(sb_poll_nc_15, KSTAT_DATA_UINT64); 2011 BNXE_KSTAT_INTR(sb_poll_nc_16, KSTAT_DATA_UINT64); 2012 2013 pUM->kstatsIntr->ks_update = BnxeKstatIntrUpdate; 2014 pUM->kstatsIntr->ks_private = (void *)pUM; 2015 2016 kstat_install(pUM->kstatsIntr); 2017 2018 /****************************************************************/ 2019 2020 if ((pUM->kstatsL2Chip = kstat_create("bnxe", 2021 pUM->instance, 2022 "l2chip", 2023 "net", 2024 KSTAT_TYPE_NAMED, 2025 BNXE_KSTAT_L2_CHIP_SIZE, 2026 0)) == NULL) 2027 { 2028 BnxeLogWarn(pUM, "Failed to create l2chip kstat"); 2029 return B_FALSE; 2030 } 2031 2032 pStatsL2Chip = (BnxeKstatL2Chip *)pUM->kstatsL2Chip->ks_data; 2033 2034 BNXE_KSTAT_L2_CHIP(IfHCInOctets, KSTAT_DATA_UINT64); 2035 BNXE_KSTAT_L2_CHIP(IfHCInBadOctets, KSTAT_DATA_UINT64); 2036 BNXE_KSTAT_L2_CHIP(IfHCOutOctets, KSTAT_DATA_UINT64); 2037 BNXE_KSTAT_L2_CHIP(IfHCOutBadOctets, KSTAT_DATA_UINT64); 2038 BNXE_KSTAT_L2_CHIP(IfHCOutPkts, KSTAT_DATA_UINT64); 2039 BNXE_KSTAT_L2_CHIP(IfHCInPkts, KSTAT_DATA_UINT64); 2040 BNXE_KSTAT_L2_CHIP(IfHCInUcastPkts, KSTAT_DATA_UINT64); 2041 BNXE_KSTAT_L2_CHIP(IfHCInMulticastPkts, KSTAT_DATA_UINT64); 2042 BNXE_KSTAT_L2_CHIP(IfHCInBroadcastPkts, KSTAT_DATA_UINT64); 2043 BNXE_KSTAT_L2_CHIP(IfHCOutUcastPkts, KSTAT_DATA_UINT64); 2044 BNXE_KSTAT_L2_CHIP(IfHCOutMulticastPkts, KSTAT_DATA_UINT64); 2045 BNXE_KSTAT_L2_CHIP(IfHCOutBroadcastPkts, KSTAT_DATA_UINT64); 2046 BNXE_KSTAT_L2_CHIP(IfHCInUcastOctets, KSTAT_DATA_UINT64); 2047 BNXE_KSTAT_L2_CHIP(IfHCInMulticastOctets, KSTAT_DATA_UINT64); 2048 BNXE_KSTAT_L2_CHIP(IfHCInBroadcastOctets, KSTAT_DATA_UINT64); 2049 BNXE_KSTAT_L2_CHIP(IfHCOutUcastOctets, KSTAT_DATA_UINT64); 2050 BNXE_KSTAT_L2_CHIP(IfHCOutMulticastOctets, KSTAT_DATA_UINT64); 2051 BNXE_KSTAT_L2_CHIP(IfHCOutBroadcastOctets, KSTAT_DATA_UINT64); 2052 BNXE_KSTAT_L2_CHIP(IfHCOutDiscards, KSTAT_DATA_UINT64); 2053 BNXE_KSTAT_L2_CHIP(IfHCInFalseCarrierErrors, KSTAT_DATA_UINT64); 2054 BNXE_KSTAT_L2_CHIP(Dot3StatsInternalMacTransmitErrors, KSTAT_DATA_UINT64); 2055 BNXE_KSTAT_L2_CHIP(Dot3StatsCarrierSenseErrors, KSTAT_DATA_UINT64); 2056 BNXE_KSTAT_L2_CHIP(Dot3StatsFCSErrors, KSTAT_DATA_UINT64); 2057 BNXE_KSTAT_L2_CHIP(Dot3StatsAlignmentErrors, KSTAT_DATA_UINT64); 2058 BNXE_KSTAT_L2_CHIP(Dot3StatsSingleCollisionFrames, KSTAT_DATA_UINT64); 2059 BNXE_KSTAT_L2_CHIP(Dot3StatsMultipleCollisionFrames, KSTAT_DATA_UINT64); 2060 BNXE_KSTAT_L2_CHIP(Dot3StatsDeferredTransmissions, KSTAT_DATA_UINT64); 2061 BNXE_KSTAT_L2_CHIP(Dot3StatsExcessiveCollisions, KSTAT_DATA_UINT64); 2062 BNXE_KSTAT_L2_CHIP(Dot3StatsLateCollisions, KSTAT_DATA_UINT64); 2063 BNXE_KSTAT_L2_CHIP(EtherStatsCollisions, KSTAT_DATA_UINT64); 2064 BNXE_KSTAT_L2_CHIP(EtherStatsFragments, KSTAT_DATA_UINT64); 2065 BNXE_KSTAT_L2_CHIP(EtherStatsJabbers, KSTAT_DATA_UINT64); 2066 BNXE_KSTAT_L2_CHIP(EtherStatsUndersizePkts, KSTAT_DATA_UINT64); 2067 BNXE_KSTAT_L2_CHIP(EtherStatsOverrsizePkts, KSTAT_DATA_UINT64); 2068 BNXE_KSTAT_L2_CHIP(EtherStatsTx64Octets, KSTAT_DATA_UINT64); 2069 BNXE_KSTAT_L2_CHIP(EtherStatsTx65to127Octets, KSTAT_DATA_UINT64); 2070 BNXE_KSTAT_L2_CHIP(EtherStatsTx128to255Octets, KSTAT_DATA_UINT64); 2071 BNXE_KSTAT_L2_CHIP(EtherStatsTx256to511Octets, KSTAT_DATA_UINT64); 2072 BNXE_KSTAT_L2_CHIP(EtherStatsTx512to1023Octets, KSTAT_DATA_UINT64); 2073 BNXE_KSTAT_L2_CHIP(EtherStatsTx1024to1522Octets, KSTAT_DATA_UINT64); 2074 BNXE_KSTAT_L2_CHIP(EtherStatsTxOver1522Octets, KSTAT_DATA_UINT64); 2075 BNXE_KSTAT_L2_CHIP(XonPauseFramesReceived, KSTAT_DATA_UINT64); 2076 BNXE_KSTAT_L2_CHIP(XoffPauseFramesReceived, KSTAT_DATA_UINT64); 2077 BNXE_KSTAT_L2_CHIP(OutXonSent, KSTAT_DATA_UINT64); 2078 BNXE_KSTAT_L2_CHIP(OutXoffSent, KSTAT_DATA_UINT64); 2079 BNXE_KSTAT_L2_CHIP(FlowControlDone, KSTAT_DATA_UINT64); 2080 BNXE_KSTAT_L2_CHIP(MacControlFramesReceived, KSTAT_DATA_UINT64); 2081 BNXE_KSTAT_L2_CHIP(XoffStateEntered, KSTAT_DATA_UINT64); 2082 BNXE_KSTAT_L2_CHIP(IfInFramesL2FilterDiscards, KSTAT_DATA_UINT64); 2083 BNXE_KSTAT_L2_CHIP(IfInTTL0Discards, KSTAT_DATA_UINT64); 2084 BNXE_KSTAT_L2_CHIP(IfInxxOverflowDiscards, KSTAT_DATA_UINT64); 2085 BNXE_KSTAT_L2_CHIP(IfInMBUFDiscards, KSTAT_DATA_UINT64); 2086 BNXE_KSTAT_L2_CHIP(IfInErrors, KSTAT_DATA_UINT64); 2087 BNXE_KSTAT_L2_CHIP(IfInErrorsOctets, KSTAT_DATA_UINT64); 2088 BNXE_KSTAT_L2_CHIP(IfInNoBrbBuffer, KSTAT_DATA_UINT64); 2089 BNXE_KSTAT_L2_CHIP(NigBrbPacket, KSTAT_DATA_UINT64); 2090 BNXE_KSTAT_L2_CHIP(NigBrbTruncate, KSTAT_DATA_UINT64); 2091 BNXE_KSTAT_L2_CHIP(NigFlowCtrlDiscard, KSTAT_DATA_UINT64); 2092 BNXE_KSTAT_L2_CHIP(NigFlowCtrlOctets, KSTAT_DATA_UINT64); 2093 BNXE_KSTAT_L2_CHIP(NigFlowCtrlPacket, KSTAT_DATA_UINT64); 2094 BNXE_KSTAT_L2_CHIP(NigMngDiscard, KSTAT_DATA_UINT64); 2095 BNXE_KSTAT_L2_CHIP(NigMngOctetInp, KSTAT_DATA_UINT64); 2096 BNXE_KSTAT_L2_CHIP(NigMngOctetOut, KSTAT_DATA_UINT64); 2097 BNXE_KSTAT_L2_CHIP(NigMngPacketInp, KSTAT_DATA_UINT64); 2098 BNXE_KSTAT_L2_CHIP(NigMngPacketOut, KSTAT_DATA_UINT64); 2099 BNXE_KSTAT_L2_CHIP(NigPbfOctets, KSTAT_DATA_UINT64); 2100 BNXE_KSTAT_L2_CHIP(NigPbfPacket, KSTAT_DATA_UINT64); 2101 BNXE_KSTAT_L2_CHIP(NigSafcInp, KSTAT_DATA_UINT64); 2102 2103 pUM->kstatsL2Chip->ks_update = BnxeKstatL2ChipUpdate; 2104 pUM->kstatsL2Chip->ks_private = (void *)pUM; 2105 2106 kstat_install(pUM->kstatsL2Chip); 2107 2108 /****************************************************************/ 2109 2110 if ((pUM->kstatsL2Driver = kstat_create("bnxe", 2111 pUM->instance, 2112 "l2driver", 2113 "net", 2114 KSTAT_TYPE_NAMED, 2115 BNXE_KSTAT_L2_DRIVER_SIZE, 2116 0)) == NULL) 2117 { 2118 BnxeLogWarn(pUM, "Failed to create l2driver kstat"); 2119 return B_FALSE; 2120 } 2121 2122 pStatsL2Driver = (BnxeKstatL2Driver *)pUM->kstatsL2Driver->ks_data; 2123 2124 BNXE_KSTAT_L2_DRIVER(RxIPv4FragCount, KSTAT_DATA_UINT64); 2125 BNXE_KSTAT_L2_DRIVER(RxIpCsErrorCount, KSTAT_DATA_UINT64); 2126 BNXE_KSTAT_L2_DRIVER(RxTcpCsErrorCount, KSTAT_DATA_UINT64); 2127 BNXE_KSTAT_L2_DRIVER(RxLlcSnapCount, KSTAT_DATA_UINT64); 2128 BNXE_KSTAT_L2_DRIVER(RxPhyErrorCount, KSTAT_DATA_UINT64); 2129 BNXE_KSTAT_L2_DRIVER(RxIpv6ExtCount, KSTAT_DATA_UINT64); 2130 BNXE_KSTAT_L2_DRIVER(TxNoL2Bd, KSTAT_DATA_UINT64); 2131 BNXE_KSTAT_L2_DRIVER(TxNoSqWqe, KSTAT_DATA_UINT64); 2132 BNXE_KSTAT_L2_DRIVER(TxL2AssemblyBufUse, KSTAT_DATA_UINT64); 2133 2134 pUM->kstatsL2Driver->ks_update = BnxeKstatL2DriverUpdate; 2135 pUM->kstatsL2Driver->ks_private = (void *)pUM; 2136 2137 kstat_install(pUM->kstatsL2Driver); 2138 2139 /****************************************************************/ 2140 2141 if ((pUM->kstatsL2Stats = kstat_create("bnxe", 2142 pUM->instance, 2143 "l2stats", 2144 "net", 2145 KSTAT_TYPE_NAMED, 2146 BNXE_KSTAT_ETH_STATS_SIZE, 2147 0)) == NULL) 2148 { 2149 BnxeLogWarn(pUM, "Failed to create l2stats kstat"); 2150 return B_FALSE; 2151 } 2152 2153 pStatsL2Stats = (BnxeKstatEthStats *)pUM->kstatsL2Stats->ks_data; 2154 2155 BNXE_KSTAT_L2_STATS(txFramesOk, KSTAT_DATA_UINT64); 2156 BNXE_KSTAT_L2_STATS(rxFramesOk, KSTAT_DATA_UINT64); 2157 BNXE_KSTAT_L2_STATS(txErr, KSTAT_DATA_UINT64); 2158 BNXE_KSTAT_L2_STATS(rxErr, KSTAT_DATA_UINT64); 2159 BNXE_KSTAT_L2_STATS(rxCrcErr, KSTAT_DATA_UINT64); 2160 BNXE_KSTAT_L2_STATS(alignErr, KSTAT_DATA_UINT64); 2161 BNXE_KSTAT_L2_STATS(collisionsSingle, KSTAT_DATA_UINT64); 2162 BNXE_KSTAT_L2_STATS(collisionsMultiple, KSTAT_DATA_UINT64); 2163 BNXE_KSTAT_L2_STATS(framesDeferred, KSTAT_DATA_UINT64); 2164 BNXE_KSTAT_L2_STATS(collisonsMax, KSTAT_DATA_UINT64); 2165 BNXE_KSTAT_L2_STATS(rxOverrun, KSTAT_DATA_UINT64); 2166 BNXE_KSTAT_L2_STATS(txOverrun, KSTAT_DATA_UINT64); 2167 BNXE_KSTAT_L2_STATS(txFramesUnicast, KSTAT_DATA_UINT64); 2168 BNXE_KSTAT_L2_STATS(txFramesMulticast, KSTAT_DATA_UINT64); 2169 BNXE_KSTAT_L2_STATS(txFramesBroadcast, KSTAT_DATA_UINT64); 2170 BNXE_KSTAT_L2_STATS(rxFramesUnicast, KSTAT_DATA_UINT64); 2171 BNXE_KSTAT_L2_STATS(rxFramesMulticast, KSTAT_DATA_UINT64); 2172 BNXE_KSTAT_L2_STATS(rxFramesBroadcast, KSTAT_DATA_UINT64); 2173 BNXE_KSTAT_L2_STATS(rxNoBufferDrop, KSTAT_DATA_UINT64); 2174 BNXE_KSTAT_L2_STATS(rxBytes, KSTAT_DATA_UINT64); 2175 BNXE_KSTAT_L2_STATS(txBytes, KSTAT_DATA_UINT64); 2176 BNXE_KSTAT_L2_STATS(offloadIP4, KSTAT_DATA_UINT64); 2177 BNXE_KSTAT_L2_STATS(offloadTCP, KSTAT_DATA_UINT64); 2178 BNXE_KSTAT_L2_STATS(ifInDiscards, KSTAT_DATA_UINT64); 2179 BNXE_KSTAT_L2_STATS(ifInErrors, KSTAT_DATA_UINT64); 2180 BNXE_KSTAT_L2_STATS(ifOutErrors, KSTAT_DATA_UINT64); 2181 BNXE_KSTAT_L2_STATS(offloadIP6, KSTAT_DATA_UINT64); 2182 BNXE_KSTAT_L2_STATS(offloadTCP6, KSTAT_DATA_UINT64); 2183 BNXE_KSTAT_L2_STATS(txDiscards, KSTAT_DATA_UINT64); 2184 BNXE_KSTAT_L2_STATS(rxBytesUnicast, KSTAT_DATA_UINT64); 2185 BNXE_KSTAT_L2_STATS(rxBytesMulticast, KSTAT_DATA_UINT64); 2186 BNXE_KSTAT_L2_STATS(rxBytesBroadcast, KSTAT_DATA_UINT64); 2187 BNXE_KSTAT_L2_STATS(txBytesUnicast, KSTAT_DATA_UINT64); 2188 BNXE_KSTAT_L2_STATS(txBytesMulticast, KSTAT_DATA_UINT64); 2189 BNXE_KSTAT_L2_STATS(txBytesBroadcast, KSTAT_DATA_UINT64); 2190 2191 pUM->kstatsL2Stats->ks_update = BnxeKstatL2StatsUpdate; 2192 pUM->kstatsL2Stats->ks_private = (void *)pUM; 2193 2194 kstat_install(pUM->kstatsL2Stats); 2195 2196 /****************************************************************/ 2197 2198 if (BNXE_FCOE(pUM)) 2199 { 2200 if ((pUM->kstatsFcoe = kstat_create("bnxe", 2201 pUM->instance, 2202 "fcoe", 2203 "net", 2204 KSTAT_TYPE_NAMED, 2205 BNXE_KSTAT_FCOE_SIZE, 2206 0)) == NULL) 2207 { 2208 BnxeLogWarn(pUM, "Failed to create fcoe kstat"); 2209 BnxeKstatFini(pUM); 2210 return B_FALSE; 2211 } 2212 2213 pStatsFcoe = (BnxeKstatFcoe *)pUM->kstatsFcoe->ks_data; 2214 2215 BNXE_KSTAT_FCOE(pdev_hi, KSTAT_DATA_CHAR); 2216 BNXE_KSTAT_FCOE(pdev_lo, KSTAT_DATA_CHAR); 2217 BNXE_KSTAT_FCOE(instance, KSTAT_DATA_CHAR); 2218 BNXE_KSTAT_FCOE(macAddr, KSTAT_DATA_CHAR); 2219 BNXE_KSTAT_FCOE(pwwn_hi, KSTAT_DATA_CHAR); 2220 BNXE_KSTAT_FCOE(pwwn_lo, KSTAT_DATA_CHAR); 2221 BNXE_KSTAT_FCOE(mtu, KSTAT_DATA_UINT64); 2222 BNXE_KSTAT_FCOE(initWqeTx, KSTAT_DATA_UINT64); 2223 BNXE_KSTAT_FCOE(initWqeTxErr, KSTAT_DATA_UINT64); 2224 BNXE_KSTAT_FCOE(initCqeRx, KSTAT_DATA_UINT64); 2225 BNXE_KSTAT_FCOE(initCqeRxErr, KSTAT_DATA_UINT64); 2226 BNXE_KSTAT_FCOE(offloadConnWqeTx, KSTAT_DATA_UINT64); 2227 BNXE_KSTAT_FCOE(offloadConnWqeTxErr, KSTAT_DATA_UINT64); 2228 BNXE_KSTAT_FCOE(offloadConnCqeRx, KSTAT_DATA_UINT64); 2229 BNXE_KSTAT_FCOE(offloadConnCqeRxErr, KSTAT_DATA_UINT64); 2230 BNXE_KSTAT_FCOE(enableConnWqeTx, KSTAT_DATA_UINT64); 2231 BNXE_KSTAT_FCOE(enableConnWqeTxErr, KSTAT_DATA_UINT64); 2232 BNXE_KSTAT_FCOE(enableConnCqeRx, KSTAT_DATA_UINT64); 2233 BNXE_KSTAT_FCOE(enableConnCqeRxErr, KSTAT_DATA_UINT64); 2234 BNXE_KSTAT_FCOE(disableConnWqeTx, KSTAT_DATA_UINT64); 2235 BNXE_KSTAT_FCOE(disableConnWqeTxErr, KSTAT_DATA_UINT64); 2236 BNXE_KSTAT_FCOE(disableConnCqeRx, KSTAT_DATA_UINT64); 2237 BNXE_KSTAT_FCOE(disableConnCqeRxErr, KSTAT_DATA_UINT64); 2238 BNXE_KSTAT_FCOE(destroyConnWqeTx, KSTAT_DATA_UINT64); 2239 BNXE_KSTAT_FCOE(destroyConnWqeTxErr, KSTAT_DATA_UINT64); 2240 BNXE_KSTAT_FCOE(destroyConnCqeRx, KSTAT_DATA_UINT64); 2241 BNXE_KSTAT_FCOE(destroyConnCqeRxErr, KSTAT_DATA_UINT64); 2242 BNXE_KSTAT_FCOE(destroyWqeTx, KSTAT_DATA_UINT64); 2243 BNXE_KSTAT_FCOE(destroyWqeTxErr, KSTAT_DATA_UINT64); 2244 BNXE_KSTAT_FCOE(destroyCqeRx, KSTAT_DATA_UINT64); 2245 BNXE_KSTAT_FCOE(destroyCqeRxErr, KSTAT_DATA_UINT64); 2246 BNXE_KSTAT_FCOE(compRequestCqeRx, KSTAT_DATA_UINT64); 2247 BNXE_KSTAT_FCOE(compRequestCqeRxErr, KSTAT_DATA_UINT64); 2248 BNXE_KSTAT_FCOE(statWqeTx, KSTAT_DATA_UINT64); 2249 BNXE_KSTAT_FCOE(statWqeTxErr, KSTAT_DATA_UINT64); 2250 BNXE_KSTAT_FCOE(statCqeRx, KSTAT_DATA_UINT64); 2251 BNXE_KSTAT_FCOE(statCqeRxErr, KSTAT_DATA_UINT64); 2252 2253 pUM->kstatsFcoe->ks_update = BnxeKstatFcoeUpdate; 2254 pUM->kstatsFcoe->ks_private = (void *)pUM; 2255 2256 kstat_install(pUM->kstatsFcoe); 2257 2258 if (!BnxeKstatInitRxQ(pUM, FCOE_CID(pLM))) 2259 { 2260 BnxeKstatFini(pUM); 2261 return B_FALSE; 2262 } 2263 2264 if (!BnxeKstatInitTxQ(pUM, FCOE_CID(pLM))) 2265 { 2266 BnxeKstatFini(pUM); 2267 return B_FALSE; 2268 } 2269 } 2270 2271 /****************************************************************/ 2272 2273 if (IS_DCB_SUPPORTED(pLM)) 2274 { 2275 if ((pUM->kstatsDcbx = kstat_create("bnxe", 2276 pUM->instance, 2277 "dcbx", 2278 "net", 2279 KSTAT_TYPE_NAMED, 2280 BNXE_KSTAT_DCBX_SIZE, 2281 0)) == NULL) 2282 { 2283 BnxeLogWarn(pUM, "Failed to create dcbx kstat"); 2284 BnxeKstatFini(pUM); 2285 return B_FALSE; 2286 } 2287 2288 pStatsDcbx = (BnxeKstatDcbx *)pUM->kstatsDcbx->ks_data; 2289 2290 BNXE_KSTAT_DCBX(dcbx_sync, KSTAT_DATA_CHAR); 2291 BNXE_KSTAT_DCBX(dcbx_vers, KSTAT_DATA_CHAR); 2292 BNXE_KSTAT_DCBX(overwrite_settings, KSTAT_DATA_CHAR); 2293 BNXE_KSTAT_DCBX(prio_tag, KSTAT_DATA_CHAR); 2294 BNXE_KSTAT_DCBX(prio_tag_fcoe, KSTAT_DATA_CHAR); 2295 BNXE_KSTAT_DCBX(prio_tag_iscsi, KSTAT_DATA_CHAR); 2296 BNXE_KSTAT_DCBX(prio_tag_net, KSTAT_DATA_CHAR); 2297 BNXE_KSTAT_DCBX(pfc, KSTAT_DATA_CHAR); 2298 BNXE_KSTAT_DCBX(pfc_prio_0, KSTAT_DATA_CHAR); 2299 BNXE_KSTAT_DCBX(pfc_prio_1, KSTAT_DATA_CHAR); 2300 BNXE_KSTAT_DCBX(pfc_prio_2, KSTAT_DATA_CHAR); 2301 BNXE_KSTAT_DCBX(pfc_prio_3, KSTAT_DATA_CHAR); 2302 BNXE_KSTAT_DCBX(pfc_prio_4, KSTAT_DATA_CHAR); 2303 BNXE_KSTAT_DCBX(pfc_prio_5, KSTAT_DATA_CHAR); 2304 BNXE_KSTAT_DCBX(pfc_prio_6, KSTAT_DATA_CHAR); 2305 BNXE_KSTAT_DCBX(pfc_prio_7, KSTAT_DATA_CHAR); 2306 BNXE_KSTAT_DCBX(ets, KSTAT_DATA_CHAR); 2307 BNXE_KSTAT_DCBX(ets_prio_0_pg, KSTAT_DATA_CHAR); 2308 BNXE_KSTAT_DCBX(ets_prio_1_pg, KSTAT_DATA_CHAR); 2309 BNXE_KSTAT_DCBX(ets_prio_2_pg, KSTAT_DATA_CHAR); 2310 BNXE_KSTAT_DCBX(ets_prio_3_pg, KSTAT_DATA_CHAR); 2311 BNXE_KSTAT_DCBX(ets_prio_4_pg, KSTAT_DATA_CHAR); 2312 BNXE_KSTAT_DCBX(ets_prio_5_pg, KSTAT_DATA_CHAR); 2313 BNXE_KSTAT_DCBX(ets_prio_6_pg, KSTAT_DATA_CHAR); 2314 BNXE_KSTAT_DCBX(ets_prio_7_pg, KSTAT_DATA_CHAR); 2315 BNXE_KSTAT_DCBX(ets_pg_0_bw, KSTAT_DATA_CHAR); 2316 BNXE_KSTAT_DCBX(ets_pg_1_bw, KSTAT_DATA_CHAR); 2317 BNXE_KSTAT_DCBX(ets_pg_2_bw, KSTAT_DATA_CHAR); 2318 BNXE_KSTAT_DCBX(ets_pg_3_bw, KSTAT_DATA_CHAR); 2319 BNXE_KSTAT_DCBX(ets_pg_4_bw, KSTAT_DATA_CHAR); 2320 BNXE_KSTAT_DCBX(ets_pg_5_bw, KSTAT_DATA_CHAR); 2321 BNXE_KSTAT_DCBX(ets_pg_6_bw, KSTAT_DATA_CHAR); 2322 BNXE_KSTAT_DCBX(ets_pg_7_bw, KSTAT_DATA_CHAR); 2323 BNXE_KSTAT_DCBX(lldp, KSTAT_DATA_CHAR); 2324 BNXE_KSTAT_DCBX(lldp_tx_interval, KSTAT_DATA_CHAR); 2325 BNXE_KSTAT_DCBX(lldp_tx_fast_interval, KSTAT_DATA_CHAR); 2326 BNXE_KSTAT_DCBX(amib_apptlv_willing, KSTAT_DATA_CHAR); 2327 BNXE_KSTAT_DCBX(amib_apptlv_tx, KSTAT_DATA_CHAR); 2328 BNXE_KSTAT_DCBX(amib_apptlv_net_prio, KSTAT_DATA_CHAR); 2329 BNXE_KSTAT_DCBX(amib_apptlv_tbl_0_prio, KSTAT_DATA_CHAR); 2330 BNXE_KSTAT_DCBX(amib_apptlv_tbl_0_appid, KSTAT_DATA_CHAR); 2331 BNXE_KSTAT_DCBX(amib_apptlv_tbl_1_prio, KSTAT_DATA_CHAR); 2332 BNXE_KSTAT_DCBX(amib_apptlv_tbl_1_appid, KSTAT_DATA_CHAR); 2333 BNXE_KSTAT_DCBX(amib_apptlv_tbl_2_prio, KSTAT_DATA_CHAR); 2334 BNXE_KSTAT_DCBX(amib_apptlv_tbl_2_appid, KSTAT_DATA_CHAR); 2335 BNXE_KSTAT_DCBX(amib_apptlv_tbl_3_prio, KSTAT_DATA_CHAR); 2336 BNXE_KSTAT_DCBX(amib_apptlv_tbl_3_appid, KSTAT_DATA_CHAR); 2337 BNXE_KSTAT_DCBX(amib_pgtlv_willing, KSTAT_DATA_CHAR); 2338 BNXE_KSTAT_DCBX(amib_pgtlv_tx, KSTAT_DATA_CHAR); 2339 BNXE_KSTAT_DCBX(amib_pgtlv_tc_supported, KSTAT_DATA_CHAR); 2340 BNXE_KSTAT_DCBX(amib_pgtlv_ets, KSTAT_DATA_CHAR); 2341 BNXE_KSTAT_DCBX(amib_pgtlv_pg_0_bw, KSTAT_DATA_CHAR); 2342 BNXE_KSTAT_DCBX(amib_pgtlv_pg_1_bw, KSTAT_DATA_CHAR); 2343 BNXE_KSTAT_DCBX(amib_pgtlv_pg_2_bw, KSTAT_DATA_CHAR); 2344 BNXE_KSTAT_DCBX(amib_pgtlv_pg_3_bw, KSTAT_DATA_CHAR); 2345 BNXE_KSTAT_DCBX(amib_pgtlv_pg_4_bw, KSTAT_DATA_CHAR); 2346 BNXE_KSTAT_DCBX(amib_pgtlv_pg_5_bw, KSTAT_DATA_CHAR); 2347 BNXE_KSTAT_DCBX(amib_pgtlv_pg_6_bw, KSTAT_DATA_CHAR); 2348 BNXE_KSTAT_DCBX(amib_pgtlv_pg_7_bw, KSTAT_DATA_CHAR); 2349 BNXE_KSTAT_DCBX(amib_pgtlv_prio_0_map, KSTAT_DATA_CHAR); 2350 BNXE_KSTAT_DCBX(amib_pgtlv_prio_1_map, KSTAT_DATA_CHAR); 2351 BNXE_KSTAT_DCBX(amib_pgtlv_prio_2_map, KSTAT_DATA_CHAR); 2352 BNXE_KSTAT_DCBX(amib_pgtlv_prio_3_map, KSTAT_DATA_CHAR); 2353 BNXE_KSTAT_DCBX(amib_pgtlv_prio_4_map, KSTAT_DATA_CHAR); 2354 BNXE_KSTAT_DCBX(amib_pgtlv_prio_5_map, KSTAT_DATA_CHAR); 2355 BNXE_KSTAT_DCBX(amib_pgtlv_prio_6_map, KSTAT_DATA_CHAR); 2356 BNXE_KSTAT_DCBX(amib_pgtlv_prio_7_map, KSTAT_DATA_CHAR); 2357 BNXE_KSTAT_DCBX(amib_pfctlv_willing, KSTAT_DATA_CHAR); 2358 BNXE_KSTAT_DCBX(amib_pfctlv_tx, KSTAT_DATA_CHAR); 2359 BNXE_KSTAT_DCBX(amib_pfctlv_pfc, KSTAT_DATA_CHAR); 2360 BNXE_KSTAT_DCBX(amib_pfctlv_pfc_map, KSTAT_DATA_CHAR); 2361 BNXE_KSTAT_DCBX(rmib_apptlv_willing, KSTAT_DATA_CHAR); 2362 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_0_prio, KSTAT_DATA_CHAR); 2363 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_0_appid, KSTAT_DATA_CHAR); 2364 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_1_prio, KSTAT_DATA_CHAR); 2365 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_1_appid, KSTAT_DATA_CHAR); 2366 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_2_prio, KSTAT_DATA_CHAR); 2367 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_2_appid, KSTAT_DATA_CHAR); 2368 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_3_prio, KSTAT_DATA_CHAR); 2369 BNXE_KSTAT_DCBX(rmib_apptlv_tbl_3_appid, KSTAT_DATA_CHAR); 2370 BNXE_KSTAT_DCBX(rmib_pgtlv_willing, KSTAT_DATA_CHAR); 2371 BNXE_KSTAT_DCBX(rmib_pgtlv_tc_supported, KSTAT_DATA_CHAR); 2372 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_0_bw, KSTAT_DATA_CHAR); 2373 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_1_bw, KSTAT_DATA_CHAR); 2374 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_2_bw, KSTAT_DATA_CHAR); 2375 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_3_bw, KSTAT_DATA_CHAR); 2376 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_4_bw, KSTAT_DATA_CHAR); 2377 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_5_bw, KSTAT_DATA_CHAR); 2378 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_6_bw, KSTAT_DATA_CHAR); 2379 BNXE_KSTAT_DCBX(rmib_pgtlv_pg_7_bw, KSTAT_DATA_CHAR); 2380 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_0_map, KSTAT_DATA_CHAR); 2381 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_1_map, KSTAT_DATA_CHAR); 2382 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_2_map, KSTAT_DATA_CHAR); 2383 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_3_map, KSTAT_DATA_CHAR); 2384 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_4_map, KSTAT_DATA_CHAR); 2385 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_5_map, KSTAT_DATA_CHAR); 2386 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_6_map, KSTAT_DATA_CHAR); 2387 BNXE_KSTAT_DCBX(rmib_pgtlv_prio_7_map, KSTAT_DATA_CHAR); 2388 BNXE_KSTAT_DCBX(rmib_pfctlv_willing, KSTAT_DATA_CHAR); 2389 BNXE_KSTAT_DCBX(rmib_pfctlv_pfc_map, KSTAT_DATA_CHAR); 2390 BNXE_KSTAT_DCBX(rmib_pfctlv_capable, KSTAT_DATA_CHAR); 2391 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_0_prio, KSTAT_DATA_CHAR); 2392 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_0_appid, KSTAT_DATA_CHAR); 2393 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_1_prio, KSTAT_DATA_CHAR); 2394 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_1_appid, KSTAT_DATA_CHAR); 2395 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_2_prio, KSTAT_DATA_CHAR); 2396 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_2_appid, KSTAT_DATA_CHAR); 2397 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_3_prio, KSTAT_DATA_CHAR); 2398 BNXE_KSTAT_DCBX(lmib_apptlv_tbl_3_appid, KSTAT_DATA_CHAR); 2399 BNXE_KSTAT_DCBX(lmib_apptlv_mismatch, KSTAT_DATA_CHAR); 2400 BNXE_KSTAT_DCBX(lmib_pgtlv_ets, KSTAT_DATA_CHAR); 2401 BNXE_KSTAT_DCBX(lmib_pgtlv_tc_supported, KSTAT_DATA_CHAR); 2402 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_0_bw, KSTAT_DATA_CHAR); 2403 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_1_bw, KSTAT_DATA_CHAR); 2404 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_2_bw, KSTAT_DATA_CHAR); 2405 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_3_bw, KSTAT_DATA_CHAR); 2406 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_4_bw, KSTAT_DATA_CHAR); 2407 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_5_bw, KSTAT_DATA_CHAR); 2408 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_6_bw, KSTAT_DATA_CHAR); 2409 BNXE_KSTAT_DCBX(lmib_pgtlv_pg_7_bw, KSTAT_DATA_CHAR); 2410 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_0_map, KSTAT_DATA_CHAR); 2411 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_1_map, KSTAT_DATA_CHAR); 2412 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_2_map, KSTAT_DATA_CHAR); 2413 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_3_map, KSTAT_DATA_CHAR); 2414 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_4_map, KSTAT_DATA_CHAR); 2415 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_5_map, KSTAT_DATA_CHAR); 2416 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_6_map, KSTAT_DATA_CHAR); 2417 BNXE_KSTAT_DCBX(lmib_pgtlv_prio_7_map, KSTAT_DATA_CHAR); 2418 BNXE_KSTAT_DCBX(lmib_pfctlv_pfc, KSTAT_DATA_CHAR); 2419 BNXE_KSTAT_DCBX(lmib_pfctlv_pfc_map, KSTAT_DATA_CHAR); 2420 BNXE_KSTAT_DCBX(lmib_pfctlv_capable, KSTAT_DATA_CHAR); 2421 BNXE_KSTAT_DCBX(lmib_pfctlv_mismatch, KSTAT_DATA_CHAR); 2422 BNXE_KSTAT_DCBX(dcbx_frames_rx, KSTAT_DATA_UINT64); 2423 BNXE_KSTAT_DCBX(dcbx_frames_tx, KSTAT_DATA_UINT64); 2424 BNXE_KSTAT_DCBX(pfc_frames_rx, KSTAT_DATA_UINT64); 2425 BNXE_KSTAT_DCBX(pfc_frames_tx, KSTAT_DATA_UINT64); 2426 2427 pUM->kstatsDcbx->ks_update = BnxeKstatDcbxUpdate; 2428 pUM->kstatsDcbx->ks_private = (void *)pUM; 2429 2430 kstat_install(pUM->kstatsDcbx); 2431 } 2432 2433 /****************************************************************/ 2434 2435 if (!BnxeProtoFcoeAfex(pUM)) 2436 { 2437 LM_FOREACH_RSS_IDX(pLM, idx) 2438 { 2439 if (!BnxeKstatInitRxQ(pUM, idx)) 2440 { 2441 BnxeKstatFini(pUM); 2442 return B_FALSE; 2443 } 2444 } 2445 2446 LM_FOREACH_TSS_IDX(pLM, idx) 2447 { 2448 if (!BnxeKstatInitTxQ(pUM, idx)) 2449 { 2450 BnxeKstatFini(pUM); 2451 return B_FALSE; 2452 } 2453 } 2454 } 2455 2456 /****************************************************************/ 2457 2458 return B_TRUE; 2459 } 2460 2461 2462 void BnxeKstatFini(um_device_t * pUM) 2463 { 2464 lm_device_t * pLM = (lm_device_t *)pUM; 2465 int idx; 2466 2467 if (pUM->kstats) 2468 { 2469 kstat_delete(pUM->kstats); 2470 pUM->kstats = NULL; 2471 } 2472 2473 if (pUM->kstatsLink) 2474 { 2475 kstat_delete(pUM->kstatsLink); 2476 pUM->kstatsLink = NULL; 2477 } 2478 2479 if (pUM->kstatsIntr) 2480 { 2481 kstat_delete(pUM->kstatsIntr); 2482 pUM->kstatsIntr = NULL; 2483 } 2484 2485 if (pUM->kstatsL2Chip) 2486 { 2487 kstat_delete(pUM->kstatsL2Chip); 2488 pUM->kstatsL2Chip = NULL; 2489 } 2490 2491 if (pUM->kstatsL2Driver) 2492 { 2493 kstat_delete(pUM->kstatsL2Driver); 2494 pUM->kstatsL2Driver = NULL; 2495 } 2496 2497 if (pUM->kstatsL2Stats) 2498 { 2499 kstat_delete(pUM->kstatsL2Stats); 2500 pUM->kstatsL2Stats = NULL; 2501 } 2502 2503 if (BNXE_FCOE(pUM)) 2504 { 2505 if (pUM->kstatsFcoe) 2506 { 2507 kstat_delete(pUM->kstatsFcoe); 2508 pUM->kstatsFcoe = NULL; 2509 } 2510 2511 idx = FCOE_CID(pLM); 2512 2513 if (pUM->kstats_rxq[idx]) 2514 { 2515 kstat_delete(pUM->kstats_rxq[idx]); 2516 pUM->kstats_rxq[idx] = NULL; 2517 } 2518 2519 pUM->kstats_rxq_map[idx].idx = 0; 2520 pUM->kstats_rxq_map[idx].pUM = NULL; 2521 2522 if (pUM->kstats_txq[idx]) 2523 { 2524 kstat_delete(pUM->kstats_txq[idx]); 2525 pUM->kstats_txq[idx] = NULL; 2526 } 2527 2528 pUM->kstats_txq_map[idx].idx = 0; 2529 pUM->kstats_txq_map[idx].pUM = NULL; 2530 } 2531 2532 if (IS_DCB_SUPPORTED(pLM)) 2533 { 2534 if (pUM->kstatsDcbx) 2535 { 2536 kstat_delete(pUM->kstatsDcbx); 2537 pUM->kstatsDcbx = NULL; 2538 } 2539 } 2540 2541 if (!BnxeProtoFcoeAfex(pUM)) 2542 { 2543 LM_FOREACH_RSS_IDX(pLM, idx) 2544 { 2545 if (pUM->kstats_rxq[idx]) 2546 { 2547 kstat_delete(pUM->kstats_rxq[idx]); 2548 pUM->kstats_rxq[idx] = NULL; 2549 } 2550 2551 pUM->kstats_rxq_map[idx].idx = 0; 2552 pUM->kstats_rxq_map[idx].pUM = NULL; 2553 } 2554 2555 LM_FOREACH_TSS_IDX(pLM, idx) 2556 { 2557 if (pUM->kstats_txq[idx]) 2558 { 2559 kstat_delete(pUM->kstats_txq[idx]); 2560 pUM->kstats_txq[idx] = NULL; 2561 } 2562 2563 pUM->kstats_txq_map[idx].idx = 0; 2564 pUM->kstats_txq_map[idx].pUM = NULL; 2565 } 2566 } 2567 } 2568 2569