Changeset View
Changeset View
Standalone View
Standalone View
sys/net/netisr.c
Show First 20 Lines • Show All 854 Lines • ▼ Show 20 Lines | |||||
* loop, and for setting the NWS_RUNNING flag. The passed workstream will be | * loop, and for setting the NWS_RUNNING flag. The passed workstream will be | ||||
* locked on entry and relocked before return, but will be released while | * locked on entry and relocked before return, but will be released while | ||||
* processing. The number of packets processed is returned. | * processing. The number of packets processed is returned. | ||||
*/ | */ | ||||
static u_int | static u_int | ||||
netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto) | netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto) | ||||
{ | { | ||||
struct netisr_work local_npw, *npwp; | struct netisr_work local_npw, *npwp; | ||||
struct epoch_tracker et; | |||||
u_int handled; | u_int handled; | ||||
struct mbuf *m; | struct mbuf *m; | ||||
NETISR_LOCK_ASSERT(); | NETISR_LOCK_ASSERT(); | ||||
NWS_LOCK_ASSERT(nwsp); | NWS_LOCK_ASSERT(nwsp); | ||||
KASSERT(nwsp->nws_flags & NWS_RUNNING, | KASSERT(nwsp->nws_flags & NWS_RUNNING, | ||||
("%s(%u): not running", __func__, proto)); | ("%s(%u): not running", __func__, proto)); | ||||
Show All 13 Lines | netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto) | ||||
*/ | */ | ||||
handled = npwp->nw_len; | handled = npwp->nw_len; | ||||
local_npw = *npwp; | local_npw = *npwp; | ||||
npwp->nw_head = NULL; | npwp->nw_head = NULL; | ||||
npwp->nw_tail = NULL; | npwp->nw_tail = NULL; | ||||
npwp->nw_len = 0; | npwp->nw_len = 0; | ||||
nwsp->nws_pendingbits &= ~(1 << proto); | nwsp->nws_pendingbits &= ~(1 << proto); | ||||
NWS_UNLOCK(nwsp); | NWS_UNLOCK(nwsp); | ||||
NET_EPOCH_ENTER(et); | |||||
while ((m = local_npw.nw_head) != NULL) { | while ((m = local_npw.nw_head) != NULL) { | ||||
local_npw.nw_head = m->m_nextpkt; | local_npw.nw_head = m->m_nextpkt; | ||||
m->m_nextpkt = NULL; | m->m_nextpkt = NULL; | ||||
if (local_npw.nw_head == NULL) | if (local_npw.nw_head == NULL) | ||||
local_npw.nw_tail = NULL; | local_npw.nw_tail = NULL; | ||||
local_npw.nw_len--; | local_npw.nw_len--; | ||||
VNET_ASSERT(m->m_pkthdr.rcvif != NULL, | VNET_ASSERT(m->m_pkthdr.rcvif != NULL, | ||||
("%s:%d rcvif == NULL: m=%p", __func__, __LINE__, m)); | ("%s:%d rcvif == NULL: m=%p", __func__, __LINE__, m)); | ||||
CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); | CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); | ||||
netisr_proto[proto].np_handler(m); | netisr_proto[proto].np_handler(m); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
NET_EPOCH_EXIT(et); | |||||
KASSERT(local_npw.nw_len == 0, | KASSERT(local_npw.nw_len == 0, | ||||
("%s(%u): len %u", __func__, proto, local_npw.nw_len)); | ("%s(%u): len %u", __func__, proto, local_npw.nw_len)); | ||||
if (netisr_proto[proto].np_drainedcpu) | if (netisr_proto[proto].np_drainedcpu) | ||||
netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); | netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); | ||||
NWS_LOCK(nwsp); | NWS_LOCK(nwsp); | ||||
npwp->nw_handled += handled; | npwp->nw_handled += handled; | ||||
return (handled); | return (handled); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | #ifdef NETISR_LOCKING | ||||
struct rm_priotracker tracker; | struct rm_priotracker tracker; | ||||
#endif | #endif | ||||
struct netisr_workstream *nwsp; | struct netisr_workstream *nwsp; | ||||
struct netisr_proto *npp; | struct netisr_proto *npp; | ||||
struct netisr_work *npwp; | struct netisr_work *npwp; | ||||
int dosignal, error; | int dosignal, error; | ||||
u_int cpuid, dispatch_policy; | u_int cpuid, dispatch_policy; | ||||
NET_EPOCH_ASSERT(); | |||||
KASSERT(proto < NETISR_MAXPROT, | KASSERT(proto < NETISR_MAXPROT, | ||||
("%s: invalid proto %u", __func__, proto)); | ("%s: invalid proto %u", __func__, proto)); | ||||
#ifdef NETISR_LOCKING | #ifdef NETISR_LOCKING | ||||
NETISR_RLOCK(&tracker); | NETISR_RLOCK(&tracker); | ||||
#endif | #endif | ||||
npp = &netisr_proto[proto]; | npp = &netisr_proto[proto]; | ||||
KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__, | KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__, | ||||
proto)); | proto)); | ||||
▲ Show 20 Lines • Show All 436 Lines • Show Last 20 Lines |