From: kn Date: Mon, 14 Nov 2022 22:06:25 +0000 (+0000) Subject: Document global interface group list locking X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=32ce3e3f29cea362a61a203962d9b193e353ee97;p=openbsd Document global interface group list locking 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. Feedback OK mvs --- diff --git a/sys/net/if.c b/sys/net/if.c index a29a011a32b..e80b50fdf83 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.677 2022/11/10 17:17:47 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.678 2022/11/14 22:06:25 kn Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -222,7 +222,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 b5ebe479b73..3a418bf0547 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.119 2022/11/10 12:46:19 kn Exp $ */ +/* $OpenBSD: if_var.h,v 1.120 2022/11/14 22:06:26 kn Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -263,22 +263,22 @@ struct ifmaddr { */ struct ifg_group { - char ifg_group[IFNAMSIZ]; - 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; + char ifg_group[IFNAMSIZ]; /* [I] group name */ + u_int ifg_refcnt; /* [N] group reference count */ + caddr_t ifg_pf_kif; /* [I] pf interface group */ + int ifg_carp_demoted; /* [K] carp demotion counter */ + 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; - struct ifnet *ifgm_ifp; + TAILQ_ENTRY(ifg_member) ifgm_next; /* [N] all members are chained */ + struct ifnet *ifgm_ifp; /* [I] member interface */ }; struct ifg_list { - struct ifg_group *ifgl_group; - TAILQ_ENTRY(ifg_list) ifgl_next; + struct ifg_group *ifgl_group; /* [I] interface group */ + TAILQ_ENTRY(ifg_list) ifgl_next; /* [N] all groups are chained */ }; #define IFNET_SLOWTIMO 1 /* granularity is 1 second */