diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2021-12-20 15:59:11 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2021-12-20 15:59:11 +0000 |
commit | 30e42e456d6df328420de84fe07366e2edf7a1cd (patch) | |
tree | 3d444eda21441a3cc106e39f2e58679ae3a4a0aa /sys/net/pfkeyv2_convert.c | |
parent | 51b217bfc57215cefe203cedd8bc9a96965ebb04 (diff) |
Use per-CPU counters for tunnel descriptor block (TDB) statistics.
'tdb_data' struct became unused and was removed.
Tested by Hrvoje Popovski.
ok bluhm@
Diffstat (limited to 'sys/net/pfkeyv2_convert.c')
-rw-r--r-- | sys/net/pfkeyv2_convert.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c index 2d648d5a7eb..61feeb9e4b3 100644 --- a/sys/net/pfkeyv2_convert.c +++ b/sys/net/pfkeyv2_convert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2_convert.c,v 1.77 2021/12/11 16:33:46 bluhm Exp $ */ +/* $OpenBSD: pfkeyv2_convert.c,v 1.78 2021/12/20 15:59:09 mvs Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@keromytis.org) * @@ -963,18 +963,21 @@ export_satype(void **p, struct tdb *tdb) void export_counter(void **p, struct tdb *tdb) { + uint64_t counters[tdb_ncounters]; struct sadb_x_counter *scnt = (struct sadb_x_counter *)*p; + counters_read(tdb->tdb_counters, counters, tdb_ncounters); + scnt->sadb_x_counter_len = sizeof(struct sadb_x_counter) / sizeof(uint64_t); scnt->sadb_x_counter_pad = 0; - scnt->sadb_x_counter_ipackets = tdb->tdb_ipackets; - scnt->sadb_x_counter_opackets = tdb->tdb_opackets; - scnt->sadb_x_counter_ibytes = tdb->tdb_ibytes; - scnt->sadb_x_counter_obytes = tdb->tdb_obytes; - scnt->sadb_x_counter_idrops = tdb->tdb_idrops; - scnt->sadb_x_counter_odrops = tdb->tdb_odrops; - scnt->sadb_x_counter_idecompbytes = tdb->tdb_idecompbytes; - scnt->sadb_x_counter_ouncompbytes = tdb->tdb_ouncompbytes; + scnt->sadb_x_counter_ipackets = counters[tdb_ipackets]; + scnt->sadb_x_counter_opackets = counters[tdb_opackets]; + scnt->sadb_x_counter_ibytes = counters[tdb_ibytes]; + scnt->sadb_x_counter_obytes = counters[tdb_obytes]; + scnt->sadb_x_counter_idrops = counters[tdb_idrops]; + scnt->sadb_x_counter_odrops = counters[tdb_odrops]; + scnt->sadb_x_counter_idecompbytes = counters[tdb_idecompbytes]; + scnt->sadb_x_counter_ouncompbytes = counters[tdb_ouncompbytes]; *p += sizeof(struct sadb_x_counter); } |