Page MenuHomeFreeBSD

D43504.id133167.diff
No OneTemporary

D43504.id133167.diff

diff --git a/sys/netinet/icmp_var.h b/sys/netinet/icmp_var.h
--- a/sys/netinet/icmp_var.h
+++ b/sys/netinet/icmp_var.h
@@ -57,22 +57,36 @@
#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 { \
+ SDT_PROBE1(mib, 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 { \
+ SDT_PROBE2(mib, 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 { \
+ SDT_PROBE1(mib, icmp, count, name, 1); \
+ kmod_icmpstat_inc( \
+ offsetof(struct icmpstat, name) / sizeof(uint64_t)); \
+ } while (0)
#endif
/*
diff --git a/sys/netinet/in_kdtrace.h b/sys/netinet/in_kdtrace.h
--- 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) \
@@ -47,11 +49,97 @@
#define TCP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5) \
SDT_PROBE6(tcp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5)
+SDT_PROVIDER_DECLARE(mib);
SDT_PROVIDER_DECLARE(ip);
SDT_PROVIDER_DECLARE(tcp);
SDT_PROVIDER_DECLARE(udp);
SDT_PROVIDER_DECLARE(udplite);
+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(ip, , , receive);
SDT_PROBE_DECLARE(ip, , , send);
diff --git a/sys/netinet/in_kdtrace.c b/sys/netinet/in_kdtrace.c
--- a/sys/netinet/in_kdtrace.c
+++ b/sys/netinet/in_kdtrace.c
@@ -30,11 +30,115 @@
#include <sys/systm.h>
#include <sys/sdt.h>
+SDT_PROVIDER_DEFINE(mib);
SDT_PROVIDER_DEFINE(ip);
+SDT_PROVIDER_DEFINE(ip6);
SDT_PROVIDER_DEFINE(tcp);
SDT_PROVIDER_DEFINE(udp);
SDT_PROVIDER_DEFINE(udplite);
+#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")
+
+MIB_PROBE_ICMP(icps_error);
+MIB_PROBE_ICMP(icps_oldshort);
+MIB_PROBE_ICMP(icps_oldicmp);
+SDT_PROBE_DEFINE2(mib, icmp, count, icps_outhist,
+ "int", "int");
+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);
+SDT_PROBE_DEFINE2(mib, icmp, count, icps_inhist,
+ "int", "int");
+MIB_PROBE_ICMP(icps_bmcastecho);
+MIB_PROBE_ICMP(icps_bmcasttstamp);
+MIB_PROBE_ICMP(icps_badaddr);
+MIB_PROBE_ICMP(icps_noroute);
+
SDT_PROBE_DEFINE6_XLATE(ip, , , receive,
"void *", "pktinfo_t *",
"void *", "csinfo_t *",
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -341,7 +341,7 @@
*/
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;
@@ -525,7 +525,7 @@
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:
@@ -660,7 +660,7 @@
}
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
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -136,15 +136,19 @@
#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 { \
+ SDT_PROBE1(mib, 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 @@
* 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 { \
+ SDT_PROBE1(mib, 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 { \
+ SDT_PROBE1(mib, 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/netinet6/in6_src.c b/sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -152,7 +152,7 @@
* an entry to the caller for later use.
*/
#define REPLACE(r) do {\
- IP6STAT_INC(ip6s_sources_rule[(r)]); \
+ IP6STAT_INC2(ip6s_sources_rule, (r)); \
/* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \
@@ -167,7 +167,7 @@
goto next; /* XXX: we can't use 'continue' here */ \
} while(0)
#define BREAK(r) do { \
- IP6STAT_INC(ip6s_sources_rule[(r)]); \
+ IP6STAT_INC2(ip6s_sources_rule, (r)); \
goto out; /* XXX: we can't use 'break' here */ \
} while(0)
@@ -523,15 +523,15 @@
bcopy(&tmp, srcp, sizeof(*srcp));
if (ia->ia_ifp == ifp)
- IP6STAT_INC(ip6s_sources_sameif[best_scope]);
+ IP6STAT_INC2(ip6s_sources_sameif, best_scope);
else
- IP6STAT_INC(ip6s_sources_otherif[best_scope]);
+ IP6STAT_INC2(ip6s_sources_otherif, best_scope);
if (dst_scope == best_scope)
- IP6STAT_INC(ip6s_sources_samescope[best_scope]);
+ IP6STAT_INC2(ip6s_sources_samescope, best_scope);
else
- IP6STAT_INC(ip6s_sources_otherscope[best_scope]);
+ IP6STAT_INC2(ip6s_sources_otherscope, best_scope);
if (IFA6_IS_DEPRECATED(ia))
- IP6STAT_INC(ip6s_sources_deprecated[best_scope]);
+ IP6STAT_INC2(ip6s_sources_deprecated, best_scope);
IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
return (0);
}
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -573,7 +573,7 @@
int ifindex = ifp->if_index;
if (ifindex >= IP6S_M2MMAX)
ifindex = 0;
- IP6STAT_INC(ip6s_m2m[ifindex]);
+ IP6STAT_INC2(ip6s_m2m, ifindex);
} else
IP6STAT_INC(ip6s_m1);
}
@@ -617,7 +617,7 @@
goto bad;
}
- IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]);
+ IP6STAT_INC2(ip6s_nxthist, ip6->ip6_nxt);
IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6);
/*
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -245,13 +245,22 @@
#ifdef _KERNEL
#include <sys/counter.h>
+#include <netinet/in_kdtrace.h>
VNET_PCPUSTAT_DECLARE(struct ip6stat, ip6stat);
-#define IP6STAT_ADD(name, val) \
- VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val))
-#define IP6STAT_SUB(name, val) IP6STAT_ADD(name, -(val))
+#define IP6STAT_ADD(name, val) \
+ do { \
+ SDT_PROBE1(mib, ip6, count, name, (val)); \
+ VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val)); \
+ } while (0)
+#define IP6STAT_SUB(name, val) IP6STAT_ADD(name, -(val))
#define IP6STAT_INC(name) IP6STAT_ADD(name, 1)
-#define IP6STAT_DEC(name) IP6STAT_SUB(name, 1)
+#define IP6STAT_INC2(name, type) \
+ do { \
+ SDT_PROBE2(mib, ip6, count, name, 1, type); \
+ VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, 1); \
+ } while (0)
+#define IP6STAT_DEC(name) IP6STAT_SUB(name, 1)
#endif
#ifdef _KERNEL

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 25, 12:54 PM (12 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24173962
Default Alt Text
D43504.id133167.diff (16 KB)

Event Timeline