xref: /freebsd/sys/netinet/sctp_kdtrace.c (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
5  * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * a) Redistributions of source code must retain the above copyright notice,
11  *    this list of conditions and the following disclaimer.
12  *
13  * b) Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the distribution.
16  *
17  * c) Neither the name of Cisco Systems, Inc. nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include <sys/cdefs.h>
35 #include <sys/param.h>
36 #include <sys/kernel.h>
37 #include <sys/sdt.h>
38 
39 SDT_PROVIDER_DEFINE(sctp);
40 
41 /********************************************************/
42 /* Cwnd probe - tracks changes in the congestion window on a netp */
43 /********************************************************/
44 /* Initial */
45 SDT_PROBE_DEFINE5(sctp, cwnd, net, init,
46     "uint32_t",			/* The Vtag for this end */
47     "uint32_t",			/* The port number of the local side << 16 |
48 				 * port number of remote in network byte
49 				 * order. */
50     "uintptr_t",		/* The pointer to the struct sctp_nets *
51 				 * changing */
52     "int",			/* The old value of the cwnd */
53     "int");			/* The new value of the cwnd */
54 
55 /* ACK-INCREASE */
56 SDT_PROBE_DEFINE5(sctp, cwnd, net, ack,
57     "uint32_t",			/* The Vtag for this end */
58     "uint32_t",			/* The port number of the local side << 16 |
59 				 * port number of remote in network byte
60 				 * order. */
61     "uintptr_t",		/* The pointer to the struct sctp_nets *
62 				 * changing */
63     "int",			/* The old value of the cwnd */
64     "int");			/* The new value of the cwnd */
65 
66 /* ACK-INCREASE */
67 SDT_PROBE_DEFINE5(sctp, cwnd, net, rttvar,
68     "uint64_t",			/* The Vtag << 32 | localport << 16 |
69 				 * remoteport */
70     "uint64_t",			/* obw | nbw */
71     "uint64_t",			/* bwrtt | newrtt */
72     "uint64_t",			/* flight */
73     "uint64_t");		/* (cwnd << 32) | point << 16 | retval(0/1) */
74 
75 SDT_PROBE_DEFINE5(sctp, cwnd, net, rttstep,
76     "uint64_t",			/* The Vtag << 32 | localport << 16 |
77 				 * remoteport */
78     "uint64_t",			/* obw | nbw */
79     "uint64_t",			/* bwrtt | newrtt */
80     "uint64_t",			/* flight */
81     "uint64_t");		/* (cwnd << 32) | point << 16 | retval(0/1) */
82 
83 /* FastRetransmit-DECREASE */
84 SDT_PROBE_DEFINE5(sctp, cwnd, net, fr,
85     "uint32_t",			/* The Vtag for this end */
86     "uint32_t",			/* The port number of the local side << 16 |
87 				 * port number of remote in network byte
88 				 * order. */
89     "uintptr_t",		/* The pointer to the struct sctp_nets *
90 				 * changing */
91     "int",			/* The old value of the cwnd */
92     "int");			/* The new value of the cwnd */
93 
94 /* TimeOut-DECREASE */
95 SDT_PROBE_DEFINE5(sctp, cwnd, net, to,
96     "uint32_t",			/* The Vtag for this end */
97     "uint32_t",			/* The port number of the local side << 16 |
98 				 * port number of remote in network byte
99 				 * order. */
100     "uintptr_t",		/* The pointer to the struct sctp_nets *
101 				 * changing */
102     "int",			/* The old value of the cwnd */
103     "int");			/* The new value of the cwnd */
104 
105 /* BurstLimit-DECREASE */
106 SDT_PROBE_DEFINE5(sctp, cwnd, net, bl,
107     "uint32_t",			/* The Vtag for this end */
108     "uint32_t",			/* The port number of the local side << 16 |
109 				 * port number of remote in network byte
110 				 * order. */
111     "uintptr_t",		/* The pointer to the struct sctp_nets *
112 				 * changing */
113     "int",			/* The old value of the cwnd */
114     "int");			/* The new value of the cwnd */
115 
116 /* ECN-DECREASE */
117 SDT_PROBE_DEFINE5(sctp, cwnd, net, ecn,
118     "uint32_t",			/* The Vtag for this end */
119     "uint32_t",			/* The port number of the local side << 16 |
120 				 * port number of remote in network byte
121 				 * order. */
122     "uintptr_t",		/* The pointer to the struct sctp_nets *
123 				 * changing */
124     "int",			/* The old value of the cwnd */
125     "int");			/* The new value of the cwnd */
126 
127 /* PacketDrop-DECREASE */
128 SDT_PROBE_DEFINE5(sctp, cwnd, net, pd,
129     "uint32_t",			/* The Vtag for this end */
130     "uint32_t",			/* The port number of the local side << 16 |
131 				 * port number of remote in network byte
132 				 * order. */
133     "uintptr_t",		/* The pointer to the struct sctp_nets *
134 				 * changing */
135     "int",			/* The old value of the cwnd */
136     "int");			/* The new value of the cwnd */
137 
138 /********************************************************/
139 /* Rwnd probe - tracks changes in the receiver window for an assoc */
140 /********************************************************/
141 SDT_PROBE_DEFINE4(sctp, rwnd, assoc, val,
142     "uint32_t",			/* The Vtag for this end */
143     "uint32_t",			/* The port number of the local side << 16 |
144 				 * port number of remote in network byte
145 				 * order. */
146     "int",			/* The up/down amount */
147     "int");			/* The new value of the cwnd */
148 
149 /********************************************************/
150 /* flight probe - tracks changes in the flight size on a net or assoc */
151 /********************************************************/
152 SDT_PROBE_DEFINE5(sctp, flightsize, net, val,
153     "uint32_t",			/* The Vtag for this end */
154     "uint32_t",			/* The port number of the local side << 16 |
155 				 * port number of remote in network byte
156 				 * order. */
157     "uintptr_t",		/* The pointer to the struct sctp_nets *
158 				 * changing */
159     "int",			/* The up/down amount */
160     "int");			/* The new value of the cwnd */
161 
162 /********************************************************/
163 /* The total flight version */
164 /********************************************************/
165 SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val,
166     "uint32_t",			/* The Vtag for this end */
167     "uint32_t",			/* The port number of the local side << 16 |
168 				 * port number of remote in network byte
169 				 * order. */
170     "int",			/* The up/down amount */
171     "int");			/* The new value of the cwnd */
172 
173 /*
174  * Standard Solaris-compatible probes.
175  */
176 
177 SDT_PROBE_DEFINE5_XLATE(sctp,,, receive,
178     "void *", "pktinfo_t *",
179     "struct sctp_tcb *", "csinfo_t *",
180     "struct mbuf *", "ipinfo_t *",
181     "struct sctp_tcb *", "sctpsinfo_t *",
182     "struct sctphdr *", "sctpinfo_t *");
183 
184 SDT_PROBE_DEFINE5_XLATE(sctp,,, send,
185     "void *", "pktinfo_t *",
186     "struct sctp_tcb *", "csinfo_t *",
187     "uint8_t *", "ipinfo_t *",
188     "struct sctp_tcb *", "sctpsinfo_t *",
189     "struct sctphdr *", "sctpinfo_t *");
190 
191 SDT_PROBE_DEFINE6_XLATE(sctp,,, state__change,
192     "void *", "void *",
193     "struct sctp_tcb *", "csinfo_t *",
194     "void *", "void *",
195     "struct sctp_tcb *", "sctpsinfo_t *",
196     "void *", "void *",
197     "int", "sctplsinfo_t *");
198