aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLutz Donnerhacke <donner@FreeBSD.org>2021-02-09 11:32:46 +0000
committerLutz Donnerhacke <donner@FreeBSD.org>2021-02-22 08:21:55 +0000
commit88e916bff0357ffd0a4b8844cc03c79fcaa2022c (patch)
treec7ef87c20ea8eaed62b7181ca631370d34f5f905
parent0952f69003e8a264989f032413055370289fa685 (diff)
downloadsrc-88e916bff0357ffd0a4b8844cc03c79fcaa2022c.tar.gz
src-88e916bff0357ffd0a4b8844cc03c79fcaa2022c.zip
netgraph/ng_bridge: Document staleness in multithreaded operation
In the data path of ng_bridge(4), the only value of the host struct, which needs to be modified, is the staleness, which is reset every time a frame is received. It's save to leave the code as it is. This patch is part of a series to make ng_bridge(4) multithreaded. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D28546 (cherry picked from commit 011b7317dbb5038a95b9b4fca050325a62f3991e)
-rw-r--r--sys/netgraph/ng_bridge.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index 316f9d4fab8c..b6f763dcb631 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -808,7 +808,10 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
/* Look up packet's source Ethernet address in hashtable */
if ((host = ng_bridge_get(priv, eh->ether_shost)) != NULL) {
- /* Update time since last heard from this host */
+ /* Update time since last heard from this host.
+ * This is safe without locking, because it's
+ * the only operation during shared access.
+ */
host->staleness = 0;
/* Did host jump to a different link? */