311 if (rx_srs[i] == 0)
312 continue;
313 mdb_printf("%p ", rx_srs[i]);
314 }
315 mdb_printf("\n");
316 break;
317 }
318 case MAC_FLOW_TX: {
319 uintptr_t tx_srs = 0, txaddr;
320
321 txaddr = addr + OFFSETOF(flow_entry_t, fe_tx_srs);
322 (void) mdb_vread(&tx_srs, sizeof (uintptr_t), txaddr);
323 mdb_printf("%?p %-32s %?p\n",
324 addr, fe.fe_flow_name, fe.fe_tx_srs);
325 break;
326 }
327 case MAC_FLOW_STATS: {
328 uint64_t totibytes = 0;
329 uint64_t totobytes = 0;
330 mac_soft_ring_set_t *mac_srs;
331 mac_rx_stats_t *mac_rx_stat;
332 mac_tx_stats_t *mac_tx_stat;
333 int i;
334
335 for (i = 0; i < fe.fe_rx_srs_cnt; i++) {
336 mac_srs = (mac_soft_ring_set_t *)(fe.fe_rx_srs[i]);
337 mac_rx_stat = &mac_srs->srs_rx.sr_stat;
338 totibytes += mac_rx_stat->mrs_intrbytes +
339 mac_rx_stat->mrs_pollbytes +
340 mac_rx_stat->mrs_lclbytes;
341 }
342 mac_srs = (mac_soft_ring_set_t *)(fe.fe_tx_srs);
343 if (mac_srs != NULL) {
344 mac_tx_stat = &mac_srs->srs_tx.st_stat;
345 totobytes = mac_tx_stat->mts_obytes;
346 }
347 mdb_printf("%?p %-32s %16llu %16llu\n",
348 addr, fe.fe_flow_name, totibytes, totobytes);
349
350 break;
351 }
352 }
353 return (DCMD_OK);
354 }
355
356 /*
357 * Parse the arguments passed to the dcmd and print all or one flow_entry_t
358 * structures
359 */
360 static int
361 mac_flow_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
362 {
363 uint_t args = 0;
364
365 if (!(flags & DCMD_ADDRSPEC)) {
366 if (mdb_walk_dcmd("mac_flow", "mac_flow", argc, argv) == -1) {
|
311 if (rx_srs[i] == 0)
312 continue;
313 mdb_printf("%p ", rx_srs[i]);
314 }
315 mdb_printf("\n");
316 break;
317 }
318 case MAC_FLOW_TX: {
319 uintptr_t tx_srs = 0, txaddr;
320
321 txaddr = addr + OFFSETOF(flow_entry_t, fe_tx_srs);
322 (void) mdb_vread(&tx_srs, sizeof (uintptr_t), txaddr);
323 mdb_printf("%?p %-32s %?p\n",
324 addr, fe.fe_flow_name, fe.fe_tx_srs);
325 break;
326 }
327 case MAC_FLOW_STATS: {
328 uint64_t totibytes = 0;
329 uint64_t totobytes = 0;
330 mac_soft_ring_set_t *mac_srs;
331 mac_rx_stats_t mac_rx_stat;
332 mac_tx_stats_t mac_tx_stat;
333 int i;
334
335 /*
336 * Sum bytes for all Rx SRS.
337 */
338 for (i = 0; i < fe.fe_rx_srs_cnt; i++) {
339 mac_srs = (mac_soft_ring_set_t *)(fe.fe_rx_srs[i]);
340 if (mdb_vread(&mac_rx_stat, sizeof (mac_rx_stats_t),
341 (uintptr_t)&mac_srs->srs_rx.sr_stat) == -1) {
342 mdb_warn("failed to read mac_rx_stats_t at %p",
343 &mac_srs->srs_rx.sr_stat);
344 return (DCMD_ERR);
345 }
346
347 totibytes += mac_rx_stat.mrs_intrbytes +
348 mac_rx_stat.mrs_pollbytes +
349 mac_rx_stat.mrs_lclbytes;
350 }
351
352 /*
353 * Sum bytes for Tx SRS.
354 */
355 mac_srs = (mac_soft_ring_set_t *)(fe.fe_tx_srs);
356 if (mac_srs != NULL) {
357 if (mdb_vread(&mac_tx_stat, sizeof (mac_tx_stats_t),
358 (uintptr_t)&mac_srs->srs_tx.st_stat) == -1) {
359 mdb_warn("failed to read max_tx_stats_t at %p",
360 &mac_srs->srs_tx.st_stat);
361 return (DCMD_ERR);
362 }
363
364 totobytes = mac_tx_stat.mts_obytes;
365 }
366
367 mdb_printf("%?p %-32s %16llu %16llu\n",
368 addr, fe.fe_flow_name, totibytes, totobytes);
369
370 break;
371 }
372 }
373 return (DCMD_OK);
374 }
375
376 /*
377 * Parse the arguments passed to the dcmd and print all or one flow_entry_t
378 * structures
379 */
380 static int
381 mac_flow_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
382 {
383 uint_t args = 0;
384
385 if (!(flags & DCMD_ADDRSPEC)) {
386 if (mdb_walk_dcmd("mac_flow", "mac_flow", argc, argv) == -1) {
|