I'm mostly interested in indicating that when we have a valid reference
to an `ifp', obtained via if_get(9), it is safe to dereference if_softc.
ok?
Index: net/if_var.h
===================================================================
RCS file: /cvs/src/sys/net/if_var.h,v
retrieving revision 1.94
diff -u -p -r1.94 if_var.h
--- net/if_var.h 9 Jan 2019 01:14:21 -0000 1.94
+++ net/if_var.h 29 Mar 2019 14:49:36 -0000
@@ -106,6 +106,9 @@ struct if_clone {
* c only used in ioctl or routing socket contexts (kernel lock)
* k kernel lock
* N net lock
+ *
+ * For SRP related structures that allow lock-free reads, the write lock
+ * is indicated below.
*/
/*
* Structure defining a queue for a network interface.
@@ -115,7 +118,7 @@ struct if_clone {
TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */
struct ifnet { /* and the entries */
- void *if_softc; /* lower-level data for this if */
+ void *if_softc; /* [I] lower-level data for this if */
struct refcnt if_refcnt;
TAILQ_ENTRY(ifnet) if_list; /* [k] all struct ifnets are chained */
TAILQ_HEAD(, ifaddr) if_addrlist; /* [N] list of addresses per if */
@@ -156,7 +159,7 @@ struct ifnet { /* and the
entries */
struct task if_linkstatetask; /* [I] task to do route updates */
/* procedure handles */
- SRPL_HEAD(, ifih) if_inputs; /* input routines (dequeue) */
+ SRPL_HEAD(, ifih) if_inputs; /* [k] input routines (dequeue) */
int (*if_output)(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *); /* output routine (enqueue) */
/* link level output function */