xref: /xnu-11215.41.3/bsd/skywalk/os_skywalk.h (revision 33de042d024d46de5ff4e89f2471de6608e37fa4)
1 /*
2  * Copyright (c) 2015-2016 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 
29 #ifndef _SKYWALK_OS_SKYWALK_H
30 #define _SKYWALK_OS_SKYWALK_H
31 
32 #ifdef PRIVATE
33 #include <skywalk/os_channel.h>
34 #include <skywalk/os_nexus.h>
35 #include <skywalk/os_packet.h>
36 #endif /* PRIVATE */
37 
38 /*
39  * Skywalk ktrace event ID
40  *
41  * Always on events are captured by artrace by default. Others can be
42  * selectively enabled via artrace -f S0x08[subclass], whereas [subclass] is
43  * one of DBG_SKYWALK_{ALWAYSON, FLOWSWITCH, NETIF, CHANNEL, PACKET}.
44  *
45  * Please keep values in sync with skywalk_signposts.plist and assertions in
46  * skywalk_self_tests.
47  */
48 /** @always-on subclass */
49 #define SK_KTRACE_AON_IF_STATS                  SKYWALKDBG_CODE(DBG_SKYWALK_ALWAYSON, 0x001)
50 
51 /** @flowswitch subclass */
52 #define SK_KTRACE_FSW_DEV_RING_FLUSH            SKYWALKDBG_CODE(DBG_SKYWALK_FLOWSWITCH, 0x001)
53 #define SK_KTRACE_FSW_USER_RING_FLUSH           SKYWALKDBG_CODE(DBG_SKYWALK_FLOWSWITCH, 0x002)
54 #define SK_KTRACE_FSW_FLOW_TRACK_RTT            SKYWALKDBG_CODE(DBG_SKYWALK_FLOWSWITCH, 0x004)
55 
56 /** @netif subclass */
57 #define SK_KTRACE_NETIF_RING_TX_REFILL          SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x001)
58 #define SK_KTRACE_NETIF_HOST_ENQUEUE            SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x002)
59 #define SK_KTRACE_NETIF_MIT_RX_INTR             SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x003)
60 #define SK_KTRACE_NETIF_COMMON_INTR             SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x004)
61 #define SK_KTRACE_NETIF_RX_NOTIFY_DEFAULT       SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x005)
62 #define SK_KTRACE_NETIF_RX_NOTIFY_FAST          SKYWALKDBG_CODE(DBG_SKYWALK_NETIF, 0x006)
63 
64 /** @channel subclass */
65 #define SK_KTRACE_CHANNEL_TX_REFILL             SKYWALKDBG_CODE(DBG_SKYWALK_CHANNEL, 0x1)
66 
67 /** @packet subclass */
68 /*
69  * Used with os_packet_trace_* functions.
70  * Total of 12bit (0xABC) code space available, current sub-code allocation is:
71  *     0x00C code space for FSW Rx path.
72  *     0x01C code space for FSW Tx path.
73  * More sub-code can be added for other packet data path, e.g. uPipe, BSD, etc.
74  */
75 /* @packet::rx group */
76 #define SK_KTRACE_PKT_RX_DRV                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x001)
77 #define SK_KTRACE_PKT_RX_FSW                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x002)
78 #define SK_KTRACE_PKT_RX_CHN                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x003)
79 /* @packet::tx group */
80 #define SK_KTRACE_PKT_TX_FSW                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x010)
81 #define SK_KTRACE_PKT_TX_AQM                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x011)
82 #define SK_KTRACE_PKT_TX_DRV                    SKYWALKDBG_CODE(DBG_SKYWALK_PACKET, 0x012)
83 
84 #endif /* _SKYWALK_OS_SKYWALK_H */
85