MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_mcore_thread

Function sctp_mcore_thread

freebsd/netinet/sctp_pcb.c:5576–5634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5574}
5575
5576static void
5577sctp_mcore_thread(void *arg)
5578{
5579
5580 struct sctp_mcore_ctrl *wkq;
5581 struct sctp_mcore_queue *qent;
5582
5583 wkq = (struct sctp_mcore_ctrl *)arg;
5584 struct mbuf *m;
5585 int off, v6;
5586
5587 /* Wait for first tickle */
5588 SCTP_MCORE_LOCK(wkq);
5589 wkq->running = 0;
5590 msleep(&wkq->running,
5591 &wkq->core_mtx,
5592 0, "wait for pkt", 0);
5593 SCTP_MCORE_UNLOCK(wkq);
5594
5595 /* Bind to our cpu */
5596 thread_lock(curthread);
5597 sched_bind(curthread, wkq->cpuid);
5598 thread_unlock(curthread);
5599
5600 /* Now lets start working */
5601 SCTP_MCORE_LOCK(wkq);
5602 /* Now grab lock and go */
5603 for (;;) {
5604 SCTP_MCORE_QLOCK(wkq);
5605skip_sleep:
5606 wkq->running = 1;
5607 qent = TAILQ_FIRST(&wkq->que);
5608 if (qent) {
5609 TAILQ_REMOVE(&wkq->que, qent, next);
5610 SCTP_MCORE_QUNLOCK(wkq);
5611 CURVNET_SET(qent->vn);
5612 m = qent->m;
5613 off = qent->off;
5614 v6 = qent->v6;
5615 SCTP_FREE(qent, SCTP_M_MCORE);
5616 if (v6 == 0) {
5617 sctp_input_with_port(m, off, 0);
5618 } else {
5619 SCTP_PRINTF("V6 not yet supported\n");
5620 sctp_m_freem(m);
5621 }
5622 CURVNET_RESTORE();
5623 SCTP_MCORE_QLOCK(wkq);
5624 }
5625 wkq->running = 0;
5626 if (!TAILQ_EMPTY(&wkq->que)) {
5627 goto skip_sleep;
5628 }
5629 SCTP_MCORE_QUNLOCK(wkq);
5630 msleep(&wkq->running,
5631 &wkq->core_mtx,
5632 0, "wait for pkt", 0);
5633 }

Callers

nothing calls this directly

Calls 3

sctp_input_with_portFunction · 0.85
sctp_m_freemFunction · 0.85
sched_bindFunction · 0.50

Tested by

no test coverage detected