1 /*****************************************************************************
2  *
3  * Name:	skgepnmi.h
4  * Project:	GEnesis, PCI Gigabit Ethernet Adapter
5  * Purpose:	Defines for Private Network Management Interface
6  *
7  ****************************************************************************/
8 
9 /******************************************************************************
10  *
11  *	(C)Copyright 1998-2002 SysKonnect GmbH.
12  *	(C)Copyright 2002-2003 Marvell.
13  *
14  *	This program is free software; you can redistribute it and/or modify
15  *	it under the terms of the GNU General Public License as published by
16  *	the Free Software Foundation; either version 2 of the License, or
17  *	(at your option) any later version.
18  *
19  *	The information in this file is provided "AS IS" without warranty.
20  *
21  ******************************************************************************/
22 
23 #ifndef _SKGEPNMI_H_
24 #define _SKGEPNMI_H_
25 
26 /*
27  * Include dependencies
28  */
29 #include "h/sktypes.h"
30 #include "h/skerror.h"
31 #include "h/sktimer.h"
32 #include "h/ski2c.h"
33 #include "h/skaddr.h"
34 #include "h/skrlmt.h"
35 #include "h/skvpd.h"
36 
37 /*
38  * Management Database Version
39  */
40 #define SK_PNMI_MDB_VERSION		0x00030001	/* 3.1 */
41 
42 
43 /*
44  * Event definitions
45  */
46 #define SK_PNMI_EVT_SIRQ_OVERFLOW		1	/* Counter overflow */
47 #define SK_PNMI_EVT_SEN_WAR_LOW			2	/* Lower war thres exceeded */
48 #define SK_PNMI_EVT_SEN_WAR_UPP			3	/* Upper war thres exceeded */
49 #define SK_PNMI_EVT_SEN_ERR_LOW			4	/* Lower err thres exceeded */
50 #define SK_PNMI_EVT_SEN_ERR_UPP			5	/* Upper err thres exceeded */
51 #define SK_PNMI_EVT_CHG_EST_TIMER		6	/* Timer event for RLMT Chg */
52 #define SK_PNMI_EVT_UTILIZATION_TIMER	7	/* Timer event for Utiliza. */
53 #define SK_PNMI_EVT_CLEAR_COUNTER		8	/* Clear statistic counters */
54 #define SK_PNMI_EVT_XMAC_RESET			9	/* XMAC will be reset */
55 
56 #define SK_PNMI_EVT_RLMT_PORT_UP		10	/* Port came logically up */
57 #define SK_PNMI_EVT_RLMT_PORT_DOWN		11	/* Port went logically down */
58 #define SK_PNMI_EVT_RLMT_SEGMENTATION	13	/* Two SP root bridges found */
59 #define SK_PNMI_EVT_RLMT_ACTIVE_DOWN	14	/* Port went logically down */
60 #define SK_PNMI_EVT_RLMT_ACTIVE_UP		15	/* Port came logically up */
61 #define SK_PNMI_EVT_RLMT_SET_NETS		16	/* 1. Parameter is number of nets
62 												1 = single net; 2 = dual net */
63 #define SK_PNMI_EVT_VCT_RESET		17	/* VCT port reset timer event started with SET. */
64 
65 
66 /*
67  * Return values
68  */
69 #define SK_PNMI_ERR_OK				0
70 #define SK_PNMI_ERR_GENERAL			1
71 #define SK_PNMI_ERR_TOO_SHORT		2
72 #define SK_PNMI_ERR_BAD_VALUE		3
73 #define SK_PNMI_ERR_READ_ONLY		4
74 #define SK_PNMI_ERR_UNKNOWN_OID		5
75 #define SK_PNMI_ERR_UNKNOWN_INST	6
76 #define SK_PNMI_ERR_UNKNOWN_NET 	7
77 #define SK_PNMI_ERR_NOT_SUPPORTED	10
78 
79 
80 /*
81  * Return values of driver reset function SK_DRIVER_RESET() and
82  * driver event function SK_DRIVER_EVENT()
83  */
84 #define SK_PNMI_ERR_OK			0
85 #define SK_PNMI_ERR_FAIL		1
86 
87 
88 /*
89  * Return values of driver test function SK_DRIVER_SELFTEST()
90  */
91 #define SK_PNMI_TST_UNKNOWN		(1 << 0)
92 #define SK_PNMI_TST_TRANCEIVER		(1 << 1)
93 #define SK_PNMI_TST_ASIC		(1 << 2)
94 #define SK_PNMI_TST_SENSOR		(1 << 3)
95 #define SK_PNMI_TST_POWERMGMT		(1 << 4)
96 #define SK_PNMI_TST_PCI			(1 << 5)
97 #define SK_PNMI_TST_MAC			(1 << 6)
98 
99 
100 /*
101  * RLMT specific definitions
102  */
103 #define SK_PNMI_RLMT_STATUS_STANDBY	1
104 #define SK_PNMI_RLMT_STATUS_ACTIVE	2
105 #define SK_PNMI_RLMT_STATUS_ERROR	3
106 
107 #define SK_PNMI_RLMT_LSTAT_PHY_DOWN	1
108 #define SK_PNMI_RLMT_LSTAT_AUTONEG	2
109 #define SK_PNMI_RLMT_LSTAT_LOG_DOWN	3
110 #define SK_PNMI_RLMT_LSTAT_LOG_UP	4
111 #define SK_PNMI_RLMT_LSTAT_INDETERMINATED 5
112 
113 #define SK_PNMI_RLMT_MODE_CHK_LINK	(SK_RLMT_CHECK_LINK)
114 #define SK_PNMI_RLMT_MODE_CHK_RX	(SK_RLMT_CHECK_LOC_LINK)
115 #define SK_PNMI_RLMT_MODE_CHK_SPT	(SK_RLMT_CHECK_SEG)
116 /* #define SK_PNMI_RLMT_MODE_CHK_EX */
117 
118 /*
119  * OID definition
120  */
121 #ifndef _NDIS_	/* Check, whether NDIS already included OIDs */
122 
123 #define OID_GEN_XMIT_OK					0x00020101
124 #define OID_GEN_RCV_OK					0x00020102
125 #define OID_GEN_XMIT_ERROR				0x00020103
126 #define OID_GEN_RCV_ERROR				0x00020104
127 #define OID_GEN_RCV_NO_BUFFER			0x00020105
128 
129 /* #define OID_GEN_DIRECTED_BYTES_XMIT	0x00020201 */
130 #define OID_GEN_DIRECTED_FRAMES_XMIT	0x00020202
131 /* #define OID_GEN_MULTICAST_BYTES_XMIT	0x00020203 */
132 #define OID_GEN_MULTICAST_FRAMES_XMIT	0x00020204
133 /* #define OID_GEN_BROADCAST_BYTES_XMIT	0x00020205 */
134 #define OID_GEN_BROADCAST_FRAMES_XMIT	0x00020206
135 /* #define OID_GEN_DIRECTED_BYTES_RCV	0x00020207 */
136 #define OID_GEN_DIRECTED_FRAMES_RCV		0x00020208
137 /* #define OID_GEN_MULTICAST_BYTES_RCV	0x00020209 */
138 #define OID_GEN_MULTICAST_FRAMES_RCV	0x0002020A
139 /* #define OID_GEN_BROADCAST_BYTES_RCV	0x0002020B */
140 #define OID_GEN_BROADCAST_FRAMES_RCV	0x0002020C
141 #define OID_GEN_RCV_CRC_ERROR			0x0002020D
142 #define OID_GEN_TRANSMIT_QUEUE_LENGTH	0x0002020E
143 
144 #define OID_802_3_PERMANENT_ADDRESS		0x01010101
145 #define OID_802_3_CURRENT_ADDRESS		0x01010102
146 /* #define OID_802_3_MULTICAST_LIST		0x01010103 */
147 /* #define OID_802_3_MAXIMUM_LIST_SIZE	0x01010104 */
148 /* #define OID_802_3_MAC_OPTIONS		0x01010105 */
149 
150 #define OID_802_3_RCV_ERROR_ALIGNMENT	0x01020101
151 #define OID_802_3_XMIT_ONE_COLLISION	0x01020102
152 #define OID_802_3_XMIT_MORE_COLLISIONS	0x01020103
153 #define OID_802_3_XMIT_DEFERRED			0x01020201
154 #define OID_802_3_XMIT_MAX_COLLISIONS	0x01020202
155 #define OID_802_3_RCV_OVERRUN			0x01020203
156 #define OID_802_3_XMIT_UNDERRUN			0x01020204
157 #define OID_802_3_XMIT_TIMES_CRS_LOST	0x01020206
158 #define OID_802_3_XMIT_LATE_COLLISIONS	0x01020207
159 
160 /*
161  * PnP and PM OIDs
162  */
163 #ifdef SK_POWER_MGMT
164 #define OID_PNP_CAPABILITIES			0xFD010100
165 #define OID_PNP_SET_POWER				0xFD010101
166 #define OID_PNP_QUERY_POWER				0xFD010102
167 #define OID_PNP_ADD_WAKE_UP_PATTERN		0xFD010103
168 #define OID_PNP_REMOVE_WAKE_UP_PATTERN	0xFD010104
169 #define OID_PNP_ENABLE_WAKE_UP			0xFD010106
170 #endif /* SK_POWER_MGMT */
171 
172 #endif /* _NDIS_ */
173 
174 #define OID_SKGE_MDB_VERSION			0xFF010100
175 #define OID_SKGE_SUPPORTED_LIST			0xFF010101
176 #define OID_SKGE_VPD_FREE_BYTES			0xFF010102
177 #define OID_SKGE_VPD_ENTRIES_LIST		0xFF010103
178 #define OID_SKGE_VPD_ENTRIES_NUMBER		0xFF010104
179 #define OID_SKGE_VPD_KEY				0xFF010105
180 #define OID_SKGE_VPD_VALUE				0xFF010106
181 #define OID_SKGE_VPD_ACCESS				0xFF010107
182 #define OID_SKGE_VPD_ACTION				0xFF010108
183 
184 #define OID_SKGE_PORT_NUMBER			0xFF010110
185 #define OID_SKGE_DEVICE_TYPE			0xFF010111
186 #define OID_SKGE_DRIVER_DESCR			0xFF010112
187 #define OID_SKGE_DRIVER_VERSION			0xFF010113
188 #define OID_SKGE_HW_DESCR				0xFF010114
189 #define OID_SKGE_HW_VERSION				0xFF010115
190 #define OID_SKGE_CHIPSET				0xFF010116
191 #define OID_SKGE_ACTION					0xFF010117
192 #define OID_SKGE_RESULT					0xFF010118
193 #define OID_SKGE_BUS_TYPE				0xFF010119
194 #define OID_SKGE_BUS_SPEED				0xFF01011A
195 #define OID_SKGE_BUS_WIDTH				0xFF01011B
196 /* 0xFF01011C unused */
197 #define OID_SKGE_DIAG_ACTION			0xFF01011D
198 #define OID_SKGE_DIAG_RESULT			0xFF01011E
199 #define OID_SKGE_MTU					0xFF01011F
200 #define OID_SKGE_PHYS_CUR_ADDR			0xFF010120
201 #define OID_SKGE_PHYS_FAC_ADDR			0xFF010121
202 #define OID_SKGE_PMD					0xFF010122
203 #define OID_SKGE_CONNECTOR				0xFF010123
204 #define OID_SKGE_LINK_CAP				0xFF010124
205 #define OID_SKGE_LINK_MODE				0xFF010125
206 #define OID_SKGE_LINK_MODE_STATUS		0xFF010126
207 #define OID_SKGE_LINK_STATUS			0xFF010127
208 #define OID_SKGE_FLOWCTRL_CAP			0xFF010128
209 #define OID_SKGE_FLOWCTRL_MODE			0xFF010129
210 #define OID_SKGE_FLOWCTRL_STATUS		0xFF01012A
211 #define OID_SKGE_PHY_OPERATION_CAP		0xFF01012B
212 #define OID_SKGE_PHY_OPERATION_MODE		0xFF01012C
213 #define OID_SKGE_PHY_OPERATION_STATUS	0xFF01012D
214 #define OID_SKGE_MULTICAST_LIST			0xFF01012E
215 #define OID_SKGE_CURRENT_PACKET_FILTER	0xFF01012F
216 
217 #define OID_SKGE_TRAP					0xFF010130
218 #define OID_SKGE_TRAP_NUMBER			0xFF010131
219 
220 #define OID_SKGE_RLMT_MODE				0xFF010140
221 #define OID_SKGE_RLMT_PORT_NUMBER		0xFF010141
222 #define OID_SKGE_RLMT_PORT_ACTIVE		0xFF010142
223 #define OID_SKGE_RLMT_PORT_PREFERRED	0xFF010143
224 #define OID_SKGE_INTERMEDIATE_SUPPORT	0xFF010160
225 
226 #define OID_SKGE_SPEED_CAP				0xFF010170
227 #define OID_SKGE_SPEED_MODE				0xFF010171
228 #define OID_SKGE_SPEED_STATUS			0xFF010172
229 
230 #define OID_SKGE_BOARDLEVEL				0xFF010180
231 
232 #define OID_SKGE_SENSOR_NUMBER			0xFF020100
233 #define OID_SKGE_SENSOR_INDEX			0xFF020101
234 #define OID_SKGE_SENSOR_DESCR			0xFF020102
235 #define OID_SKGE_SENSOR_TYPE			0xFF020103
236 #define OID_SKGE_SENSOR_VALUE			0xFF020104
237 #define OID_SKGE_SENSOR_WAR_THRES_LOW	0xFF020105
238 #define OID_SKGE_SENSOR_WAR_THRES_UPP	0xFF020106
239 #define OID_SKGE_SENSOR_ERR_THRES_LOW	0xFF020107
240 #define OID_SKGE_SENSOR_ERR_THRES_UPP	0xFF020108
241 #define OID_SKGE_SENSOR_STATUS			0xFF020109
242 #define OID_SKGE_SENSOR_WAR_CTS			0xFF02010A
243 #define OID_SKGE_SENSOR_ERR_CTS			0xFF02010B
244 #define OID_SKGE_SENSOR_WAR_TIME		0xFF02010C
245 #define OID_SKGE_SENSOR_ERR_TIME		0xFF02010D
246 
247 #define OID_SKGE_CHKSM_NUMBER			0xFF020110
248 #define OID_SKGE_CHKSM_RX_OK_CTS		0xFF020111
249 #define OID_SKGE_CHKSM_RX_UNABLE_CTS	0xFF020112
250 #define OID_SKGE_CHKSM_RX_ERR_CTS		0xFF020113
251 #define OID_SKGE_CHKSM_TX_OK_CTS		0xFF020114
252 #define OID_SKGE_CHKSM_TX_UNABLE_CTS	0xFF020115
253 
254 #define OID_SKGE_STAT_TX				0xFF020120
255 #define OID_SKGE_STAT_TX_OCTETS			0xFF020121
256 #define OID_SKGE_STAT_TX_BROADCAST		0xFF020122
257 #define OID_SKGE_STAT_TX_MULTICAST		0xFF020123
258 #define OID_SKGE_STAT_TX_UNICAST		0xFF020124
259 #define OID_SKGE_STAT_TX_LONGFRAMES		0xFF020125
260 #define OID_SKGE_STAT_TX_BURST			0xFF020126
261 #define OID_SKGE_STAT_TX_PFLOWC			0xFF020127
262 #define OID_SKGE_STAT_TX_FLOWC			0xFF020128
263 #define OID_SKGE_STAT_TX_SINGLE_COL		0xFF020129
264 #define OID_SKGE_STAT_TX_MULTI_COL		0xFF02012A
265 #define OID_SKGE_STAT_TX_EXCESS_COL		0xFF02012B
266 #define OID_SKGE_STAT_TX_LATE_COL		0xFF02012C
267 #define OID_SKGE_STAT_TX_DEFFERAL		0xFF02012D
268 #define OID_SKGE_STAT_TX_EXCESS_DEF		0xFF02012E
269 #define OID_SKGE_STAT_TX_UNDERRUN		0xFF02012F
270 #define OID_SKGE_STAT_TX_CARRIER		0xFF020130
271 /* #define OID_SKGE_STAT_TX_UTIL		0xFF020131 */
272 #define OID_SKGE_STAT_TX_64				0xFF020132
273 #define OID_SKGE_STAT_TX_127			0xFF020133
274 #define OID_SKGE_STAT_TX_255			0xFF020134
275 #define OID_SKGE_STAT_TX_511			0xFF020135
276 #define OID_SKGE_STAT_TX_1023			0xFF020136
277 #define OID_SKGE_STAT_TX_MAX			0xFF020137
278 #define OID_SKGE_STAT_TX_SYNC			0xFF020138
279 #define OID_SKGE_STAT_TX_SYNC_OCTETS	0xFF020139
280 #define OID_SKGE_STAT_RX				0xFF02013A
281 #define OID_SKGE_STAT_RX_OCTETS			0xFF02013B
282 #define OID_SKGE_STAT_RX_BROADCAST		0xFF02013C
283 #define OID_SKGE_STAT_RX_MULTICAST		0xFF02013D
284 #define OID_SKGE_STAT_RX_UNICAST		0xFF02013E
285 #define OID_SKGE_STAT_RX_PFLOWC			0xFF02013F
286 #define OID_SKGE_STAT_RX_FLOWC			0xFF020140
287 #define OID_SKGE_STAT_RX_PFLOWC_ERR		0xFF020141
288 #define OID_SKGE_STAT_RX_FLOWC_UNKWN	0xFF020142
289 #define OID_SKGE_STAT_RX_BURST			0xFF020143
290 #define OID_SKGE_STAT_RX_MISSED			0xFF020144
291 #define OID_SKGE_STAT_RX_FRAMING		0xFF020145
292 #define OID_SKGE_STAT_RX_OVERFLOW		0xFF020146
293 #define OID_SKGE_STAT_RX_JABBER			0xFF020147
294 #define OID_SKGE_STAT_RX_CARRIER		0xFF020148
295 #define OID_SKGE_STAT_RX_IR_LENGTH		0xFF020149
296 #define OID_SKGE_STAT_RX_SYMBOL			0xFF02014A
297 #define OID_SKGE_STAT_RX_SHORTS			0xFF02014B
298 #define OID_SKGE_STAT_RX_RUNT			0xFF02014C
299 #define OID_SKGE_STAT_RX_CEXT			0xFF02014D
300 #define OID_SKGE_STAT_RX_TOO_LONG		0xFF02014E
301 #define OID_SKGE_STAT_RX_FCS			0xFF02014F
302 /* #define OID_SKGE_STAT_RX_UTIL		0xFF020150 */
303 #define OID_SKGE_STAT_RX_64				0xFF020151
304 #define OID_SKGE_STAT_RX_127			0xFF020152
305 #define OID_SKGE_STAT_RX_255			0xFF020153
306 #define OID_SKGE_STAT_RX_511			0xFF020154
307 #define OID_SKGE_STAT_RX_1023			0xFF020155
308 #define OID_SKGE_STAT_RX_MAX			0xFF020156
309 #define OID_SKGE_STAT_RX_LONGFRAMES		0xFF020157
310 
311 #define OID_SKGE_RLMT_CHANGE_CTS		0xFF020160
312 #define OID_SKGE_RLMT_CHANGE_TIME		0xFF020161
313 #define OID_SKGE_RLMT_CHANGE_ESTIM		0xFF020162
314 #define OID_SKGE_RLMT_CHANGE_THRES		0xFF020163
315 
316 #define OID_SKGE_RLMT_PORT_INDEX		0xFF020164
317 #define OID_SKGE_RLMT_STATUS			0xFF020165
318 #define OID_SKGE_RLMT_TX_HELLO_CTS		0xFF020166
319 #define OID_SKGE_RLMT_RX_HELLO_CTS		0xFF020167
320 #define OID_SKGE_RLMT_TX_SP_REQ_CTS		0xFF020168
321 #define OID_SKGE_RLMT_RX_SP_CTS			0xFF020169
322 
323 #define OID_SKGE_RLMT_MONITOR_NUMBER	0xFF010150
324 #define OID_SKGE_RLMT_MONITOR_INDEX		0xFF010151
325 #define OID_SKGE_RLMT_MONITOR_ADDR		0xFF010152
326 #define OID_SKGE_RLMT_MONITOR_ERRS		0xFF010153
327 #define OID_SKGE_RLMT_MONITOR_TIMESTAMP	0xFF010154
328 #define OID_SKGE_RLMT_MONITOR_ADMIN		0xFF010155
329 
330 #define OID_SKGE_TX_SW_QUEUE_LEN		0xFF020170
331 #define OID_SKGE_TX_SW_QUEUE_MAX		0xFF020171
332 #define OID_SKGE_TX_RETRY				0xFF020172
333 #define OID_SKGE_RX_INTR_CTS			0xFF020173
334 #define OID_SKGE_TX_INTR_CTS			0xFF020174
335 #define OID_SKGE_RX_NO_BUF_CTS			0xFF020175
336 #define OID_SKGE_TX_NO_BUF_CTS			0xFF020176
337 #define OID_SKGE_TX_USED_DESCR_NO		0xFF020177
338 #define OID_SKGE_RX_DELIVERED_CTS		0xFF020178
339 #define OID_SKGE_RX_OCTETS_DELIV_CTS	0xFF020179
340 #define OID_SKGE_RX_HW_ERROR_CTS		0xFF02017A
341 #define OID_SKGE_TX_HW_ERROR_CTS		0xFF02017B
342 #define OID_SKGE_IN_ERRORS_CTS			0xFF02017C
343 #define OID_SKGE_OUT_ERROR_CTS			0xFF02017D
344 #define OID_SKGE_ERR_RECOVERY_CTS		0xFF02017E
345 #define OID_SKGE_SYSUPTIME				0xFF02017F
346 
347 #define OID_SKGE_ALL_DATA				0xFF020190
348 
349 /* Defines for VCT. */
350 #define OID_SKGE_VCT_GET				0xFF020200
351 #define OID_SKGE_VCT_SET				0xFF020201
352 #define OID_SKGE_VCT_STATUS				0xFF020202
353 
354 #ifdef SK_DIAG_SUPPORT
355 /* Defines for driver DIAG mode. */
356 #define OID_SKGE_DIAG_MODE				0xFF020204
357 #endif /* SK_DIAG_SUPPORT */
358 
359 /* New OIDs */
360 #define OID_SKGE_DRIVER_RELDATE			0xFF020210
361 #define OID_SKGE_DRIVER_FILENAME		0xFF020211
362 #define OID_SKGE_CHIPID					0xFF020212
363 #define OID_SKGE_RAMSIZE				0xFF020213
364 #define OID_SKGE_VAUXAVAIL				0xFF020214
365 #define OID_SKGE_PHY_TYPE				0xFF020215
366 #define OID_SKGE_PHY_LP_MODE			0xFF020216
367 
368 /* VCT struct to store a backup copy of VCT data after a port reset. */
369 typedef struct s_PnmiVct {
370 	SK_U8			VctStatus;
371 	SK_U8			PCableLen;
372 	SK_U32			PMdiPairLen[4];
373 	SK_U8			PMdiPairSts[4];
374 } SK_PNMI_VCT;
375 
376 
377 /* VCT status values (to be given to CPA via OID_SKGE_VCT_STATUS). */
378 #define SK_PNMI_VCT_NONE		0
379 #define SK_PNMI_VCT_OLD_VCT_DATA	1
380 #define SK_PNMI_VCT_NEW_VCT_DATA	2
381 #define SK_PNMI_VCT_OLD_DSP_DATA	4
382 #define SK_PNMI_VCT_NEW_DSP_DATA	8
383 #define SK_PNMI_VCT_RUNNING		16
384 
385 
386 /* VCT cable test status. */
387 #define SK_PNMI_VCT_NORMAL_CABLE		0
388 #define SK_PNMI_VCT_SHORT_CABLE			1
389 #define SK_PNMI_VCT_OPEN_CABLE			2
390 #define SK_PNMI_VCT_TEST_FAIL			3
391 #define SK_PNMI_VCT_IMPEDANCE_MISMATCH		4
392 
393 #define	OID_SKGE_TRAP_SEN_WAR_LOW		500
394 #define OID_SKGE_TRAP_SEN_WAR_UPP		501
395 #define	OID_SKGE_TRAP_SEN_ERR_LOW		502
396 #define OID_SKGE_TRAP_SEN_ERR_UPP		503
397 #define OID_SKGE_TRAP_RLMT_CHANGE_THRES	520
398 #define OID_SKGE_TRAP_RLMT_CHANGE_PORT	521
399 #define OID_SKGE_TRAP_RLMT_PORT_DOWN	522
400 #define OID_SKGE_TRAP_RLMT_PORT_UP		523
401 #define OID_SKGE_TRAP_RLMT_SEGMENTATION	524
402 
403 #ifdef SK_DIAG_SUPPORT
404 /* Defines for driver DIAG mode. */
405 #define SK_DIAG_ATTACHED	2
406 #define SK_DIAG_RUNNING		1
407 #define SK_DIAG_IDLE		0
408 #endif /* SK_DIAG_SUPPORT */
409 
410 /*
411  * Generic PNMI IOCTL subcommand definitions.
412  */
413 #define	SK_GET_SINGLE_VAR		1
414 #define	SK_SET_SINGLE_VAR		2
415 #define	SK_PRESET_SINGLE_VAR	3
416 #define	SK_GET_FULL_MIB			4
417 #define	SK_SET_FULL_MIB			5
418 #define	SK_PRESET_FULL_MIB		6
419 
420 
421 /*
422  * Define error numbers and messages for syslog
423  */
424 #define SK_PNMI_ERR001		(SK_ERRBASE_PNMI + 1)
425 #define SK_PNMI_ERR001MSG	"SkPnmiGetStruct: Unknown OID"
426 #define SK_PNMI_ERR002		(SK_ERRBASE_PNMI + 2)
427 #define SK_PNMI_ERR002MSG	"SkPnmiGetStruct: Cannot read VPD keys"
428 #define SK_PNMI_ERR003		(SK_ERRBASE_PNMI + 3)
429 #define SK_PNMI_ERR003MSG	"OidStruct: Called with wrong OID"
430 #define SK_PNMI_ERR004		(SK_ERRBASE_PNMI + 4)
431 #define SK_PNMI_ERR004MSG	"OidStruct: Called with wrong action"
432 #define SK_PNMI_ERR005		(SK_ERRBASE_PNMI + 5)
433 #define SK_PNMI_ERR005MSG	"Perform: Cannot reset driver"
434 #define SK_PNMI_ERR006		(SK_ERRBASE_PNMI + 6)
435 #define SK_PNMI_ERR006MSG	"Perform: Unknown OID action command"
436 #define SK_PNMI_ERR007		(SK_ERRBASE_PNMI + 7)
437 #define SK_PNMI_ERR007MSG	"General: Driver description not initialized"
438 #define SK_PNMI_ERR008		(SK_ERRBASE_PNMI + 8)
439 #define SK_PNMI_ERR008MSG	"Addr: Tried to get unknown OID"
440 #define SK_PNMI_ERR009		(SK_ERRBASE_PNMI + 9)
441 #define SK_PNMI_ERR009MSG	"Addr: Unknown OID"
442 #define SK_PNMI_ERR010		(SK_ERRBASE_PNMI + 10)
443 #define SK_PNMI_ERR010MSG	"CsumStat: Unknown OID"
444 #define SK_PNMI_ERR011		(SK_ERRBASE_PNMI + 11)
445 #define SK_PNMI_ERR011MSG	"SensorStat: Sensor descr string too long"
446 #define SK_PNMI_ERR012		(SK_ERRBASE_PNMI + 12)
447 #define SK_PNMI_ERR012MSG	"SensorStat: Unknown OID"
448 #define SK_PNMI_ERR013		(SK_ERRBASE_PNMI + 13)
449 #define SK_PNMI_ERR013MSG	""
450 #define SK_PNMI_ERR014		(SK_ERRBASE_PNMI + 14)
451 #define SK_PNMI_ERR014MSG	"Vpd: Cannot read VPD keys"
452 #define SK_PNMI_ERR015		(SK_ERRBASE_PNMI + 15)
453 #define SK_PNMI_ERR015MSG	"Vpd: Internal array for VPD keys to small"
454 #define SK_PNMI_ERR016		(SK_ERRBASE_PNMI + 16)
455 #define SK_PNMI_ERR016MSG	"Vpd: Key string too long"
456 #define SK_PNMI_ERR017		(SK_ERRBASE_PNMI + 17)
457 #define SK_PNMI_ERR017MSG	"Vpd: Invalid VPD status pointer"
458 #define SK_PNMI_ERR018		(SK_ERRBASE_PNMI + 18)
459 #define SK_PNMI_ERR018MSG	"Vpd: VPD data not valid"
460 #define SK_PNMI_ERR019		(SK_ERRBASE_PNMI + 19)
461 #define SK_PNMI_ERR019MSG	"Vpd: VPD entries list string too long"
462 #define SK_PNMI_ERR021		(SK_ERRBASE_PNMI + 21)
463 #define SK_PNMI_ERR021MSG	"Vpd: VPD data string too long"
464 #define SK_PNMI_ERR022		(SK_ERRBASE_PNMI + 22)
465 #define SK_PNMI_ERR022MSG	"Vpd: VPD data string too long should be errored before"
466 #define SK_PNMI_ERR023		(SK_ERRBASE_PNMI + 23)
467 #define SK_PNMI_ERR023MSG	"Vpd: Unknown OID in get action"
468 #define SK_PNMI_ERR024		(SK_ERRBASE_PNMI + 24)
469 #define SK_PNMI_ERR024MSG	"Vpd: Unknown OID in preset/set action"
470 #define SK_PNMI_ERR025		(SK_ERRBASE_PNMI + 25)
471 #define SK_PNMI_ERR025MSG	"Vpd: Cannot write VPD after modify entry"
472 #define SK_PNMI_ERR026		(SK_ERRBASE_PNMI + 26)
473 #define SK_PNMI_ERR026MSG	"Vpd: Cannot update VPD"
474 #define SK_PNMI_ERR027		(SK_ERRBASE_PNMI + 27)
475 #define SK_PNMI_ERR027MSG	"Vpd: Cannot delete VPD entry"
476 #define SK_PNMI_ERR028		(SK_ERRBASE_PNMI + 28)
477 #define SK_PNMI_ERR028MSG	"Vpd: Cannot update VPD after delete entry"
478 #define SK_PNMI_ERR029		(SK_ERRBASE_PNMI + 29)
479 #define SK_PNMI_ERR029MSG	"General: Driver description string too long"
480 #define SK_PNMI_ERR030		(SK_ERRBASE_PNMI + 30)
481 #define SK_PNMI_ERR030MSG	"General: Driver version not initialized"
482 #define SK_PNMI_ERR031		(SK_ERRBASE_PNMI + 31)
483 #define SK_PNMI_ERR031MSG	"General: Driver version string too long"
484 #define SK_PNMI_ERR032		(SK_ERRBASE_PNMI + 32)
485 #define SK_PNMI_ERR032MSG	"General: Cannot read VPD Name for HW descr"
486 #define SK_PNMI_ERR033		(SK_ERRBASE_PNMI + 33)
487 #define SK_PNMI_ERR033MSG	"General: HW description string too long"
488 #define SK_PNMI_ERR034		(SK_ERRBASE_PNMI + 34)
489 #define SK_PNMI_ERR034MSG	"General: Unknown OID"
490 #define SK_PNMI_ERR035		(SK_ERRBASE_PNMI + 35)
491 #define SK_PNMI_ERR035MSG	"Rlmt: Unknown OID"
492 #define SK_PNMI_ERR036		(SK_ERRBASE_PNMI + 36)
493 #define SK_PNMI_ERR036MSG	""
494 #define SK_PNMI_ERR037		(SK_ERRBASE_PNMI + 37)
495 #define SK_PNMI_ERR037MSG	"Rlmt: SK_RLMT_MODE_CHANGE event return not 0"
496 #define SK_PNMI_ERR038		(SK_ERRBASE_PNMI + 38)
497 #define SK_PNMI_ERR038MSG	"Rlmt: SK_RLMT_PREFPORT_CHANGE event return not 0"
498 #define SK_PNMI_ERR039		(SK_ERRBASE_PNMI + 39)
499 #define SK_PNMI_ERR039MSG	"RlmtStat: Unknown OID"
500 #define SK_PNMI_ERR040		(SK_ERRBASE_PNMI + 40)
501 #define SK_PNMI_ERR040MSG	"PowerManagement: Unknown OID"
502 #define SK_PNMI_ERR041		(SK_ERRBASE_PNMI + 41)
503 #define SK_PNMI_ERR041MSG	"MacPrivateConf: Unknown OID"
504 #define SK_PNMI_ERR042		(SK_ERRBASE_PNMI + 42)
505 #define SK_PNMI_ERR042MSG	"MacPrivateConf: SK_HWEV_SET_ROLE returned not 0"
506 #define SK_PNMI_ERR043		(SK_ERRBASE_PNMI + 43)
507 #define SK_PNMI_ERR043MSG	"MacPrivateConf: SK_HWEV_SET_LMODE returned not 0"
508 #define SK_PNMI_ERR044		(SK_ERRBASE_PNMI + 44)
509 #define SK_PNMI_ERR044MSG	"MacPrivateConf: SK_HWEV_SET_FLOWMODE returned not 0"
510 #define SK_PNMI_ERR045		(SK_ERRBASE_PNMI + 45)
511 #define SK_PNMI_ERR045MSG	"MacPrivateConf: SK_HWEV_SET_SPEED returned not 0"
512 #define SK_PNMI_ERR046		(SK_ERRBASE_PNMI + 46)
513 #define SK_PNMI_ERR046MSG	"Monitor: Unknown OID"
514 #define SK_PNMI_ERR047		(SK_ERRBASE_PNMI + 47)
515 #define SK_PNMI_ERR047MSG	"SirqUpdate: Event function returns not 0"
516 #define SK_PNMI_ERR048		(SK_ERRBASE_PNMI + 48)
517 #define SK_PNMI_ERR048MSG	"RlmtUpdate: Event function returns not 0"
518 #define SK_PNMI_ERR049		(SK_ERRBASE_PNMI + 49)
519 #define SK_PNMI_ERR049MSG	"SkPnmiInit: Invalid size of 'CounterOffset' struct!!"
520 #define SK_PNMI_ERR050		(SK_ERRBASE_PNMI + 50)
521 #define SK_PNMI_ERR050MSG	"SkPnmiInit: Invalid size of 'StatAddr' table!!"
522 #define SK_PNMI_ERR051		(SK_ERRBASE_PNMI + 51)
523 #define SK_PNMI_ERR051MSG	"SkPnmiEvent: Port switch suspicious"
524 #define SK_PNMI_ERR052		(SK_ERRBASE_PNMI + 52)
525 #define SK_PNMI_ERR052MSG	""
526 #define SK_PNMI_ERR053		(SK_ERRBASE_PNMI + 53)
527 #define SK_PNMI_ERR053MSG	"General: Driver release date not initialized"
528 #define SK_PNMI_ERR054		(SK_ERRBASE_PNMI + 54)
529 #define SK_PNMI_ERR054MSG	"General: Driver release date string too long"
530 #define SK_PNMI_ERR055		(SK_ERRBASE_PNMI + 55)
531 #define SK_PNMI_ERR055MSG	"General: Driver file name not initialized"
532 #define SK_PNMI_ERR056		(SK_ERRBASE_PNMI + 56)
533 #define SK_PNMI_ERR056MSG	"General: Driver file name string too long"
534 
535 /*
536  * Management counter macros called by the driver
537  */
538 #define SK_PNMI_SET_DRIVER_DESCR(pAC,v)	((pAC)->Pnmi.pDriverDescription = \
539 	(char *)(v))
540 
541 #define SK_PNMI_SET_DRIVER_VER(pAC,v)	((pAC)->Pnmi.pDriverVersion = \
542 	(char *)(v))
543 
544 #define SK_PNMI_SET_DRIVER_RELDATE(pAC,v)	((pAC)->Pnmi.pDriverReleaseDate = \
545 	(char *)(v))
546 
547 #define SK_PNMI_SET_DRIVER_FILENAME(pAC,v)	((pAC)->Pnmi.pDriverFileName = \
548 	(char *)(v))
549 
550 #define SK_PNMI_CNT_TX_QUEUE_LEN(pAC,v,p) \
551 	{ \
552 		(pAC)->Pnmi.Port[p].TxSwQueueLen = (SK_U64)(v); \
553 		if ((pAC)->Pnmi.Port[p].TxSwQueueLen > (pAC)->Pnmi.Port[p].TxSwQueueMax) { \
554 			(pAC)->Pnmi.Port[p].TxSwQueueMax = (pAC)->Pnmi.Port[p].TxSwQueueLen; \
555 		} \
556 	}
557 #define SK_PNMI_CNT_TX_RETRY(pAC,p)	(((pAC)->Pnmi.Port[p].TxRetryCts)++)
558 #define SK_PNMI_CNT_RX_INTR(pAC,p)	(((pAC)->Pnmi.Port[p].RxIntrCts)++)
559 #define SK_PNMI_CNT_TX_INTR(pAC,p)	(((pAC)->Pnmi.Port[p].TxIntrCts)++)
560 #define SK_PNMI_CNT_NO_RX_BUF(pAC,p)	(((pAC)->Pnmi.Port[p].RxNoBufCts)++)
561 #define SK_PNMI_CNT_NO_TX_BUF(pAC,p)	(((pAC)->Pnmi.Port[p].TxNoBufCts)++)
562 #define SK_PNMI_CNT_USED_TX_DESCR(pAC,v,p) \
563 	((pAC)->Pnmi.Port[p].TxUsedDescrNo=(SK_U64)(v));
564 #define SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,v,p) \
565 	{ \
566 		((pAC)->Pnmi.Port[p].RxDeliveredCts)++; \
567 		(pAC)->Pnmi.Port[p].RxOctetsDeliveredCts += (SK_U64)(v); \
568 	}
569 #define SK_PNMI_CNT_ERR_RECOVERY(pAC,p)	(((pAC)->Pnmi.Port[p].ErrRecoveryCts)++);
570 
571 #define SK_PNMI_CNT_SYNC_OCTETS(pAC,p,v) \
572 	{ \
573 		if ((p) < SK_MAX_MACS) { \
574 			((pAC)->Pnmi.Port[p].StatSyncCts)++; \
575 			(pAC)->Pnmi.Port[p].StatSyncOctetsCts += (SK_U64)(v); \
576 		} \
577 	}
578 
579 #define SK_PNMI_CNT_RX_LONGFRAMES(pAC,p) \
580 	{ \
581 		if ((p) < SK_MAX_MACS) { \
582 			((pAC)->Pnmi.Port[p].StatRxLongFrameCts++); \
583 		} \
584 	}
585 
586 #define SK_PNMI_CNT_RX_FRAMETOOLONG(pAC,p) \
587 	{ \
588 		if ((p) < SK_MAX_MACS) { \
589 			((pAC)->Pnmi.Port[p].StatRxFrameTooLongCts++); \
590 		} \
591 	}
592 
593 #define SK_PNMI_CNT_RX_PMACC_ERR(pAC,p) \
594 	{ \
595 		if ((p) < SK_MAX_MACS) { \
596 			((pAC)->Pnmi.Port[p].StatRxPMaccErr++); \
597 		} \
598 	}
599 
600 /*
601  * Conversion Macros
602  */
603 #define SK_PNMI_PORT_INST2LOG(i)	((unsigned int)(i) - 1)
604 #define SK_PNMI_PORT_LOG2INST(l)	((unsigned int)(l) + 1)
605 #define SK_PNMI_PORT_PHYS2LOG(p)	((unsigned int)(p) + 1)
606 #define SK_PNMI_PORT_LOG2PHYS(pAC,l)	((unsigned int)(l) - 1)
607 #define SK_PNMI_PORT_PHYS2INST(pAC,p)	\
608 	(pAC->Pnmi.DualNetActiveFlag ? 2 : ((unsigned int)(p) + 2))
609 #define SK_PNMI_PORT_INST2PHYS(pAC,i)	((unsigned int)(i) - 2)
610 
611 /*
612  * Structure definition for SkPnmiGetStruct and SkPnmiSetStruct
613  */
614 #define SK_PNMI_VPD_KEY_SIZE	5
615 #define SK_PNMI_VPD_BUFSIZE		(VPD_SIZE)
616 #define SK_PNMI_VPD_ENTRIES		(VPD_SIZE / 4)
617 #define SK_PNMI_VPD_DATALEN		128 /*  Number of data bytes */
618 
619 #define SK_PNMI_MULTICAST_LISTLEN	64
620 #define SK_PNMI_SENSOR_ENTRIES		(SK_MAX_SENSORS)
621 #define SK_PNMI_CHECKSUM_ENTRIES	3
622 #define SK_PNMI_MAC_ENTRIES			(SK_MAX_MACS + 1)
623 #define SK_PNMI_MONITOR_ENTRIES		20
624 #define SK_PNMI_TRAP_ENTRIES		10
625 #define SK_PNMI_TRAPLEN				128
626 #define SK_PNMI_STRINGLEN1			80
627 #define SK_PNMI_STRINGLEN2			25
628 #define SK_PNMI_TRAP_QUEUE_LEN		512
629 
630 typedef struct s_PnmiVpd {
631 	char			VpdKey[SK_PNMI_VPD_KEY_SIZE];
632 	char			VpdValue[SK_PNMI_VPD_DATALEN];
633 	SK_U8			VpdAccess;
634 	SK_U8			VpdAction;
635 } SK_PNMI_VPD;
636 
637 typedef struct s_PnmiSensor {
638 	SK_U8			SensorIndex;
639 	char			SensorDescr[SK_PNMI_STRINGLEN2];
640 	SK_U8			SensorType;
641 	SK_U32			SensorValue;
642 	SK_U32			SensorWarningThresholdLow;
643 	SK_U32			SensorWarningThresholdHigh;
644 	SK_U32			SensorErrorThresholdLow;
645 	SK_U32			SensorErrorThresholdHigh;
646 	SK_U8			SensorStatus;
647 	SK_U64			SensorWarningCts;
648 	SK_U64			SensorErrorCts;
649 	SK_U64			SensorWarningTimestamp;
650 	SK_U64			SensorErrorTimestamp;
651 } SK_PNMI_SENSOR;
652 
653 typedef struct s_PnmiChecksum {
654 	SK_U64			ChecksumRxOkCts;
655 	SK_U64			ChecksumRxUnableCts;
656 	SK_U64			ChecksumRxErrCts;
657 	SK_U64			ChecksumTxOkCts;
658 	SK_U64			ChecksumTxUnableCts;
659 } SK_PNMI_CHECKSUM;
660 
661 typedef struct s_PnmiStat {
662 	SK_U64			StatTxOkCts;
663 	SK_U64			StatTxOctetsOkCts;
664 	SK_U64			StatTxBroadcastOkCts;
665 	SK_U64			StatTxMulticastOkCts;
666 	SK_U64			StatTxUnicastOkCts;
667 	SK_U64			StatTxLongFramesCts;
668 	SK_U64			StatTxBurstCts;
669 	SK_U64			StatTxPauseMacCtrlCts;
670 	SK_U64			StatTxMacCtrlCts;
671 	SK_U64			StatTxSingleCollisionCts;
672 	SK_U64			StatTxMultipleCollisionCts;
673 	SK_U64			StatTxExcessiveCollisionCts;
674 	SK_U64			StatTxLateCollisionCts;
675 	SK_U64			StatTxDeferralCts;
676 	SK_U64			StatTxExcessiveDeferralCts;
677 	SK_U64			StatTxFifoUnderrunCts;
678 	SK_U64			StatTxCarrierCts;
679 	SK_U64			Dummy1; /* StatTxUtilization */
680 	SK_U64			StatTx64Cts;
681 	SK_U64			StatTx127Cts;
682 	SK_U64			StatTx255Cts;
683 	SK_U64			StatTx511Cts;
684 	SK_U64			StatTx1023Cts;
685 	SK_U64			StatTxMaxCts;
686 	SK_U64			StatTxSyncCts;
687 	SK_U64			StatTxSyncOctetsCts;
688 	SK_U64			StatRxOkCts;
689 	SK_U64			StatRxOctetsOkCts;
690 	SK_U64			StatRxBroadcastOkCts;
691 	SK_U64			StatRxMulticastOkCts;
692 	SK_U64			StatRxUnicastOkCts;
693 	SK_U64			StatRxLongFramesCts;
694 	SK_U64			StatRxPauseMacCtrlCts;
695 	SK_U64			StatRxMacCtrlCts;
696 	SK_U64			StatRxPauseMacCtrlErrorCts;
697 	SK_U64			StatRxMacCtrlUnknownCts;
698 	SK_U64			StatRxBurstCts;
699 	SK_U64			StatRxMissedCts;
700 	SK_U64			StatRxFramingCts;
701 	SK_U64			StatRxFifoOverflowCts;
702 	SK_U64			StatRxJabberCts;
703 	SK_U64			StatRxCarrierCts;
704 	SK_U64			StatRxIRLengthCts;
705 	SK_U64			StatRxSymbolCts;
706 	SK_U64			StatRxShortsCts;
707 	SK_U64			StatRxRuntCts;
708 	SK_U64			StatRxCextCts;
709 	SK_U64			StatRxTooLongCts;
710 	SK_U64			StatRxFcsCts;
711 	SK_U64			Dummy2; /* StatRxUtilization */
712 	SK_U64			StatRx64Cts;
713 	SK_U64			StatRx127Cts;
714 	SK_U64			StatRx255Cts;
715 	SK_U64			StatRx511Cts;
716 	SK_U64			StatRx1023Cts;
717 	SK_U64			StatRxMaxCts;
718 } SK_PNMI_STAT;
719 
720 typedef struct s_PnmiConf {
721 	char			ConfMacCurrentAddr[6];
722 	char			ConfMacFactoryAddr[6];
723 	SK_U8			ConfPMD;
724 	SK_U8			ConfConnector;
725 	SK_U32			ConfPhyType;
726 	SK_U32			ConfPhyMode;
727 	SK_U8			ConfLinkCapability;
728 	SK_U8			ConfLinkMode;
729 	SK_U8			ConfLinkModeStatus;
730 	SK_U8			ConfLinkStatus;
731 	SK_U8			ConfFlowCtrlCapability;
732 	SK_U8			ConfFlowCtrlMode;
733 	SK_U8			ConfFlowCtrlStatus;
734 	SK_U8			ConfPhyOperationCapability;
735 	SK_U8			ConfPhyOperationMode;
736 	SK_U8			ConfPhyOperationStatus;
737 	SK_U8			ConfSpeedCapability;
738 	SK_U8			ConfSpeedMode;
739 	SK_U8			ConfSpeedStatus;
740 } SK_PNMI_CONF;
741 
742 typedef struct s_PnmiRlmt {
743 	SK_U32			RlmtIndex;
744 	SK_U32			RlmtStatus;
745 	SK_U64			RlmtTxHelloCts;
746 	SK_U64			RlmtRxHelloCts;
747 	SK_U64			RlmtTxSpHelloReqCts;
748 	SK_U64			RlmtRxSpHelloCts;
749 } SK_PNMI_RLMT;
750 
751 typedef struct s_PnmiRlmtMonitor {
752 	SK_U32			RlmtMonitorIndex;
753 	char			RlmtMonitorAddr[6];
754 	SK_U64			RlmtMonitorErrorCts;
755 	SK_U64			RlmtMonitorTimestamp;
756 	SK_U8			RlmtMonitorAdmin;
757 } SK_PNMI_RLMT_MONITOR;
758 
759 typedef struct s_PnmiRequestStatus {
760 	SK_U32			ErrorStatus;
761 	SK_U32			ErrorOffset;
762 } SK_PNMI_REQUEST_STATUS;
763 
764 typedef struct s_PnmiStrucData {
765 	SK_U32			MgmtDBVersion;
766 	SK_PNMI_REQUEST_STATUS	ReturnStatus;
767 	SK_U32			VpdFreeBytes;
768 	char			VpdEntriesList[SK_PNMI_VPD_ENTRIES * SK_PNMI_VPD_KEY_SIZE];
769 	SK_U32			VpdEntriesNumber;
770 	SK_PNMI_VPD		Vpd[SK_PNMI_VPD_ENTRIES];
771 	SK_U32			PortNumber;
772 	SK_U32			DeviceType;
773 	char			DriverDescr[SK_PNMI_STRINGLEN1];
774 	char			DriverVersion[SK_PNMI_STRINGLEN2];
775 	char			DriverReleaseDate[SK_PNMI_STRINGLEN1];
776 	char			DriverFileName[SK_PNMI_STRINGLEN1];
777 	char			HwDescr[SK_PNMI_STRINGLEN1];
778 	char			HwVersion[SK_PNMI_STRINGLEN2];
779 	SK_U16			Chipset;
780 	SK_U32			ChipId;
781 	SK_U8			VauxAvail;
782 	SK_U32			RamSize;
783 	SK_U32			MtuSize;
784 	SK_U32			Action;
785 	SK_U32			TestResult;
786 	SK_U8			BusType;
787 	SK_U8			BusSpeed;
788 	SK_U8			BusWidth;
789 	SK_U8			SensorNumber;
790 	SK_PNMI_SENSOR	Sensor[SK_PNMI_SENSOR_ENTRIES];
791 	SK_U8			ChecksumNumber;
792 	SK_PNMI_CHECKSUM	Checksum[SK_PNMI_CHECKSUM_ENTRIES];
793 	SK_PNMI_STAT	Stat[SK_PNMI_MAC_ENTRIES];
794 	SK_PNMI_CONF	Conf[SK_PNMI_MAC_ENTRIES];
795 	SK_U8			RlmtMode;
796 	SK_U32			RlmtPortNumber;
797 	SK_U8			RlmtPortActive;
798 	SK_U8			RlmtPortPreferred;
799 	SK_U64			RlmtChangeCts;
800 	SK_U64			RlmtChangeTime;
801 	SK_U64			RlmtChangeEstimate;
802 	SK_U64			RlmtChangeThreshold;
803 	SK_PNMI_RLMT	Rlmt[SK_MAX_MACS];
804 	SK_U32			RlmtMonitorNumber;
805 	SK_PNMI_RLMT_MONITOR	RlmtMonitor[SK_PNMI_MONITOR_ENTRIES];
806 	SK_U32			TrapNumber;
807 	SK_U8			Trap[SK_PNMI_TRAP_QUEUE_LEN];
808 	SK_U64			TxSwQueueLen;
809 	SK_U64			TxSwQueueMax;
810 	SK_U64			TxRetryCts;
811 	SK_U64			RxIntrCts;
812 	SK_U64			TxIntrCts;
813 	SK_U64			RxNoBufCts;
814 	SK_U64			TxNoBufCts;
815 	SK_U64			TxUsedDescrNo;
816 	SK_U64			RxDeliveredCts;
817 	SK_U64			RxOctetsDeliveredCts;
818 	SK_U64			RxHwErrorsCts;
819 	SK_U64			TxHwErrorsCts;
820 	SK_U64			InErrorsCts;
821 	SK_U64			OutErrorsCts;
822 	SK_U64			ErrRecoveryCts;
823 	SK_U64			SysUpTime;
824 } SK_PNMI_STRUCT_DATA;
825 
826 #define SK_PNMI_STRUCT_SIZE	(sizeof(SK_PNMI_STRUCT_DATA))
827 #define SK_PNMI_MIN_STRUCT_SIZE	((unsigned int)(SK_UPTR)\
828 				 &(((SK_PNMI_STRUCT_DATA *)0)->VpdFreeBytes))
829 														/*
830 														 * ReturnStatus field
831 														 * must be located
832 														 * before VpdFreeBytes
833 														 */
834 
835 /*
836  * Various definitions
837  */
838 #define SK_PNMI_MAX_PROTOS		3
839 
840 #define SK_PNMI_CNT_NO			66	/* Must have the value of the enum
841 									 * SK_PNMI_MAX_IDX. Define SK_PNMI_CHECK
842 									 * for check while init phase 1
843 									 */
844 
845 /*
846  * Estimate data structure
847  */
848 typedef struct s_PnmiEstimate {
849 	unsigned int	EstValueIndex;
850 	SK_U64			EstValue[7];
851 	SK_U64			Estimate;
852 	SK_TIMER		EstTimer;
853 } SK_PNMI_ESTIMATE;
854 
855 
856 /*
857  * VCT timer data structure
858  */
859 typedef struct s_VctTimer {
860 	SK_TIMER		VctTimer;
861 } SK_PNMI_VCT_TIMER;
862 
863 
864 /*
865  * PNMI specific adapter context structure
866  */
867 typedef struct s_PnmiPort {
868 	SK_U64			StatSyncCts;
869 	SK_U64			StatSyncOctetsCts;
870 	SK_U64			StatRxLongFrameCts;
871 	SK_U64			StatRxFrameTooLongCts;
872 	SK_U64			StatRxPMaccErr;
873 	SK_U64			TxSwQueueLen;
874 	SK_U64			TxSwQueueMax;
875 	SK_U64			TxRetryCts;
876 	SK_U64			RxIntrCts;
877 	SK_U64			TxIntrCts;
878 	SK_U64			RxNoBufCts;
879 	SK_U64			TxNoBufCts;
880 	SK_U64			TxUsedDescrNo;
881 	SK_U64			RxDeliveredCts;
882 	SK_U64			RxOctetsDeliveredCts;
883 	SK_U64			RxHwErrorsCts;
884 	SK_U64			TxHwErrorsCts;
885 	SK_U64			InErrorsCts;
886 	SK_U64			OutErrorsCts;
887 	SK_U64			ErrRecoveryCts;
888 	SK_U64			RxShortZeroMark;
889 	SK_U64			CounterOffset[SK_PNMI_CNT_NO];
890 	SK_U32			CounterHigh[SK_PNMI_CNT_NO];
891 	SK_BOOL			ActiveFlag;
892 	SK_U8			Align[3];
893 } SK_PNMI_PORT;
894 
895 
896 typedef struct s_PnmiData {
897 	SK_PNMI_PORT	Port	[SK_MAX_MACS];
898 	SK_PNMI_PORT	BufPort	[SK_MAX_MACS]; /* 2002-09-13 pweber  */
899 	SK_U64			VirtualCounterOffset[SK_PNMI_CNT_NO];
900 	SK_U32			TestResult;
901 	char			HwVersion[10];
902 	SK_U16			Align01;
903 
904 	char			*pDriverDescription;
905 	char			*pDriverVersion;
906 	char			*pDriverReleaseDate;
907 	char			*pDriverFileName;
908 
909 	int				MacUpdatedFlag;
910 	int				RlmtUpdatedFlag;
911 	int				SirqUpdatedFlag;
912 
913 	SK_U64			RlmtChangeCts;
914 	SK_U64			RlmtChangeTime;
915 	SK_PNMI_ESTIMATE	RlmtChangeEstimate;
916 	SK_U64			RlmtChangeThreshold;
917 
918 	SK_U64			StartUpTime;
919 	SK_U32			DeviceType;
920 	char			PciBusSpeed;
921 	char			PciBusWidth;
922 	char			Chipset;
923 	char			PMD;
924 	char			Connector;
925 	SK_BOOL			DualNetActiveFlag;
926 	SK_U16			Align02;
927 
928 	char			TrapBuf[SK_PNMI_TRAP_QUEUE_LEN];
929 	unsigned int	TrapBufFree;
930 	unsigned int	TrapQueueBeg;
931 	unsigned int	TrapQueueEnd;
932 	unsigned int	TrapBufPad;
933 	unsigned int	TrapUnique;
934 	SK_U8		VctStatus[SK_MAX_MACS];
935 	SK_PNMI_VCT	VctBackup[SK_MAX_MACS];
936 	SK_PNMI_VCT_TIMER VctTimeout[SK_MAX_MACS];
937 #ifdef SK_DIAG_SUPPORT
938 	SK_U32			DiagAttached;
939 #endif /* SK_DIAG_SUPPORT */
940 } SK_PNMI;
941 
942 
943 /*
944  * Function prototypes
945  */
946 extern int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int Level);
947 extern int SkPnmiGetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf,
948 	unsigned int* pLen, SK_U32 Instance, SK_U32 NetIndex);
949 extern int SkPnmiPreSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id,
950 	void* pBuf, unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);
951 extern int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void* pBuf,
952 	unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);
953 extern int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
954 	unsigned int *pLen, SK_U32 NetIndex);
955 extern int SkPnmiPreSetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
956 	unsigned int *pLen, SK_U32 NetIndex);
957 extern int SkPnmiSetStruct(SK_AC *pAC, SK_IOC IoC, void* pBuf,
958 	unsigned int *pLen, SK_U32 NetIndex);
959 extern int SkPnmiEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event,
960 	SK_EVPARA Param);
961 extern int SkPnmiGenIoctl(SK_AC *pAC, SK_IOC IoC, void * pBuf,
962 	unsigned int * pLen, SK_U32 NetIndex);
963 
964 #endif
965