3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sbin/atm/atm/atm_fore200.c,v 1.3.2.1 2000/07/01 06:02:14 ps Exp $
27 * @(#) $DragonFly: src/sbin/atm/atm/atm_fore200.c,v 1.2 2003/06/17 04:27:32 dillon Exp $
31 * User configuration and display program
32 * --------------------------------------
34 * Routines for Fore SBA-200-specific subcommands
38 #include <sys/param.h>
39 #include <sys/socket.h>
41 #include <netinet/in.h>
42 #include <netatm/port.h>
43 #include <netatm/atm.h>
44 #include <netatm/atm_if.h>
45 #include <netatm/atm_sap.h>
46 #include <netatm/atm_sys.h>
47 #include <netatm/atm_ioctl.h>
48 #include <dev/hfa/fore_aali.h>
49 #include <dev/hfa/fore_slave.h>
50 #include <dev/hfa/fore_stats.h>
69 #define SHOW_DRIVER 64
73 * Headers for statistics
75 #define TAXI_STATS_HDR \
76 "%s TAXI Statistics\n\
77 CRC Errs Framing Errs\n"
79 #define DEV_STATS_HDR \
80 "%s Device Statistics\n\
81 Type 1 Type 1 Type 2 Type 2\n\
82 Small Buff Large Buff Small Buff Large Buff Receive Receive\n\
83 Alloc Fail Alloc Fail Alloc Fail Alloc Fail Queue Full Carrier\n"
85 #define ATM_STATS_HDR \
86 "%s ATM Layer Statistics\n\
87 Cells In Cells Out VPI Range VPI NoConn VCI Range VCI NoConn\n"
89 #define AAL0_STATS_HDR \
90 "%s AAL 0 Statistics\n\
91 Cells In Cells Out Cell Drops\n"
93 #define AAL4_STATS_HDR \
94 "%s AAL 4 Statistics\n\
95 CRC Proto Cell PDU PDU\n\
96 Cells In Cells Out Errs Errs Drops PDUs In PDUs Out Errs Drops\n"
98 #define AAL5_STATS_HDR \
99 "%s AAL 5 Statistics\n\
100 CRC/Len CRC Proto PDU\n\
101 Cells In Cells Out Errs Drops PDUs In PDUs Out Errs Errs Drops\n"
103 #define DRIVER_STATS_HDR \
104 "%s Device Driver Statistics\n\
105 No Xmit Max Seg No No No IQ No Cmd No\n\
106 VCC Queue Seg Not Seg DMA VCC No Mbuf Full DMA Queue DMA\n\
107 Out Full Size Align Pad Out In Buff In In Sup Full Cmd\n"
109 #define OC3_STATS_HDR \
110 "%s OC-3c Statistics\n\
111 Section Path Line Line Path Corr Uncorr\n\
112 BIP8 BIP8 BIP24 FEBE FEBE HCS HCS\n\
113 Errs Errs Errs Errs Errs Errs Errs\n"
117 * Process show Fore SBA-200 statistics command
119 * The statistics printed are vendor-specific, depending on the brand of
120 * the interface card.
123 * atm show stats interface [<interface-name> [phy | dev | atm |
124 * aal0 | aal4 | aal5 | driver]]
127 * intf interface statistics are for
128 * argc number of remaining arguments to command
129 * argv pointer to remaining argument strings
136 show_fore200_stats(intf, argc, argv)
141 int buf_len, stats_type;
142 struct air_cfg_rsp *cfg;
143 struct air_vinfo_rsp *stats;
144 struct atminfreq air;
147 * Get statistics type qualifier
149 if (!strcasecmp("phy", argv[0])) {
150 stats_type = SHOW_PHY;
151 } else if (!strcasecmp("dev", argv[0])) {
152 stats_type = SHOW_DEV;
153 } else if (!strcasecmp("atm", argv[0])) {
154 stats_type = SHOW_ATM;
155 } else if (!strcasecmp("aal0", argv[0])) {
156 stats_type = SHOW_AAL0;
157 } else if (!strcasecmp("aal4", argv[0])) {
158 stats_type = SHOW_AAL4;
159 } else if (!strcasecmp("aal5", argv[0])) {
160 stats_type = SHOW_AAL5;
161 } else if (!strcasecmp("driver", argv[0])) {
162 stats_type = SHOW_DRIVER;
164 fprintf(stderr, "%s: Illegal statistics type\n", prog);
170 * Get adapter configuration from the kernel
172 UM_ZERO(&air, sizeof(air));
173 air.air_opcode = AIOCS_INF_CFG;
174 strcpy(air.air_cfg_intf, intf);
175 buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
177 fprintf(stderr, "%s: ", prog);
181 perror("Internal error");
184 fprintf(stderr, "%s is not an ATM device\n",
188 perror("ioctl (AIOCINFO)");
193 cfg = (struct air_cfg_rsp *) air.air_buf_addr;
196 * Get vendor-specific statistics from the kernel
198 UM_ZERO(&air, sizeof(air));
199 air.air_opcode = AIOCS_INF_VST;
200 strcpy(air.air_vinfo_intf, intf);
201 buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
203 fprintf(stderr, "%s: ", prog);
207 perror("Internal error");
210 fprintf(stderr, "%s is not an ATM device\n",
214 perror("ioctl (AIOCINFO)");
219 stats = (struct air_vinfo_rsp *) air.air_buf_addr;
222 * Print the statistics
224 if (buf_len < sizeof(struct air_vinfo_rsp) +
225 sizeof(Fore_stats)) {
231 switch (stats_type) {
233 switch (cfg->acp_media) {
236 print_fore200_taxi(stats);
239 print_fore200_oc3(stats);
248 print_fore200_dev(stats);
251 print_fore200_atm(stats);
254 print_fore200_aal0(stats);
257 print_fore200_aal4(stats);
260 print_fore200_aal5(stats);
263 print_fore200_driver(stats);
273 * Print Fore ASX-200 TAXI statistics
276 * vi pointer to vendor-specific statistics to print
283 print_fore200_taxi(vi)
284 struct air_vinfo_rsp *vi;
289 * Bump stats pointer past header info
291 stats = (Fore_stats *)
292 ((u_long) vi + sizeof(struct air_vinfo_rsp));
297 printf(TAXI_STATS_HDR, get_adapter_name(vi->avsp_intf));
300 * Print the physical layer info
302 printf("%10ld %12ld\n",
303 stats->st_taxi.taxi_bad_crc,
304 stats->st_taxi.taxi_framing);
309 * Print Fore ASX-200 OC-3c statistics
312 * vi pointer to vendor-specific statistics to print
319 print_fore200_oc3(vi)
320 struct air_vinfo_rsp *vi;
325 * Bump stats pointer past header info
327 stats = (Fore_stats *)
328 ((u_long) vi + sizeof(struct air_vinfo_rsp));
333 printf(OC3_STATS_HDR, get_adapter_name(vi->avsp_intf));
336 * Print the OC-3c info
338 printf("%7ld %7ld %7ld %7ld %7ld %7ld %7ld\n",
339 stats->st_oc3.oc3_sect_bip8,
340 stats->st_oc3.oc3_path_bip8,
341 stats->st_oc3.oc3_line_bip24,
342 stats->st_oc3.oc3_line_febe,
343 stats->st_oc3.oc3_path_febe,
344 stats->st_oc3.oc3_hec_corr,
345 stats->st_oc3.oc3_hec_uncorr);
350 * Print Fore ASX-200 device statistics
353 * vi pointer to vendor-specific statistics to print
360 print_fore200_dev(vi)
361 struct air_vinfo_rsp *vi;
366 * Bump stats pointer past header info
368 stats = (Fore_stats *)
369 ((u_long) vi + sizeof(struct air_vinfo_rsp));
374 printf(DEV_STATS_HDR, get_adapter_name(vi->avsp_intf));
377 * Print the device info
379 printf("%10ld %10ld %10ld %10ld %10ld %s\n",
380 stats->st_misc.buf1_sm_fail,
381 stats->st_misc.buf1_lg_fail,
382 stats->st_misc.buf2_sm_fail,
383 stats->st_misc.buf2_lg_fail,
384 stats->st_misc.rcvd_pdu_fail,
385 (stats->st_misc.carrier_status ? "On" : "Off"));
390 * Print Fore ASX-200 ATM statistics
393 * vi pointer to vendor-specific statistics to print
400 print_fore200_atm(vi)
401 struct air_vinfo_rsp *vi;
406 * Bump stats pointer past header info
408 stats = (Fore_stats *)
409 ((u_long) vi + sizeof(struct air_vinfo_rsp));
414 printf(ATM_STATS_HDR, get_adapter_name(vi->avsp_intf));
417 * Print the ATM layer info
419 printf("%10ld %10ld %10ld %10ld %10ld %10ld\n",
420 stats->st_atm.atm_rcvd,
421 stats->st_atm.atm_xmit,
422 stats->st_atm.atm_vpi_range,
423 stats->st_atm.atm_vpi_noconn,
424 stats->st_atm.atm_vci_range,
425 stats->st_atm.atm_vci_noconn);
430 * Print Fore ASX-200 AAL 0 statistics
433 * vi pointer to vendor-specific statistics to print
440 print_fore200_aal0(vi)
441 struct air_vinfo_rsp *vi;
446 * Bump stats pointer past header info
448 stats = (Fore_stats *)
449 ((u_long) vi + sizeof(struct air_vinfo_rsp));
454 printf(AAL0_STATS_HDR, get_adapter_name(vi->avsp_intf));
457 * Print the AAL 0 info
459 printf("%10ld %10ld %10ld\n",
460 stats->st_aal0.aal0_rcvd,
461 stats->st_aal0.aal0_xmit,
462 stats->st_aal0.aal0_drops);
467 * Print Fore ASX-200 AAL 4 statistics
470 * vi pointer to vendor-specific statistics to print
477 print_fore200_aal4(vi)
478 struct air_vinfo_rsp *vi;
483 * Bump stats pointer past header info
485 stats = (Fore_stats *)
486 ((u_long) vi + sizeof(struct air_vinfo_rsp));
491 printf(AAL4_STATS_HDR, get_adapter_name(vi->avsp_intf));
494 * Print the AAL 4 info
496 printf("%10ld %10ld %5ld %5ld %5ld %9ld %9ld %5ld %5ld\n",
497 stats->st_aal4.aal4_rcvd,
498 stats->st_aal4.aal4_xmit,
499 stats->st_aal4.aal4_crc,
500 stats->st_aal4.aal4_sar_cs,
501 stats->st_aal4.aal4_drops,
502 stats->st_aal4.aal4_pdu_rcvd,
503 stats->st_aal4.aal4_pdu_xmit,
504 stats->st_aal4.aal4_pdu_errs,
505 stats->st_aal4.aal4_pdu_drops);
510 * Print Fore ASX-200 AAL 5 statistics
513 * vi pointer to vendor-specific statistics to print
520 print_fore200_aal5(vi)
521 struct air_vinfo_rsp *vi;
526 * Bump stats pointer past header info
528 stats = (Fore_stats *)
529 ((u_long) vi + sizeof(struct air_vinfo_rsp));
534 printf(AAL5_STATS_HDR, get_adapter_name(vi->avsp_intf));
537 * Print the AAL 5 info
539 printf("%10ld %10ld %5ld %5ld %9ld %9ld %5ld %5ld %5ld\n",
540 stats->st_aal5.aal5_rcvd,
541 stats->st_aal5.aal5_xmit,
542 stats->st_aal5.aal5_crc_len,
543 stats->st_aal5.aal5_drops,
544 stats->st_aal5.aal5_pdu_rcvd,
545 stats->st_aal5.aal5_pdu_xmit,
546 stats->st_aal5.aal5_pdu_crc,
547 stats->st_aal5.aal5_pdu_errs,
548 stats->st_aal5.aal5_pdu_drops);
553 * Print Fore ASX-200 device driver statistics
556 * vi pointer to vendor-specific statistics to print
563 print_fore200_driver(vi)
564 struct air_vinfo_rsp *vi;
569 * Bump stats pointer past header info
571 stats = (Fore_stats *)
572 ((u_long) vi + sizeof(struct air_vinfo_rsp));
577 printf(DRIVER_STATS_HDR, get_adapter_name(vi->avsp_intf));
580 * Print the driver info
582 printf("%4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
583 stats->st_drv.drv_xm_notact,
584 stats->st_drv.drv_xm_full,
585 stats->st_drv.drv_xm_maxpdu,
586 stats->st_drv.drv_xm_segnoal,
587 stats->st_drv.drv_xm_seglen,
588 stats->st_drv.drv_xm_segdma,
589 stats->st_drv.drv_rv_novcc,
590 stats->st_drv.drv_rv_nosbf,
591 stats->st_drv.drv_rv_nomb,
592 stats->st_drv.drv_rv_ifull,
593 stats->st_drv.drv_bf_segdma,
594 stats->st_drv.drv_cm_full,
595 stats->st_drv.drv_cm_nodma);