Page MenuHomeFreeBSD

D23242.id66936.diff
No OneTemporary

D23242.id66936.diff

Index: sys/dev/altera/atse/if_atse.c
===================================================================
--- sys/dev/altera/atse/if_atse.c
+++ sys/dev/altera/atse/if_atse.c
@@ -1381,7 +1381,8 @@
}
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH;
ifp->if_ioctl = atse_ioctl;
ifp->if_transmit = atse_transmit;
ifp->if_qflush = atse_qflush;
Index: sys/dev/beri/virtio/network/if_vtbe.c
===================================================================
--- sys/dev/beri/virtio/network/if_vtbe.c
+++ sys/dev/beri/virtio/network/if_vtbe.c
@@ -613,7 +613,7 @@
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX |
- IFF_MULTICAST | IFF_PROMISC);
+ IFF_MULTICAST | IFF_PROMISC | IFF_NEEDSEPOCH);
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifp->if_capenable = ifp->if_capabilities;
ifp->if_start = vtbe_txstart;
Index: sys/dev/dpaa/if_dtsec.c
===================================================================
--- sys/dev/dpaa/if_dtsec.c
+++ sys/dev/dpaa/if_dtsec.c
@@ -688,7 +688,7 @@
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU; /* TODO: Configure */
- ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST;
+ ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_NEEDSEPOCH;
ifp->if_init = dtsec_if_init;
ifp->if_start = dtsec_if_start;
ifp->if_ioctl = dtsec_if_ioctl;
Index: sys/dev/hyperv/netvsc/if_hn.c
===================================================================
--- sys/dev/hyperv/netvsc/if_hn.c
+++ sys/dev/hyperv/netvsc/if_hn.c
@@ -2362,7 +2362,8 @@
*/
ifp->if_baudrate = IF_Gbps(10);
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_init;
#ifdef HN_IFSTART_SUPPORT
Index: sys/dev/if_ndis/if_ndis.c
===================================================================
--- sys/dev/if_ndis/if_ndis.c
+++ sys/dev/if_ndis/if_ndis.c
@@ -967,7 +967,8 @@
if_initname(ifp, device_get_name(sc->ndis_dev),
device_get_unit(sc->ndis_dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH;
ifp->if_ioctl = ndis_ifioctl;
ifp->if_start = ndis_ifstart;
ifp->if_init = ndis_init;
Index: sys/dev/netmap/netmap.c
===================================================================
--- sys/dev/netmap/netmap.c
+++ sys/dev/netmap/netmap.c
@@ -437,11 +437,13 @@
#include <sys/socketvar.h> /* struct socket */
#include <sys/malloc.h>
#include <sys/poll.h>
+#include <sys/proc.h>
#include <sys/rwlock.h>
#include <sys/socket.h> /* sockaddrs */
#include <sys/selinfo.h>
#include <sys/sysctl.h>
#include <sys/jail.h>
+#include <sys/epoch.h>
#include <net/vnet.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -1146,9 +1148,11 @@
static void
netmap_send_up(struct ifnet *dst, struct mbq *q)
{
+ struct epoch_tracker et;
struct mbuf *m;
struct mbuf *head = NULL, *prev = NULL;
+ NET_EPOCH_ENTER(et);
/* Send packets up, outside the lock; head/prev machinery
* is only useful for Windows. */
while ((m = mbq_dequeue(q)) != NULL) {
@@ -1160,6 +1164,7 @@
}
if (head)
nm_os_send_up(dst, NULL, head);
+ NET_EPOCH_EXIT(et);
mbq_fini(q);
}
Index: sys/dev/ntb/if_ntb/if_ntb.c
===================================================================
--- sys/dev/ntb/if_ntb/if_ntb.c
+++ sys/dev/ntb/if_ntb/if_ntb.c
@@ -172,7 +172,8 @@
if_setinitfn(ifp, ntb_net_init);
if_setsoftc(ifp, sc);
- if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+ if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH);
if_setioctlfn(ifp, ntb_ioctl);
if_settransmitfn(ifp, ntb_transmit);
if_setqflushfn(ifp, ntb_qflush);
Index: sys/dev/sbni/if_sbni.c
===================================================================
--- sys/dev/sbni/if_sbni.c
+++ sys/dev/sbni/if_sbni.c
@@ -243,7 +243,8 @@
ifp->if_baudrate =
(csr0 & 0x01 ? 500000 : 2000000) / (1 << flags.rate);
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH;
mtx_init(&sc->lock, ifp->if_xname, MTX_NETWORK_LOCK, MTX_DEF);
callout_init_mtx(&sc->wch, &sc->lock, 0);
Index: sys/dev/xen/netback/netback.c
===================================================================
--- sys/dev/xen/netback/netback.c
+++ sys/dev/xen/netback/netback.c
@@ -780,7 +780,7 @@
xnb->evtchn,
/*filter*/NULL,
xnb_intr, /*arg*/xnb,
- INTR_TYPE_BIO | INTR_MPSAFE,
+ INTR_TYPE_NET | INTR_MPSAFE,
&xnb->xen_intr_handle);
if (error != 0) {
(void)xnb_disconnect(xnb);
Index: sys/kern/kern_intr.c
===================================================================
--- sys/kern/kern_intr.c
+++ sys/kern/kern_intr.c
@@ -48,6 +48,7 @@
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/epoch.h>
#include <sys/random.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
@@ -94,6 +95,9 @@
SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, CTLFLAG_RWTUN,
&intr_storm_threshold, 0,
"Number of consecutive interrupts before storm protection is enabled");
+static int intr_epoch_batch = 1000;
+SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, &intr_epoch_batch,
+ 0, "Maximum interrupt handler executions without re-entering epoch(9)");
static TAILQ_HEAD(, intr_event) event_list =
TAILQ_HEAD_INITIALIZER(event_list);
static struct mtx event_lock;
@@ -190,7 +194,7 @@
/* Start off with no entropy and just the name of the event. */
mtx_assert(&ie->ie_lock, MA_OWNED);
strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname));
- ie->ie_flags &= ~IE_ENTROPY;
+ ie->ie_hflags = 0;
missed = 0;
space = 1;
@@ -203,8 +207,7 @@
space = 0;
} else
missed++;
- if (ih->ih_flags & IH_ENTROPY)
- ie->ie_flags |= IE_ENTROPY;
+ ie->ie_hflags |= ih->ih_flags;
}
/*
@@ -588,6 +591,8 @@
ih->ih_flags |= IH_MPSAFE;
if (flags & INTR_ENTROPY)
ih->ih_flags |= IH_ENTROPY;
+ if (flags & INTR_TYPE_NET)
+ ih->ih_flags |= IH_NET;
/* We can only have one exclusive handler in a event. */
mtx_lock(&ie->ie_lock);
@@ -958,7 +963,7 @@
* If any of the handlers for this ithread claim to be good
* sources of entropy, then gather some.
*/
- if (ie->ie_flags & IE_ENTROPY) {
+ if (ie->ie_hflags & IH_ENTROPY) {
entropy.event = (uintptr_t)ie;
entropy.td = ctd;
random_harvest_queue(&entropy, sizeof(entropy), RANDOM_INTERRUPT);
@@ -1197,11 +1202,12 @@
static void
ithread_loop(void *arg)
{
+ struct epoch_tracker et;
struct intr_thread *ithd;
struct intr_event *ie;
struct thread *td;
struct proc *p;
- int wake;
+ int wake, epoch_count;
td = curthread;
p = td->td_proc;
@@ -1236,8 +1242,21 @@
* that the load of ih_need in ithread_execute_handlers()
* is ordered after the load of it_need here.
*/
- while (atomic_cmpset_acq_int(&ithd->it_need, 1, 0) != 0)
+ if (ie->ie_hflags & IH_NET) {
+ epoch_count = 0;
+ NET_EPOCH_ENTER(et);
+ }
+ while (atomic_cmpset_acq_int(&ithd->it_need, 1, 0) != 0) {
ithread_execute_handlers(p, ie);
+ if ((ie->ie_hflags & IH_NET) &&
+ ++epoch_count >= intr_epoch_batch) {
+ NET_EPOCH_EXIT(et);
+ epoch_count = 0;
+ NET_EPOCH_ENTER(et);
+ }
+ }
+ if (ie->ie_hflags & IH_NET)
+ NET_EPOCH_EXIT(et);
WITNESS_WARN(WARN_PANIC, NULL, "suspending ithread");
mtx_assert(&Giant, MA_NOTOWNED);
@@ -1492,7 +1511,7 @@
db_printf("(pid %d)", it->it_thread->td_proc->p_pid);
else
db_printf("(no thread)");
- if ((ie->ie_flags & (IE_SOFT | IE_ENTROPY | IE_ADDING_THREAD)) != 0 ||
+ if ((ie->ie_flags & (IE_SOFT | IE_ADDING_THREAD)) != 0 ||
(it != NULL && it->it_need)) {
db_printf(" {");
comma = 0;
@@ -1500,12 +1519,6 @@
db_printf("SOFT");
comma = 1;
}
- if (ie->ie_flags & IE_ENTROPY) {
- if (comma)
- db_printf(", ");
- db_printf("ENTROPY");
- comma = 1;
- }
if (ie->ie_flags & IE_ADDING_THREAD) {
if (comma)
db_printf(", ");
Index: sys/kern/kern_poll.c
===================================================================
--- sys/kern/kern_poll.c
+++ sys/kern/kern_poll.c
@@ -37,6 +37,7 @@
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/proc.h>
+#include <sys/epoch.h>
#include <sys/eventhandler.h>
#include <sys/resourcevar.h>
#include <sys/socket.h> /* needed by net/if.h */
@@ -332,6 +333,7 @@
static void
ether_poll(int count)
{
+ struct epoch_tracker et;
int i;
mtx_lock(&poll_mtx);
@@ -339,8 +341,10 @@
if (count > poll_each_burst)
count = poll_each_burst;
+ NET_EPOCH_ENTER(et);
for (i = 0 ; i < poll_handlers ; i++)
pr[i].handler(pr[i].ifp, POLL_ONLY, count);
+ NET_EPOCH_EXIT(et);
mtx_unlock(&poll_mtx);
}
@@ -429,6 +433,8 @@
int i, cycles;
enum poll_cmd arg = POLL_ONLY;
+ NET_EPOCH_ASSERT();
+
if (poll_handlers == 0)
return;
Index: sys/kern/uipc_domain.c
===================================================================
--- sys/kern/uipc_domain.c
+++ sys/kern/uipc_domain.c
@@ -39,6 +39,7 @@
#include <sys/protosw.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
+#include <sys/epoch.h>
#include <sys/mbuf.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -47,8 +48,6 @@
#include <sys/systm.h>
#include <net/vnet.h>
-#include <net/if.h> /* XXXGL: net_epoch should move out there */
-#include <net/if_var.h> /* XXXGL: net_epoch should move out there */
/*
* System initialization
Index: sys/mips/nlm/dev/net/xlpge.c
===================================================================
--- sys/mips/nlm/dev/net/xlpge.c
+++ sys/mips/nlm/dev/net/xlpge.c
@@ -1052,7 +1052,8 @@
}
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
+ IFF_NEEDSEPOCH;
sc->if_flags = ifp->if_flags;
/*ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_HWTAGGING;*/
ifp->if_capabilities = 0;
Index: sys/net/if.h
===================================================================
--- sys/net/if.h
+++ sys/net/if.h
@@ -144,7 +144,7 @@
#define IFF_DEBUG 0x4 /* (n) turn on debugging */
#define IFF_LOOPBACK 0x8 /* (i) is a loopback net */
#define IFF_POINTOPOINT 0x10 /* (i) is a point-to-point link */
-/* 0x20 was IFF_SMART */
+#define IFF_NEEDSEPOCH 0x20 /* (i) calls if_input w/o epoch */
#define IFF_DRV_RUNNING 0x40 /* (d) resources allocated */
#define IFF_NOARP 0x80 /* (n) no address resolution protocol */
#define IFF_PROMISC 0x100 /* (n) receive all packets */
Index: sys/net/if.c
===================================================================
--- sys/net/if.c
+++ sys/net/if.c
@@ -108,7 +108,6 @@
offsetof(struct ifreq, ifr_ifru), "gap between ifr_name and ifr_ifru");
__read_mostly epoch_t net_epoch_preempt;
-__read_mostly epoch_t net_epoch;
#ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <compat/freebsd32/freebsd32.h>
@@ -932,7 +931,6 @@
{
net_epoch_preempt = epoch_alloc("Net preemptible", EPOCH_PREEMPT);
- net_epoch = epoch_alloc("Net", 0);
}
SYSINIT(ifepochalloc, SI_SUB_EPOCH, SI_ORDER_ANY, if_epochalloc, NULL);
Index: sys/net/if_ethersubr.c
===================================================================
--- sys/net/if_ethersubr.c
+++ sys/net/if_ethersubr.c
@@ -809,7 +809,8 @@
* them up. This allows the drivers to amortize the receive lock.
*/
CURVNET_SET_QUIET(ifp->if_vnet);
- NET_EPOCH_ENTER(et);
+ if (__predict_false(ifp->if_flags & IFF_NEEDSEPOCH))
+ NET_EPOCH_ENTER(et);
while (m) {
mn = m->m_nextpkt;
m->m_nextpkt = NULL;
@@ -824,7 +825,8 @@
netisr_dispatch(NETISR_ETHER, m);
m = mn;
}
- NET_EPOCH_EXIT(et);
+ if (__predict_false(ifp->if_flags & IFF_NEEDSEPOCH))
+ NET_EPOCH_EXIT(et);
CURVNET_RESTORE();
}
Index: sys/net/if_tuntap.c
===================================================================
--- sys/net/if_tuntap.c
+++ sys/net/if_tuntap.c
@@ -1778,6 +1778,7 @@
tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m,
struct virtio_net_hdr_mrg_rxbuf *vhdr)
{
+ struct epoch_tracker et;
struct ether_header *eh;
struct ifnet *ifp;
@@ -1808,7 +1809,9 @@
/* Pass packet up to parent. */
CURVNET_SET(ifp->if_vnet);
+ NET_EPOCH_ENTER(et);
(*ifp->if_input)(ifp, m);
+ NET_EPOCH_EXIT(et);
CURVNET_RESTORE();
/* ibytes are counted in parent */
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
Index: sys/net/if_var.h
===================================================================
--- sys/net/if_var.h
+++ sys/net/if_var.h
@@ -107,8 +107,6 @@
VNET_DECLARE(struct hhook_head *, ipsec_hhh_out[HHOOK_IPSEC_COUNT]);
#define V_ipsec_hhh_in VNET(ipsec_hhh_in)
#define V_ipsec_hhh_out VNET(ipsec_hhh_out)
-extern epoch_t net_epoch_preempt;
-extern epoch_t net_epoch;
#endif /* _KERNEL */
typedef enum {
@@ -445,10 +443,6 @@
#define IF_ADDR_WUNLOCK(if) mtx_unlock(&(if)->if_addr_lock)
#define IF_ADDR_LOCK_ASSERT(if) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(if)->if_addr_lock))
#define IF_ADDR_WLOCK_ASSERT(if) mtx_assert(&(if)->if_addr_lock, MA_OWNED)
-#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et))
-#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et))
-#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt)
-#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt))
#ifdef _KERNEL
/* interface link layer address change event */
Index: sys/net/iflib.c
===================================================================
--- sys/net/iflib.c
+++ sys/net/iflib.c
@@ -2756,6 +2756,8 @@
*/
struct mbuf *m, *mh, *mt, *mf;
+ NET_EPOCH_ASSERT();
+
lro_possible = v4_forwarding = v6_forwarding = false;
ifp = ctx->ifc_ifp;
mh = mt = NULL;
@@ -3776,6 +3778,7 @@
static void
_task_fn_rx(void *context)
{
+ struct epoch_tracker et;
iflib_rxq_t rxq = context;
if_ctx_t ctx = rxq->ifr_ctx;
bool more;
@@ -3799,6 +3802,7 @@
budget = ctx->ifc_sysctl_rx_budget;
if (budget == 0)
budget = 16; /* XXX */
+ NET_EPOCH_ENTER(et);
if (more == false || (more = iflib_rxeof(rxq, budget)) == false) {
if (ctx->ifc_flags & IFC_LEGACY)
IFDI_INTR_ENABLE(ctx);
@@ -3806,6 +3810,7 @@
IFDI_RX_QUEUE_INTR_ENABLE(ctx, rxq->ifr_id);
DBG_COUNTER_INC(rx_intr_enables);
}
+ NET_EPOCH_EXIT(et);
if (__predict_false(!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)))
return;
if (more)
@@ -6808,6 +6813,7 @@
static int
iflib_debugnet_poll(if_t ifp, int count)
{
+ struct epoch_tracker et;
if_ctx_t ctx;
if_softc_ctx_t scctx;
iflib_txq_t txq;
@@ -6823,8 +6829,10 @@
txq = &ctx->ifc_txqs[0];
(void)iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx));
+ NET_EPOCH_ENTER(et);
for (i = 0; i < scctx->isc_nrxqsets; i++)
(void)iflib_rxeof(&ctx->ifc_rxqs[i], 16 /* XXX */);
+ NET_EPOCH_EXIT(et);
return (0);
}
#endif /* DEBUGNET */
Index: sys/net/netisr.c
===================================================================
--- sys/net/netisr.c
+++ sys/net/netisr.c
@@ -861,7 +861,6 @@
netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto)
{
struct netisr_work local_npw, *npwp;
- struct epoch_tracker et;
u_int handled;
struct mbuf *m;
@@ -891,7 +890,6 @@
npwp->nw_len = 0;
nwsp->nws_pendingbits &= ~(1 << proto);
NWS_UNLOCK(nwsp);
- NET_EPOCH_ENTER(et);
while ((m = local_npw.nw_head) != NULL) {
local_npw.nw_head = m->m_nextpkt;
m->m_nextpkt = NULL;
@@ -904,7 +902,6 @@
netisr_proto[proto].np_handler(m);
CURVNET_RESTORE();
}
- NET_EPOCH_EXIT(et);
KASSERT(local_npw.nw_len == 0,
("%s(%u): len %u", __func__, proto, local_npw.nw_len));
if (netisr_proto[proto].np_drainedcpu)
@@ -1248,7 +1245,7 @@
nwsp->nws_cpu = cpuid;
snprintf(swiname, sizeof(swiname), "netisr %u", cpuid);
error = swi_add(&nwsp->nws_intr_event, swiname, swi_net, nwsp,
- SWI_NET, INTR_MPSAFE, &nwsp->nws_swi_cookie);
+ SWI_NET, INTR_TYPE_NET | INTR_MPSAFE, &nwsp->nws_swi_cookie);
if (error)
panic("%s: swi_add %d", __func__, error);
pc->pc_netisr = nwsp->nws_intr_event;
Index: sys/net/pfil.c
===================================================================
--- sys/net/pfil.c
+++ sys/net/pfil.c
@@ -69,10 +69,6 @@
#define PFIL_UNLOCK() mtx_unlock(&pfil_lock)
#define PFIL_LOCK_ASSERT() mtx_assert(&pfil_lock, MA_OWNED)
-#define PFIL_EPOCH net_epoch_preempt
-#define PFIL_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et))
-#define PFIL_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et))
-
struct pfil_hook {
pfil_func_t hook_func;
void *hook_ruleset;
@@ -168,12 +164,13 @@
pfil_run_hooks(struct pfil_head *head, pfil_packet_t p, struct ifnet *ifp,
int flags, struct inpcb *inp)
{
- struct epoch_tracker et;
pfil_chain_t *pch;
struct pfil_link *link;
pfil_return_t rv;
bool realloc = false;
+ NET_EPOCH_ASSERT();
+
if (PFIL_DIR(flags) == PFIL_IN)
pch = &head->head_in;
else if (__predict_true(PFIL_DIR(flags) == PFIL_OUT))
@@ -182,7 +179,6 @@
panic("%s: bogus flags %d", __func__, flags);
rv = PFIL_PASS;
- PFIL_EPOCH_ENTER(et);
CK_STAILQ_FOREACH(link, pch, link_chain) {
if ((flags & PFIL_MEMPTR) && !(link->link_flags & PFIL_MEMPTR))
rv = pfil_fake_mbuf(link->link_func, &p, ifp, flags,
@@ -197,7 +193,6 @@
realloc = true;
}
}
- PFIL_EPOCH_EXIT(et);
if (realloc && rv == PFIL_PASS)
rv = PFIL_REALLOCED;
return (rv);
@@ -313,9 +308,11 @@
PFIL_UNLOCK();
if (in != NULL)
- epoch_call(PFIL_EPOCH, &in->link_epoch_ctx, pfil_link_free);
+ epoch_call(net_epoch_preempt, &in->link_epoch_ctx,
+ pfil_link_free);
if (out != NULL)
- epoch_call(PFIL_EPOCH, &out->link_epoch_ctx, pfil_link_free);
+ epoch_call(net_epoch_preempt, &out->link_epoch_ctx,
+ pfil_link_free);
if (in == NULL && out == NULL)
return (ENOENT);
@@ -443,14 +440,14 @@
if (in != NULL) {
head->head_nhooksin--;
hook->hook_links--;
- epoch_call(PFIL_EPOCH, &in->link_epoch_ctx,
+ epoch_call(net_epoch_preempt, &in->link_epoch_ctx,
pfil_link_free);
}
out = pfil_link_remove(&head->head_out, hook);
if (out != NULL) {
head->head_nhooksout--;
hook->hook_links--;
- epoch_call(PFIL_EPOCH, &out->link_epoch_ctx,
+ epoch_call(net_epoch_preempt, &out->link_epoch_ctx,
pfil_link_free);
}
if (in != NULL || out != NULL)
Index: sys/powerpc/pseries/phyp_llan.c
===================================================================
--- sys/powerpc/pseries/phyp_llan.c
+++ sys/powerpc/pseries/phyp_llan.c
@@ -189,7 +189,7 @@
return (ENXIO);
}
- bus_setup_intr(dev, sc->irq, INTR_TYPE_MISC | INTR_MPSAFE |
+ bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE |
INTR_ENTROPY, NULL, llan_intr, sc, &sc->irq_cookie);
/* Setup DMA */
Index: sys/sys/epoch.h
===================================================================
--- sys/sys/epoch.h
+++ sys/sys/epoch.h
@@ -93,5 +93,15 @@
void epoch_enter(epoch_t epoch);
void epoch_exit(epoch_t epoch);
+/*
+ * Globally recognized epochs in the FreeBSD kernel.
+ */
+/* Network preemptible epoch, declared in sys/net/if.c. */
+extern epoch_t net_epoch_preempt;
+#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et))
+#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et))
+#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt)
+#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt))
+
#endif /* _KERNEL */
#endif /* _SYS_EPOCH_H_ */
Index: sys/sys/interrupt.h
===================================================================
--- sys/sys/interrupt.h
+++ sys/sys/interrupt.h
@@ -58,6 +58,7 @@
};
/* Interrupt handle flags kept in ih_flags */
+#define IH_NET 0x00000001 /* Network. */
#define IH_EXCLUSIVE 0x00000002 /* Exclusive interrupt. */
#define IH_ENTROPY 0x00000004 /* Device is a good entropy source. */
#define IH_DEAD 0x00000008 /* Handler should be removed. */
@@ -118,6 +119,7 @@
void (*ie_post_filter)(void *);
int (*ie_assign_cpu)(void *, int);
int ie_flags;
+ int ie_hflags; /* cumulative flags of all handlers */
int ie_count; /* Loop counter. */
int ie_warncnt; /* Rate-check interrupt storm warns. */
struct timeval ie_warntm;
@@ -129,7 +131,6 @@
/* Interrupt event flags kept in ie_flags. */
#define IE_SOFT 0x000001 /* Software interrupt. */
-#define IE_ENTROPY 0x000002 /* Interrupt is an entropy source. */
#define IE_ADDING_THREAD 0x000004 /* Currently building an ithread. */
/* Flags to pass to sched_swi. */

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 19, 8:31 AM (14 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35227867
Default Alt Text
D23242.id66936.diff (20 KB)

Event Timeline