diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-09-09 16:01:11 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-09-09 16:01:11 +0000 |
commit | a6de9dc5e2128c1faec0b50d068d7ef7dc149e98 (patch) | |
tree | 653cf3c95df449d1f06e78ca01dfa4a1f8ad9190 /sys/net/if.h | |
parent | a6fb90dcc331486ecbf83766494c4718f9eb2c9c (diff) |
introduce reference counts for interfaces (ie, struct ifnet *ifp).
if_get can get a reference to an ifp, but it never releases that
reference. this provides an if_put function that can be used to
decrement the refcount.
we cannot come up with a scheme for letting the network stack run on
one (or many) cpus while ioctls are pulling interfaces down on another
cpu without refcounts for the interfaces.
if_put is going in now so we can go through the stack and put the
necessary calls to it in, and then we'll backfill this implementation
to actually check the refcounts when the interface detaches.
ok mpi@ mikeb@ claudio@
Diffstat (limited to 'sys/net/if.h')
-rw-r--r-- | sys/net/if.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if.h b/sys/net/if.h index c4962b8df80..741ec2be537 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.165 2015/08/30 10:39:16 mpi Exp $ */ +/* $OpenBSD: if.h,v 1.166 2015/09/09 16:01:10 dlg Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -462,6 +462,8 @@ int if_delgroup(struct ifnet *, const char *); void if_group_routechange(struct sockaddr *, struct sockaddr *); struct ifnet *ifunit(const char *); struct ifnet *if_get(unsigned int); +struct ifnet *if_ref(struct ifnet *); +void if_put(struct ifnet *); void ifnewlladdr(struct ifnet *); void if_congestion(void); int if_congested(void); |