PERFORCE change 166822 for review

Gabor Pali pgj at FreeBSD.org
Thu Jul 30 18:31:37 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166822

Change 166822 by pgj at petymeg-current on 2009/07/30 18:31:35

	- Standardize and add header for SPX statistics.
	- Expose SPX statistics via sysctl(3) [net.ipx.spx.stats].

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/sys/netipx/spx_usrreq.c#3 edit
.. //depot/projects/soc2009/pgj_libstat/src/sys/netipx/spx_var.h#3 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/sys/netipx/spx_usrreq.c#3 (text+ko) ====

@@ -65,6 +65,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.96 2009/05/25 11:52:33 rwatson Exp $");
 
+#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
@@ -77,9 +78,13 @@
 #include <sys/socketvar.h>
 #include <sys/sx.h>
 #include <sys/systm.h>
+#include <sys/linker_set.h>
+#include <sys/sysctl.h>
+#include <sys/sockopt.h>
 
 #include <net/route.h>
 #include <netinet/tcp_fsm.h>
+#include <netinet/tcp_var.h>
 
 #include <netipx/ipx.h>
 #include <netipx/ipx_pcb.h>
@@ -97,8 +102,17 @@
 u_short		spx_newchecks[50];
 static int	spx_hardnosed;
 static int	traceallspxs = 0;
+struct	stat_header spx_istat_header = {
+	.sth_version = SPXSTAT_VERSION,
+	.sth_len = sizeof(struct spx_istat)
+};
 struct	spx_istat spx_istat;
 
+SYSCTL_STRUCT(_net_ipx_spx, OID_AUTO, stats, CTLFLAG_RW, &spx_istat,
+    spx_istat, "SPX Statistics (struct spx_istat, netipx/spx_var.h)");
+SYSCTL_STRUCT(_net_ipx_spx, OID_AUTO, stats_header, CTLFLAG_RD,
+    &spx_istat_header, stat_header, "SPX Statistics header");
+
 #define	SPX_LOCK_INIT()	mtx_init(&spx_mtx, "spx_mtx", NULL, MTX_DEF)
 #define	SPX_LOCK()	mtx_lock(&spx_mtx)
 #define	SPX_UNLOCK()	mtx_unlock(&spx_mtx)

==== //depot/projects/soc2009/pgj_libstat/src/sys/netipx/spx_var.h#3 (text+ko) ====

@@ -64,71 +64,73 @@
 #ifndef _NETIPX_SPX_VAR_H_
 #define _NETIPX_SPX_VAR_H_
 
+#define SPXSTAT_VERSION	    0x00000001
+
 struct	spxstat {
-	long	spxs_connattempt;	/* connections initiated */
-	long	spxs_accepts;		/* connections accepted */
-	long	spxs_connects;		/* connections established */
-	long	spxs_drops;		/* connections dropped */
-	long	spxs_conndrops;		/* embryonic connections dropped */
-	long	spxs_closed;		/* conn. closed (includes drops) */
-	long	spxs_segstimed;		/* segs where we tried to get rtt */
-	long	spxs_rttupdated;	/* times we succeeded */
-	long	spxs_delack;		/* delayed acks sent */
-	long	spxs_timeoutdrop;	/* conn. dropped in rxmt timeout */
-	long	spxs_rexmttimeo;	/* retransmit timeouts */
-	long	spxs_persisttimeo;	/* persist timeouts */
-	long	spxs_keeptimeo;		/* keepalive timeouts */
-	long	spxs_keepprobe;		/* keepalive probes sent */
-	long	spxs_keepdrops;		/* connections dropped in keepalive */
+	u_int64_t	spxs_connattempt;	/* connections initiated */
+	u_int64_t	spxs_accepts;		/* connections accepted */
+	u_int64_t	spxs_connects;		/* connections established */
+	u_int64_t	spxs_drops;		/* connections dropped */
+	u_int64_t	spxs_conndrops;		/* embryonic connections dropped */
+	u_int64_t	spxs_closed;		/* conn. closed (includes drops) */
+	u_int64_t	spxs_segstimed;		/* segs where we tried to get rtt */
+	u_int64_t	spxs_rttupdated;	/* times we succeeded */
+	u_int64_t	spxs_delack;		/* delayed acks sent */
+	u_int64_t	spxs_timeoutdrop;	/* conn. dropped in rxmt timeout */
+	u_int64_t	spxs_rexmttimeo;	/* retransmit timeouts */
+	u_int64_t	spxs_persisttimeo;	/* persist timeouts */
+	u_int64_t	spxs_keeptimeo;		/* keepalive timeouts */
+	u_int64_t	spxs_keepprobe;		/* keepalive probes sent */
+	u_int64_t	spxs_keepdrops;		/* connections dropped in keepalive */
 
-	long	spxs_sndtotal;		/* total packets sent */
-	long	spxs_sndpack;		/* data packets sent */
-	long	spxs_sndbyte;		/* data bytes sent */
-	long	spxs_sndrexmitpack;	/* data packets retransmitted */
-	long	spxs_sndrexmitbyte;	/* data bytes retransmitted */
-	long	spxs_sndacks;		/* ack-only packets sent */
-	long	spxs_sndprobe;		/* window probes sent */
-	long	spxs_sndurg;		/* packets sent with URG only */
-	long	spxs_sndwinup;		/* window update-only packets sent */
-	long	spxs_sndctrl;		/* control (SYN|FIN|RST) packets sent */
-	long	spxs_sndvoid;		/* couldn't find requested packet*/
+	u_int64_t	spxs_sndtotal;		/* total packets sent */
+	u_int64_t	spxs_sndpack;		/* data packets sent */
+	u_int64_t	spxs_sndbyte;		/* data bytes sent */
+	u_int64_t	spxs_sndrexmitpack;	/* data packets retransmitted */
+	u_int64_t	spxs_sndrexmitbyte;	/* data bytes retransmitted */
+	u_int64_t	spxs_sndacks;		/* ack-only packets sent */
+	u_int64_t	spxs_sndprobe;		/* window probes sent */
+	u_int64_t	spxs_sndurg;		/* packets sent with URG only */
+	u_int64_t	spxs_sndwinup;		/* window update-only packets sent */
+	u_int64_t	spxs_sndctrl;		/* control (SYN|FIN|RST) packets sent */
+	u_int64_t	spxs_sndvoid;		/* couldn't find requested packet*/
 
-	long	spxs_rcvtotal;		/* total packets received */
-	long	spxs_rcvpack;		/* packets received in sequence */
-	long	spxs_rcvbyte;		/* bytes received in sequence */
-	long	spxs_rcvbadsum;		/* packets received with ccksum errs */
-	long	spxs_rcvbadoff;		/* packets received with bad offset */
-	long	spxs_rcvshort;		/* packets received too short */
-	long	spxs_rcvduppack;	/* duplicate-only packets received */
-	long	spxs_rcvdupbyte;	/* duplicate-only bytes received */
-	long	spxs_rcvpartduppack;	/* packets with some duplicate data */
-	long	spxs_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
-	long	spxs_rcvoopack;		/* out-of-order packets received */
-	long	spxs_rcvoobyte;		/* out-of-order bytes received */
-	long	spxs_rcvpackafterwin;	/* packets with data after window */
-	long	spxs_rcvbyteafterwin;	/* bytes rcvd after window */
-	long	spxs_rcvafterclose;	/* packets rcvd after "close" */
-	long	spxs_rcvwinprobe;	/* rcvd window probe packets */
-	long	spxs_rcvdupack;		/* rcvd duplicate acks */
-	long	spxs_rcvacktoomuch;	/* rcvd acks for unsent data */
-	long	spxs_rcvackpack;	/* rcvd ack packets */
-	long	spxs_rcvackbyte;	/* bytes acked by rcvd acks */
-	long	spxs_rcvwinupd;		/* rcvd window update packets */
+	u_int64_t	spxs_rcvtotal;		/* total packets received */
+	u_int64_t	spxs_rcvpack;		/* packets received in sequence */
+	u_int64_t	spxs_rcvbyte;		/* bytes received in sequence */
+	u_int64_t	spxs_rcvbadsum;		/* packets received with ccksum errs */
+	u_int64_t	spxs_rcvbadoff;		/* packets received with bad offset */
+	u_int64_t	spxs_rcvshort;		/* packets received too short */
+	u_int64_t	spxs_rcvduppack;	/* duplicate-only packets received */
+	u_int64_t	spxs_rcvdupbyte;	/* duplicate-only bytes received */
+	u_int64_t	spxs_rcvpartduppack;	/* packets with some duplicate data */
+	u_int64_t	spxs_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
+	u_int64_t	spxs_rcvoopack;		/* out-of-order packets received */
+	u_int64_t	spxs_rcvoobyte;		/* out-of-order bytes received */
+	u_int64_t	spxs_rcvpackafterwin;	/* packets with data after window */
+	u_int64_t	spxs_rcvbyteafterwin;	/* bytes rcvd after window */
+	u_int64_t	spxs_rcvafterclose;	/* packets rcvd after "close" */
+	u_int64_t	spxs_rcvwinprobe;	/* rcvd window probe packets */
+	u_int64_t	spxs_rcvdupack;		/* rcvd duplicate acks */
+	u_int64_t	spxs_rcvacktoomuch;	/* rcvd acks for unsent data */
+	u_int64_t	spxs_rcvackpack;	/* rcvd ack packets */
+	u_int64_t	spxs_rcvackbyte;	/* bytes acked by rcvd acks */
+	u_int64_t	spxs_rcvwinupd;		/* rcvd window update packets */
 };
 struct	spx_istat {
-	short	hdrops;
-	short	badsum;
-	short	badlen;
-	short	slotim;
-	short	fastim;
-	short	nonucn;
-	short	noconn;
-	short	notme;
-	short	wrncon;
-	short	bdreas;
-	short	gonawy;
-	short	notyet;
-	short	lstdup;
+	u_int64_t	hdrops;
+	u_int64_t	badsum;
+	u_int64_t	badlen;
+	u_int64_t	slotim;
+	u_int64_t	fastim;
+	u_int64_t	nonucn;
+	u_int64_t	noconn;
+	u_int64_t	notme;
+	u_int64_t	wrncon;
+	u_int64_t	bdreas;
+	u_int64_t	gonawy;
+	u_int64_t	notyet;
+	u_int64_t	lstdup;
 	struct spxstat newstats;
 };
 
@@ -144,6 +146,11 @@
 #define	SSEQ_GEQ(a,b)	(((short)((a)-(b))) >= 0)
 
 #ifdef _KERNEL
+
+#ifdef SYSCTL_DECL
+SYSCTL_DECL(_net_ipx_spx);
+#endif
+
 /* Following was struct spxstat spxstat; */
 #ifndef spxstat
 #define	spxstat	spx_istat.newstats


More information about the p4-projects mailing list