Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Convert wg(4) to if_stat.



details:   https://anonhg.NetBSD.org/src/rev/ed275061e3d0
branches:  trunk
changeset: 975037:ed275061e3d0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Aug 20 21:31:06 2020 +0000

description:
Convert wg(4) to if_stat.

diffstat:

 sys/net/if_wg.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 29a6c9daed17 -r ed275061e3d0 sys/net/if_wg.c
--- a/sys/net/if_wg.c   Thu Aug 20 21:30:56 2020 +0000
+++ b/sys/net/if_wg.c   Thu Aug 20 21:31:06 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wg.c,v 1.3 2020/08/20 21:30:56 riastradh Exp $      */
+/*     $NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $      */
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.3 2020/08/20 21:30:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.4 2020/08/20 21:31:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3469,8 +3469,8 @@
        error = wg->wg_ops->send_data_msg(wgp, n);
        if (error == 0) {
                struct ifnet *ifp = &wg->wg_if;
-               ifp->if_obytes += mlen;
-               ifp->if_opackets++;
+               if_statadd(ifp, if_obytes, mlen);
+               if_statinc(ifp, if_opackets);
                if (wgs->wgs_is_initiator && wgs->wgs_time_last_data_sent == 0) {
                        /*
                         * [W] 6.2 Transport Message Limits
@@ -3531,8 +3531,8 @@
 
        const u_int h = curcpu()->ci_index;
        if (__predict_true(pktq_enqueue(pktq, m, h))) {
-               ifp->if_ibytes += pktlen;
-               ifp->if_ipackets++;
+               if_statadd(ifp, if_ibytes, pktlen);
+               if_statinc(ifp, if_ipackets);
        } else {
                m_freem(m);
        }



Home | Main Index | Thread Index | Old Index