diff options
-rw-r--r-- | sys/net/if.c | 34 | ||||
-rw-r--r-- | sys/net/if_var.h | 10 |
2 files changed, 44 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 58ab679..c41390a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1419,6 +1419,40 @@ if_rtdel(struct radix_node *rn, void *arg) } /* + * Wrapper functions for struct ifnet address list locking macros. These are + * used by kernel modules to avoid encoding programming interface or binary + * interface assumptions that may be violated when kernel-internal locking + * approaches change. + */ +void +if_addr_rlock(struct ifnet *ifp) +{ + + IF_ADDR_LOCK(ifp); +} + +void +if_addr_runlock(struct ifnet *ifp) +{ + + IF_ADDR_UNLOCK(ifp); +} + +void +if_maddr_rlock(struct ifnet *ifp) +{ + + IF_ADDR_LOCK(ifp); +} + +void +if_maddr_runlock(struct ifnet *ifp) +{ + + IF_ADDR_UNLOCK(ifp); +} + +/* * Reference count functions for ifaddrs. */ void diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 35e4232..df09035 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -253,6 +253,16 @@ typedef void if_init_f_t(void *); #define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) /* + * Function variations on locking macros intended to be used by loadable + * kernel modules in order to divorce them from the internals of address list + * locking. + */ +void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */ +void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */ +void if_maddr_rlock(struct ifnet *ifp); /* if_multiaddrs */ +void if_maddr_runlock(struct ifnet *ifp); /* if_multiaddrs */ + +/* * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) * are queues of messages stored on ifqueue structures * (defined above). Entries are added to and deleted from these structures |