6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26
27 #include <sys/mdb_modapi.h>
28 #include <sys/mutex.h>
29 #include <sys/modctl.h>
30 #include <time.h>
31 #include <sys/fibre-channel/fc.h>
32 #include <sys/fibre-channel/impl/fctl_private.h>
33 #include <sys/fibre-channel/impl/fc_ulpif.h>
34 #include <sys/fibre-channel/impl/fc_portif.h>
35 #include <sys/fibre-channel/impl/fc_fcaif.h>
36
37
38 /*
39 * If we #include <string.h> then other definitions fail. This is
40 * the easiest way of getting access to the function
41 */
42 extern char *strtok(char *string, const char *sepset);
43
44 /* we need 26 bytes for the cftime() call */
45 #define TIMESTAMPSIZE 26 * sizeof (char)
1092
1093 uintptr_t pktstart = 0;
1094 uintptr_t pktend = UINT_MAX;
1095 int rval = DCMD_OK;
1096
1097 if (mdb_vread(&logq, sizeof (logq), addr) != sizeof (logq)) {
1098 mdb_warn("Failed to read log queue in kernel");
1099 return (DCMD_ERR);
1100 }
1101
1102 if (mdb_getopts(argc, argv,
1103 's', MDB_OPT_UINTPTR, &pktstart,
1104 'e', MDB_OPT_UINTPTR, &pktend) != argc) {
1105 return (DCMD_USAGE);
1106 }
1107
1108 if (pktstart > pktend) {
1109 return (DCMD_USAGE);
1110 }
1111
1112 if (logq.il_flags & FC_TRACE_LOGQ_V2 != 0) {
1113 rval = fc_dump_logmsg((fc_trace_dmsg_t *)logq.il_msgh, pktstart,
1114 pktend, &printed);
1115 } else {
1116 rval = fc_dump_old_logmsg((fc_trace_dmsgv1_t *)logq.il_msgh,
1117 pktstart, pktend, &printed);
1118 }
1119
1120 if (rval != DCMD_OK) {
1121 return (rval);
1122 }
1123
1124 if (printed == 0) {
1125 mdb_printf("No packets in the buffer match the"
1126 " criteria given");
1127 }
1128
1129 return (rval);
1130 }
1131
1132 int
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Copyright (c) 2018, Joyent, Inc.
28 */
29
30 #include <sys/mdb_modapi.h>
31 #include <sys/mutex.h>
32 #include <sys/modctl.h>
33 #include <time.h>
34 #include <sys/fibre-channel/fc.h>
35 #include <sys/fibre-channel/impl/fctl_private.h>
36 #include <sys/fibre-channel/impl/fc_ulpif.h>
37 #include <sys/fibre-channel/impl/fc_portif.h>
38 #include <sys/fibre-channel/impl/fc_fcaif.h>
39
40
41 /*
42 * If we #include <string.h> then other definitions fail. This is
43 * the easiest way of getting access to the function
44 */
45 extern char *strtok(char *string, const char *sepset);
46
47 /* we need 26 bytes for the cftime() call */
48 #define TIMESTAMPSIZE 26 * sizeof (char)
1095
1096 uintptr_t pktstart = 0;
1097 uintptr_t pktend = UINT_MAX;
1098 int rval = DCMD_OK;
1099
1100 if (mdb_vread(&logq, sizeof (logq), addr) != sizeof (logq)) {
1101 mdb_warn("Failed to read log queue in kernel");
1102 return (DCMD_ERR);
1103 }
1104
1105 if (mdb_getopts(argc, argv,
1106 's', MDB_OPT_UINTPTR, &pktstart,
1107 'e', MDB_OPT_UINTPTR, &pktend) != argc) {
1108 return (DCMD_USAGE);
1109 }
1110
1111 if (pktstart > pktend) {
1112 return (DCMD_USAGE);
1113 }
1114
1115 if ((logq.il_flags & FC_TRACE_LOGQ_V2) != 0) {
1116 rval = fc_dump_logmsg((fc_trace_dmsg_t *)logq.il_msgh, pktstart,
1117 pktend, &printed);
1118 } else {
1119 rval = fc_dump_old_logmsg((fc_trace_dmsgv1_t *)logq.il_msgh,
1120 pktstart, pktend, &printed);
1121 }
1122
1123 if (rval != DCMD_OK) {
1124 return (rval);
1125 }
1126
1127 if (printed == 0) {
1128 mdb_printf("No packets in the buffer match the"
1129 " criteria given");
1130 }
1131
1132 return (rval);
1133 }
1134
1135 int
|