git: 60d8dbbef075 - main - netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 08 Apr 2024 15:30:51 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=60d8dbbef075d3b39891ed35e124d0f7ef8e5fb9

commit 60d8dbbef075d3b39891ed35e124d0f7ef8e5fb9
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-01-18 19:44:47 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-04-08 15:29:59 +0000

    netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters
    
    When debugging network issues one common clue is an unexpectedly
    incrementing error counter. This is helpful, in that it gives us an
    idea of what might be going wrong, but often these counters may be
    incremented in different functions.
    
    Add a static probe point for them so that we can use dtrace to get
    futher information (e.g. a stack trace).
    
    For example:
            dtrace -n 'mib:ip:count: { printf("%d", arg0); stack(); }'
    
    This can be disabled by setting the following kernel option:
            options         KDTRACE_NO_MIB_SDT
    
    Reviewed by:    gallatin, tuexen (previous version), gnn (previous version)
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D43504
---
 sys/conf/options         |   1 +
 sys/netinet/icmp6.h      |  71 +++++------
 sys/netinet/icmp_var.h   |  22 +++-
 sys/netinet/in_kdtrace.c | 305 +++++++++++++++++++++++++++++++++++++++++++++++
 sys/netinet/in_kdtrace.h | 279 +++++++++++++++++++++++++++++++++++++++++++
 sys/netinet/ip_icmp.c    |   6 +-
 sys/netinet/ip_var.h     |  28 +++--
 sys/netinet/tcp_var.h    |  17 ++-
 sys/netinet/udp_var.h    |  18 ++-
 sys/netinet6/icmp6.c     |  10 +-
 sys/netinet6/in6_src.c   |  14 +--
 sys/netinet6/ip6_input.c |   4 +-
 sys/netinet6/ip6_var.h   |  17 ++-
 sys/netinet6/mld6.c      |   2 +-
 sys/netinet6/nd6_nbr.c   |   4 +-
 sys/netinet6/raw_ip6.c   |   2 +-
 sys/sys/sdt.h            |  11 ++
 17 files changed, 725 insertions(+), 86 deletions(-)

diff --git a/sys/conf/options b/sys/conf/options
index 276c6c5067f7..ba1efff080b7 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -145,6 +145,7 @@ GEOM_ZERO	opt_geom.h
 IFLIB		opt_iflib.h
 KDTRACE_HOOKS	opt_global.h
 KDTRACE_FRAME	opt_kdtrace.h
+KDTRACE_NO_MIB_SDT	opt_global.h
 KN_HASHSIZE	opt_kqueue.h
 KSTACK_MAX_PAGES
 KSTACK_PAGES
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h
index e344c662783a..4368fd2a0fcf 100644
--- a/sys/netinet/icmp6.h
+++ b/sys/netinet/icmp6.h
@@ -572,22 +572,6 @@ do {								\
  * Variables related to this implementation
  * of the internet control message protocol version 6.
  */
-struct icmp6errstat {
-	uint64_t icp6errs_dst_unreach_noroute;
-	uint64_t icp6errs_dst_unreach_admin;
-	uint64_t icp6errs_dst_unreach_beyondscope;
-	uint64_t icp6errs_dst_unreach_addr;
-	uint64_t icp6errs_dst_unreach_noport;
-	uint64_t icp6errs_packet_too_big;
-	uint64_t icp6errs_time_exceed_transit;
-	uint64_t icp6errs_time_exceed_reassembly;
-	uint64_t icp6errs_paramprob_header;
-	uint64_t icp6errs_paramprob_nextheader;
-	uint64_t icp6errs_paramprob_option;
-	uint64_t icp6errs_redirect; /* we regard redirect as an error here */
-	uint64_t icp6errs_unknown;
-};
-
 struct icmp6stat {
 /* statistics related to icmp6 packets generated */
 	uint64_t icp6s_error;		/* # of calls to icmp6_error */
@@ -607,25 +591,19 @@ struct icmp6stat {
 	uint64_t icp6s_reflect;
 	uint64_t icp6s_inhist[256];
 	uint64_t icp6s_nd_toomanyopt;	/* too many ND options */
-	struct icmp6errstat icp6s_outerrhist;
-#define icp6s_odst_unreach_noroute \
-	icp6s_outerrhist.icp6errs_dst_unreach_noroute
-#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
-#define icp6s_odst_unreach_beyondscope \
-	icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
-#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
-#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
-#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
-#define icp6s_otime_exceed_transit \
-	icp6s_outerrhist.icp6errs_time_exceed_transit
-#define icp6s_otime_exceed_reassembly \
-	icp6s_outerrhist.icp6errs_time_exceed_reassembly
-#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
-#define icp6s_oparamprob_nextheader \
-	icp6s_outerrhist.icp6errs_paramprob_nextheader
-#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
-#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
-#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
+	uint64_t icp6s_odst_unreach_noroute;
+	uint64_t icp6s_odst_unreach_admin;
+	uint64_t icp6s_odst_unreach_beyondscope;
+	uint64_t icp6s_odst_unreach_addr;
+	uint64_t icp6s_odst_unreach_noport;
+	uint64_t icp6s_opacket_too_big;
+	uint64_t icp6s_otime_exceed_transit;
+	uint64_t icp6s_otime_exceed_reassembly;
+	uint64_t icp6s_oparamprob_header;
+	uint64_t icp6s_oparamprob_nextheader;
+	uint64_t icp6s_oparamprob_option;
+	uint64_t icp6s_oredirect;
+	uint64_t icp6s_ounknown;
 	uint64_t icp6s_pmtuchg;		/* path MTU changes */
 	uint64_t icp6s_nd_badopt;	/* bad ND options */
 	uint64_t icp6s_badns;		/* bad neighbor solicitation */
@@ -643,6 +621,7 @@ struct icmp6stat {
 
 #ifdef _KERNEL
 #include <sys/counter.h>
+#include <netinet/in_kdtrace.h>
 
 #ifdef SYSCTL_DECL
 SYSCTL_DECL(_net_inet6_icmp6);
@@ -653,16 +632,28 @@ VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#define	ICMP6STAT_ADD(name, val)	\
-    VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val))
-#define	ICMP6STAT_INC(name)		ICMP6STAT_ADD(name, 1)
+#define ICMP6STAT_ADD(name, val)                                             \
+	do {                                                                 \
+		MIB_SDT_PROBE1(icmp6, count, name, (val));                   \
+		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val)); \
+	} while (0)
+#define ICMP6STAT_INC(name) ICMP6STAT_ADD(name, 1)
+#define ICMP6STAT_INC2(name, type)                                       \
+	do {                                                             \
+		MIB_SDT_PROBE2(icmp6, count, name, 1, type);             \
+		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, 1); \
+	} while (0)
 
 /*
  * Kernel module consumers must use this accessor macro.
  */
 void	kmod_icmp6stat_inc(int statnum);
-#define	KMOD_ICMP6STAT_INC(name)	\
-    kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t))
+#define KMOD_ICMP6STAT_INC(name)                                          \
+	do {                                                              \
+		MIB_SDT_PROBE1(icmp6, count, name, 1);                    \
+		kmod_icmp6stat_inc(                                       \
+		    offsetof(struct icmp6stat, name) / sizeof(uint64_t)); \
+	} while (0)
 #endif
 
 /*
diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h
index a14b5607f39d..b1f2b0ebf911 100644
--- a/sys/netinet/icmp_var.h
+++ b/sys/netinet/icmp_var.h
@@ -57,22 +57,36 @@ struct	icmpstat {
 
 #ifdef _KERNEL
 #include <sys/counter.h>
+#include <netinet/in_kdtrace.h>
 
 VNET_PCPUSTAT_DECLARE(struct icmpstat, icmpstat);
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#define	ICMPSTAT_ADD(name, val)	\
-    VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name, (val))
+#define ICMPSTAT_ADD(name, val)                                            \
+	do {                                                               \
+		MIB_SDT_PROBE1(icmp, count, name, (val));                  \
+		VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name, (val)); \
+	} while (0)
+
 #define	ICMPSTAT_INC(name)	ICMPSTAT_ADD(name, 1)
+#define ICMPSTAT_INC2(name, type)                                            \
+	do {                                                                 \
+		MIB_SDT_PROBE2(icmp, count, name, 1, type);                  \
+		VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name[type], 1); \
+	} while (0)
 
 /*
  * Kernel module consumers must use this accessor macro.
  */
 void	kmod_icmpstat_inc(int statnum);
-#define	KMOD_ICMPSTAT_INC(name)						\
-    kmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(uint64_t))
+#define KMOD_ICMPSTAT_INC(name)                                          \
+	do {                                                             \
+		MIB_SDT_PROBE1(icmp, count, name, 1);                    \
+		kmod_icmpstat_inc(                                       \
+		    offsetof(struct icmpstat, name) / sizeof(uint64_t)); \
+	} while (0)
 #endif
 
 /*
diff --git a/sys/netinet/in_kdtrace.c b/sys/netinet/in_kdtrace.c
index 68a9c91ecba6..2a53b11c3be2 100644
--- a/sys/netinet/in_kdtrace.c
+++ b/sys/netinet/in_kdtrace.c
@@ -30,11 +30,316 @@
 #include <sys/systm.h>
 #include <sys/sdt.h>
 
+SDT_PROVIDER_DEFINE(mib);
 SDT_PROVIDER_DEFINE(ip);
 SDT_PROVIDER_DEFINE(tcp);
 SDT_PROVIDER_DEFINE(udp);
 SDT_PROVIDER_DEFINE(udplite);
 
+#ifndef KDTRACE_NO_MIB_SDT
+#define MIB_PROBE_IP(name) \
+    SDT_PROBE_DEFINE1(mib, ip, count, name, \
+        "int")
+
+MIB_PROBE_IP(ips_total);
+MIB_PROBE_IP(ips_badsum);
+MIB_PROBE_IP(ips_tooshort);
+MIB_PROBE_IP(ips_toosmall);
+MIB_PROBE_IP(ips_badhlen);
+MIB_PROBE_IP(ips_badlen);
+MIB_PROBE_IP(ips_fragments);
+MIB_PROBE_IP(ips_fragdropped);
+MIB_PROBE_IP(ips_fragtimeout);
+MIB_PROBE_IP(ips_forward);
+MIB_PROBE_IP(ips_fastforward);
+MIB_PROBE_IP(ips_cantforward);
+MIB_PROBE_IP(ips_redirectsent);
+MIB_PROBE_IP(ips_noproto);
+MIB_PROBE_IP(ips_delivered);
+MIB_PROBE_IP(ips_localout);
+MIB_PROBE_IP(ips_odropped);
+MIB_PROBE_IP(ips_reassembled);
+MIB_PROBE_IP(ips_fragmented);
+MIB_PROBE_IP(ips_ofragments);
+MIB_PROBE_IP(ips_cantfrag);
+MIB_PROBE_IP(ips_badoptions);
+MIB_PROBE_IP(ips_noroute);
+MIB_PROBE_IP(ips_badvers);
+MIB_PROBE_IP(ips_rawout);
+MIB_PROBE_IP(ips_toolong);
+MIB_PROBE_IP(ips_notmember);
+MIB_PROBE_IP(ips_nogif);
+MIB_PROBE_IP(ips_badaddr);
+
+#define MIB_PROBE_IP6(name) \
+    SDT_PROBE_DEFINE1(mib, ip6, count, name, \
+        "int")
+#define MIB_PROBE2_IP6(name) \
+    SDT_PROBE_DEFINE2(mib, ip6, count, name, \
+        "int", "int")
+
+MIB_PROBE_IP6(ip6s_total);
+MIB_PROBE_IP6(ip6s_tooshort);
+MIB_PROBE_IP6(ip6s_toosmall);
+MIB_PROBE_IP6(ip6s_fragments);
+MIB_PROBE_IP6(ip6s_fragdropped);
+MIB_PROBE_IP6(ip6s_fragtimeout);
+MIB_PROBE_IP6(ip6s_fragoverflow);
+MIB_PROBE_IP6(ip6s_forward);
+MIB_PROBE_IP6(ip6s_cantforward);
+MIB_PROBE_IP6(ip6s_redirectsent);
+MIB_PROBE_IP6(ip6s_delivered);
+MIB_PROBE_IP6(ip6s_localout);
+MIB_PROBE_IP6(ip6s_odropped);
+MIB_PROBE_IP6(ip6s_reassembled);
+MIB_PROBE_IP6(ip6s_atomicfrags);
+MIB_PROBE_IP6(ip6s_fragmented);
+MIB_PROBE_IP6(ip6s_ofragments);
+MIB_PROBE_IP6(ip6s_cantfrag);
+MIB_PROBE_IP6(ip6s_badoptions);
+MIB_PROBE_IP6(ip6s_noroute);
+MIB_PROBE_IP6(ip6s_badvers);
+MIB_PROBE_IP6(ip6s_rawout);
+MIB_PROBE_IP6(ip6s_badscope);
+MIB_PROBE_IP6(ip6s_notmember);
+MIB_PROBE2_IP6(ip6s_nxthist);
+MIB_PROBE_IP6(ip6s_m1);
+MIB_PROBE2_IP6(ip6s_m2m);
+MIB_PROBE_IP6(ip6s_mext1);
+MIB_PROBE_IP6(ip6s_mext2m);
+MIB_PROBE_IP6(ip6s_exthdrtoolong);
+MIB_PROBE_IP6(ip6s_nogif);
+MIB_PROBE_IP6(ip6s_toomanyhdr);
+MIB_PROBE_IP6(ip6s_sources_none);
+MIB_PROBE2_IP6(ip6s_sources_sameif);
+MIB_PROBE2_IP6(ip6s_sources_otherif);
+MIB_PROBE2_IP6(ip6s_sources_samescope);
+MIB_PROBE2_IP6(ip6s_sources_otherscope);
+MIB_PROBE2_IP6(ip6s_sources_deprecated);
+MIB_PROBE2_IP6(ip6s_sources_rule);
+
+#define MIB_PROBE_ICMP(name) \
+    SDT_PROBE_DEFINE1(mib, icmp, count, name, \
+        "int")
+#define MIB_PROBE2_ICMP(name) \
+    SDT_PROBE_DEFINE2(mib, icmp, count, name, \
+        "int", "int")
+
+MIB_PROBE_ICMP(icps_error);
+MIB_PROBE_ICMP(icps_oldshort);
+MIB_PROBE_ICMP(icps_oldicmp);
+MIB_PROBE2_ICMP(icps_outhist);
+MIB_PROBE_ICMP(icps_badcode);
+MIB_PROBE_ICMP(icps_tooshort);
+MIB_PROBE_ICMP(icps_checksum);
+MIB_PROBE_ICMP(icps_badlen);
+MIB_PROBE_ICMP(icps_reflect);
+MIB_PROBE2_ICMP(icps_inhist);
+MIB_PROBE_ICMP(icps_bmcastecho);
+MIB_PROBE_ICMP(icps_bmcasttstamp);
+MIB_PROBE_ICMP(icps_badaddr);
+MIB_PROBE_ICMP(icps_noroute);
+
+#define MIB_PROBE_ICMP6(name) \
+    SDT_PROBE_DEFINE1(mib, icmp6, count, name, \
+        "int")
+#define MIB_PROBE2_ICMP6(name) \
+    SDT_PROBE_DEFINE2(mib, icmp6, count, name, \
+        "int", "int")
+
+MIB_PROBE_ICMP6(icp6s_error);
+MIB_PROBE_ICMP6(icp6s_canterror);
+MIB_PROBE_ICMP6(icp6s_toofreq);
+MIB_PROBE2_ICMP6(icp6s_outhist);
+MIB_PROBE_ICMP6(icp6s_badcode);
+MIB_PROBE_ICMP6(icp6s_tooshort);
+MIB_PROBE_ICMP6(icp6s_checksum);
+MIB_PROBE_ICMP6(icp6s_badlen);
+MIB_PROBE_ICMP6(icp6s_dropped);
+MIB_PROBE_ICMP6(icp6s_reflect);
+MIB_PROBE2_ICMP6(icp6s_inhist);
+MIB_PROBE_ICMP6(icp6s_nd_toomanyopt);
+MIB_PROBE_ICMP6(icp6s_odst_unreach_noroute);
+MIB_PROBE_ICMP6(icp6s_odst_unreach_admin);
+MIB_PROBE_ICMP6(icp6s_odst_unreach_beyondscope);
+MIB_PROBE_ICMP6(icp6s_odst_unreach_addr);
+MIB_PROBE_ICMP6(icp6s_odst_unreach_noport);
+MIB_PROBE_ICMP6(icp6s_opacket_too_big);
+MIB_PROBE_ICMP6(icp6s_otime_exceed_transit);
+MIB_PROBE_ICMP6(icp6s_otime_exceed_reassembly);
+MIB_PROBE_ICMP6(icp6s_oparamprob_header);
+MIB_PROBE_ICMP6(icp6s_oparamprob_nextheader);
+MIB_PROBE_ICMP6(icp6s_oparamprob_option);
+MIB_PROBE_ICMP6(icp6s_oredirect);
+MIB_PROBE_ICMP6(icp6s_ounknown);
+MIB_PROBE_ICMP6(icp6s_pmtuchg);
+MIB_PROBE_ICMP6(icp6s_nd_badopt);
+MIB_PROBE_ICMP6(icp6s_badns);
+MIB_PROBE_ICMP6(icp6s_badna);
+MIB_PROBE_ICMP6(icp6s_badrs);
+MIB_PROBE_ICMP6(icp6s_badra);
+MIB_PROBE_ICMP6(icp6s_badredirect);
+MIB_PROBE_ICMP6(icp6s_overflowdefrtr);
+MIB_PROBE_ICMP6(icp6s_overflowprfx);
+MIB_PROBE_ICMP6(icp6s_overflownndp);
+MIB_PROBE_ICMP6(icp6s_overflowredirect);
+MIB_PROBE_ICMP6(icp6s_invlhlim);
+
+#define	MIB_PROBE_UDP(name)	SDT_PROBE_DEFINE1(mib, udp, count, name, "int")
+MIB_PROBE_UDP(udps_ipackets);
+MIB_PROBE_UDP(udps_hdrops);
+MIB_PROBE_UDP(udps_badsum);
+MIB_PROBE_UDP(udps_nosum);
+MIB_PROBE_UDP(udps_badlen);
+MIB_PROBE_UDP(udps_noport);
+MIB_PROBE_UDP(udps_noportbcast);
+MIB_PROBE_UDP(udps_fullsock);
+MIB_PROBE_UDP(udps_pcbcachemiss);
+MIB_PROBE_UDP(udps_pcbhashmiss);
+MIB_PROBE_UDP(udps_opackets);
+MIB_PROBE_UDP(udps_fastout);
+MIB_PROBE_UDP(udps_noportmcast);
+MIB_PROBE_UDP(udps_filtermcast);
+
+#define	MIB_PROBE_TCP(name)	SDT_PROBE_DEFINE1(mib, tcp, count, name, "int")
+
+MIB_PROBE_TCP(tcps_connattempt);
+MIB_PROBE_TCP(tcps_accepts);
+MIB_PROBE_TCP(tcps_connects);
+MIB_PROBE_TCP(tcps_drops);
+MIB_PROBE_TCP(tcps_conndrops);
+MIB_PROBE_TCP(tcps_minmmsdrops);
+MIB_PROBE_TCP(tcps_closed);
+MIB_PROBE_TCP(tcps_segstimed);
+MIB_PROBE_TCP(tcps_rttupdated);
+MIB_PROBE_TCP(tcps_delack);
+MIB_PROBE_TCP(tcps_timeoutdrop);
+MIB_PROBE_TCP(tcps_rexmttimeo);
+MIB_PROBE_TCP(tcps_persisttimeo);
+MIB_PROBE_TCP(tcps_keeptimeo);
+MIB_PROBE_TCP(tcps_keepprobe);
+MIB_PROBE_TCP(tcps_keepdrops);
+MIB_PROBE_TCP(tcps_progdrops);
+
+MIB_PROBE_TCP(tcps_sndtotal);
+MIB_PROBE_TCP(tcps_sndpack);
+MIB_PROBE_TCP(tcps_sndbyte);
+MIB_PROBE_TCP(tcps_sndrexmitpack);
+MIB_PROBE_TCP(tcps_sndrexmitbyte);
+MIB_PROBE_TCP(tcps_sndrexmitbad);
+MIB_PROBE_TCP(tcps_sndacks);
+MIB_PROBE_TCP(tcps_sndprobe);
+MIB_PROBE_TCP(tcps_sndurg);
+MIB_PROBE_TCP(tcps_sndwinup);
+MIB_PROBE_TCP(tcps_sndctrl);
+
+MIB_PROBE_TCP(tcps_rcvtotal);
+MIB_PROBE_TCP(tcps_rcvpack);
+MIB_PROBE_TCP(tcps_rcvbyte);
+MIB_PROBE_TCP(tcps_rcvbadsum);
+MIB_PROBE_TCP(tcps_rcvbadoff);
+MIB_PROBE_TCP(tcps_rcvreassfull);
+MIB_PROBE_TCP(tcps_rcvshort);
+MIB_PROBE_TCP(tcps_rcvduppack);
+MIB_PROBE_TCP(tcps_rcvdupbyte);
+MIB_PROBE_TCP(tcps_rcvpartduppack);
+MIB_PROBE_TCP(tcps_rcvpartdupbyte);
+MIB_PROBE_TCP(tcps_rcvoopack);
+MIB_PROBE_TCP(tcps_rcvoobyte);
+MIB_PROBE_TCP(tcps_rcvpackafterwin);
+MIB_PROBE_TCP(tcps_rcvbyteafterwin);
+MIB_PROBE_TCP(tcps_rcvafterclose);
+MIB_PROBE_TCP(tcps_rcvwinprobe);
+MIB_PROBE_TCP(tcps_rcvdupack);
+MIB_PROBE_TCP(tcps_rcvacktoomuch);
+MIB_PROBE_TCP(tcps_rcvackpack);
+MIB_PROBE_TCP(tcps_rcvackbyte);
+MIB_PROBE_TCP(tcps_rcvwinupd);
+MIB_PROBE_TCP(tcps_pawsdrop);
+MIB_PROBE_TCP(tcps_predack);
+MIB_PROBE_TCP(tcps_preddat);
+MIB_PROBE_TCP(tcps_pcbackemiss);
+MIB_PROBE_TCP(tcps_cachedrtt);
+MIB_PROBE_TCP(tcps_cachedrttvar);
+MIB_PROBE_TCP(tcps_cachedssthresh);
+MIB_PROBE_TCP(tcps_usedrtt);
+MIB_PROBE_TCP(tcps_usedrttvar);
+MIB_PROBE_TCP(tcps_usedssthresh);
+MIB_PROBE_TCP(tcps_persistdrop);
+MIB_PROBE_TCP(tcps_badsyn);
+MIB_PROBE_TCP(tcps_mturesent);
+MIB_PROBE_TCP(tcps_listendrop);
+MIB_PROBE_TCP(tcps_badrst);
+
+MIB_PROBE_TCP(tcps_sc_added);
+MIB_PROBE_TCP(tcps_sc_retransmitted);
+MIB_PROBE_TCP(tcps_sc_dupsyn);
+MIB_PROBE_TCP(tcps_sc_dropped);
+MIB_PROBE_TCP(tcps_sc_completed);
+MIB_PROBE_TCP(tcps_sc_bucketoverflow);
+MIB_PROBE_TCP(tcps_sc_cacheoverflow);
+MIB_PROBE_TCP(tcps_sc_reset);
+MIB_PROBE_TCP(tcps_sc_stale);
+MIB_PROBE_TCP(tcps_sc_aborted);
+MIB_PROBE_TCP(tcps_sc_badack);
+MIB_PROBE_TCP(tcps_sc_unreach);
+MIB_PROBE_TCP(tcps_sc_zonefail);
+MIB_PROBE_TCP(tcps_sc_sendcookie);
+MIB_PROBE_TCP(tcps_sc_recvcookie);
+
+MIB_PROBE_TCP(tcps_hc_added);
+MIB_PROBE_TCP(tcps_hc_bucketoverflow);
+
+MIB_PROBE_TCP(tcps_finwait2_drops);
+
+MIB_PROBE_TCP(tcps_sack_recovery_episode);
+MIB_PROBE_TCP(tcps_sack_rexmits);
+MIB_PROBE_TCP(tcps_sack_rexmit_bytes);
+MIB_PROBE_TCP(tcps_sack_rcv_blocks);
+MIB_PROBE_TCP(tcps_sack_send_blocks);
+MIB_PROBE_TCP(tcps_sack_lostrexmt);
+MIB_PROBE_TCP(tcps_sack_sboverflow);
+
+MIB_PROBE_TCP(tcps_ecn_rcvce);
+MIB_PROBE_TCP(tcps_ecn_rcvect0);
+MIB_PROBE_TCP(tcps_ecn_rcvect1);
+MIB_PROBE_TCP(tcps_ecn_shs);
+MIB_PROBE_TCP(tcps_ecn_rcwnd);
+
+MIB_PROBE_TCP(tcps_sig_rcvgoodsig);
+MIB_PROBE_TCP(tcps_sig_rcvbadsig);
+MIB_PROBE_TCP(tcps_sig_err_buildsig);
+MIB_PROBE_TCP(tcps_sig_err_sigopt);
+MIB_PROBE_TCP(tcps_sig_err_nosigopt);
+
+MIB_PROBE_TCP(tcps_pmtud_blackhole_activated);
+MIB_PROBE_TCP(tcps_pmtud_blackhole_activated_min_mss);
+MIB_PROBE_TCP(tcps_pmtud_blackhole_failed);
+
+MIB_PROBE_TCP(tcps_tunneled_pkts);
+MIB_PROBE_TCP(tcps_tunneled_errs);
+
+MIB_PROBE_TCP(tcps_dsack_count);
+MIB_PROBE_TCP(tcps_dsack_bytes);
+MIB_PROBE_TCP(tcps_dsack_tlp_bytes);
+
+MIB_PROBE_TCP(tcps_tw_recycles);
+MIB_PROBE_TCP(tcps_tw_resets);
+MIB_PROBE_TCP(tcps_tw_responds);
+
+MIB_PROBE_TCP(tcps_ace_nect);
+MIB_PROBE_TCP(tcps_ace_ect1);
+MIB_PROBE_TCP(tcps_ace_ect0);
+MIB_PROBE_TCP(tcps_ace_ce);
+
+MIB_PROBE_TCP(tcps_ecn_sndect0);
+MIB_PROBE_TCP(tcps_ecn_sndect1);
+
+MIB_PROBE_TCP(tcps_tlpresends);
+MIB_PROBE_TCP(tcps_tlpresend_bytes);
+
+#endif
+
 SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
     "void *", "pktinfo_t *",
     "void *", "csinfo_t *",
diff --git a/sys/netinet/in_kdtrace.h b/sys/netinet/in_kdtrace.h
index ca279cdfc3be..780839299993 100644
--- a/sys/netinet/in_kdtrace.h
+++ b/sys/netinet/in_kdtrace.h
@@ -28,6 +28,8 @@
 #ifndef _SYS_IN_KDTRACE_H_
 #define	_SYS_IN_KDTRACE_H_
 
+#include <sys/sdt.h>
+
 #define	IP_PROBE(probe, arg0, arg1, arg2, arg3, arg4, arg5)		\
 	SDT_PROBE6(ip, , , probe, arg0, arg1, arg2, arg3, arg4, arg5)
 #define	UDP_PROBE(probe, arg0, arg1, arg2, arg3, arg4)			\
@@ -52,6 +54,283 @@ SDT_PROVIDER_DECLARE(tcp);
 SDT_PROVIDER_DECLARE(udp);
 SDT_PROVIDER_DECLARE(udplite);
 
+#ifndef KDTRACE_NO_MIB_SDT
+SDT_PROVIDER_DECLARE(mib);
+
+SDT_PROBE_DECLARE(mib, ip, count, ips_total);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badsum);
+SDT_PROBE_DECLARE(mib, ip, count, ips_tooshort);
+SDT_PROBE_DECLARE(mib, ip, count, ips_toosmall);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badhlen);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badlen);
+SDT_PROBE_DECLARE(mib, ip, count, ips_fragments);
+SDT_PROBE_DECLARE(mib, ip, count, ips_fragdropped);
+SDT_PROBE_DECLARE(mib, ip, count, ips_fragtimeout);
+SDT_PROBE_DECLARE(mib, ip, count, ips_forward);
+SDT_PROBE_DECLARE(mib, ip, count, ips_fastforward);
+SDT_PROBE_DECLARE(mib, ip, count, ips_cantforward);
+SDT_PROBE_DECLARE(mib, ip, count, ips_redirectsent);
+SDT_PROBE_DECLARE(mib, ip, count, ips_noproto);
+SDT_PROBE_DECLARE(mib, ip, count, ips_delivered);
+SDT_PROBE_DECLARE(mib, ip, count, ips_localout);
+SDT_PROBE_DECLARE(mib, ip, count, ips_odropped);
+SDT_PROBE_DECLARE(mib, ip, count, ips_reassembled);
+SDT_PROBE_DECLARE(mib, ip, count, ips_fragmented);
+SDT_PROBE_DECLARE(mib, ip, count, ips_ofragments);
+SDT_PROBE_DECLARE(mib, ip, count, ips_cantfrag);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badoptions);
+SDT_PROBE_DECLARE(mib, ip, count, ips_noroute);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badvers);
+SDT_PROBE_DECLARE(mib, ip, count, ips_rawout);
+SDT_PROBE_DECLARE(mib, ip, count, ips_toolong);
+SDT_PROBE_DECLARE(mib, ip, count, ips_notmember);
+SDT_PROBE_DECLARE(mib, ip, count, ips_nogif);
+SDT_PROBE_DECLARE(mib, ip, count, ips_badaddr);
+
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_total);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_tooshort);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_toosmall);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragments);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragdropped);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragtimeout);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragoverflow);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_forward);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_cantforward);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_redirectsent);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_delivered);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_localout);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_odropped);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_reassembled);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_atomicfrags);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragmented);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_ofragments);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_cantfrag);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badoptions);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_noroute);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badvers);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_rawout);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badscope);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_notmember);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_nxthist);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_m1);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_m2m);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_mext1);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_mext2m);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_exthdrtoolong);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_nogif);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_toomanyhdr);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_none);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_sameif);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_otherif);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_samescope);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_otherscope);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_deprecated);
+SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_rule);
+
+SDT_PROBE_DECLARE(mib, icmp, count, icps_error);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_oldshort);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_oldicmp);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_outhist);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_badcode);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_tooshort);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_checksum);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_badlen);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_reflect);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_inhist);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_bmcastecho);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_bmcasttstamp);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_badaddr);
+SDT_PROBE_DECLARE(mib, icmp, count, icps_noroute);
+
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_error);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_canterror);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_toofreq);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_outhist);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badcode);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_tooshort);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_checksum);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badlen);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_dropped);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_reflect);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_inhist);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_nd_toomanyopt);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_noroute);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_admin);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_beyondscope);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_addr);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_noport);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_opacket_too_big);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_otime_exceed_transit);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_otime_exceed_reassembly);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_header);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_nextheader);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_option);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oredirect);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_ounknown);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_pmtuchg);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_nd_badopt);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badns);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badna);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badrs);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badra);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badredirect);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowdefrtr);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowprfx);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflownndp);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowredirect);
+SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_invlhlim);
+
+SDT_PROBE_DECLARE(mib, udp, count, udps_ipackets);
+SDT_PROBE_DECLARE(mib, udp, count, udps_hdrops);
+SDT_PROBE_DECLARE(mib, udp, count, udps_badsum);
+SDT_PROBE_DECLARE(mib, udp, count, udps_nosum);
+SDT_PROBE_DECLARE(mib, udp, count, udps_badlen);
+SDT_PROBE_DECLARE(mib, udp, count, udps_noport);
+SDT_PROBE_DECLARE(mib, udp, count, udps_noportbcast);
+SDT_PROBE_DECLARE(mib, udp, count, udps_fullsock);
+SDT_PROBE_DECLARE(mib, udp, count, udps_pcbcachemiss);
+SDT_PROBE_DECLARE(mib, udp, count, udps_pcbhashmiss);
+SDT_PROBE_DECLARE(mib, udp, count, udps_opackets);
+SDT_PROBE_DECLARE(mib, udp, count, udps_fastout);
+SDT_PROBE_DECLARE(mib, udp, count, udps_noportmcast);
+SDT_PROBE_DECLARE(mib, udp, count, udps_filtermcast);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_connattempt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_accepts);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_connects);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_drops);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_conndrops);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_minmssdrops);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_closed);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_segstimed);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rttupdated);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_delack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_timeoutdrop);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rexmttimeo);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_persisttimeo);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_keeptimeo);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_keepprobe);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_keepdrops);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_progdrops);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndtotal);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndpack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitpack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitbad);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndacks);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndprobe);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndurg);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndwinup);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndctrl);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvtotal);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbadsum);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbadoff);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvreassfull);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvshort);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvduppack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvdupbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpartduppack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpartdupbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvoopack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvoobyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpackafterwin);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbyteafterwin);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvafterclose);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvwinprobe);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvdupack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvacktoomuch);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvackpack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvackbyte);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvwinupd);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_pawsdrop);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_predack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_preddat);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_pcbcachemiss);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrtt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrttvar);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedssthresh);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrtt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrttvar);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedssthresh);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_persistdrop);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_badsyn);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_mturesent);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_listendrop);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_badrst);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_added);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_retransmitted);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_dupsyn);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_dropped);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_completed);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_bucketoverflow);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_cacheoverflow);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_reset);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_stale);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_aborted);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_badack);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_unreach);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_zonefail);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_sendcookie);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_recvcookie);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_added);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_bucketoverflow);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_finwait2_drops);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_recovery_episode);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rexmits);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rexmit_bytes);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rcv_blocks);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_send_blocks);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_lostrexmt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_sboverflow);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvce);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvect0);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvect1);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_shs);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcwnd);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_rcvgoodsig);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_rcvbadsig);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_buildsig);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_sigopt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_nosigopt);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_activated);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_activated_min_mss);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_failed);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tunneled_pkts);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tunneled_errs);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_count);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_bytes);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_tlp_bytes);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_recycles);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_resets);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_responds);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_nect);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ect1);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ect0);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ce);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_sndect0);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_sndect1);
+
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tlpresends);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_tlpresend_bytes);
+#endif
+
 SDT_PROBE_DECLARE(ip, , , receive);
 SDT_PROBE_DECLARE(ip, , , send);
 
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 4dfbd0c525ff..a8ce2b4c1d6c 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -344,7 +344,7 @@ stdreply:	icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) -
 	 */
 	M_SETFIB(m, M_GETFIB(n));
 	icp = mtod(m, struct icmp *);
-	ICMPSTAT_INC(icps_outhist[type]);
+	ICMPSTAT_INC2(icps_outhist, type);
 	icp->icmp_type = type;
 	if (type == ICMP_REDIRECT)
 		icp->icmp_gwaddr.s_addr = dest;
@@ -528,7 +528,7 @@ icmp_input(struct mbuf **mp, int *offp, int proto)
 	icmpgw.sin_len = sizeof(struct sockaddr_in);
 	icmpgw.sin_family = AF_INET;
 
-	ICMPSTAT_INC(icps_inhist[icp->icmp_type]);
+	ICMPSTAT_INC2(icps_inhist, icp->icmp_type);
 	code = icp->icmp_code;
 	switch (icp->icmp_type) {
 	case ICMP_UNREACH:
@@ -663,7 +663,7 @@ icmp_input(struct mbuf **mp, int *offp, int proto)
 		}
 reflect:
 		ICMPSTAT_INC(icps_reflect);
-		ICMPSTAT_INC(icps_outhist[icp->icmp_type]);
+		ICMPSTAT_INC2(icps_outhist, icp->icmp_type);
 		icmp_reflect(m);
 		return (IPPROTO_DONE);
 
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 826954c6fb6a..0f2ed8c43e64 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -136,15 +136,19 @@ struct	ipstat {
 
 #include <sys/counter.h>
 #include <net/vnet.h>
+#include <netinet/in_kdtrace.h>
 
 VNET_PCPUSTAT_DECLARE(struct ipstat, ipstat);
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#define	IPSTAT_ADD(name, val)	\
-    VNET_PCPUSTAT_ADD(struct ipstat, ipstat, name, (val))
-#define	IPSTAT_SUB(name, val)	IPSTAT_ADD(name, -(val))
+#define IPSTAT_ADD(name, val)                                          \
+	do {                                                           \
+		MIB_SDT_PROBE1(ip, count, name, (val));                \
+		VNET_PCPUSTAT_ADD(struct ipstat, ipstat, name, (val)); \
+	} while (0)
+#define IPSTAT_SUB(name, val) IPSTAT_ADD(name, -(val))
 #define	IPSTAT_INC(name)	IPSTAT_ADD(name, 1)
 #define	IPSTAT_DEC(name)	IPSTAT_SUB(name, 1)
 
@@ -152,11 +156,19 @@ VNET_PCPUSTAT_DECLARE(struct ipstat, ipstat);
  * Kernel module consumers must use this accessor macro.
  */
 void	kmod_ipstat_inc(int statnum);
-#define	KMOD_IPSTAT_INC(name)	\
-    kmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(uint64_t))
-void	kmod_ipstat_dec(int statnum);
-#define	KMOD_IPSTAT_DEC(name)	\
-    kmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(uint64_t))
+#define KMOD_IPSTAT_INC(name)                                          \
+	do {                                                           \
+		MIB_SDT_PROBE1(ip, count, name, 1);                    \
+		kmod_ipstat_inc(                                       \
+		    offsetof(struct ipstat, name) / sizeof(uint64_t)); \
+	} while (0)
+void kmod_ipstat_dec(int statnum);
+#define KMOD_IPSTAT_DEC(name)                                          \
+	do {                                                           \
+		MIB_SDT_PROBE1(ip, count, name, -1);                   \
+		kmod_ipstat_dec(                                       \
+		    offsetof(struct ipstat, name) / sizeof(uint64_t)); \
+	} while (0)
 
 /* flags passed to ip_output as last parameter */
 #define	IP_FORWARDING		0x1		/* most of ip header exists */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 7542d680daa0..b16410dad4db 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1093,22 +1093,31 @@ struct	tcpstat {
 #define	TI_UNLOCKED	1
 #define	TI_RLOCKED	2
 #include <sys/counter.h>
+#include <netinet/in_kdtrace.h>
 
 VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat);	/* tcp statistics */
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#define	TCPSTAT_ADD(name, val)	\
-    VNET_PCPUSTAT_ADD(struct tcpstat, tcpstat, name, (val))
+#define TCPSTAT_ADD(name, val)                                           \
+	do {                                                             \
+		MIB_SDT_PROBE1(tcp, count, name, (val));                 \
+		VNET_PCPUSTAT_ADD(struct tcpstat, tcpstat, name, (val)); \
+	} while (0)
 #define	TCPSTAT_INC(name)	TCPSTAT_ADD(name, 1)
 
 /*
  * Kernel module consumers must use this accessor macro.
  */
 void	kmod_tcpstat_add(int statnum, int val);
-#define	KMOD_TCPSTAT_ADD(name, val)					\
-    kmod_tcpstat_add(offsetof(struct tcpstat, name) / sizeof(uint64_t), val)
+#define KMOD_TCPSTAT_ADD(name, val)                               \
+	do {                                                      \
+		MIB_SDT_PROBE1(tcp, count, name, (val));          \
+		kmod_tcpstat_add(offsetof(struct tcpstat, name) / \
+			sizeof(uint64_t),                         \
+		    val);                                         \
+	} while (0)
 #define	KMOD_TCPSTAT_INC(name)	KMOD_TCPSTAT_ADD(name, 1)
 
 /*
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index a66d76845eb6..0d70bad91df4 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -93,6 +93,7 @@ struct udpstat {
 #ifdef _KERNEL
 #include <netinet/in_pcb.h>
 #include <sys/counter.h>
+#include <netinet/in_kdtrace.h>
 struct mbuf;
 
 typedef bool	udp_tun_func_t(struct mbuf *, int, struct inpcb *,
@@ -127,16 +128,23 @@ VNET_PCPUSTAT_DECLARE(struct udpstat, udpstat);
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#define	UDPSTAT_ADD(name, val)  \
-    VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val))
-#define	UDPSTAT_INC(name)	UDPSTAT_ADD(name, 1)
+#define UDPSTAT_ADD(name, val)                                           \
+	do {                                                             \
+		MIB_SDT_PROBE1(udp, count, name, (val));                 \
+		VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val)); \
+	} while (0)
+#define UDPSTAT_INC(name) UDPSTAT_ADD(name, 1)
 
 /*
  * Kernel module consumers must use this accessor macro.
  */
 void	kmod_udpstat_inc(int statnum);
-#define	KMOD_UDPSTAT_INC(name)	\
*** 232 LINES SKIPPED ***