summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/net/art.c3
-rw-r--r--sys/net/art.h24
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/net/art.c b/sys/net/art.c
index afb0a1b8998..404b10cc80c 100644
--- a/sys/net/art.c
+++ b/sys/net/art.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: art.c,v 1.28 2019/03/31 19:29:27 tb Exp $ */
+/* $OpenBSD: art.c,v 1.29 2020/11/12 15:25:28 mpi Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -115,7 +115,6 @@ art_alloc(unsigned int rtableid, unsigned int alen, unsigned int off)
}
ar->ar_off = off;
- ar->ar_rtableid = rtableid;
rw_init(&ar->ar_lock, "art");
return (ar);
diff --git a/sys/net/art.h b/sys/net/art.h
index b53974edf10..e2f1659df96 100644
--- a/sys/net/art.h
+++ b/sys/net/art.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: art.h,v 1.19 2020/10/29 21:15:27 denis Exp $ */
+/* $OpenBSD: art.h,v 1.20 2020/11/12 15:25:28 mpi Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -27,16 +27,22 @@
/*
* Root of the ART tables, equivalent to the radix head.
+ *
+ * Locks used to protect struct members in this file:
+ * I immutable after creation
+ * l root's `ar_lock'
+ * K kernel lock
+ * For SRP related structures that allow lock-free reads, the write lock
+ * is indicated below.
*/
struct art_root {
- struct srp ar_root; /* First table */
- struct rwlock ar_lock; /* Serialise modifications */
- uint8_t ar_bits[ART_MAXLVL]; /* Per level stride */
- uint8_t ar_nlvl; /* Number of levels */
- uint8_t ar_alen; /* Address length in bits */
- uint8_t ar_off; /* Offset of the key in bytes */
- unsigned int ar_rtableid; /* ID of this routing table */
- struct sockaddr *source; /* optional src addr to use */
+ struct srp ar_root; /* [l] First table */
+ struct rwlock ar_lock; /* [] Serialise modifications */
+ uint8_t ar_bits[ART_MAXLVL]; /* [I] Per level stride */
+ uint8_t ar_nlvl; /* [I] Number of levels */
+ uint8_t ar_alen; /* [I] Address length in bits */
+ uint8_t ar_off; /* [I] Offset of key in bytes */
+ struct sockaddr *source; /* [K] optional src addr to use */
};
#define ISLEAF(e) (((unsigned long)(e) & 1) == 0)