Print this page
6064 ixgbe needs X550 support
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/ixgbe/ixgbe_stat.c
+++ new/usr/src/uts/common/io/ixgbe/ixgbe_stat.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 28 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
29 + * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
29 30 */
30 31
31 32 #include "ixgbe_sw.h"
32 33
33 34 /*
34 35 * Update driver private statistics.
35 36 */
36 37 static int
37 38 ixgbe_update_stats(kstat_t *ks, int rw)
38 39 {
39 40 ixgbe_t *ixgbe;
40 41 struct ixgbe_hw *hw;
41 42 ixgbe_stat_t *ixgbe_ks;
42 43 int i;
43 44
44 45 if (rw == KSTAT_WRITE)
45 46 return (EACCES);
46 47
47 48 ixgbe = (ixgbe_t *)ks->ks_private;
48 49 ixgbe_ks = (ixgbe_stat_t *)ks->ks_data;
49 50 hw = &ixgbe->hw;
50 51
51 52 mutex_enter(&ixgbe->gen_lock);
52 53
53 54 /*
54 55 * Basic information
55 56 */
56 57 ixgbe_ks->link_speed.value.ui64 = ixgbe->link_speed;
57 58 ixgbe_ks->reset_count.value.ui64 = ixgbe->reset_count;
58 59 ixgbe_ks->lroc.value.ui64 = ixgbe->lro_pkt_count;
59 60
60 61 #ifdef IXGBE_DEBUG
61 62 ixgbe_ks->rx_frame_error.value.ui64 = 0;
62 63 ixgbe_ks->rx_cksum_error.value.ui64 = 0;
63 64 ixgbe_ks->rx_exceed_pkt.value.ui64 = 0;
64 65 for (i = 0; i < ixgbe->num_rx_rings; i++) {
65 66 ixgbe_ks->rx_frame_error.value.ui64 +=
66 67 ixgbe->rx_rings[i].stat_frame_error;
67 68 ixgbe_ks->rx_cksum_error.value.ui64 +=
68 69 ixgbe->rx_rings[i].stat_cksum_error;
69 70 ixgbe_ks->rx_exceed_pkt.value.ui64 +=
70 71 ixgbe->rx_rings[i].stat_exceed_pkt;
71 72 }
72 73
73 74 ixgbe_ks->tx_overload.value.ui64 = 0;
74 75 ixgbe_ks->tx_fail_no_tbd.value.ui64 = 0;
75 76 ixgbe_ks->tx_fail_no_tcb.value.ui64 = 0;
76 77 ixgbe_ks->tx_fail_dma_bind.value.ui64 = 0;
77 78 ixgbe_ks->tx_reschedule.value.ui64 = 0;
78 79 for (i = 0; i < ixgbe->num_tx_rings; i++) {
79 80 ixgbe_ks->tx_overload.value.ui64 +=
80 81 ixgbe->tx_rings[i].stat_overload;
81 82 ixgbe_ks->tx_fail_no_tbd.value.ui64 +=
82 83 ixgbe->tx_rings[i].stat_fail_no_tbd;
83 84 ixgbe_ks->tx_fail_no_tcb.value.ui64 +=
84 85 ixgbe->tx_rings[i].stat_fail_no_tcb;
85 86 ixgbe_ks->tx_fail_dma_bind.value.ui64 +=
86 87 ixgbe->tx_rings[i].stat_fail_dma_bind;
87 88 ixgbe_ks->tx_reschedule.value.ui64 +=
88 89 ixgbe->tx_rings[i].stat_reschedule;
89 90 }
90 91 #endif
91 92
92 93 /*
93 94 * Hardware calculated statistics.
94 95 */
95 96 ixgbe_ks->gprc.value.ui64 = 0;
96 97 ixgbe_ks->gptc.value.ui64 = 0;
97 98 ixgbe_ks->tor.value.ui64 = 0;
98 99 ixgbe_ks->tot.value.ui64 = 0;
99 100 for (i = 0; i < 16; i++) {
100 101 ixgbe_ks->qprc[i].value.ui64 +=
101 102 IXGBE_READ_REG(hw, IXGBE_QPRC(i));
102 103 ixgbe_ks->gprc.value.ui64 += ixgbe_ks->qprc[i].value.ui64;
103 104 ixgbe_ks->qptc[i].value.ui64 +=
104 105 IXGBE_READ_REG(hw, IXGBE_QPTC(i));
105 106 ixgbe_ks->gptc.value.ui64 += ixgbe_ks->qptc[i].value.ui64;
106 107 ixgbe_ks->qbrc[i].value.ui64 +=
↓ open down ↓ |
68 lines elided |
↑ open up ↑ |
107 108 IXGBE_READ_REG(hw, IXGBE_QBRC(i));
108 109 ixgbe_ks->tor.value.ui64 += ixgbe_ks->qbrc[i].value.ui64;
109 110 switch (hw->mac.type) {
110 111 case ixgbe_mac_82598EB:
111 112 ixgbe_ks->qbtc[i].value.ui64 +=
112 113 IXGBE_READ_REG(hw, IXGBE_QBTC(i));
113 114 break;
114 115
115 116 case ixgbe_mac_82599EB:
116 117 case ixgbe_mac_X540:
118 + case ixgbe_mac_X550:
119 + case ixgbe_mac_X550EM_x:
117 120 ixgbe_ks->qbtc[i].value.ui64 +=
118 121 IXGBE_READ_REG(hw, IXGBE_QBTC_L(i));
119 122 ixgbe_ks->qbtc[i].value.ui64 +=
120 123 ((uint64_t)((IXGBE_READ_REG(hw,
121 124 IXGBE_QBTC_H(i))) & 0xF) << 32);
122 125 break;
123 126
124 127 default:
125 128 break;
126 129 }
127 130 ixgbe_ks->tot.value.ui64 += ixgbe_ks->qbtc[i].value.ui64;
128 131 }
129 132 /*
130 133 * This is a Workaround:
131 134 * Currently h/w GORCH, GOTCH, TORH registers are not
132 135 * correctly implemented. We found that the values in
133 136 * these registers are same as those in corresponding
134 137 * *L registers (i.e. GORCL, GOTCL, and TORL). Here the
135 138 * gor and got stat data will not be retrieved through
136 139 * GORC{H/L} and GOTC{H/L} registers but be obtained by
137 140 * simply assigning tor/tot stat data, so the gor/got
138 141 * stat data will not be accurate.
139 142 */
140 143 ixgbe_ks->gor.value.ui64 = ixgbe_ks->tor.value.ui64;
141 144 ixgbe_ks->got.value.ui64 = ixgbe_ks->tot.value.ui64;
142 145
143 146 ixgbe_ks->prc64.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC64);
144 147 ixgbe_ks->prc127.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC127);
145 148 ixgbe_ks->prc255.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC255);
146 149 ixgbe_ks->prc511.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC511);
147 150 ixgbe_ks->prc1023.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC1023);
148 151 ixgbe_ks->prc1522.value.ul += IXGBE_READ_REG(hw, IXGBE_PRC1522);
149 152 ixgbe_ks->ptc64.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC64);
150 153 ixgbe_ks->ptc127.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC127);
151 154 ixgbe_ks->ptc255.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC255);
152 155 ixgbe_ks->ptc511.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC511);
153 156 ixgbe_ks->ptc1023.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC1023);
154 157 ixgbe_ks->ptc1522.value.ul += IXGBE_READ_REG(hw, IXGBE_PTC1522);
155 158
156 159 ixgbe_ks->mspdc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_MSPDC);
157 160 for (i = 0; i < 8; i++)
158 161 ixgbe_ks->mpc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_MPC(i));
159 162 ixgbe_ks->mlfc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_MLFC);
160 163 ixgbe_ks->mrfc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_MRFC);
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
161 164 ixgbe_ks->rlec.value.ui64 += IXGBE_READ_REG(hw, IXGBE_RLEC);
162 165 ixgbe_ks->lxontxc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_LXONTXC);
163 166 switch (hw->mac.type) {
164 167 case ixgbe_mac_82598EB:
165 168 ixgbe_ks->lxonrxc.value.ui64 += IXGBE_READ_REG(hw,
166 169 IXGBE_LXONRXC);
167 170 break;
168 171
169 172 case ixgbe_mac_82599EB:
170 173 case ixgbe_mac_X540:
174 + case ixgbe_mac_X550:
175 + case ixgbe_mac_X550EM_x:
171 176 ixgbe_ks->lxonrxc.value.ui64 += IXGBE_READ_REG(hw,
172 177 IXGBE_LXONRXCNT);
173 178 break;
174 179
175 180 default:
176 181 break;
177 182 }
178 183 ixgbe_ks->lxofftxc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
179 184 switch (hw->mac.type) {
180 185 case ixgbe_mac_82598EB:
181 186 ixgbe_ks->lxoffrxc.value.ui64 += IXGBE_READ_REG(hw,
182 187 IXGBE_LXOFFRXC);
183 188 break;
184 189
185 190 case ixgbe_mac_82599EB:
186 191 case ixgbe_mac_X540:
192 + case ixgbe_mac_X550:
193 + case ixgbe_mac_X550EM_x:
187 194 ixgbe_ks->lxoffrxc.value.ui64 += IXGBE_READ_REG(hw,
188 195 IXGBE_LXOFFRXCNT);
189 196 break;
190 197
191 198 default:
192 199 break;
193 200 }
194 201 ixgbe_ks->ruc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_RUC);
195 202 ixgbe_ks->rfc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_RFC);
196 203 ixgbe_ks->roc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_ROC);
197 204 ixgbe_ks->rjc.value.ui64 += IXGBE_READ_REG(hw, IXGBE_RJC);
198 205
199 206 mutex_exit(&ixgbe->gen_lock);
200 207
201 208 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK)
202 209 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_UNAFFECTED);
203 210
204 211 return (0);
205 212 }
206 213
207 214 /*
208 215 * Create and initialize the driver private statistics.
209 216 */
210 217 int
211 218 ixgbe_init_stats(ixgbe_t *ixgbe)
212 219 {
213 220 kstat_t *ks;
214 221 ixgbe_stat_t *ixgbe_ks;
215 222
216 223 /*
217 224 * Create and init kstat
218 225 */
219 226 ks = kstat_create(MODULE_NAME, ddi_get_instance(ixgbe->dip),
220 227 "statistics", "net", KSTAT_TYPE_NAMED,
221 228 sizeof (ixgbe_stat_t) / sizeof (kstat_named_t), 0);
222 229
223 230 if (ks == NULL) {
224 231 ixgbe_error(ixgbe,
225 232 "Could not create kernel statistics");
226 233 return (IXGBE_FAILURE);
227 234 }
228 235
229 236 ixgbe->ixgbe_ks = ks;
230 237
231 238 ixgbe_ks = (ixgbe_stat_t *)ks->ks_data;
232 239
233 240 /*
234 241 * Initialize all the statistics.
235 242 */
236 243 kstat_named_init(&ixgbe_ks->link_speed, "link_speed",
237 244 KSTAT_DATA_UINT64);
238 245 kstat_named_init(&ixgbe_ks->reset_count, "reset_count",
239 246 KSTAT_DATA_UINT64);
240 247
241 248 #ifdef IXGBE_DEBUG
242 249 kstat_named_init(&ixgbe_ks->rx_frame_error, "rx_frame_error",
243 250 KSTAT_DATA_UINT64);
244 251 kstat_named_init(&ixgbe_ks->rx_cksum_error, "rx_cksum_error",
245 252 KSTAT_DATA_UINT64);
246 253 kstat_named_init(&ixgbe_ks->rx_exceed_pkt, "rx_exceed_pkt",
247 254 KSTAT_DATA_UINT64);
248 255 kstat_named_init(&ixgbe_ks->tx_overload, "tx_overload",
249 256 KSTAT_DATA_UINT64);
250 257 kstat_named_init(&ixgbe_ks->tx_fail_no_tbd, "tx_fail_no_tbd",
251 258 KSTAT_DATA_UINT64);
252 259 kstat_named_init(&ixgbe_ks->tx_fail_no_tcb, "tx_fail_no_tcb",
253 260 KSTAT_DATA_UINT64);
254 261 kstat_named_init(&ixgbe_ks->tx_fail_dma_bind, "tx_fail_dma_bind",
255 262 KSTAT_DATA_UINT64);
256 263 kstat_named_init(&ixgbe_ks->tx_reschedule, "tx_reschedule",
257 264 KSTAT_DATA_UINT64);
258 265 #endif
259 266
260 267 kstat_named_init(&ixgbe_ks->gprc, "good_pkts_recvd",
261 268 KSTAT_DATA_UINT64);
262 269 kstat_named_init(&ixgbe_ks->gptc, "good_pkts_xmitd",
263 270 KSTAT_DATA_UINT64);
264 271 kstat_named_init(&ixgbe_ks->gor, "good_octets_recvd",
265 272 KSTAT_DATA_UINT64);
266 273 kstat_named_init(&ixgbe_ks->got, "good_octets_xmitd",
267 274 KSTAT_DATA_UINT64);
268 275 kstat_named_init(&ixgbe_ks->prc64, "pkts_recvd_( 64b)",
269 276 KSTAT_DATA_UINT64);
270 277 kstat_named_init(&ixgbe_ks->prc127, "pkts_recvd_( 65- 127b)",
271 278 KSTAT_DATA_UINT64);
272 279 kstat_named_init(&ixgbe_ks->prc255, "pkts_recvd_( 127- 255b)",
273 280 KSTAT_DATA_UINT64);
274 281 kstat_named_init(&ixgbe_ks->prc511, "pkts_recvd_( 256- 511b)",
275 282 KSTAT_DATA_UINT64);
276 283 kstat_named_init(&ixgbe_ks->prc1023, "pkts_recvd_( 511-1023b)",
277 284 KSTAT_DATA_UINT64);
278 285 kstat_named_init(&ixgbe_ks->prc1522, "pkts_recvd_(1024-1522b)",
279 286 KSTAT_DATA_UINT64);
280 287 kstat_named_init(&ixgbe_ks->ptc64, "pkts_xmitd_( 64b)",
281 288 KSTAT_DATA_UINT64);
282 289 kstat_named_init(&ixgbe_ks->ptc127, "pkts_xmitd_( 65- 127b)",
283 290 KSTAT_DATA_UINT64);
284 291 kstat_named_init(&ixgbe_ks->ptc255, "pkts_xmitd_( 128- 255b)",
285 292 KSTAT_DATA_UINT64);
286 293 kstat_named_init(&ixgbe_ks->ptc511, "pkts_xmitd_( 255- 511b)",
287 294 KSTAT_DATA_UINT64);
288 295 kstat_named_init(&ixgbe_ks->ptc1023, "pkts_xmitd_( 512-1023b)",
289 296 KSTAT_DATA_UINT64);
290 297 kstat_named_init(&ixgbe_ks->ptc1522, "pkts_xmitd_(1024-1522b)",
291 298 KSTAT_DATA_UINT64);
292 299
293 300 kstat_named_init(&ixgbe_ks->qprc[0], "queue_pkts_recvd [ 0]",
294 301 KSTAT_DATA_UINT64);
295 302 kstat_named_init(&ixgbe_ks->qprc[1], "queue_pkts_recvd [ 1]",
296 303 KSTAT_DATA_UINT64);
297 304 kstat_named_init(&ixgbe_ks->qprc[2], "queue_pkts_recvd [ 2]",
298 305 KSTAT_DATA_UINT64);
299 306 kstat_named_init(&ixgbe_ks->qprc[3], "queue_pkts_recvd [ 3]",
300 307 KSTAT_DATA_UINT64);
301 308 kstat_named_init(&ixgbe_ks->qprc[4], "queue_pkts_recvd [ 4]",
302 309 KSTAT_DATA_UINT64);
303 310 kstat_named_init(&ixgbe_ks->qprc[5], "queue_pkts_recvd [ 5]",
304 311 KSTAT_DATA_UINT64);
305 312 kstat_named_init(&ixgbe_ks->qprc[6], "queue_pkts_recvd [ 6]",
306 313 KSTAT_DATA_UINT64);
307 314 kstat_named_init(&ixgbe_ks->qprc[7], "queue_pkts_recvd [ 7]",
308 315 KSTAT_DATA_UINT64);
309 316 kstat_named_init(&ixgbe_ks->qprc[8], "queue_pkts_recvd [ 8]",
310 317 KSTAT_DATA_UINT64);
311 318 kstat_named_init(&ixgbe_ks->qprc[9], "queue_pkts_recvd [ 9]",
312 319 KSTAT_DATA_UINT64);
313 320 kstat_named_init(&ixgbe_ks->qprc[10], "queue_pkts_recvd [10]",
314 321 KSTAT_DATA_UINT64);
315 322 kstat_named_init(&ixgbe_ks->qprc[11], "queue_pkts_recvd [11]",
316 323 KSTAT_DATA_UINT64);
317 324 kstat_named_init(&ixgbe_ks->qprc[12], "queue_pkts_recvd [12]",
318 325 KSTAT_DATA_UINT64);
319 326 kstat_named_init(&ixgbe_ks->qprc[13], "queue_pkts_recvd [13]",
320 327 KSTAT_DATA_UINT64);
321 328 kstat_named_init(&ixgbe_ks->qprc[14], "queue_pkts_recvd [14]",
322 329 KSTAT_DATA_UINT64);
323 330 kstat_named_init(&ixgbe_ks->qprc[15], "queue_pkts_recvd [15]",
324 331 KSTAT_DATA_UINT64);
325 332
326 333 kstat_named_init(&ixgbe_ks->qptc[0], "queue_pkts_xmitd [ 0]",
327 334 KSTAT_DATA_UINT64);
328 335 kstat_named_init(&ixgbe_ks->qptc[1], "queue_pkts_xmitd [ 1]",
329 336 KSTAT_DATA_UINT64);
330 337 kstat_named_init(&ixgbe_ks->qptc[2], "queue_pkts_xmitd [ 2]",
331 338 KSTAT_DATA_UINT64);
332 339 kstat_named_init(&ixgbe_ks->qptc[3], "queue_pkts_xmitd [ 3]",
333 340 KSTAT_DATA_UINT64);
334 341 kstat_named_init(&ixgbe_ks->qptc[4], "queue_pkts_xmitd [ 4]",
335 342 KSTAT_DATA_UINT64);
336 343 kstat_named_init(&ixgbe_ks->qptc[5], "queue_pkts_xmitd [ 5]",
337 344 KSTAT_DATA_UINT64);
338 345 kstat_named_init(&ixgbe_ks->qptc[6], "queue_pkts_xmitd [ 6]",
339 346 KSTAT_DATA_UINT64);
340 347 kstat_named_init(&ixgbe_ks->qptc[7], "queue_pkts_xmitd [ 7]",
341 348 KSTAT_DATA_UINT64);
342 349 kstat_named_init(&ixgbe_ks->qptc[8], "queue_pkts_xmitd [ 8]",
343 350 KSTAT_DATA_UINT64);
344 351 kstat_named_init(&ixgbe_ks->qptc[9], "queue_pkts_xmitd [ 9]",
345 352 KSTAT_DATA_UINT64);
346 353 kstat_named_init(&ixgbe_ks->qptc[10], "queue_pkts_xmitd [10]",
347 354 KSTAT_DATA_UINT64);
348 355 kstat_named_init(&ixgbe_ks->qptc[11], "queue_pkts_xmitd [11]",
349 356 KSTAT_DATA_UINT64);
350 357 kstat_named_init(&ixgbe_ks->qptc[12], "queue_pkts_xmitd [12]",
351 358 KSTAT_DATA_UINT64);
352 359 kstat_named_init(&ixgbe_ks->qptc[13], "queue_pkts_xmitd [13]",
353 360 KSTAT_DATA_UINT64);
354 361 kstat_named_init(&ixgbe_ks->qptc[14], "queue_pkts_xmitd [14]",
355 362 KSTAT_DATA_UINT64);
356 363 kstat_named_init(&ixgbe_ks->qptc[15], "queue_pkts_xmitd [15]",
357 364 KSTAT_DATA_UINT64);
358 365
359 366 kstat_named_init(&ixgbe_ks->qbrc[0], "queue_bytes_recvd [ 0]",
360 367 KSTAT_DATA_UINT64);
361 368 kstat_named_init(&ixgbe_ks->qbrc[1], "queue_bytes_recvd [ 1]",
362 369 KSTAT_DATA_UINT64);
363 370 kstat_named_init(&ixgbe_ks->qbrc[2], "queue_bytes_recvd [ 2]",
364 371 KSTAT_DATA_UINT64);
365 372 kstat_named_init(&ixgbe_ks->qbrc[3], "queue_bytes_recvd [ 3]",
366 373 KSTAT_DATA_UINT64);
367 374 kstat_named_init(&ixgbe_ks->qbrc[4], "queue_bytes_recvd [ 4]",
368 375 KSTAT_DATA_UINT64);
369 376 kstat_named_init(&ixgbe_ks->qbrc[5], "queue_bytes_recvd [ 5]",
370 377 KSTAT_DATA_UINT64);
371 378 kstat_named_init(&ixgbe_ks->qbrc[6], "queue_bytes_recvd [ 6]",
372 379 KSTAT_DATA_UINT64);
373 380 kstat_named_init(&ixgbe_ks->qbrc[7], "queue_bytes_recvd [ 7]",
374 381 KSTAT_DATA_UINT64);
375 382 kstat_named_init(&ixgbe_ks->qbrc[8], "queue_bytes_recvd [ 8]",
376 383 KSTAT_DATA_UINT64);
377 384 kstat_named_init(&ixgbe_ks->qbrc[9], "queue_bytes_recvd [ 9]",
378 385 KSTAT_DATA_UINT64);
379 386 kstat_named_init(&ixgbe_ks->qbrc[10], "queue_bytes_recvd [10]",
380 387 KSTAT_DATA_UINT64);
381 388 kstat_named_init(&ixgbe_ks->qbrc[11], "queue_bytes_recvd [11]",
382 389 KSTAT_DATA_UINT64);
383 390 kstat_named_init(&ixgbe_ks->qbrc[12], "queue_bytes_recvd [12]",
384 391 KSTAT_DATA_UINT64);
385 392 kstat_named_init(&ixgbe_ks->qbrc[13], "queue_bytes_recvd [13]",
386 393 KSTAT_DATA_UINT64);
387 394 kstat_named_init(&ixgbe_ks->qbrc[14], "queue_bytes_recvd [14]",
388 395 KSTAT_DATA_UINT64);
389 396 kstat_named_init(&ixgbe_ks->qbrc[15], "queue_bytes_recvd [15]",
390 397 KSTAT_DATA_UINT64);
391 398
392 399 kstat_named_init(&ixgbe_ks->qbtc[0], "queue_bytes_xmitd [ 0]",
393 400 KSTAT_DATA_UINT64);
394 401 kstat_named_init(&ixgbe_ks->qbtc[1], "queue_bytes_xmitd [ 1]",
395 402 KSTAT_DATA_UINT64);
396 403 kstat_named_init(&ixgbe_ks->qbtc[2], "queue_bytes_xmitd [ 2]",
397 404 KSTAT_DATA_UINT64);
398 405 kstat_named_init(&ixgbe_ks->qbtc[3], "queue_bytes_xmitd [ 3]",
399 406 KSTAT_DATA_UINT64);
400 407 kstat_named_init(&ixgbe_ks->qbtc[4], "queue_bytes_xmitd [ 4]",
401 408 KSTAT_DATA_UINT64);
402 409 kstat_named_init(&ixgbe_ks->qbtc[5], "queue_bytes_xmitd [ 5]",
403 410 KSTAT_DATA_UINT64);
404 411 kstat_named_init(&ixgbe_ks->qbtc[6], "queue_bytes_xmitd [ 6]",
405 412 KSTAT_DATA_UINT64);
406 413 kstat_named_init(&ixgbe_ks->qbtc[7], "queue_bytes_xmitd [ 7]",
407 414 KSTAT_DATA_UINT64);
408 415 kstat_named_init(&ixgbe_ks->qbtc[8], "queue_bytes_xmitd [ 8]",
409 416 KSTAT_DATA_UINT64);
410 417 kstat_named_init(&ixgbe_ks->qbtc[9], "queue_bytes_xmitd [ 9]",
411 418 KSTAT_DATA_UINT64);
412 419 kstat_named_init(&ixgbe_ks->qbtc[10], "queue_bytes_xmitd [10]",
413 420 KSTAT_DATA_UINT64);
414 421 kstat_named_init(&ixgbe_ks->qbtc[11], "queue_bytes_xmitd [11]",
415 422 KSTAT_DATA_UINT64);
416 423 kstat_named_init(&ixgbe_ks->qbtc[12], "queue_bytes_xmitd [12]",
417 424 KSTAT_DATA_UINT64);
418 425 kstat_named_init(&ixgbe_ks->qbtc[13], "queue_bytes_xmitd [13]",
419 426 KSTAT_DATA_UINT64);
420 427 kstat_named_init(&ixgbe_ks->qbtc[14], "queue_bytes_xmitd [14]",
421 428 KSTAT_DATA_UINT64);
422 429 kstat_named_init(&ixgbe_ks->qbtc[15], "queue_bytes_xmitd [15]",
423 430 KSTAT_DATA_UINT64);
424 431
425 432 kstat_named_init(&ixgbe_ks->mspdc, "mac_short_packet_discard",
426 433 KSTAT_DATA_UINT64);
427 434 kstat_named_init(&ixgbe_ks->mpc, "missed_packets",
428 435 KSTAT_DATA_UINT64);
429 436 kstat_named_init(&ixgbe_ks->mlfc, "mac_local_fault",
430 437 KSTAT_DATA_UINT64);
431 438 kstat_named_init(&ixgbe_ks->mrfc, "mac_remote_fault",
432 439 KSTAT_DATA_UINT64);
433 440 kstat_named_init(&ixgbe_ks->rlec, "recv_length_err",
434 441 KSTAT_DATA_UINT64);
435 442 kstat_named_init(&ixgbe_ks->lxontxc, "link_xon_xmitd",
436 443 KSTAT_DATA_UINT64);
437 444 kstat_named_init(&ixgbe_ks->lxonrxc, "link_xon_recvd",
438 445 KSTAT_DATA_UINT64);
439 446 kstat_named_init(&ixgbe_ks->lxofftxc, "link_xoff_xmitd",
440 447 KSTAT_DATA_UINT64);
441 448 kstat_named_init(&ixgbe_ks->lxoffrxc, "link_xoff_recvd",
442 449 KSTAT_DATA_UINT64);
443 450 kstat_named_init(&ixgbe_ks->ruc, "recv_undersize",
444 451 KSTAT_DATA_UINT64);
445 452 kstat_named_init(&ixgbe_ks->rfc, "recv_fragment",
446 453 KSTAT_DATA_UINT64);
447 454 kstat_named_init(&ixgbe_ks->roc, "recv_oversize",
448 455 KSTAT_DATA_UINT64);
449 456 kstat_named_init(&ixgbe_ks->rjc, "recv_jabber",
450 457 KSTAT_DATA_UINT64);
451 458 kstat_named_init(&ixgbe_ks->rnbc, "recv_no_buffer",
452 459 KSTAT_DATA_UINT64);
453 460 kstat_named_init(&ixgbe_ks->lroc, "lro_pkt_count",
454 461 KSTAT_DATA_UINT64);
455 462 /*
456 463 * Function to provide kernel stat update on demand
457 464 */
458 465 ks->ks_update = ixgbe_update_stats;
459 466
460 467 ks->ks_private = (void *)ixgbe;
461 468
462 469 /*
463 470 * Add kstat to systems kstat chain
464 471 */
465 472 kstat_install(ks);
466 473
467 474 return (IXGBE_SUCCESS);
468 475 }
469 476
↓ open down ↓ |
273 lines elided |
↑ open up ↑ |
470 477 /*
471 478 * Retrieve a value for one of the statistics.
472 479 */
473 480 int
474 481 ixgbe_m_stat(void *arg, uint_t stat, uint64_t *val)
475 482 {
476 483 ixgbe_t *ixgbe = (ixgbe_t *)arg;
477 484 struct ixgbe_hw *hw = &ixgbe->hw;
478 485 ixgbe_stat_t *ixgbe_ks;
479 486 int i;
487 + ixgbe_link_speed speeds = 0;
480 488
481 489 ixgbe_ks = (ixgbe_stat_t *)ixgbe->ixgbe_ks->ks_data;
482 490
483 491 mutex_enter(&ixgbe->gen_lock);
484 492
493 + /*
494 + * We cannot always rely on the common code maintaining
495 + * hw->phy.speeds_supported, therefore we fall back to use the recorded
496 + * supported speeds which were obtained during instance init in
497 + * ixgbe_init_params().
498 + */
499 + speeds = hw->phy.speeds_supported;
500 + if (speeds == 0)
501 + speeds = ixgbe->speeds_supported;
502 +
485 503 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
486 504 mutex_exit(&ixgbe->gen_lock);
487 505 return (ECANCELED);
488 506 }
489 507
490 508 switch (stat) {
491 509 case MAC_STAT_IFSPEED:
492 510 *val = ixgbe->link_speed * 1000000ull;
493 511 break;
494 512
495 513 case MAC_STAT_MULTIRCV:
496 514 ixgbe_ks->mprc.value.ui64 +=
497 515 IXGBE_READ_REG(hw, IXGBE_MPRC);
498 516 *val = ixgbe_ks->mprc.value.ui64;
499 517 break;
500 518
501 519 case MAC_STAT_BRDCSTRCV:
502 520 ixgbe_ks->bprc.value.ui64 +=
503 521 IXGBE_READ_REG(hw, IXGBE_BPRC);
504 522 *val = ixgbe_ks->bprc.value.ui64;
505 523 break;
506 524
507 525 case MAC_STAT_MULTIXMT:
508 526 ixgbe_ks->mptc.value.ui64 +=
509 527 IXGBE_READ_REG(hw, IXGBE_MPTC);
510 528 *val = ixgbe_ks->mptc.value.ui64;
511 529 break;
512 530
513 531 case MAC_STAT_BRDCSTXMT:
514 532 ixgbe_ks->bptc.value.ui64 +=
515 533 IXGBE_READ_REG(hw, IXGBE_BPTC);
516 534 *val = ixgbe_ks->bptc.value.ui64;
517 535 break;
518 536
519 537 case MAC_STAT_NORCVBUF:
520 538 for (i = 0; i < 8; i++) {
521 539 ixgbe_ks->rnbc.value.ui64 +=
522 540 IXGBE_READ_REG(hw, IXGBE_RNBC(i));
523 541 }
524 542 *val = ixgbe_ks->rnbc.value.ui64;
525 543 break;
526 544
527 545 case MAC_STAT_IERRORS:
528 546 ixgbe_ks->crcerrs.value.ui64 +=
529 547 IXGBE_READ_REG(hw, IXGBE_CRCERRS);
530 548 ixgbe_ks->illerrc.value.ui64 +=
531 549 IXGBE_READ_REG(hw, IXGBE_ILLERRC);
532 550 ixgbe_ks->errbc.value.ui64 +=
533 551 IXGBE_READ_REG(hw, IXGBE_ERRBC);
534 552 ixgbe_ks->rlec.value.ui64 +=
535 553 IXGBE_READ_REG(hw, IXGBE_RLEC);
536 554 *val = ixgbe_ks->crcerrs.value.ui64 +
537 555 ixgbe_ks->illerrc.value.ui64 +
538 556 ixgbe_ks->errbc.value.ui64 +
539 557 ixgbe_ks->rlec.value.ui64;
540 558 break;
541 559
542 560 case MAC_STAT_RBYTES:
543 561 ixgbe_ks->tor.value.ui64 = 0;
544 562 for (i = 0; i < 16; i++) {
545 563 ixgbe_ks->qbrc[i].value.ui64 +=
546 564 IXGBE_READ_REG(hw, IXGBE_QBRC(i));
547 565 ixgbe_ks->tor.value.ui64 +=
548 566 ixgbe_ks->qbrc[i].value.ui64;
549 567 }
550 568 *val = ixgbe_ks->tor.value.ui64;
551 569 break;
552 570
553 571 case MAC_STAT_OBYTES:
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
554 572 ixgbe_ks->tot.value.ui64 = 0;
555 573 for (i = 0; i < 16; i++) {
556 574 switch (hw->mac.type) {
557 575 case ixgbe_mac_82598EB:
558 576 ixgbe_ks->qbtc[i].value.ui64 +=
559 577 IXGBE_READ_REG(hw, IXGBE_QBTC(i));
560 578 break;
561 579
562 580 case ixgbe_mac_82599EB:
563 581 case ixgbe_mac_X540:
582 + case ixgbe_mac_X550:
583 + case ixgbe_mac_X550EM_x:
564 584 ixgbe_ks->qbtc[i].value.ui64 +=
565 585 IXGBE_READ_REG(hw, IXGBE_QBTC_L(i));
566 586 ixgbe_ks->qbtc[i].value.ui64 +=
567 587 ((uint64_t)((IXGBE_READ_REG(hw,
568 588 IXGBE_QBTC_H(i))) & 0xF) << 32);
569 589 break;
570 590
571 591 default:
572 592 break;
573 593 }
574 594 ixgbe_ks->tot.value.ui64 +=
575 595 ixgbe_ks->qbtc[i].value.ui64;
576 596 }
577 597 *val = ixgbe_ks->tot.value.ui64;
578 598 break;
579 599
580 600 case MAC_STAT_IPACKETS:
581 601 ixgbe_ks->tpr.value.ui64 +=
582 602 IXGBE_READ_REG(hw, IXGBE_TPR);
583 603 *val = ixgbe_ks->tpr.value.ui64;
584 604 break;
585 605
586 606 case MAC_STAT_OPACKETS:
587 607 ixgbe_ks->tpt.value.ui64 +=
588 608 IXGBE_READ_REG(hw, IXGBE_TPT);
589 609 *val = ixgbe_ks->tpt.value.ui64;
590 610 break;
591 611
592 612 /* RFC 1643 stats */
593 613 case ETHER_STAT_FCS_ERRORS:
594 614 ixgbe_ks->crcerrs.value.ui64 +=
595 615 IXGBE_READ_REG(hw, IXGBE_CRCERRS);
596 616 *val = ixgbe_ks->crcerrs.value.ui64;
597 617 break;
598 618
599 619 case ETHER_STAT_TOOLONG_ERRORS:
600 620 ixgbe_ks->roc.value.ui64 +=
601 621 IXGBE_READ_REG(hw, IXGBE_ROC);
602 622 *val = ixgbe_ks->roc.value.ui64;
603 623 break;
604 624
605 625 case ETHER_STAT_MACRCV_ERRORS:
606 626 ixgbe_ks->crcerrs.value.ui64 +=
607 627 IXGBE_READ_REG(hw, IXGBE_CRCERRS);
608 628 ixgbe_ks->illerrc.value.ui64 +=
609 629 IXGBE_READ_REG(hw, IXGBE_ILLERRC);
610 630 ixgbe_ks->errbc.value.ui64 +=
611 631 IXGBE_READ_REG(hw, IXGBE_ERRBC);
612 632 ixgbe_ks->rlec.value.ui64 +=
613 633 IXGBE_READ_REG(hw, IXGBE_RLEC);
614 634 *val = ixgbe_ks->crcerrs.value.ui64 +
615 635 ixgbe_ks->illerrc.value.ui64 +
616 636 ixgbe_ks->errbc.value.ui64 +
617 637 ixgbe_ks->rlec.value.ui64;
618 638 break;
619 639
620 640 /* MII/GMII stats */
621 641 case ETHER_STAT_XCVR_ADDR:
622 642 /* The Internal PHY's MDI address for each MAC is 1 */
623 643 *val = 1;
624 644 break;
625 645
626 646 case ETHER_STAT_XCVR_ID:
627 647 *val = hw->phy.id;
628 648 break;
629 649
630 650 case ETHER_STAT_XCVR_INUSE:
631 651 switch (ixgbe->link_speed) {
632 652 case IXGBE_LINK_SPEED_1GB_FULL:
633 653 *val =
634 654 (hw->phy.media_type == ixgbe_media_type_copper) ?
635 655 XCVR_1000T : XCVR_1000X;
636 656 break;
637 657 case IXGBE_LINK_SPEED_100_FULL:
↓ open down ↓ |
64 lines elided |
↑ open up ↑ |
638 658 *val = (hw->phy.media_type == ixgbe_media_type_copper) ?
639 659 XCVR_100T2 : XCVR_100X;
640 660 break;
641 661 default:
642 662 *val = XCVR_NONE;
643 663 break;
644 664 }
645 665 break;
646 666
647 667 case ETHER_STAT_CAP_10GFDX:
648 - *val = 1;
668 + *val = (speeds & IXGBE_LINK_SPEED_10GB_FULL) ? 1 : 0;
649 669 break;
650 670
671 + case ETHER_STAT_CAP_5000FDX:
672 + *val = (speeds & IXGBE_LINK_SPEED_5GB_FULL) ? 1 : 0;
673 + break;
674 +
675 + case ETHER_STAT_CAP_2500FDX:
676 + *val = (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) ? 1 : 0;
677 + break;
678 +
651 679 case ETHER_STAT_CAP_1000FDX:
652 - *val = 1;
680 + *val = (speeds & IXGBE_LINK_SPEED_1GB_FULL) ? 1 : 0;
653 681 break;
654 682
655 683 case ETHER_STAT_CAP_100FDX:
656 - *val = 1;
684 + *val = (speeds & IXGBE_LINK_SPEED_100_FULL) ? 1 : 0;
657 685 break;
658 686
659 687 case ETHER_STAT_CAP_ASMPAUSE:
660 688 *val = ixgbe->param_asym_pause_cap;
661 689 break;
662 690
663 691 case ETHER_STAT_CAP_PAUSE:
664 692 *val = ixgbe->param_pause_cap;
665 693 break;
666 694
667 695 case ETHER_STAT_CAP_AUTONEG:
668 696 *val = 1;
669 697 break;
670 698
671 699 case ETHER_STAT_ADV_CAP_10GFDX:
672 700 *val = ixgbe->param_adv_10000fdx_cap;
673 701 break;
674 702
703 + case ETHER_STAT_ADV_CAP_5000FDX:
704 + *val = ixgbe->param_adv_5000fdx_cap;
705 + break;
706 +
707 + case ETHER_STAT_ADV_CAP_2500FDX:
708 + *val = ixgbe->param_adv_2500fdx_cap;
709 + break;
710 +
675 711 case ETHER_STAT_ADV_CAP_1000FDX:
676 712 *val = ixgbe->param_adv_1000fdx_cap;
677 713 break;
678 714
679 715 case ETHER_STAT_ADV_CAP_100FDX:
680 716 *val = ixgbe->param_adv_100fdx_cap;
681 717 break;
682 718
683 719 case ETHER_STAT_ADV_CAP_ASMPAUSE:
684 720 *val = ixgbe->param_adv_asym_pause_cap;
685 721 break;
686 722
687 723 case ETHER_STAT_ADV_CAP_PAUSE:
688 724 *val = ixgbe->param_adv_pause_cap;
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
689 725 break;
690 726
691 727 case ETHER_STAT_ADV_CAP_AUTONEG:
692 728 *val = ixgbe->param_adv_autoneg_cap;
693 729 break;
694 730
695 731 case ETHER_STAT_LP_CAP_10GFDX:
696 732 *val = ixgbe->param_lp_10000fdx_cap;
697 733 break;
698 734
735 + case ETHER_STAT_LP_CAP_5000FDX:
736 + *val = ixgbe->param_lp_5000fdx_cap;
737 + break;
738 +
739 + case ETHER_STAT_LP_CAP_2500FDX:
740 + *val = ixgbe->param_lp_2500fdx_cap;
741 + break;
742 +
699 743 case ETHER_STAT_LP_CAP_1000FDX:
700 744 *val = ixgbe->param_lp_1000fdx_cap;
701 745 break;
702 746
703 747 case ETHER_STAT_LP_CAP_100FDX:
704 748 *val = ixgbe->param_lp_100fdx_cap;
705 749 break;
706 750
707 751 case ETHER_STAT_LP_CAP_ASMPAUSE:
708 752 *val = ixgbe->param_lp_asym_pause_cap;
709 753 break;
710 754
711 755 case ETHER_STAT_LP_CAP_PAUSE:
712 756 *val = ixgbe->param_lp_pause_cap;
713 757 break;
714 758
715 759 case ETHER_STAT_LP_CAP_AUTONEG:
716 760 *val = ixgbe->param_lp_autoneg_cap;
717 761 break;
718 762
719 763 case ETHER_STAT_LINK_ASMPAUSE:
720 764 *val = ixgbe->param_asym_pause_cap;
721 765 break;
722 766
723 767 case ETHER_STAT_LINK_PAUSE:
724 768 *val = ixgbe->param_pause_cap;
725 769 break;
726 770
727 771 case ETHER_STAT_LINK_AUTONEG:
728 772 *val = ixgbe->param_adv_autoneg_cap;
729 773 break;
730 774
731 775 case ETHER_STAT_LINK_DUPLEX:
732 776 *val = ixgbe->link_duplex;
733 777 break;
734 778
735 779 case ETHER_STAT_TOOSHORT_ERRORS:
736 780 ixgbe_ks->ruc.value.ui64 +=
737 781 IXGBE_READ_REG(hw, IXGBE_RUC);
738 782 *val = ixgbe_ks->ruc.value.ui64;
739 783 break;
740 784
741 785 case ETHER_STAT_CAP_REMFAULT:
742 786 *val = ixgbe->param_rem_fault;
743 787 break;
744 788
745 789 case ETHER_STAT_ADV_REMFAULT:
746 790 *val = ixgbe->param_adv_rem_fault;
747 791 break;
748 792
749 793 case ETHER_STAT_LP_REMFAULT:
750 794 *val = ixgbe->param_lp_rem_fault;
751 795 break;
752 796
753 797 case ETHER_STAT_JABBER_ERRORS:
754 798 ixgbe_ks->rjc.value.ui64 +=
755 799 IXGBE_READ_REG(hw, IXGBE_RJC);
756 800 *val = ixgbe_ks->rjc.value.ui64;
757 801 break;
758 802
759 803 default:
760 804 mutex_exit(&ixgbe->gen_lock);
761 805 return (ENOTSUP);
762 806 }
763 807
764 808 mutex_exit(&ixgbe->gen_lock);
765 809
766 810 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) {
767 811 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED);
768 812 return (EIO);
769 813 }
770 814
771 815 return (0);
772 816 }
773 817
774 818 /*
775 819 * Retrieve a value for one of the statistics for a particular rx ring
776 820 */
777 821 int
778 822 ixgbe_rx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val)
779 823 {
780 824 ixgbe_rx_ring_t *rx_ring = (ixgbe_rx_ring_t *)rh;
781 825 ixgbe_t *ixgbe = rx_ring->ixgbe;
782 826
783 827 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
784 828 return (ECANCELED);
785 829 }
786 830
787 831 switch (stat) {
788 832 case MAC_STAT_RBYTES:
789 833 *val = rx_ring->stat_rbytes;
790 834 break;
791 835
792 836 case MAC_STAT_IPACKETS:
793 837 *val = rx_ring->stat_ipackets;
794 838 break;
795 839
796 840 default:
797 841 *val = 0;
798 842 return (ENOTSUP);
799 843 }
800 844
801 845 return (0);
802 846 }
803 847
804 848 /*
805 849 * Retrieve a value for one of the statistics for a particular tx ring
806 850 */
807 851 int
808 852 ixgbe_tx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val)
809 853 {
810 854 ixgbe_tx_ring_t *tx_ring = (ixgbe_tx_ring_t *)rh;
811 855 ixgbe_t *ixgbe = tx_ring->ixgbe;
812 856
813 857 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
814 858 return (ECANCELED);
815 859 }
816 860
817 861 switch (stat) {
818 862 case MAC_STAT_OBYTES:
819 863 *val = tx_ring->stat_obytes;
820 864 break;
821 865
822 866 case MAC_STAT_OPACKETS:
823 867 *val = tx_ring->stat_opackets;
824 868 break;
825 869
826 870 default:
827 871 *val = 0;
828 872 return (ENOTSUP);
829 873 }
830 874
831 875 return (0);
832 876 }
↓ open down ↓ |
124 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX