Lines Matching defs:sp

6283 sctp_set_prsctp_policy(struct sctp_stream_queue_pending *sp)
6289 if (PR_SCTP_ENABLED(sp->sinfo_flags)) {
6290 sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags);
6291 } else if (sp->timetolive > 0) {
6292 sp->sinfo_flags |= SCTP_PR_SCTP_TTL;
6293 sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags);
6297 switch (PR_SCTP_POLICY(sp->sinfo_flags)) {
6303 sp->ts.tv_sec = sp->timetolive;
6304 sp->ts.tv_usec = 0;
6310 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
6311 tv.tv_sec = sp->timetolive / 1000;
6312 tv.tv_usec = (sp->timetolive * 1000) % 1000000;
6317 timevaladd(&sp->ts, &tv);
6325 sp->ts.tv_sec = sp->timetolive;
6326 sp->ts.tv_usec = 0;
6331 PR_SCTP_POLICY(sp->sinfo_flags));
6344 struct sctp_stream_queue_pending *sp = NULL;
6374 sctp_alloc_a_strmoq(stcb, sp);
6375 if (sp == NULL) {
6380 sp->sinfo_flags = srcv->sinfo_flags;
6381 sp->timetolive = srcv->sinfo_timetolive;
6382 sp->ppid = srcv->sinfo_ppid;
6383 sp->context = srcv->sinfo_context;
6384 sp->fsn = 0;
6385 if (sp->sinfo_flags & SCTP_ADDR_OVER) {
6386 sp->net = net;
6387 atomic_add_int(&sp->net->ref_count, 1);
6389 sp->net = NULL;
6391 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
6392 sp->stream = srcv->sinfo_stream;
6393 sp->msg_is_complete = 1;
6394 sp->sender_all_done = 1;
6395 sp->some_taken = 0;
6396 sp->data = m;
6397 sp->tail_mbuf = NULL;
6398 sctp_set_prsctp_policy(sp);
6404 sp->length = 0;
6407 sp->tail_mbuf = at;
6408 sp->length += SCTP_BUF_LEN(at);
6411 sp->auth_keyid = srcv->sinfo_keynumber;
6413 sp->auth_keyid = stcb->asoc.authinfo.active_keyid;
6416 sctp_auth_key_acquire(stcb, sp->auth_keyid);
6417 sp->holds_key_ref = 1;
6422 sctp_snd_sb_alloc(stcb, sp->length);
6424 TAILQ_INSERT_TAIL(&strm->outqueue, sp, next);
6425 stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp, 1);
7170 struct sctp_stream_queue_pending *sp;
7184 sp = TAILQ_FIRST(&strq->outqueue);
7185 if (sp == NULL) {
7190 sp = TAILQ_FIRST(&strq->outqueue);
7191 if (sp) {
7209 if ((sp->msg_is_complete) && (sp->length == 0)) {
7210 if (sp->sender_all_done) {
7216 if ((sp->put_last_out == 0) && (sp->discard_rest == 0)) {
7219 sp->sender_all_done,
7220 sp->length,
7221 sp->msg_is_complete,
7222 sp->put_last_out,
7225 if ((TAILQ_NEXT(sp, next) == NULL) && (send_lock_up == 0)) {
7230 TAILQ_REMOVE(&strq->outqueue, sp, next);
7231 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up);
7237 if (sp->net) {
7238 sctp_free_remote_addr(sp->net);
7239 sp->net = NULL;
7241 if (sp->data) {
7242 sctp_m_freem(sp->data);
7243 sp->data = NULL;
7245 sctp_free_a_strmoq(stcb, sp, so_locked);
7264 if (sp->length == 0) {
7269 } else if (sp->discard_rest) {
7275 atomic_subtract_int(&stcb->asoc.total_output_queue_size, sp->length);
7279 atomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc, sp->length);
7281 if (sp->data) {
7282 sctp_m_freem(sp->data);
7283 sp->data = NULL;
7284 sp->tail_mbuf = NULL;
7286 sp->length = 0;
7287 sp->some_taken = 1;
7293 some_taken = sp->some_taken;
7295 length = sp->length;
7296 if (sp->msg_is_complete) {
7301 if (sp->some_taken) {
7306 sp->put_last_out = 1;
7307 if (sp->sinfo_flags & SCTP_SACK_IMMEDIATELY) {
7312 if (sp->some_taken == 0) {
7315 sp->some_taken = 1;
7336 if (sp->msg_is_complete) {
7345 if (sp->some_taken == 0) {
7347 sp->some_taken = 1;
7369 if (sp->sinfo_flags & SCTP_UNORDERED) {
7373 (sp->sinfo_flags & SCTP_EOF) == SCTP_EOF) {
7382 if ((sp->sender_all_done == 0) && (send_lock_up == 0)) {
7386 if (to_move < sp->length) {
7390 chk->data = sp->data;
7391 chk->last_mbuf = sp->tail_mbuf;
7393 sp->data = sp->tail_mbuf = NULL;
7398 chk->data = SCTP_M_COPYM(sp->data, 0, to_move, M_NOWAIT);
7401 sp->some_taken = some_taken;
7413 m_adj(sp->data, to_move);
7415 m = sp->data;
7417 sp->data = SCTP_BUF_NEXT(m);
7419 if (sp->tail_mbuf == m) {
7423 * than the sp->length.
7429 sp->tail_mbuf = sp->data = NULL;
7430 sp->length = 0;
7435 m = sp->data;
7456 * of sp->length if its larger.
7462 sp->length = 0;
7465 atomic_subtract_int(&sp->length, to_move);
7487 if (sp->data == NULL) {
7489 sp->data = chk->data;
7490 sp->tail_mbuf = chk->last_mbuf;
7495 m_tmp = sp->data;
7496 sp->data = chk->data;
7499 sp->some_taken = some_taken;
7500 atomic_add_int(&sp->length, to_move);
7567 chk->rec.data.stream_number = sp->stream;
7568 chk->rec.data.payloadtype = sp->ppid;
7569 chk->rec.data.context = sp->context;
7572 chk->rec.data.timetodrop = sp->ts;
7573 chk->flags = sp->act_flags;
7575 if (sp->net) {
7576 chk->whoTo = sp->net;
7581 if (sp->holds_key_ref) {
7582 chk->auth_keyid = sp->auth_keyid;
7589 (uint32_t) (uintptr_t) stcb, sp->length,
7634 if (sp->fsn == 0)
7637 ndchkh->dp.ppid_fsn.fsn = htonl(sp->fsn);
7638 sp->fsn++;
7658 if (sp->msg_is_complete && (sp->length == 0) && (sp->sender_all_done)) {
7660 if (sp->put_last_out == 0) {
7663 sp->sender_all_done,
7664 sp->length,
7665 sp->msg_is_complete,
7666 sp->put_last_out,
7669 if ((send_lock_up == 0) && (TAILQ_NEXT(sp, next) == NULL)) {
7674 TAILQ_REMOVE(&strq->outqueue, sp, next);
7675 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up);
7681 if (sp->net) {
7682 sctp_free_remote_addr(sp->net);
7683 sp->net = NULL;
7685 if (sp->data) {
7686 sctp_m_freem(sp->data);
7687 sp->data = NULL;
7689 sctp_free_a_strmoq(stcb, sp, so_locked);
7796 struct sctp_stream_queue_pending *sp;
7804 TAILQ_FOREACH(sp, &stcb->asoc.strmout[i].outqueue, next) {
7805 if (sp->net == net) {
7806 sctp_free_remote_addr(sp->net);
7807 sp->net = NULL;
12170 struct sctp_stream_queue_pending *sp, *nsp;
12213 TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) {
12214 TAILQ_REMOVE(&oldstream[i].outqueue, sp, next);
12215 TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next);
12332 sctp_copy_one(struct sctp_stream_queue_pending *sp,
12336 sp->data = m_uiotombuf(uio, M_WAITOK, sp->length,
12338 if (sp->data == NULL) {
12342 sp->tail_mbuf = m_last(sp->data);
12365 struct sctp_stream_queue_pending *sp = NULL;
12379 sctp_alloc_a_strmoq(stcb, sp);
12380 if (sp == NULL) {
12385 sp->act_flags = 0;
12386 sp->sender_all_done = 0;
12387 sp->sinfo_flags = srcv->sinfo_flags;
12388 sp->timetolive = srcv->sinfo_timetolive;
12389 sp->ppid = srcv->sinfo_ppid;
12390 sp->context = srcv->sinfo_context;
12391 sp->fsn = 0;
12392 (void)SCTP_GETTIME_TIMEVAL(&sp->ts);
12394 sp->stream = srcv->sinfo_stream;
12395 sp->length = (uint32_t) min(uio->uio_resid, max_send_len);
12396 if ((sp->length == (uint32_t) uio->uio_resid) &&
12400 sp->msg_is_complete = 1;
12402 sp->msg_is_complete = 0;
12404 sp->sender_all_done = 0;
12405 sp->some_taken = 0;
12406 sp->put_last_out = 0;
12408 sp->data = sp->tail_mbuf = NULL;
12409 if (sp->length == 0) {
12414 sp->auth_keyid = srcv->sinfo_keynumber;
12416 sp->auth_keyid = stcb->asoc.authinfo.active_keyid;
12419 sctp_auth_key_acquire(stcb, sp->auth_keyid);
12420 sp->holds_key_ref = 1;
12422 *error = sctp_copy_one(sp, uio, resv_in_first);
12425 sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED);
12426 sp = NULL;
12428 if (sp->sinfo_flags & SCTP_ADDR_OVER) {
12429 sp->net = net;
12430 atomic_add_int(&sp->net->ref_count, 1);
12432 sp->net = NULL;
12434 sctp_set_prsctp_policy(sp);
12437 return (sp);
13115 struct sctp_stream_queue_pending *sp;
13132 sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error);
13133 if ((sp == NULL) || (error)) {
13137 if (sp->msg_is_complete) {
13150 sp->sender_all_done = 0;
13152 sctp_snd_sb_alloc(stcb, sp->length);
13157 TAILQ_INSERT_TAIL(&strm->outqueue, sp, next);
13158 stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1);
13162 sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead);
13164 if (sp == NULL) {
13216 if (sp->tail_mbuf) {
13218 SCTP_BUF_NEXT(sp->tail_mbuf) = mm;
13219 sp->tail_mbuf = new_tail;
13222 sp->data = mm;
13223 sp->tail_mbuf = new_tail;
13226 atomic_add_int(&sp->length, sndout);
13229 sp->sinfo_flags |= SCTP_SACK_IMMEDIATELY;
13236 sp->msg_is_complete = 1;
13238 sp->msg_is_complete = 0;
13407 if (sp) {
13408 if (sp->msg_is_complete == 0) {
13415 sp->sender_all_done = 1;
13420 SCTP_PRINTF("Huh no sp TSNH?\n");