summaryrefslogtreecommitdiff
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-05-18 03:46:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-05-18 03:46:04 +0000
commit73e2cbb8b2a34e42d0362509d4abd486264ac3c0 (patch)
tree5f74d9d3f6e0514b3564da375461cb32a1c9b3d7 /sys/net/if_vlan.c
parent8a76118d0dc228d29251371c26cd0b91301ba059 (diff)
rework the srp api so it takes an srp_ref struct that the caller provides.
the srp_ref struct is used to track the location of the callers hazard pointer so later calls to srp_follow and srp_enter already know what to clear. this in turn means most of the caveats around using srps go away. specifically, you can now: - switch cpus while holding an srp ref - ie, you can sleep while holding an srp ref - you can take and release srp refs in any order the original intent was to simplify use of the api when dealing with complicated data structures. the caller now no longer has to track the location of the srp a value was fetched from, the srp_ref effectively does that for you. srp lists have been refactored to use srp_refs instead of srpl_iter structs. this is in preparation of using srps inside the ART code. ART is a complicated data structure, and lookups require overlapping holds of srp references. ok mpi@ jmatthew@
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r--sys/net/if_vlan.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 7171ca5d8ea..0aa47d77fb0 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.164 2016/04/19 23:32:15 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.165 2016/05/18 03:46:03 dlg Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -335,7 +335,7 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie)
struct ether_vlan_header *evl;
struct ether_header *eh;
SRPL_HEAD(, ifvlan) *tagh, *list;
- struct srpl_iter i;
+ struct srp_ref sr;
u_int tag;
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
u_int16_t etype;
@@ -370,7 +370,7 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie)
m->m_pkthdr.pf.prio = !m->m_pkthdr.pf.prio;
list = &tagh[TAG_HASH(tag)];
- SRPL_FOREACH(ifv, list, &i, ifv_list) {
+ SRPL_FOREACH(ifv, &sr, list, ifv_list) {
if (ifp0->if_index == ifv->ifv_ifp0 && tag == ifv->ifv_tag &&
etype == ifv->ifv_type)
break;
@@ -400,11 +400,11 @@ vlan_input(struct ifnet *ifp0, struct mbuf *m, void *cookie)
ml_enqueue(&ml, m);
if_input(&ifv->ifv_if, &ml);
- SRPL_LEAVE(&i, ifv);
+ SRPL_LEAVE(&sr);
return (1);
drop:
- SRPL_LEAVE(&i, ifv);
+ SRPL_LEAVE(&sr);
m_freem(m);
return (1);
}