-/* $OpenBSD: if_pflow.c,v 1.102 2023/12/08 23:15:44 mvs Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.103 2023/12/11 14:25:09 mvs Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
#define DPRINTF(x)
#endif
-SLIST_HEAD(, pflow_softc) pflowif_list;
+SMR_SLIST_HEAD(, pflow_softc) pflowif_list;
struct pflowstats pflowstats;
void pflowattach(int);
void
pflowattach(int npflow)
{
- SLIST_INIT(&pflowif_list);
+ SMR_SLIST_INIT(&pflowif_list);
if_clone_attach(&pflow_cloner);
}
task_set(&pflowif->sc_outputtask, pflow_output_process, pflowif);
/* Insert into list of pflows */
- NET_LOCK();
- SLIST_INSERT_HEAD(&pflowif_list, pflowif, sc_next);
- NET_UNLOCK();
+ KERNEL_ASSERT_LOCKED();
+ SMR_SLIST_INSERT_HEAD_LOCKED(&pflowif_list, pflowif, sc_next);
return (0);
}
NET_LOCK();
sc->sc_dying = 1;
- SLIST_REMOVE(&pflowif_list, sc, pflow_softc, sc_next);
NET_UNLOCK();
+ KERNEL_ASSERT_LOCKED();
+ SMR_SLIST_REMOVE_LOCKED(&pflowif_list, sc, pflow_softc, sc_next);
+ smr_barrier();
+
timeout_del(&sc->sc_tmo);
timeout_del(&sc->sc_tmo6);
timeout_del(&sc->sc_tmo_tmpl);
sk = st->key[st->direction == PF_IN ? PF_SK_WIRE : PF_SK_STACK];
- SLIST_FOREACH(sc, &pflowif_list, sc_next) {
+ SMR_SLIST_FOREACH(sc, &pflowif_list, sc_next) {
mtx_enter(&sc->sc_mtx);
switch (sc->sc_version) {
case PFLOW_PROTO_5:
-/* $OpenBSD: if_pflow.h,v 1.20 2023/12/08 23:13:40 mvs Exp $ */
+/* $OpenBSD: if_pflow.h,v 1.21 2023/12/11 14:25:09 mvs Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
#ifdef _KERNEL
+#include <sys/smr.h>
+
/*
* Locks used to protect struct members and global data
* I immutable after creation
mbuf */
struct mbuf *sc_mbuf6; /* [m] current cumulative
mbuf */
- SLIST_ENTRY(pflow_softc) sc_next;
+ SMR_SLIST_ENTRY(pflow_softc) sc_next;
};
extern struct pflow_softc *pflowif;