Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2012 14:29:24 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r233836 - projects/pf/head/sys/contrib/pf/net
Message-ID:  <201204031429.q33ETOpt053768@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue Apr  3 14:29:24 2012
New Revision: 233836
URL: http://svn.freebsd.org/changeset/base/233836

Log:
  Store counters for all sent and received pfsync actions
  in pfsyncstats.

Modified:
  projects/pf/head/sys/contrib/pf/net/if_pfsync.c
  projects/pf/head/sys/contrib/pf/net/if_pfsync.h

Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/if_pfsync.c	Tue Apr  3 09:16:41 2012	(r233835)
+++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c	Tue Apr  3 14:29:24 2012	(r233836)
@@ -584,6 +584,7 @@ pfsync_input(struct mbuf *m, __unused in
 
 	int offset;
 	int rv;
+	uint16_t count;
 
 	V_pfsyncstats.pfsyncs_ipackets++;
 
@@ -644,8 +645,9 @@ pfsync_input(struct mbuf *m, __unused in
 			goto done;
 		}
 
-		rv = (*pfsync_acts[subh.action])(&pkt, m, offset,
-		    ntohs(subh.count));
+		count = ntohs(subh.count);
+		V_pfsyncstats.pfsyncs_iacts[subh.action] += count;
+		rv = (*pfsync_acts[subh.action])(&pkt, m, offset, count);
 		if (rv == -1)
 			return;
 
@@ -1571,6 +1573,7 @@ pfsync_sendout(int schedswi)
 		bzero(subh, sizeof(*subh));
 		subh->action = pfsync_qs[q].action;
 		subh->count = htons(count);
+		V_pfsyncstats.pfsyncs_oacts[pfsync_qs[q].action] += count;
 	}
 
 	if (!TAILQ_EMPTY(&sc->sc_upd_req_list)) {
@@ -1593,6 +1596,7 @@ pfsync_sendout(int schedswi)
 		bzero(subh, sizeof(*subh));
 		subh->action = PFSYNC_ACT_UPD_REQ;
 		subh->count = htons(count);
+		V_pfsyncstats.pfsyncs_oacts[PFSYNC_ACT_UPD_REQ] += count;
 	}
 
 	/* has someone built a custom region for us to add? */
@@ -1609,6 +1613,7 @@ pfsync_sendout(int schedswi)
 	bzero(subh, sizeof(*subh));
 	subh->action = PFSYNC_ACT_EOF;
 	subh->count = htons(1);
+	V_pfsyncstats.pfsyncs_oacts[PFSYNC_ACT_EOF]++;
 
 	/* XXX write checksum in EOF here */
 
@@ -1955,6 +1960,7 @@ pfsync_clear_states(u_int32_t creatorid,
 
 	r.subh.action = PFSYNC_ACT_CLR;
 	r.subh.count = htons(1);
+	V_pfsyncstats.pfsyncs_oacts[PFSYNC_ACT_CLR]++;
 
 	strlcpy(r.clr.ifname, ifname, sizeof(r.clr.ifname));
 	r.clr.creatorid = creatorid;
@@ -2104,6 +2110,7 @@ pfsync_bulk_status(u_int8_t status)
 
 	r.subh.action = PFSYNC_ACT_BUS;
 	r.subh.count = htons(1);
+	V_pfsyncstats.pfsyncs_oacts[PFSYNC_ACT_BUS]++;
 
 	r.bus.creatorid = V_pf_status.hostid;
 	r.bus.endtime = htonl(time_uptime - sc->sc_ureq_received);

Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.h
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/if_pfsync.h	Tue Apr  3 09:16:41 2012	(r233835)
+++ projects/pf/head/sys/contrib/pf/net/if_pfsync.h	Tue Apr  3 14:29:24 2012	(r233836)
@@ -256,6 +256,9 @@ struct pfsyncstats {
 	u_int64_t	pfsyncs_opackets6;	/* total output packets, IPv6 */
 	u_int64_t	pfsyncs_onomem;		/* no memory for an mbuf */
 	u_int64_t	pfsyncs_oerrors;	/* ip output error */
+
+	u_int64_t	pfsyncs_iacts[PFSYNC_ACT_MAX];
+	u_int64_t	pfsyncs_oacts[PFSYNC_ACT_MAX];
 };
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204031429.q33ETOpt053768>