Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 2014 09:19:30 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271857 - head/sys/netpfil/pf
Message-ID:  <201409190919.s8J9JUkl005388@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Sep 19 09:19:29 2014
New Revision: 271857
URL: http://svnweb.freebsd.org/changeset/base/271857

Log:
  Mechanically convert to if_inc_counter().

Modified:
  head/sys/netpfil/pf/if_pflog.c
  head/sys/netpfil/pf/if_pfsync.c

Modified: head/sys/netpfil/pf/if_pflog.c
==============================================================================
--- head/sys/netpfil/pf/if_pflog.c	Fri Sep 19 09:01:19 2014	(r271856)
+++ head/sys/netpfil/pf/if_pflog.c	Fri Sep 19 09:19:29 2014	(r271857)
@@ -252,8 +252,8 @@ pflog_packet(struct pfi_kif *kif, struct
 	}
 #endif /* INET */
 
-	ifn->if_opackets++;
-	ifn->if_obytes += m->m_pkthdr.len;
+	if_inc_counter(ifn, IFCOUNTER_OPACKETS, 1);
+	if_inc_counter(ifn, IFCOUNTER_OBYTES, m->m_pkthdr.len);
 	BPF_MTAP2(ifn, &hdr, PFLOG_HDRLEN, m);
 
 	return (0);

Modified: head/sys/netpfil/pf/if_pfsync.c
==============================================================================
--- head/sys/netpfil/pf/if_pfsync.c	Fri Sep 19 09:01:19 2014	(r271856)
+++ head/sys/netpfil/pf/if_pfsync.c	Fri Sep 19 09:19:29 2014	(r271857)
@@ -598,8 +598,8 @@ pfsync_input(struct mbuf **mp, int *offp
 		goto done;
 	}
 
-	sc->sc_ifp->if_ipackets++;
-	sc->sc_ifp->if_ibytes += m->m_pkthdr.len;
+	if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1);
+	if_inc_counter(sc->sc_ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
 	/* verify that the IP TTL is 255. */
 	if (ip->ip_ttl != PFSYNC_DFLTTL) {
 		V_pfsyncstats.pfsyncs_badttl++;
@@ -1525,7 +1525,7 @@ pfsync_sendout(int schedswi)
 
 	m = m_get2(max_linkhdr + sc->sc_len, M_NOWAIT, MT_DATA, M_PKTHDR);
 	if (m == NULL) {
-		sc->sc_ifp->if_oerrors++;
+		if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
 		V_pfsyncstats.pfsyncs_onomem++;
 		return;
 	}
@@ -1632,15 +1632,15 @@ pfsync_sendout(int schedswi)
 		return;
 	}
 
-	sc->sc_ifp->if_opackets++;
-	sc->sc_ifp->if_obytes += m->m_pkthdr.len;
+	if_inc_counter(sc->sc_ifp, IFCOUNTER_OPACKETS, 1);
+	if_inc_counter(sc->sc_ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
 	sc->sc_len = PFSYNC_MINPKT;
 
 	if (!_IF_QFULL(&sc->sc_ifp->if_snd))
 		_IF_ENQUEUE(&sc->sc_ifp->if_snd, m);
 	else {
 		m_freem(m);
-		sc->sc_ifp->if_oqdrops++;
+		if_inc_counter(sc->sc_ifp, IFCOUNTER_OQDROPS, 1);
 	}
 	if (schedswi)
 		swi_sched(V_pfsync_swi_cookie, 0);



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