1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org> 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #include <sys/cdefs.h> 32 __FBSDID("$FreeBSD$"); 33 34 #include <sys/param.h> 35 #include <sys/systm.h> 36 #include <sys/sdt.h> 37 38 SDT_PROVIDER_DEFINE(ip); 39 SDT_PROVIDER_DEFINE(sctp); 40 SDT_PROVIDER_DEFINE(tcp); 41 SDT_PROVIDER_DEFINE(udp); 42 SDT_PROVIDER_DEFINE(udplite); 43 44 SDT_PROBE_DEFINE6_XLATE(ip, , , receive, 45 "void *", "pktinfo_t *", 46 "void *", "csinfo_t *", 47 "uint8_t *", "ipinfo_t *", 48 "struct ifnet *", "ifinfo_t *", 49 "struct ip *", "ipv4info_t *", 50 "struct ip6_hdr *", "ipv6info_t *"); 51 52 SDT_PROBE_DEFINE6_XLATE(ip, , , send, 53 "void *", "pktinfo_t *", 54 "void *", "csinfo_t *", 55 "uint8_t *", "ipinfo_t *", 56 "struct ifnet *", "ifinfo_t *", 57 "struct ip *", "ipv4info_t *", 58 "struct ip6_hdr *", "ipv6info_t *"); 59 60 SDT_PROBE_DEFINE5_XLATE(sctp, , , receive, 61 "void *", "pktinfo_t *", 62 "struct sctp_tcb *", "csinfo_t *", 63 "struct mbuf *", "ipinfo_t *", 64 "struct sctp_tcb *", "sctpsinfo_t *" , 65 "struct sctphdr *", "sctpinfo_t *"); 66 67 SDT_PROBE_DEFINE5_XLATE(sctp, , , send, 68 "void *", "pktinfo_t *", 69 "struct sctp_tcb *", "csinfo_t *", 70 "uint8_t *", "ipinfo_t *", 71 "struct sctp_tcb *", "sctpsinfo_t *" , 72 "struct sctphdr *", "sctpinfo_t *"); 73 74 SDT_PROBE_DEFINE6_XLATE(sctp, , , state__change, 75 "void *", "void *", 76 "struct sctp_tcb *", "csinfo_t *", 77 "void *", "void *", 78 "struct sctp_tcb *", "sctpsinfo_t *", 79 "void *", "void *", 80 "int", "sctplsinfo_t *"); 81 82 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, 83 "void *", "pktinfo_t *", 84 "struct tcpcb *", "csinfo_t *", 85 "struct mbuf *", "ipinfo_t *", 86 "struct tcpcb *", "tcpsinfo_t *" , 87 "struct tcphdr *", "tcpinfoh_t *"); 88 89 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused, 90 "void *", "pktinfo_t *", 91 "struct tcpcb *", "csinfo_t *", 92 "struct mbuf *", "ipinfo_t *", 93 "struct tcpcb *", "tcpsinfo_t *" , 94 "struct tcphdr *", "tcpinfo_t *"); 95 96 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established, 97 "void *", "pktinfo_t *", 98 "struct tcpcb *", "csinfo_t *", 99 "struct mbuf *", "ipinfo_t *", 100 "struct tcpcb *", "tcpsinfo_t *" , 101 "struct tcphdr *", "tcpinfoh_t *"); 102 103 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused, 104 "void *", "pktinfo_t *", 105 "struct tcpcb *", "csinfo_t *", 106 "struct mbuf *", "ipinfo_t *", 107 "struct tcpcb *", "tcpsinfo_t *" , 108 "struct tcphdr *", "tcpinfoh_t *"); 109 110 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__request, 111 "void *", "pktinfo_t *", 112 "struct tcpcb *", "csinfo_t *", 113 "uint8_t *", "ipinfo_t *", 114 "struct tcpcb *", "tcpsinfo_t *" , 115 "struct tcphdr *", "tcpinfo_t *"); 116 117 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive, 118 "void *", "pktinfo_t *", 119 "struct tcpcb *", "csinfo_t *", 120 "struct mbuf *", "ipinfo_t *", 121 "struct tcpcb *", "tcpsinfo_t *" , 122 "struct tcphdr *", "tcpinfoh_t *"); 123 124 SDT_PROBE_DEFINE5_XLATE(tcp, , , send, 125 "void *", "pktinfo_t *", 126 "struct tcpcb *", "csinfo_t *", 127 "uint8_t *", "ipinfo_t *", 128 "struct tcpcb *", "tcpsinfo_t *" , 129 "struct tcphdr *", "tcpinfo_t *"); 130 131 SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr, 132 "struct pkt_node *", "siftrinfo_t *"); 133 134 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input, 135 "struct tcpcb *", "tcpsinfo_t *" , 136 "struct tcphdr *", "tcpinfoh_t *", 137 "uint8_t *", "ipinfo_t *"); 138 139 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output, 140 "struct tcpcb *", "tcpsinfo_t *" , 141 "struct tcphdr *", "tcpinfo_t *", 142 "struct mbuf *", "ipinfo_t *"); 143 144 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user, 145 "struct tcpcb *", "tcpsinfo_t *" , 146 "int", "int"); 147 148 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop, 149 "struct tcpcb *", "tcpsinfo_t *" , 150 "struct tcphdr *", "tcpinfoh_t *", 151 "struct mbuf *", "ipinfo_t *"); 152 153 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change, 154 "void *", "void *", 155 "struct tcpcb *", "csinfo_t *", 156 "void *", "void *", 157 "struct tcpcb *", "tcpsinfo_t *", 158 "void *", "void *", 159 "int", "tcplsinfo_t *"); 160 161 SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize, 162 "void *", "void *", 163 "struct tcpcb *", "csinfo_t *", 164 "struct mbuf *", "ipinfo_t *", 165 "struct tcpcb *", "tcpsinfo_t *" , 166 "struct tcphdr *", "tcpinfoh_t *", 167 "int", "int"); 168 169 SDT_PROBE_DEFINE5_XLATE(udp, , , receive, 170 "void *", "pktinfo_t *", 171 "struct inpcb *", "csinfo_t *", 172 "uint8_t *", "ipinfo_t *", 173 "struct inpcb *", "udpsinfo_t *", 174 "struct udphdr *", "udpinfo_t *"); 175 176 SDT_PROBE_DEFINE5_XLATE(udp, , , send, 177 "void *", "pktinfo_t *", 178 "struct inpcb *", "csinfo_t *", 179 "uint8_t *", "ipinfo_t *", 180 "struct inpcb *", "udpsinfo_t *", 181 "struct udphdr *", "udpinfo_t *"); 182 183 SDT_PROBE_DEFINE5_XLATE(udplite, , , receive, 184 "void *", "pktinfo_t *", 185 "struct inpcb *", "csinfo_t *", 186 "uint8_t *", "ipinfo_t *", 187 "struct inpcb *", "udplitesinfo_t *", 188 "struct udphdr *", "udpliteinfo_t *"); 189 190 SDT_PROBE_DEFINE5_XLATE(udplite, , , send, 191 "void *", "pktinfo_t *", 192 "struct inpcb *", "csinfo_t *", 193 "uint8_t *", "ipinfo_t *", 194 "struct inpcb *", "udplitesinfo_t *", 195 "struct udphdr *", "udpliteinfo_t *"); 196