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