The per-interface group list is protected by the net lock and already
documented as such.

The global interface group list `ifg_head' is also protected by the net
lock and all access to it (all within if.c) take it accordingly.

OK?
---
 sys/net/if.c     | 3 ++-
 sys/net/if_var.h | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index ad7d8ea5956..6a0ac9ee77f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -226,7 +226,8 @@ void        if_idxmap_alloc(struct ifnet *);
 void   if_idxmap_insert(struct ifnet *);
 void   if_idxmap_remove(struct ifnet *);
 
-TAILQ_HEAD(, ifg_group) ifg_head = TAILQ_HEAD_INITIALIZER(ifg_head);
+TAILQ_HEAD(, ifg_group) ifg_head =
+    TAILQ_HEAD_INITIALIZER(ifg_head);  /* [N] list of interface groups */
 
 LIST_HEAD(, if_clone) if_cloners =
     LIST_HEAD_INITIALIZER(if_cloners); /* [I] list of clonable interfaces */
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 6272be882f4..275ea85bd2a 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -267,18 +267,18 @@ struct ifg_group {
        u_int                    ifg_refcnt;
        caddr_t                  ifg_pf_kif;
        int                      ifg_carp_demoted;
-       TAILQ_HEAD(, ifg_member) ifg_members;
-       TAILQ_ENTRY(ifg_group)   ifg_next;
+       TAILQ_HEAD(, ifg_member) ifg_members; /* [N] list of members per group 
*/
+       TAILQ_ENTRY(ifg_group)   ifg_next;    /* [N] all groups are chained */
 };
 
 struct ifg_member {
-       TAILQ_ENTRY(ifg_member)  ifgm_next;
+       TAILQ_ENTRY(ifg_member)  ifgm_next; /* [N] all members are chained */
        struct ifnet            *ifgm_ifp;
 };
 
 struct ifg_list {
        struct ifg_group        *ifgl_group;
-       TAILQ_ENTRY(ifg_list)    ifgl_next;
+       TAILQ_ENTRY(ifg_list)    ifgl_next;  /* [N] all groups are chained */
 };
 
 #define        IFNET_SLOWTIMO  1               /* granularity is 1 second */
-- 
2.38.1

Reply via email to