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

Function sctp_setup_tail_pointer

freebsd/netinet/sctp_indata.c:632–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632static void
633sctp_setup_tail_pointer(struct sctp_queued_to_read *control)
634{
635 struct mbuf *m, *prev = NULL;
636 struct sctp_tcb *stcb;
637
638 stcb = control->stcb;
639 control->held_length = 0;
640 control->length = 0;
641 m = control->data;
642 while (m) {
643 if (SCTP_BUF_LEN(m) == 0) {
644 /* Skip mbufs with NO length */
645 if (prev == NULL) {
646 /* First one */
647 control->data = sctp_m_free(m);
648 m = control->data;
649 } else {
650 SCTP_BUF_NEXT(prev) = sctp_m_free(m);
651 m = SCTP_BUF_NEXT(prev);
652 }
653 if (m == NULL) {
654 control->tail_mbuf = prev;
655 }
656 continue;
657 }
658 prev = m;
659 atomic_add_int(&control->length, SCTP_BUF_LEN(m));
660 if (control->on_read_q) {
661 /*
662 * On read queue so we must increment the SB stuff,
663 * we assume caller has done any locks of SB.
664 */
665 sctp_sballoc(stcb, &stcb->sctp_socket->so_rcv, m);
666 }
667 m = SCTP_BUF_NEXT(m);
668 }
669 if (prev) {
670 control->tail_mbuf = prev;
671 }
672}
673
674static void
675sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m, uint32_t *added)

Callers 5

sctp_add_to_tail_pointerFunction · 0.85
sctp_add_chk_to_controlFunction · 0.85

Calls 1

sctp_m_freeFunction · 0.85

Tested by

no test coverage detected