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.
28 * User configuration and display program
29 * --------------------------------------
31 * Routines for Fore SBA-200-specific subcommands
35 #include <sys/param.h>
36 #include <sys/socket.h>
38 #include <netinet/in.h>
39 #include <netatm/port.h>
40 #include <netatm/atm.h>
41 #include <netatm/atm_if.h>
42 #include <netatm/atm_sap.h>
43 #include <netatm/atm_sys.h>
44 #include <netatm/atm_ioctl.h>
45 #include <dev/hfa/fore_aali.h>
46 #include <dev/hfa/fore_slave.h>
47 #include <dev/hfa/fore_stats.h>
59 __RCSID("@(#) $FreeBSD$");
72 #define SHOW_DRIVER 64
76 * Headers for statistics
78 #define TAXI_STATS_HDR \
79 "%s TAXI Statistics\n\
80 CRC Errs Framing Errs\n"
82 #define DEV_STATS_HDR \
83 "%s Device Statistics\n\
84 Type 1 Type 1 Type 2 Type 2\n\
85 Small Buff Large Buff Small Buff Large Buff Receive Receive\n\
86 Alloc Fail Alloc Fail Alloc Fail Alloc Fail Queue Full Carrier\n"
88 #define ATM_STATS_HDR \
89 "%s ATM Layer Statistics\n\
90 Cells In Cells Out VPI Range VPI NoConn VCI Range VCI NoConn\n"
92 #define AAL0_STATS_HDR \
93 "%s AAL 0 Statistics\n\
94 Cells In Cells Out Cell Drops\n"
96 #define AAL4_STATS_HDR \
97 "%s AAL 4 Statistics\n\
98 CRC Proto Cell PDU PDU\n\
99 Cells In Cells Out Errs Errs Drops PDUs In PDUs Out Errs Drops\n"
101 #define AAL5_STATS_HDR \
102 "%s AAL 5 Statistics\n\
103 CRC/Len CRC Proto PDU\n\
104 Cells In Cells Out Errs Drops PDUs In PDUs Out Errs Errs Drops\n"
106 #define DRIVER_STATS_HDR \
107 "%s Device Driver Statistics\n\
108 No Xmit Max Seg No No No IQ No Cmd No\n\
109 VCC Queue Seg Not Seg DMA VCC No Mbuf Full DMA Queue DMA\n\
110 Out Full Size Align Pad Out In Buff In In Sup Full Cmd\n"
112 #define OC3_STATS_HDR \
113 "%s OC-3c Statistics\n\
114 Section Path Line Line Path Corr Uncorr\n\
115 BIP8 BIP8 BIP24 FEBE FEBE HCS HCS\n\
116 Errs Errs Errs Errs Errs Errs Errs\n"
118 static void print_fore200_taxi(struct air_vinfo_rsp *);
119 static void print_fore200_oc3(struct air_vinfo_rsp *);
120 static void print_fore200_dev(struct air_vinfo_rsp *);
121 static void print_fore200_atm(struct air_vinfo_rsp *);
122 static void print_fore200_aal0(struct air_vinfo_rsp *);
123 static void print_fore200_aal4(struct air_vinfo_rsp *);
124 static void print_fore200_aal5(struct air_vinfo_rsp *);
125 static void print_fore200_driver(struct air_vinfo_rsp *);
128 * Process show Fore SBA-200 statistics command
130 * The statistics printed are vendor-specific, depending on the brand of
131 * the interface card.
134 * atm show stats interface [<interface-name> [phy | dev | atm |
135 * aal0 | aal4 | aal5 | driver]]
138 * intf interface statistics are for
139 * argc number of remaining arguments to command
140 * argv pointer to remaining argument strings
147 show_fore200_stats(intf, argc, argv)
154 struct air_cfg_rsp *cfg;
155 struct air_vinfo_rsp *stats;
156 struct atminfreq air;
159 * Get statistics type qualifier
161 if (!strcasecmp("phy", argv[0])) {
162 stats_type = SHOW_PHY;
163 } else if (!strcasecmp("dev", argv[0])) {
164 stats_type = SHOW_DEV;
165 } else if (!strcasecmp("atm", argv[0])) {
166 stats_type = SHOW_ATM;
167 } else if (!strcasecmp("aal0", argv[0])) {
168 stats_type = SHOW_AAL0;
169 } else if (!strcasecmp("aal4", argv[0])) {
170 stats_type = SHOW_AAL4;
171 } else if (!strcasecmp("aal5", argv[0])) {
172 stats_type = SHOW_AAL5;
173 } else if (!strcasecmp("driver", argv[0])) {
174 stats_type = SHOW_DRIVER;
176 errx(1, "Illegal statistics type");
181 * Get adapter configuration from the kernel
183 bzero(&air, sizeof(air));
184 air.air_opcode = AIOCS_INF_CFG;
185 strcpy(air.air_cfg_intf, intf);
186 buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
191 err(1, "Internal error");
193 errx(1, "%s is not an ATM device", intf);
195 err(1, "ioctl (AIOCINFO)");
198 cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
201 * Get vendor-specific statistics from the kernel
203 bzero(&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);
211 err(1, "Internal error");
213 errx(1, "%s is not an ATM device", intf);
215 err(1, "ioctl (AIOCINFO)");
218 stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
221 * Print the statistics
223 if ((size_t)buf_len < sizeof(struct air_vinfo_rsp) +
224 sizeof(Fore_stats)) {
230 switch (stats_type) {
232 switch (cfg->acp_media) {
235 print_fore200_taxi(stats);
238 print_fore200_oc3(stats);
247 print_fore200_dev(stats);
250 print_fore200_atm(stats);
253 print_fore200_aal0(stats);
256 print_fore200_aal4(stats);
259 print_fore200_aal5(stats);
262 print_fore200_driver(stats);
272 * Print Fore ASX-200 TAXI statistics
275 * vi pointer to vendor-specific statistics to print
282 print_fore200_taxi(vi)
283 struct air_vinfo_rsp *vi;
288 * Bump stats pointer past header info
290 stats = (Fore_stats *)
291 ((u_long) vi + sizeof(struct air_vinfo_rsp));
296 printf(TAXI_STATS_HDR, get_adapter_name(vi->avsp_intf));
299 * Print the physical layer info
301 printf("%10ld %12ld\n",
302 stats->st_taxi.taxi_bad_crc,
303 stats->st_taxi.taxi_framing);
308 * Print Fore ASX-200 OC-3c statistics
311 * vi pointer to vendor-specific statistics to print
318 print_fore200_oc3(vi)
319 struct air_vinfo_rsp *vi;
324 * Bump stats pointer past header info
326 stats = (Fore_stats *)
327 ((u_long) vi + sizeof(struct air_vinfo_rsp));
332 printf(OC3_STATS_HDR, get_adapter_name(vi->avsp_intf));
335 * Print the OC-3c info
337 printf("%7ld %7ld %7ld %7ld %7ld %7ld %7ld\n",
338 stats->st_oc3.oc3_sect_bip8,
339 stats->st_oc3.oc3_path_bip8,
340 stats->st_oc3.oc3_line_bip24,
341 stats->st_oc3.oc3_line_febe,
342 stats->st_oc3.oc3_path_febe,
343 stats->st_oc3.oc3_hec_corr,
344 stats->st_oc3.oc3_hec_uncorr);
349 * Print Fore ASX-200 device statistics
352 * vi pointer to vendor-specific statistics to print
359 print_fore200_dev(vi)
360 struct air_vinfo_rsp *vi;
365 * Bump stats pointer past header info
367 stats = (Fore_stats *)
368 ((u_long) vi + sizeof(struct air_vinfo_rsp));
373 printf(DEV_STATS_HDR, get_adapter_name(vi->avsp_intf));
376 * Print the device info
378 printf("%10ld %10ld %10ld %10ld %10ld %s\n",
379 stats->st_misc.buf1_sm_fail,
380 stats->st_misc.buf1_lg_fail,
381 stats->st_misc.buf2_sm_fail,
382 stats->st_misc.buf2_lg_fail,
383 stats->st_misc.rcvd_pdu_fail,
384 (stats->st_misc.carrier_status ? "On" : "Off"));
389 * Print Fore ASX-200 ATM statistics
392 * vi pointer to vendor-specific statistics to print
399 print_fore200_atm(vi)
400 struct air_vinfo_rsp *vi;
405 * Bump stats pointer past header info
407 stats = (Fore_stats *)
408 ((u_long) vi + sizeof(struct air_vinfo_rsp));
413 printf(ATM_STATS_HDR, get_adapter_name(vi->avsp_intf));
416 * Print the ATM layer info
418 printf("%10ld %10ld %10ld %10ld %10ld %10ld\n",
419 stats->st_atm.atm_rcvd,
420 stats->st_atm.atm_xmit,
421 stats->st_atm.atm_vpi_range,
422 stats->st_atm.atm_vpi_noconn,
423 stats->st_atm.atm_vci_range,
424 stats->st_atm.atm_vci_noconn);
429 * Print Fore ASX-200 AAL 0 statistics
432 * vi pointer to vendor-specific statistics to print
439 print_fore200_aal0(vi)
440 struct air_vinfo_rsp *vi;
445 * Bump stats pointer past header info
447 stats = (Fore_stats *)
448 ((u_long) vi + sizeof(struct air_vinfo_rsp));
453 printf(AAL0_STATS_HDR, get_adapter_name(vi->avsp_intf));
456 * Print the AAL 0 info
458 printf("%10ld %10ld %10ld\n",
459 stats->st_aal0.aal0_rcvd,
460 stats->st_aal0.aal0_xmit,
461 stats->st_aal0.aal0_drops);
466 * Print Fore ASX-200 AAL 4 statistics
469 * vi pointer to vendor-specific statistics to print
476 print_fore200_aal4(vi)
477 struct air_vinfo_rsp *vi;
482 * Bump stats pointer past header info
484 stats = (Fore_stats *)
485 ((u_long) vi + sizeof(struct air_vinfo_rsp));
490 printf(AAL4_STATS_HDR, get_adapter_name(vi->avsp_intf));
493 * Print the AAL 4 info
495 printf("%10ld %10ld %5ld %5ld %5ld %9ld %9ld %5ld %5ld\n",
496 stats->st_aal4.aal4_rcvd,
497 stats->st_aal4.aal4_xmit,
498 stats->st_aal4.aal4_crc,
499 stats->st_aal4.aal4_sar_cs,
500 stats->st_aal4.aal4_drops,
501 stats->st_aal4.aal4_pdu_rcvd,
502 stats->st_aal4.aal4_pdu_xmit,
503 stats->st_aal4.aal4_pdu_errs,
504 stats->st_aal4.aal4_pdu_drops);
509 * Print Fore ASX-200 AAL 5 statistics
512 * vi pointer to vendor-specific statistics to print
519 print_fore200_aal5(vi)
520 struct air_vinfo_rsp *vi;
525 * Bump stats pointer past header info
527 stats = (Fore_stats *)
528 ((u_long) vi + sizeof(struct air_vinfo_rsp));
533 printf(AAL5_STATS_HDR, get_adapter_name(vi->avsp_intf));
536 * Print the AAL 5 info
538 printf("%10ld %10ld %5ld %5ld %9ld %9ld %5ld %5ld %5ld\n",
539 stats->st_aal5.aal5_rcvd,
540 stats->st_aal5.aal5_xmit,
541 stats->st_aal5.aal5_crc_len,
542 stats->st_aal5.aal5_drops,
543 stats->st_aal5.aal5_pdu_rcvd,
544 stats->st_aal5.aal5_pdu_xmit,
545 stats->st_aal5.aal5_pdu_crc,
546 stats->st_aal5.aal5_pdu_errs,
547 stats->st_aal5.aal5_pdu_drops);
552 * Print Fore ASX-200 device driver statistics
555 * vi pointer to vendor-specific statistics to print
562 print_fore200_driver(vi)
563 struct air_vinfo_rsp *vi;
568 * Bump stats pointer past header info
570 stats = (Fore_stats *)
571 ((u_long) vi + sizeof(struct air_vinfo_rsp));
576 printf(DRIVER_STATS_HDR, get_adapter_name(vi->avsp_intf));
579 * Print the driver info
581 printf("%4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld %4ld\n",
582 stats->st_drv.drv_xm_notact,
583 stats->st_drv.drv_xm_full,
584 stats->st_drv.drv_xm_maxpdu,
585 stats->st_drv.drv_xm_segnoal,
586 stats->st_drv.drv_xm_seglen,
587 stats->st_drv.drv_xm_segdma,
588 stats->st_drv.drv_rv_novcc,
589 stats->st_drv.drv_rv_nosbf,
590 stats->st_drv.drv_rv_nomb,
591 stats->st_drv.drv_rv_ifull,
592 stats->st_drv.drv_bf_segdma,
593 stats->st_drv.drv_cm_full,
594 stats->st_drv.drv_cm_nodma);