diff options
author | mvs <mvs@cvs.openbsd.org> | 2020-08-30 19:45:21 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2020-08-30 19:45:21 +0000 |
commit | ae61b710e417071f2c3ffb112058dfba5511a4be (patch) | |
tree | 152c0e94ac3d04ac80a4b419024e9da2a213debf /sys | |
parent | 22e84cfd2c51ba19b559be273de713a2f7729919 (diff) |
pppac(4) uses per cpu counters for collect `ifnet' statistics, but in
pipex(4) layer this `ifnet' still uses `if_data'. Also pppx(4) doesn't
use per cpu counters but `if_data'.
Add per cpu counters to pppx(4) and pipex(4). This finishes interface
statistics collecting mess.
ok yasuoka@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_pppx.c | 5 | ||||
-rw-r--r-- | sys/net/pipex.c | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index 8906fc73491..e71d181a801 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.102 2020/08/27 10:47:52 yasuoka Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.103 2020/08/30 19:45:20 mvs Exp $ */ /* * Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org> @@ -658,6 +658,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req) ifp->if_type = IFT_PPP; ifp->if_softc = pxi; /* ifp->if_rdomain = req->pr_rdomain; */ + if_counters_alloc(ifp); /* XXXSMP breaks atomicity */ NET_UNLOCK(); @@ -878,7 +879,7 @@ pppx_if_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, out: if (error) - ifp->if_oerrors++; + counters_inc(ifp->if_counters, ifc_oerrors); return (error); } diff --git a/sys/net/pipex.c b/sys/net/pipex.c index 7ce310e0adc..76d2feb49c6 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.125 2020/08/27 10:47:52 yasuoka Exp $ */ +/* $OpenBSD: pipex.c,v 1.126 2020/08/30 19:45:20 mvs Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -912,8 +912,7 @@ pipex_ip_input(struct mbuf *m0, struct pipex_session *session) bpf_mtap_af(ifp->if_bpf, AF_INET, m0, BPF_DIRECTION_IN); #endif - ifp->if_ipackets++; - ifp->if_ibytes += len; + counters_pkt(ifp->if_counters, ifc_ipackets, ifc_ibytes, len); session->stat.ipackets++; session->stat.ibytes += len; ipv4_input(ifp, m0); @@ -962,8 +961,7 @@ pipex_ip6_input(struct mbuf *m0, struct pipex_session *session) bpf_mtap_af(ifp->if_bpf, AF_INET6, m0, BPF_DIRECTION_IN); #endif - ifp->if_ipackets++; - ifp->if_ibytes += len; + counters_pkt(ifp->if_counters, ifc_ipackets, ifc_ibytes, len); session->stat.ipackets++; session->stat.ibytes += len; ipv6_input(ifp, m0); |