160c778b2SVlad Yasevich /* SCTP kernel implementation 21da177e4SLinus Torvalds * (C) Copyright IBM Corp. 2003, 2004 31da177e4SLinus Torvalds * 460c778b2SVlad Yasevich * This file is part of the SCTP kernel implementation 51da177e4SLinus Torvalds * 659c51591SMichael Opdenacker * This file contains the code relating the chunk abstraction. 71da177e4SLinus Torvalds * 860c778b2SVlad Yasevich * This SCTP implementation is free software; 91da177e4SLinus Torvalds * you can redistribute it and/or modify it under the terms of 101da177e4SLinus Torvalds * the GNU General Public License as published by 111da177e4SLinus Torvalds * the Free Software Foundation; either version 2, or (at your option) 121da177e4SLinus Torvalds * any later version. 131da177e4SLinus Torvalds * 1460c778b2SVlad Yasevich * This SCTP implementation is distributed in the hope that it 151da177e4SLinus Torvalds * will be useful, but WITHOUT ANY WARRANTY; without even the implied 161da177e4SLinus Torvalds * ************************ 171da177e4SLinus Torvalds * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 181da177e4SLinus Torvalds * See the GNU General Public License for more details. 191da177e4SLinus Torvalds * 201da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 214b2f13a2SJeff Kirsher * along with GNU CC; see the file COPYING. If not, see 224b2f13a2SJeff Kirsher * <http://www.gnu.org/licenses/>. 231da177e4SLinus Torvalds * 241da177e4SLinus Torvalds * Please send any bug reports or fixes you make to the 251da177e4SLinus Torvalds * email address(es): 2691705c61SDaniel Borkmann * lksctp developers <linux-sctp@vger.kernel.org> 271da177e4SLinus Torvalds * 281da177e4SLinus Torvalds * Written or modified by: 291da177e4SLinus Torvalds * Jon Grimm <jgrimm@us.ibm.com> 301da177e4SLinus Torvalds * Sridhar Samudrala <sri@us.ibm.com> 311da177e4SLinus Torvalds */ 321da177e4SLinus Torvalds 33145ce502SJoe Perches #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 34145ce502SJoe Perches 351da177e4SLinus Torvalds #include <linux/types.h> 361da177e4SLinus Torvalds #include <linux/kernel.h> 371da177e4SLinus Torvalds #include <linux/net.h> 381da177e4SLinus Torvalds #include <linux/inet.h> 391da177e4SLinus Torvalds #include <linux/skbuff.h> 405a0e3ad6STejun Heo #include <linux/slab.h> 411da177e4SLinus Torvalds #include <net/sock.h> 421da177e4SLinus Torvalds #include <net/sctp/sctp.h> 431da177e4SLinus Torvalds #include <net/sctp/sm.h> 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds /* This file is mostly in anticipation of future work, but initially 461da177e4SLinus Torvalds * populate with fragment tracking for an outbound message. 471da177e4SLinus Torvalds */ 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds /* Initialize datamsg from memory. */ 501da177e4SLinus Torvalds static void sctp_datamsg_init(struct sctp_datamsg *msg) 511da177e4SLinus Torvalds { 521da177e4SLinus Torvalds atomic_set(&msg->refcnt, 1); 531da177e4SLinus Torvalds msg->send_failed = 0; 541da177e4SLinus Torvalds msg->send_error = 0; 550e3aef8dSVlad Yasevich msg->can_delay = 1; 561da177e4SLinus Torvalds msg->expires_at = 0; 571da177e4SLinus Torvalds INIT_LIST_HEAD(&msg->chunks); 581da177e4SLinus Torvalds } 591da177e4SLinus Torvalds 601da177e4SLinus Torvalds /* Allocate and initialize datamsg. */ 61dda91928SDaniel Borkmann static struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp) 621da177e4SLinus Torvalds { 631da177e4SLinus Torvalds struct sctp_datamsg *msg; 641da177e4SLinus Torvalds msg = kmalloc(sizeof(struct sctp_datamsg), gfp); 65e8c38751SLi Zefan if (msg) { 661da177e4SLinus Torvalds sctp_datamsg_init(msg); 671da177e4SLinus Torvalds SCTP_DBG_OBJCNT_INC(datamsg); 68e8c38751SLi Zefan } 691da177e4SLinus Torvalds return msg; 701da177e4SLinus Torvalds } 711da177e4SLinus Torvalds 72b61c654fSXin Long void sctp_datamsg_free(struct sctp_datamsg *msg) 73b61c654fSXin Long { 74b61c654fSXin Long struct sctp_chunk *chunk; 75b61c654fSXin Long 76b61c654fSXin Long /* This doesn't have to be a _safe vairant because 77b61c654fSXin Long * sctp_chunk_free() only drops the refs. 78b61c654fSXin Long */ 79b61c654fSXin Long list_for_each_entry(chunk, &msg->chunks, frag_list) 80b61c654fSXin Long sctp_chunk_free(chunk); 81b61c654fSXin Long 82b61c654fSXin Long sctp_datamsg_put(msg); 83b61c654fSXin Long } 84b61c654fSXin Long 851da177e4SLinus Torvalds /* Final destructruction of datamsg memory. */ 861da177e4SLinus Torvalds static void sctp_datamsg_destroy(struct sctp_datamsg *msg) 871da177e4SLinus Torvalds { 881da177e4SLinus Torvalds struct list_head *pos, *temp; 891da177e4SLinus Torvalds struct sctp_chunk *chunk; 901da177e4SLinus Torvalds struct sctp_sock *sp; 911da177e4SLinus Torvalds struct sctp_ulpevent *ev; 921da177e4SLinus Torvalds struct sctp_association *asoc = NULL; 931da177e4SLinus Torvalds int error = 0, notify; 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds /* If we failed, we may need to notify. */ 961da177e4SLinus Torvalds notify = msg->send_failed ? -1 : 0; 971da177e4SLinus Torvalds 981da177e4SLinus Torvalds /* Release all references. */ 991da177e4SLinus Torvalds list_for_each_safe(pos, temp, &msg->chunks) { 1001da177e4SLinus Torvalds list_del_init(pos); 1011da177e4SLinus Torvalds chunk = list_entry(pos, struct sctp_chunk, frag_list); 1021da177e4SLinus Torvalds /* Check whether we _really_ need to notify. */ 1031da177e4SLinus Torvalds if (notify < 0) { 1041da177e4SLinus Torvalds asoc = chunk->asoc; 1051da177e4SLinus Torvalds if (msg->send_error) 1061da177e4SLinus Torvalds error = msg->send_error; 1071da177e4SLinus Torvalds else 1081da177e4SLinus Torvalds error = asoc->outqueue.error; 1091da177e4SLinus Torvalds 1101da177e4SLinus Torvalds sp = sctp_sk(asoc->base.sk); 1111da177e4SLinus Torvalds notify = sctp_ulpevent_type_enabled(SCTP_SEND_FAILED, 1121da177e4SLinus Torvalds &sp->subscribe); 1131da177e4SLinus Torvalds } 1141da177e4SLinus Torvalds 1151da177e4SLinus Torvalds /* Generate a SEND FAILED event only if enabled. */ 1161da177e4SLinus Torvalds if (notify > 0) { 1171da177e4SLinus Torvalds int sent; 1181da177e4SLinus Torvalds if (chunk->has_tsn) 1191da177e4SLinus Torvalds sent = SCTP_DATA_SENT; 1201da177e4SLinus Torvalds else 1211da177e4SLinus Torvalds sent = SCTP_DATA_UNSENT; 1221da177e4SLinus Torvalds 1231da177e4SLinus Torvalds ev = sctp_ulpevent_make_send_failed(asoc, chunk, sent, 1241da177e4SLinus Torvalds error, GFP_ATOMIC); 1251da177e4SLinus Torvalds if (ev) 1261da177e4SLinus Torvalds sctp_ulpq_tail_event(&asoc->ulpq, ev); 1271da177e4SLinus Torvalds } 1281da177e4SLinus Torvalds 1291da177e4SLinus Torvalds sctp_chunk_put(chunk); 1301da177e4SLinus Torvalds } 1311da177e4SLinus Torvalds 1321da177e4SLinus Torvalds SCTP_DBG_OBJCNT_DEC(datamsg); 1331da177e4SLinus Torvalds kfree(msg); 1341da177e4SLinus Torvalds } 1351da177e4SLinus Torvalds 1361da177e4SLinus Torvalds /* Hold a reference. */ 1371da177e4SLinus Torvalds static void sctp_datamsg_hold(struct sctp_datamsg *msg) 1381da177e4SLinus Torvalds { 1391da177e4SLinus Torvalds atomic_inc(&msg->refcnt); 1401da177e4SLinus Torvalds } 1411da177e4SLinus Torvalds 1421da177e4SLinus Torvalds /* Release a reference. */ 1431da177e4SLinus Torvalds void sctp_datamsg_put(struct sctp_datamsg *msg) 1441da177e4SLinus Torvalds { 1451da177e4SLinus Torvalds if (atomic_dec_and_test(&msg->refcnt)) 1461da177e4SLinus Torvalds sctp_datamsg_destroy(msg); 1471da177e4SLinus Torvalds } 1481da177e4SLinus Torvalds 1491da177e4SLinus Torvalds /* Assign a chunk to this datamsg. */ 1501da177e4SLinus Torvalds static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) 1511da177e4SLinus Torvalds { 1521da177e4SLinus Torvalds sctp_datamsg_hold(msg); 1531da177e4SLinus Torvalds chunk->msg = msg; 1541da177e4SLinus Torvalds } 1551da177e4SLinus Torvalds 1561da177e4SLinus Torvalds 1571da177e4SLinus Torvalds /* A data chunk can have a maximum payload of (2^16 - 20). Break 1581da177e4SLinus Torvalds * down any such message into smaller chunks. Opportunistically, fragment 1591da177e4SLinus Torvalds * the chunks down to the current MTU constraints. We may get refragmented 1601da177e4SLinus Torvalds * later if the PMTU changes, but it is _much better_ to fragment immediately 1611da177e4SLinus Torvalds * with a reasonable guess than always doing our fragmentation on the 1621da177e4SLinus Torvalds * soft-interrupt. 1631da177e4SLinus Torvalds */ 1641da177e4SLinus Torvalds struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, 1651da177e4SLinus Torvalds struct sctp_sndrcvinfo *sinfo, 166e0eb093eSAl Viro struct iov_iter *from) 1671da177e4SLinus Torvalds { 1681da177e4SLinus Torvalds int max, whole, i, offset, over, err; 1691da177e4SLinus Torvalds int len, first_len; 1703e62abf9SVlad Yasevich int max_data; 1711da177e4SLinus Torvalds struct sctp_chunk *chunk; 1721da177e4SLinus Torvalds struct sctp_datamsg *msg; 1731da177e4SLinus Torvalds struct list_head *pos, *temp; 174e0eb093eSAl Viro size_t msg_len = iov_iter_count(from); 1751da177e4SLinus Torvalds __u8 frag; 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds msg = sctp_datamsg_new(GFP_KERNEL); 1781da177e4SLinus Torvalds if (!msg) 1796e51fe75STommi Rantala return ERR_PTR(-ENOMEM); 1801da177e4SLinus Torvalds 1811da177e4SLinus Torvalds /* Note: Calculate this outside of the loop, so that all fragments 1821da177e4SLinus Torvalds * have the same expiration. 1831da177e4SLinus Torvalds */ 184*8ae808ebSXin Long if (asoc->peer.prsctp_capable && sinfo->sinfo_timetolive && 185*8ae808ebSXin Long (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags) || 186*8ae808ebSXin Long !SCTP_PR_POLICY(sinfo->sinfo_flags))) 1871da177e4SLinus Torvalds msg->expires_at = jiffies + 1881da177e4SLinus Torvalds msecs_to_jiffies(sinfo->sinfo_timetolive); 1890605483fSXin Long 1903e62abf9SVlad Yasevich /* This is the biggest possible DATA chunk that can fit into 1913e62abf9SVlad Yasevich * the packet 1923e62abf9SVlad Yasevich */ 1934a225ce3SMarcelo Ricardo Leitner max_data = asoc->pathmtu - 1943e62abf9SVlad Yasevich sctp_sk(asoc->base.sk)->pf->af->net_header_len - 1954a225ce3SMarcelo Ricardo Leitner sizeof(struct sctphdr) - sizeof(struct sctp_data_chunk); 1964a225ce3SMarcelo Ricardo Leitner max_data = SCTP_TRUNC4(max_data); 1971da177e4SLinus Torvalds 1983e62abf9SVlad Yasevich max = asoc->frag_point; 1994cd57c80SVlad Yasevich /* If the the peer requested that we authenticate DATA chunks 2002bccbadfSwangweidong * we need to account for bundling of the AUTH chunks along with 2014cd57c80SVlad Yasevich * DATA. 2024cd57c80SVlad Yasevich */ 2034cd57c80SVlad Yasevich if (sctp_auth_send_cid(SCTP_CID_DATA, asoc)) { 2044cd57c80SVlad Yasevich struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc); 2054cd57c80SVlad Yasevich 2064cd57c80SVlad Yasevich if (hmac_desc) 207e2f036a9SMarcelo Ricardo Leitner max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) + 2084cd57c80SVlad Yasevich hmac_desc->hmac_len); 2094cd57c80SVlad Yasevich } 2104cd57c80SVlad Yasevich 2113e62abf9SVlad Yasevich /* Now, check if we need to reduce our max */ 2123e62abf9SVlad Yasevich if (max > max_data) 2133e62abf9SVlad Yasevich max = max_data; 2143e62abf9SVlad Yasevich 2151da177e4SLinus Torvalds whole = 0; 2161da177e4SLinus Torvalds first_len = max; 2171da177e4SLinus Torvalds 2185d7ff261SVlad Yasevich /* Check to see if we have a pending SACK and try to let it be bundled 2195d7ff261SVlad Yasevich * with this message. Do this if we don't have any data queued already. 2205d7ff261SVlad Yasevich * To check that, look at out_qlen and retransmit list. 2215d7ff261SVlad Yasevich * NOTE: we will not reduce to account for SACK, if the message would 2225d7ff261SVlad Yasevich * not have been fragmented. 2235d7ff261SVlad Yasevich */ 2245d7ff261SVlad Yasevich if (timer_pending(&asoc->timers[SCTP_EVENT_TIMEOUT_SACK]) && 2255d7ff261SVlad Yasevich asoc->outqueue.out_qlen == 0 && 2265d7ff261SVlad Yasevich list_empty(&asoc->outqueue.retransmit) && 2275d7ff261SVlad Yasevich msg_len > max) 228e2f036a9SMarcelo Ricardo Leitner max_data -= SCTP_PAD4(sizeof(sctp_sack_chunk_t)); 2295d7ff261SVlad Yasevich 2301da177e4SLinus Torvalds /* Encourage Cookie-ECHO bundling. */ 2315d7ff261SVlad Yasevich if (asoc->state < SCTP_STATE_COOKIE_ECHOED) 2323e62abf9SVlad Yasevich max_data -= SCTP_ARBITRARY_COOKIE_ECHO_LEN; 2331da177e4SLinus Torvalds 2345d7ff261SVlad Yasevich /* Now that we adjusted completely, reset first_len */ 2353e62abf9SVlad Yasevich if (first_len > max_data) 2363e62abf9SVlad Yasevich first_len = max_data; 2373e62abf9SVlad Yasevich 2383e62abf9SVlad Yasevich /* Account for a different sized first fragment */ 2393e62abf9SVlad Yasevich if (msg_len >= first_len) { 2401da177e4SLinus Torvalds msg_len -= first_len; 2411da177e4SLinus Torvalds whole = 1; 2420e3aef8dSVlad Yasevich msg->can_delay = 0; 2431da177e4SLinus Torvalds } 2441da177e4SLinus Torvalds 2451da177e4SLinus Torvalds /* How many full sized? How many bytes leftover? */ 2461da177e4SLinus Torvalds whole += msg_len / max; 2471da177e4SLinus Torvalds over = msg_len % max; 2481da177e4SLinus Torvalds offset = 0; 2491da177e4SLinus Torvalds 2501da177e4SLinus Torvalds if ((whole > 1) || (whole && over)) 2516aef70a8SEric Dumazet SCTP_INC_STATS(sock_net(asoc->base.sk), SCTP_MIB_FRAGUSRMSGS); 2521da177e4SLinus Torvalds 2531da177e4SLinus Torvalds /* Create chunks for all the full sized DATA chunks. */ 2541da177e4SLinus Torvalds for (i = 0, len = first_len; i < whole; i++) { 2551da177e4SLinus Torvalds frag = SCTP_DATA_MIDDLE_FRAG; 2561da177e4SLinus Torvalds 2571da177e4SLinus Torvalds if (0 == i) 2581da177e4SLinus Torvalds frag |= SCTP_DATA_FIRST_FRAG; 2591da177e4SLinus Torvalds 260b93d6471SWei Yongjun if ((i == (whole - 1)) && !over) { 2611da177e4SLinus Torvalds frag |= SCTP_DATA_LAST_FRAG; 2621da177e4SLinus Torvalds 263b93d6471SWei Yongjun /* The application requests to set the I-bit of the 264b93d6471SWei Yongjun * last DATA chunk of a user message when providing 265b93d6471SWei Yongjun * the user message to the SCTP implementation. 266b93d6471SWei Yongjun */ 267b93d6471SWei Yongjun if ((sinfo->sinfo_flags & SCTP_EOF) || 268b93d6471SWei Yongjun (sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY)) 269b93d6471SWei Yongjun frag |= SCTP_DATA_SACK_IMM; 270b93d6471SWei Yongjun } 271b93d6471SWei Yongjun 272cea8768fSMarcelo Ricardo Leitner chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 273cea8768fSMarcelo Ricardo Leitner 0, GFP_KERNEL); 2741da177e4SLinus Torvalds 2756e51fe75STommi Rantala if (!chunk) { 2766e51fe75STommi Rantala err = -ENOMEM; 2771da177e4SLinus Torvalds goto errout; 2786e51fe75STommi Rantala } 2796e51fe75STommi Rantala 280e0eb093eSAl Viro err = sctp_user_addto_chunk(chunk, len, from); 2811da177e4SLinus Torvalds if (err < 0) 282be364c8cSTommi Rantala goto errout_chunk_free; 2831da177e4SLinus Torvalds 2841da177e4SLinus Torvalds /* Put the chunk->skb back into the form expected by send. */ 2851da177e4SLinus Torvalds __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr 2861da177e4SLinus Torvalds - (__u8 *)chunk->skb->data); 2871da177e4SLinus Torvalds 2881da177e4SLinus Torvalds sctp_datamsg_assign(msg, chunk); 2891da177e4SLinus Torvalds list_add_tail(&chunk->frag_list, &msg->chunks); 2901da177e4SLinus Torvalds 2911da177e4SLinus Torvalds /* The first chunk, the first chunk was likely short 2921da177e4SLinus Torvalds * to allow bundling, so reset to full size. 2931da177e4SLinus Torvalds */ 2941da177e4SLinus Torvalds if (0 == i) 2951da177e4SLinus Torvalds len = max; 2961da177e4SLinus Torvalds } 2971da177e4SLinus Torvalds 2981da177e4SLinus Torvalds /* .. now the leftover bytes. */ 2991da177e4SLinus Torvalds if (over) { 3001da177e4SLinus Torvalds if (!whole) 3011da177e4SLinus Torvalds frag = SCTP_DATA_NOT_FRAG; 3021da177e4SLinus Torvalds else 3031da177e4SLinus Torvalds frag = SCTP_DATA_LAST_FRAG; 3041da177e4SLinus Torvalds 305b93d6471SWei Yongjun if ((sinfo->sinfo_flags & SCTP_EOF) || 306b93d6471SWei Yongjun (sinfo->sinfo_flags & SCTP_SACK_IMMEDIATELY)) 307b93d6471SWei Yongjun frag |= SCTP_DATA_SACK_IMM; 308b93d6471SWei Yongjun 309cea8768fSMarcelo Ricardo Leitner chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 310cea8768fSMarcelo Ricardo Leitner 0, GFP_KERNEL); 3111da177e4SLinus Torvalds 3126e51fe75STommi Rantala if (!chunk) { 3136e51fe75STommi Rantala err = -ENOMEM; 3141da177e4SLinus Torvalds goto errout; 3156e51fe75STommi Rantala } 3161da177e4SLinus Torvalds 317e0eb093eSAl Viro err = sctp_user_addto_chunk(chunk, over, from); 3181da177e4SLinus Torvalds 3191da177e4SLinus Torvalds /* Put the chunk->skb back into the form expected by send. */ 3201da177e4SLinus Torvalds __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr 3211da177e4SLinus Torvalds - (__u8 *)chunk->skb->data); 3221da177e4SLinus Torvalds if (err < 0) 323be364c8cSTommi Rantala goto errout_chunk_free; 3241da177e4SLinus Torvalds 3251da177e4SLinus Torvalds sctp_datamsg_assign(msg, chunk); 3261da177e4SLinus Torvalds list_add_tail(&chunk->frag_list, &msg->chunks); 3271da177e4SLinus Torvalds } 3281da177e4SLinus Torvalds 3291da177e4SLinus Torvalds return msg; 3301da177e4SLinus Torvalds 331be364c8cSTommi Rantala errout_chunk_free: 332be364c8cSTommi Rantala sctp_chunk_free(chunk); 333be364c8cSTommi Rantala 3341da177e4SLinus Torvalds errout: 3351da177e4SLinus Torvalds list_for_each_safe(pos, temp, &msg->chunks) { 3361da177e4SLinus Torvalds list_del_init(pos); 3371da177e4SLinus Torvalds chunk = list_entry(pos, struct sctp_chunk, frag_list); 3381da177e4SLinus Torvalds sctp_chunk_free(chunk); 3391da177e4SLinus Torvalds } 34080445cfbSFlorian Westphal sctp_datamsg_put(msg); 3416e51fe75STommi Rantala return ERR_PTR(err); 3421da177e4SLinus Torvalds } 3431da177e4SLinus Torvalds 3441da177e4SLinus Torvalds /* Check whether this message has expired. */ 3451da177e4SLinus Torvalds int sctp_chunk_abandoned(struct sctp_chunk *chunk) 3461da177e4SLinus Torvalds { 347*8ae808ebSXin Long if (!chunk->asoc->peer.prsctp_capable) 3481da177e4SLinus Torvalds return 0; 3491da177e4SLinus Torvalds 350a6c2f792SXin Long if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && 3510605483fSXin Long time_after(jiffies, chunk->msg->expires_at)) { 352a6c2f792SXin Long if (chunk->sent_count) 353a6c2f792SXin Long chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; 354a6c2f792SXin Long else 355a6c2f792SXin Long chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++; 356a6c2f792SXin Long return 1; 35701aadb3aSXin Long } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) && 3580605483fSXin Long chunk->sent_count > chunk->sinfo.sinfo_timetolive) { 35901aadb3aSXin Long chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; 36001aadb3aSXin Long return 1; 361*8ae808ebSXin Long } else if (!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags) && 362*8ae808ebSXin Long chunk->msg->expires_at && 363*8ae808ebSXin Long time_after(jiffies, chunk->msg->expires_at)) { 364*8ae808ebSXin Long return 1; 365a6c2f792SXin Long } 3668dbdf1f5SXin Long /* PRIO policy is processed by sendmsg, not here */ 367a6c2f792SXin Long 368a6c2f792SXin Long return 0; 369a6c2f792SXin Long } 370a6c2f792SXin Long 3711da177e4SLinus Torvalds /* This chunk (and consequently entire message) has failed in its sending. */ 3721da177e4SLinus Torvalds void sctp_chunk_fail(struct sctp_chunk *chunk, int error) 3731da177e4SLinus Torvalds { 3741da177e4SLinus Torvalds chunk->msg->send_failed = 1; 3751da177e4SLinus Torvalds chunk->msg->send_error = error; 3761da177e4SLinus Torvalds } 377