diff options
Diffstat (limited to 'sys/netinet/ip_ipsp.h')
-rw-r--r-- | sys/netinet/ip_ipsp.h | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index 2528811eab0..4453d410292 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.203 2021/07/18 18:19:22 mvs Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.204 2021/07/26 23:17:07 mvs Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -135,17 +135,6 @@ struct ipsecstat { uint64_t ipsec_noxform; /* Crypto error */ }; -struct tdb_data { - uint64_t tdd_ipackets; /* Input IPsec packets */ - uint64_t tdd_opackets; /* Output IPsec packets */ - uint64_t tdd_ibytes; /* Input bytes */ - uint64_t tdd_obytes; /* Output bytes */ - uint64_t tdd_idrops; /* Dropped on input */ - uint64_t tdd_odrops; /* Dropped on output */ - uint64_t tdd_idecompbytes; /* Input bytes, decompressed */ - uint64_t tdd_ouncompbytes; /* Output bytes, uncompressed */ -}; - #ifdef _KERNEL #include <sys/timeout.h> @@ -369,7 +358,8 @@ struct tdb { /* tunnel descriptor block */ u_int64_t tdb_last_used; /* When was this SA last used */ u_int64_t tdb_last_marked;/* Last SKIPCRYPTO status change */ - struct tdb_data tdb_data; /* stats about this TDB */ + struct cpumem *tdb_counters; /* stats about this TDB */ + u_int64_t tdb_cryptoid; /* Crypto session ID */ u_int32_t tdb_spi; /* SPI */ @@ -415,15 +405,37 @@ struct tdb { /* tunnel descriptor block */ TAILQ_HEAD(tdb_policy_head, ipsec_policy) tdb_policy_head; TAILQ_ENTRY(tdb) tdb_sync_entry; }; -#define tdb_ipackets tdb_data.tdd_ipackets -#define tdb_opackets tdb_data.tdd_opackets -#define tdb_ibytes tdb_data.tdd_ibytes -#define tdb_obytes tdb_data.tdd_obytes -#define tdb_idrops tdb_data.tdd_idrops -#define tdb_odrops tdb_data.tdd_odrops -#define tdb_idecompbytes tdb_data.tdd_idecompbytes -#define tdb_ouncompbytes tdb_data.tdd_ouncompbytes +enum tdb_counters { + tdb_ipackets, /* Input IPsec packets */ + tdb_opackets, /* Output IPsec packets */ + tdb_ibytes, /* Input bytes */ + tdb_obytes, /* Output bytes */ + tdb_idrops, /* Dropped on input */ + tdb_odrops, /* Dropped on output */ + tdb_idecompbytes, /* Input bytes, decompressed */ + tdb_ouncompbytes, /* Output bytes, uncompressed */ + tdb_ncounters +}; + +static inline void +tdbstat_inc(struct tdb *tdb, enum tdb_counters c) +{ + counters_inc(tdb->tdb_counters, c); +} + +static inline void +tdbstat_add(struct tdb *tdb, enum tdb_counters c, uint64_t v) +{ + counters_add(tdb->tdb_counters, c, v); +} + +static inline void +tdbstat_pkt(struct tdb *tdb, enum tdb_counters pc, enum tdb_counters bc, + uint64_t bytes) +{ + counters_pkt(tdb->tdb_counters, pc, bc, bytes); +} struct tdb_ident { u_int32_t spi; |