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_eni.c,v 1.3.2.1 2000/07/01 06:02:14 ps Exp $
31 * User configuration and display program
32 * --------------------------------------
34 * Routines for Efficient-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/hea/eni_stats.h>
59 __RCSID("@(#) $FreeBSD: src/sbin/atm/atm/atm_eni.c,v 1.3.2.1 2000/07/01 06:02:14 ps Exp $");
70 #define SHOW_DRIVER 64
74 * Headers for statistics
76 #define ATM_STATS_HDR \
77 "%s ATM Layer Statistics\n\
80 #define AAL0_STATS_HDR \
81 "%s AAL 0 Statistics\n\
82 Cells In Cells Out Cell Drops\n"
84 #define AAL5_STATS_HDR \
85 "%s AAL 5 Statistics\n\
86 CRC/Len CRC Proto PDU\n\
87 Cells In Cells Out Errs Drops PDUs In PDUs Out Errs Errs Drops\n"
89 #define DRIVER_STATS_HDR_1 \
90 "%s Device Driver Statistics\n\
91 Buf Buf Buf Buf Can't VCC VCC No No No RX RX\n\
92 Req No No Alrdy Find PDU Range Resrc RX DMA Queue\n\
93 Size Descr Mem Free Descr Size Error In Bufs Room Full\n"
95 #define DRIVER_STATS_HDR_2 \
96 "%s Device Driver Statistics\n\
97 No ATM No RX No TX Seg Max No No No TX\n\
98 RX IntrQ DMA DMA Not Seg Seg TX Resrc DMA\n\
99 VCC Full Room Addr Align Pad Out Buf Out Room\n"
101 #define OC3_STATS_HDR \
102 "%s OC-3c Statistics\n\
103 Section Path Line Line Path Corr Uncorr\n\
104 BIP8 BIP8 BIP24 FEBE FEBE HCS HCS\n\
105 Errs Errs Errs Errs Errs Errs Errs\n"
109 * Process show ENI statistics command
111 * The statistics printed are vendor-specific, depending on the brand of
112 * the interface card.
115 * atm show stats interface [<interface-name> [phy | dev | atm |
116 aal0 | aal5 | driver ]]
119 * intf interface to print statistics for
120 * argc number of remaining arguments to command
121 * argv pointer to remaining argument strings
128 show_eni_stats(intf, argc, argv)
133 int buf_len, stats_type;
134 struct atminfreq air;
135 struct air_vinfo_rsp *stats;
138 * Get statistics type qualifier
140 if (!strcasecmp("phy", argv[0])) {
141 stats_type = SHOW_PHY;
142 } else if (!strcasecmp("atm", argv[0])) {
143 stats_type = SHOW_ATM;
144 } else if (!strcasecmp("aal0", argv[0])) {
145 stats_type = SHOW_AAL0;
146 } else if (!strcasecmp("aal5", argv[0])) {
147 stats_type = SHOW_AAL5;
148 } else if (!strcasecmp("driver", argv[0])) {
149 stats_type = SHOW_DRIVER;
151 fprintf(stderr, "%s: Illegal or unsupported statistics type\n", prog);
157 * Get vendor-specific statistics from the kernel
159 UM_ZERO(&air, sizeof(air));
160 air.air_opcode = AIOCS_INF_VST;
161 strcpy(air.air_vinfo_intf, intf);
162 buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
164 fprintf(stderr, "%s: ", prog);
168 perror("Internal error");
171 fprintf(stderr, "%s is not an ATM device\n",
175 perror("ioctl (AIOCINFO)");
180 stats = (struct air_vinfo_rsp *) air.air_buf_addr;
183 * Print the statistics
185 if (buf_len < sizeof(struct air_vinfo_rsp) +
191 switch (stats_type) {
193 print_eni_oc3(stats);
196 print_eni_atm(stats);
199 print_eni_aal0(stats);
202 print_eni_aal5(stats);
205 print_eni_driver(stats);
214 * Print ENI OC-3c statistics
217 * vi pointer to vendor-specific statistics to print
225 struct air_vinfo_rsp *vi;
230 * Bump stats pointer past header info
232 stats = (Eni_stats *)
233 ((u_long) vi + sizeof(struct air_vinfo_rsp));
238 printf(OC3_STATS_HDR, get_adapter_name(vi->avsp_intf));
241 * Print the OC-3c info
243 printf("%7ld %7ld %7ld %7ld %7ld %7ld %7ld\n",
244 stats->eni_st_oc3.oc3_sect_bip8,
245 stats->eni_st_oc3.oc3_path_bip8,
246 stats->eni_st_oc3.oc3_line_bip24,
247 stats->eni_st_oc3.oc3_line_febe,
248 stats->eni_st_oc3.oc3_path_febe,
249 stats->eni_st_oc3.oc3_hec_corr,
250 stats->eni_st_oc3.oc3_hec_uncorr);
255 * Print ENI ATM statistics
258 * vi pointer to vendor-specific statistics to print
266 struct air_vinfo_rsp *vi;
271 * Bump stats pointer past header info
273 stats = (Eni_stats *)
274 ((u_long) vi + sizeof(struct air_vinfo_rsp));
279 printf(ATM_STATS_HDR, get_adapter_name(vi->avsp_intf));
282 * Print the ATM layer info
284 printf("%10ld %10ld\n",
285 stats->eni_st_atm.atm_rcvd,
286 stats->eni_st_atm.atm_xmit);
291 * Print ENI AAL 0 statistics
294 * vi pointer to vendor-specific statistics to print
302 struct air_vinfo_rsp *vi;
307 * Bump stats pointer past header info
309 stats = (Eni_stats *)
310 ((u_long) vi + sizeof(struct air_vinfo_rsp));
315 printf(AAL0_STATS_HDR, get_adapter_name(vi->avsp_intf));
318 * Print the AAL 0 info
320 printf("%10ld %10ld %10ld\n",
321 stats->eni_st_aal0.aal0_rcvd,
322 stats->eni_st_aal0.aal0_xmit,
323 stats->eni_st_aal0.aal0_drops);
328 * Print ENI AAL 5 statistics
331 * vi pointer to vendor-specific statistics to print
339 struct air_vinfo_rsp *vi;
344 * Bump stats pointer past header info
346 stats = (Eni_stats *)
347 ((u_long) vi + sizeof(struct air_vinfo_rsp));
352 printf(AAL5_STATS_HDR, get_adapter_name(vi->avsp_intf));
355 * Print the AAL 5 info
357 printf("%10ld %10ld %5ld %5ld %9ld %9ld %5ld %5ld %5ld\n",
358 stats->eni_st_aal5.aal5_rcvd,
359 stats->eni_st_aal5.aal5_xmit,
360 stats->eni_st_aal5.aal5_crc_len,
361 stats->eni_st_aal5.aal5_drops,
362 stats->eni_st_aal5.aal5_pdu_rcvd,
363 stats->eni_st_aal5.aal5_pdu_xmit,
364 stats->eni_st_aal5.aal5_pdu_crc,
365 stats->eni_st_aal5.aal5_pdu_errs,
366 stats->eni_st_aal5.aal5_pdu_drops);
370 * Print Efficient device driver statistics
373 * vi pointer to vendor-specific statistics to print
381 struct air_vinfo_rsp *vi;
386 * Bump stats pointer past header info
388 stats = (Eni_stats *)
389 ((u_long) vi + sizeof(struct air_vinfo_rsp));
394 printf(DRIVER_STATS_HDR_1, get_adapter_name(vi->avsp_intf));
397 * Print the driver info
399 printf ( "%5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
400 stats->eni_st_drv.drv_mm_toobig,
401 stats->eni_st_drv.drv_mm_nodesc,
402 stats->eni_st_drv.drv_mm_nobuf,
403 stats->eni_st_drv.drv_mm_notuse,
404 stats->eni_st_drv.drv_mm_notfnd,
405 stats->eni_st_drv.drv_vc_maxpdu,
406 stats->eni_st_drv.drv_vc_badrng,
407 stats->eni_st_drv.drv_rv_norsc,
408 stats->eni_st_drv.drv_rv_nobufs,
409 stats->eni_st_drv.drv_rv_nodma,
410 stats->eni_st_drv.drv_rv_rxq
416 printf(DRIVER_STATS_HDR_2, get_adapter_name(vi->avsp_intf));
419 * Print the driver info
421 printf ( "%5ld %5ld %5ld %5ld %5ld %5ld %5ld %7ld %5ld %7ld\n",
422 stats->eni_st_drv.drv_rv_novcc,
423 stats->eni_st_drv.drv_rv_intrq,
424 stats->eni_st_drv.drv_rv_segdma,
425 stats->eni_st_drv.drv_xm_segdma,
426 stats->eni_st_drv.drv_xm_segnoal,
427 stats->eni_st_drv.drv_xm_seglen,
428 stats->eni_st_drv.drv_xm_maxpdu,
429 stats->eni_st_drv.drv_xm_nobuf,
430 stats->eni_st_drv.drv_xm_norsc,
431 stats->eni_st_drv.drv_xm_nodma