xref: /freebsd/sys/netinet/sctp_kdtrace.c (revision 069ac184)
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/param.h>
35 #include <sys/kernel.h>
36 #include <sys/sdt.h>
37 
38 SDT_PROVIDER_DEFINE(sctp);
39 
40 /********************************************************/
41 /* Cwnd probe - tracks changes in the congestion window on a netp */
42 /********************************************************/
43 /* Initial */
44 SDT_PROBE_DEFINE5(sctp, cwnd, net, init,
45     "uint32_t",			/* The Vtag for this end */
46     "uint32_t",			/* The port number of the local side << 16 |
47 				 * port number of remote in network byte
48 				 * order. */
49     "uintptr_t",		/* The pointer to the struct sctp_nets *
50 				 * changing */
51     "int",			/* The old value of the cwnd */
52     "int");			/* The new value of the cwnd */
53 
54 /* ACK-INCREASE */
55 SDT_PROBE_DEFINE5(sctp, cwnd, net, ack,
56     "uint32_t",			/* The Vtag for this end */
57     "uint32_t",			/* The port number of the local side << 16 |
58 				 * port number of remote in network byte
59 				 * order. */
60     "uintptr_t",		/* The pointer to the struct sctp_nets *
61 				 * changing */
62     "int",			/* The old value of the cwnd */
63     "int");			/* The new value of the cwnd */
64 
65 /* ACK-INCREASE */
66 SDT_PROBE_DEFINE5(sctp, cwnd, net, rttvar,
67     "uint64_t",			/* The Vtag << 32 | localport << 16 |
68 				 * remoteport */
69     "uint64_t",			/* obw | nbw */
70     "uint64_t",			/* bwrtt | newrtt */
71     "uint64_t",			/* flight */
72     "uint64_t");		/* (cwnd << 32) | point << 16 | retval(0/1) */
73 
74 SDT_PROBE_DEFINE5(sctp, cwnd, net, rttstep,
75     "uint64_t",			/* The Vtag << 32 | localport << 16 |
76 				 * remoteport */
77     "uint64_t",			/* obw | nbw */
78     "uint64_t",			/* bwrtt | newrtt */
79     "uint64_t",			/* flight */
80     "uint64_t");		/* (cwnd << 32) | point << 16 | retval(0/1) */
81 
82 /* FastRetransmit-DECREASE */
83 SDT_PROBE_DEFINE5(sctp, cwnd, net, fr,
84     "uint32_t",			/* The Vtag for this end */
85     "uint32_t",			/* The port number of the local side << 16 |
86 				 * port number of remote in network byte
87 				 * order. */
88     "uintptr_t",		/* The pointer to the struct sctp_nets *
89 				 * changing */
90     "int",			/* The old value of the cwnd */
91     "int");			/* The new value of the cwnd */
92 
93 /* TimeOut-DECREASE */
94 SDT_PROBE_DEFINE5(sctp, cwnd, net, to,
95     "uint32_t",			/* The Vtag for this end */
96     "uint32_t",			/* The port number of the local side << 16 |
97 				 * port number of remote in network byte
98 				 * order. */
99     "uintptr_t",		/* The pointer to the struct sctp_nets *
100 				 * changing */
101     "int",			/* The old value of the cwnd */
102     "int");			/* The new value of the cwnd */
103 
104 /* BurstLimit-DECREASE */
105 SDT_PROBE_DEFINE5(sctp, cwnd, net, bl,
106     "uint32_t",			/* The Vtag for this end */
107     "uint32_t",			/* The port number of the local side << 16 |
108 				 * port number of remote in network byte
109 				 * order. */
110     "uintptr_t",		/* The pointer to the struct sctp_nets *
111 				 * changing */
112     "int",			/* The old value of the cwnd */
113     "int");			/* The new value of the cwnd */
114 
115 /* ECN-DECREASE */
116 SDT_PROBE_DEFINE5(sctp, cwnd, net, ecn,
117     "uint32_t",			/* The Vtag for this end */
118     "uint32_t",			/* The port number of the local side << 16 |
119 				 * port number of remote in network byte
120 				 * order. */
121     "uintptr_t",		/* The pointer to the struct sctp_nets *
122 				 * changing */
123     "int",			/* The old value of the cwnd */
124     "int");			/* The new value of the cwnd */
125 
126 /* PacketDrop-DECREASE */
127 SDT_PROBE_DEFINE5(sctp, cwnd, net, pd,
128     "uint32_t",			/* The Vtag for this end */
129     "uint32_t",			/* The port number of the local side << 16 |
130 				 * port number of remote in network byte
131 				 * order. */
132     "uintptr_t",		/* The pointer to the struct sctp_nets *
133 				 * changing */
134     "int",			/* The old value of the cwnd */
135     "int");			/* The new value of the cwnd */
136 
137 /********************************************************/
138 /* Rwnd probe - tracks changes in the receiver window for an assoc */
139 /********************************************************/
140 SDT_PROBE_DEFINE4(sctp, rwnd, assoc, val,
141     "uint32_t",			/* The Vtag for this end */
142     "uint32_t",			/* The port number of the local side << 16 |
143 				 * port number of remote in network byte
144 				 * order. */
145     "int",			/* The up/down amount */
146     "int");			/* The new value of the cwnd */
147 
148 /********************************************************/
149 /* flight probe - tracks changes in the flight size on a net or assoc */
150 /********************************************************/
151 SDT_PROBE_DEFINE5(sctp, flightsize, net, val,
152     "uint32_t",			/* The Vtag for this end */
153     "uint32_t",			/* The port number of the local side << 16 |
154 				 * port number of remote in network byte
155 				 * order. */
156     "uintptr_t",		/* The pointer to the struct sctp_nets *
157 				 * changing */
158     "int",			/* The up/down amount */
159     "int");			/* The new value of the cwnd */
160 
161 /********************************************************/
162 /* The total flight version */
163 /********************************************************/
164 SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val,
165     "uint32_t",			/* The Vtag for this end */
166     "uint32_t",			/* The port number of the local side << 16 |
167 				 * port number of remote in network byte
168 				 * order. */
169     "int",			/* The up/down amount */
170     "int");			/* The new value of the cwnd */
171 
172 /*
173  * Standard Solaris-compatible probes.
174  */
175 
176 SDT_PROBE_DEFINE5_XLATE(sctp,,, receive,
177     "void *", "pktinfo_t *",
178     "struct sctp_tcb *", "csinfo_t *",
179     "struct mbuf *", "ipinfo_t *",
180     "struct sctp_tcb *", "sctpsinfo_t *",
181     "struct sctphdr *", "sctpinfo_t *");
182 
183 SDT_PROBE_DEFINE5_XLATE(sctp,,, send,
184     "void *", "pktinfo_t *",
185     "struct sctp_tcb *", "csinfo_t *",
186     "uint8_t *", "ipinfo_t *",
187     "struct sctp_tcb *", "sctpsinfo_t *",
188     "struct sctphdr *", "sctpinfo_t *");
189 
190 SDT_PROBE_DEFINE6_XLATE(sctp,,, state__change,
191     "void *", "void *",
192     "struct sctp_tcb *", "csinfo_t *",
193     "void *", "void *",
194     "struct sctp_tcb *", "sctpsinfo_t *",
195     "void *", "void *",
196     "int", "sctplsinfo_t *");
197