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 $
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>
61 __RCSID("@(#) $FreeBSD: src/sbin/atm/atm/atm_fore200.c,v 1.3.2.1 2000/07/01 06:02:14 ps Exp $");
74 #define SHOW_DRIVER 64
78 * Headers for statistics
80 #define TAXI_STATS_HDR \
81 "%s TAXI Statistics\n\
82 CRC Errs Framing Errs\n"
84 #define DEV_STATS_HDR \
85 "%s Device Statistics\n\
86 Type 1 Type 1 Type 2 Type 2\n\
87 Small Buff Large Buff Small Buff Large Buff Receive Receive\n\
88 Alloc Fail Alloc Fail Alloc Fail Alloc Fail Queue Full Carrier\n"
90 #define ATM_STATS_HDR \
91 "%s ATM Layer Statistics\n\
92 Cells In Cells Out VPI Range VPI NoConn VCI Range VCI NoConn\n"
94 #define AAL0_STATS_HDR \
95 "%s AAL 0 Statistics\n\
96 Cells In Cells Out Cell Drops\n"
98 #define AAL4_STATS_HDR \
99 "%s AAL 4 Statistics\n\
100 CRC Proto Cell PDU PDU\n\
101 Cells In Cells Out Errs Errs Drops PDUs In PDUs Out Errs Drops\n"
103 #define AAL5_STATS_HDR \
104 "%s AAL 5 Statistics\n\
105 CRC/Len CRC Proto PDU\n\
106 Cells In Cells Out Errs Drops PDUs In PDUs Out Errs Errs Drops\n"
108 #define DRIVER_STATS_HDR \
109 "%s Device Driver Statistics\n\
110 No Xmit Max Seg No No No IQ No Cmd No\n\
111 VCC Queue Seg Not Seg DMA VCC No Mbuf Full DMA Queue DMA\n\
112 Out Full Size Align Pad Out In Buff In In Sup Full Cmd\n"
114 #define OC3_STATS_HDR \
115 "%s OC-3c Statistics\n\
116 Section Path Line Line Path Corr Uncorr\n\
117 BIP8 BIP8 BIP24 FEBE FEBE HCS HCS\n\
118 Errs Errs Errs Errs Errs Errs Errs\n"
122 * Process show Fore SBA-200 statistics command
124 * The statistics printed are vendor-specific, depending on the brand of
125 * the interface card.
128 * atm show stats interface [<interface-name> [phy | dev | atm |
129 * aal0 | aal4 | aal5 | driver]]
132 * intf interface statistics are for
133 * argc number of remaining arguments to command
134 * argv pointer to remaining argument strings
141 show_fore200_stats(intf, argc, argv)
146 int buf_len, stats_type;
147 struct air_cfg_rsp *cfg;
148 struct air_vinfo_rsp *stats;
149 struct atminfreq air;
152 * Get statistics type qualifier
154 if (!strcasecmp("phy", argv[0])) {
155 stats_type = SHOW_PHY;
156 } else if (!strcasecmp("dev", argv[0])) {
157 stats_type = SHOW_DEV;
158 } else if (!strcasecmp("atm", argv[0])) {
159 stats_type = SHOW_ATM;
160 } else if (!strcasecmp("aal0", argv[0])) {
161 stats_type = SHOW_AAL0;
162 } else if (!strcasecmp("aal4", argv[0])) {
163 stats_type = SHOW_AAL4;
164 } else if (!strcasecmp("aal5", argv[0])) {
165 stats_type = SHOW_AAL5;
166 } else if (!strcasecmp("driver", argv[0])) {
167 stats_type = SHOW_DRIVER;
169 fprintf(stderr, "%s: Illegal statistics type\n", prog);
175 * Get adapter configuration from the kernel
177 UM_ZERO(&air, sizeof(air));
178 air.air_opcode = AIOCS_INF_CFG;
179 strcpy(air.air_cfg_intf, intf);
180 buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
182 fprintf(stderr, "%s: ", prog);
186 perror("Internal error");
189 fprintf(stderr, "%s is not an ATM device\n",
193 perror("ioctl (AIOCINFO)");
198 cfg = (struct air_cfg_rsp *) air.air_buf_addr;
201 * Get vendor-specific statistics from the kernel
203 UM_ZERO(&air, sizeof(air));
204 air.air_opcode = AIOCS_INF_VST;
205 strcpy(air.air_vinfo_intf, intf);
206 buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
208 fprintf(stderr, "%s: ", prog);
212 perror("Internal error");
215 fprintf(stderr, "%s is not an ATM device\n",
219 perror("ioctl (AIOCINFO)");
224 stats = (struct air_vinfo_rsp *) air.air_buf_addr;
227 * Print the statistics
229 if (buf_len < sizeof(struct air_vinfo_rsp) +
230 sizeof(Fore_stats)) {
236 switch (stats_type) {
238 switch (cfg->acp_media) {
241 print_fore200_taxi(stats);
244 print_fore200_oc3(stats);
253 print_fore200_dev(stats);
256 print_fore200_atm(stats);
259 print_fore200_aal0(stats);
262 print_fore200_aal4(stats);
265 print_fore200_aal5(stats);
268 print_fore200_driver(stats);
278 * Print Fore ASX-200 TAXI statistics
281 * vi pointer to vendor-specific statistics to print
288 print_fore200_taxi(vi)
289 struct air_vinfo_rsp *vi;
294 * Bump stats pointer past header info
296 stats = (Fore_stats *)
297 ((u_long) vi + sizeof(struct air_vinfo_rsp));
302 printf(TAXI_STATS_HDR, get_adapter_name(vi->avsp_intf));
305 * Print the physical layer info
307 printf("%10ld %12ld\n",
308 stats->st_taxi.taxi_bad_crc,
309 stats->st_taxi.taxi_framing);
314 * Print Fore ASX-200 OC-3c statistics
317 * vi pointer to vendor-specific statistics to print
324 print_fore200_oc3(vi)
325 struct air_vinfo_rsp *vi;
330 * Bump stats pointer past header info
332 stats = (Fore_stats *)
333 ((u_long) vi + sizeof(struct air_vinfo_rsp));
338 printf(OC3_STATS_HDR, get_adapter_name(vi->avsp_intf));
341 * Print the OC-3c info
343 printf("%7ld %7ld %7ld %7ld %7ld %7ld %7ld\n",
344 stats->st_oc3.oc3_sect_bip8,
345 stats->st_oc3.oc3_path_bip8,
346 stats->st_oc3.oc3_line_bip24,
347 stats->st_oc3.oc3_line_febe,
348 stats->st_oc3.oc3_path_febe,
349 stats->st_oc3.oc3_hec_corr,
350 stats->st_oc3.oc3_hec_uncorr);
355 * Print Fore ASX-200 device statistics
358 * vi pointer to vendor-specific statistics to print
365 print_fore200_dev(vi)
366 struct air_vinfo_rsp *vi;
371 * Bump stats pointer past header info
373 stats = (Fore_stats *)
374 ((u_long) vi + sizeof(struct air_vinfo_rsp));
379 printf(DEV_STATS_HDR, get_adapter_name(vi->avsp_intf));
382 * Print the device info
384 printf("%10ld %10ld %10ld %10ld %10ld %s\n",
385 stats->st_misc.buf1_sm_fail,
386 stats->st_misc.buf1_lg_fail,
387 stats->st_misc.buf2_sm_fail,
388 stats->st_misc.buf2_lg_fail,
389 stats->st_misc.rcvd_pdu_fail,
390 (stats->st_misc.carrier_status ? "On" : "Off"));
395 * Print Fore ASX-200 ATM statistics
398 * vi pointer to vendor-specific statistics to print
405 print_fore200_atm(vi)
406 struct air_vinfo_rsp *vi;
411 * Bump stats pointer past header info
413 stats = (Fore_stats *)
414 ((u_long) vi + sizeof(struct air_vinfo_rsp));
419 printf(ATM_STATS_HDR, get_adapter_name(vi->avsp_intf));
422 * Print the ATM layer info
424 printf("%10ld %10ld %10ld %10ld %10ld %10ld\n",
425 stats->st_atm.atm_rcvd,
426 stats->st_atm.atm_xmit,
427 stats->st_atm.atm_vpi_range,
428 stats->st_atm.atm_vpi_noconn,
429 stats->st_atm.atm_vci_range,
430 stats->st_atm.atm_vci_noconn);
435 * Print Fore ASX-200 AAL 0 statistics
438 * vi pointer to vendor-specific statistics to print
445 print_fore200_aal0(vi)
446 struct air_vinfo_rsp *vi;
451 * Bump stats pointer past header info
453 stats = (Fore_stats *)
454 ((u_long) vi + sizeof(struct air_vinfo_rsp));
459 printf(AAL0_STATS_HDR, get_adapter_name(vi->avsp_intf));
462 * Print the AAL 0 info
464 printf("%10ld %10ld %10ld\n",
465 stats->st_aal0.aal0_rcvd,
466 stats->st_aal0.aal0_xmit,
467 stats->st_aal0.aal0_drops);
472 * Print Fore ASX-200 AAL 4 statistics
475 * vi pointer to vendor-specific statistics to print
482 print_fore200_aal4(vi)
483 struct air_vinfo_rsp *vi;
488 * Bump stats pointer past header info
490 stats = (Fore_stats *)
491 ((u_long) vi + sizeof(struct air_vinfo_rsp));
496 printf(AAL4_STATS_HDR, get_adapter_name(vi->avsp_intf));
499 * Print the AAL 4 info
501 printf("%10ld %10ld %5ld %5ld %5ld %9ld %9ld %5ld %5ld\n",
502 stats->st_aal4.aal4_rcvd,
503 stats->st_aal4.aal4_xmit,
504 stats->st_aal4.aal4_crc,
505 stats->st_aal4.aal4_sar_cs,
506 stats->st_aal4.aal4_drops,
507 stats->st_aal4.aal4_pdu_rcvd,
508 stats->st_aal4.aal4_pdu_xmit,
509 stats->st_aal4.aal4_pdu_errs,
510 stats->st_aal4.aal4_pdu_drops);
515 * Print Fore ASX-200 AAL 5 statistics
518 * vi pointer to vendor-specific statistics to print
525 print_fore200_aal5(vi)
526 struct air_vinfo_rsp *vi;
531 * Bump stats pointer past header info
533 stats = (Fore_stats *)
534 ((u_long) vi + sizeof(struct air_vinfo_rsp));
539 printf(AAL5_STATS_HDR, get_adapter_name(vi->avsp_intf));
542 * Print the AAL 5 info
544 printf("%10ld %10ld %5ld %5ld %9ld %9ld %5ld %5ld %5ld\n",
545 stats->st_aal5.aal5_rcvd,
546 stats->st_aal5.aal5_xmit,
547 stats->st_aal5.aal5_crc_len,
548 stats->st_aal5.aal5_drops,
549 stats->st_aal5.aal5_pdu_rcvd,
550 stats->st_aal5.aal5_pdu_xmit,
551 stats->st_aal5.aal5_pdu_crc,
552 stats->st_aal5.aal5_pdu_errs,
553 stats->st_aal5.aal5_pdu_drops);
558 * Print Fore ASX-200 device driver statistics
561 * vi pointer to vendor-specific statistics to print
568 print_fore200_driver(vi)
569 struct air_vinfo_rsp *vi;
574 * Bump stats pointer past header info
576 stats = (Fore_stats *)
577 ((u_long) vi + sizeof(struct air_vinfo_rsp));
582 printf(DRIVER_STATS_HDR, get_adapter_name(vi->avsp_intf));
585 * Print the driver info
587 printf("%4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
588 stats->st_drv.drv_xm_notact,
589 stats->st_drv.drv_xm_full,
590 stats->st_drv.drv_xm_maxpdu,
591 stats->st_drv.drv_xm_segnoal,
592 stats->st_drv.drv_xm_seglen,
593 stats->st_drv.drv_xm_segdma,
594 stats->st_drv.drv_rv_novcc,
595 stats->st_drv.drv_rv_nosbf,
596 stats->st_drv.drv_rv_nomb,
597 stats->st_drv.drv_rv_ifull,
598 stats->st_drv.drv_bf_segdma,
599 stats->st_drv.drv_cm_full,
600 stats->st_drv.drv_cm_nodma);