Lines Matching refs:msg

35 static void sctp_datamsg_init(struct sctp_datamsg *msg)  in sctp_datamsg_init()  argument
37 refcount_set(&msg->refcnt, 1); in sctp_datamsg_init()
38 msg->send_failed = 0; in sctp_datamsg_init()
39 msg->send_error = 0; in sctp_datamsg_init()
40 msg->can_delay = 1; in sctp_datamsg_init()
41 msg->abandoned = 0; in sctp_datamsg_init()
42 msg->expires_at = 0; in sctp_datamsg_init()
43 INIT_LIST_HEAD(&msg->chunks); in sctp_datamsg_init()
49 struct sctp_datamsg *msg; in sctp_datamsg_new() local
50 msg = kmalloc(sizeof(struct sctp_datamsg), gfp); in sctp_datamsg_new()
51 if (msg) { in sctp_datamsg_new()
52 sctp_datamsg_init(msg); in sctp_datamsg_new()
55 return msg; in sctp_datamsg_new()
58 void sctp_datamsg_free(struct sctp_datamsg *msg) in sctp_datamsg_free() argument
65 list_for_each_entry(chunk, &msg->chunks, frag_list) in sctp_datamsg_free()
68 sctp_datamsg_put(msg); in sctp_datamsg_free()
72 static void sctp_datamsg_destroy(struct sctp_datamsg *msg) in sctp_datamsg_destroy() argument
81 list_for_each_safe(pos, temp, &msg->chunks) { in sctp_datamsg_destroy()
85 if (!msg->send_failed) { in sctp_datamsg_destroy()
91 error = msg->send_error ?: asoc->outqueue.error; in sctp_datamsg_destroy()
115 kfree(msg); in sctp_datamsg_destroy()
119 static void sctp_datamsg_hold(struct sctp_datamsg *msg) in sctp_datamsg_hold() argument
121 refcount_inc(&msg->refcnt); in sctp_datamsg_hold()
125 void sctp_datamsg_put(struct sctp_datamsg *msg) in sctp_datamsg_put() argument
127 if (refcount_dec_and_test(&msg->refcnt)) in sctp_datamsg_put()
128 sctp_datamsg_destroy(msg); in sctp_datamsg_put()
132 static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) in sctp_datamsg_assign() argument
134 sctp_datamsg_hold(msg); in sctp_datamsg_assign()
135 chunk->msg = msg; in sctp_datamsg_assign()
155 struct sctp_datamsg *msg; in sctp_datamsg_from_user() local
158 msg = sctp_datamsg_new(GFP_KERNEL); in sctp_datamsg_from_user()
159 if (!msg) in sctp_datamsg_from_user()
168 msg->expires_at = jiffies + in sctp_datamsg_from_user()
226 msg->can_delay = 0; in sctp_datamsg_from_user()
279 sctp_datamsg_assign(msg, chunk); in sctp_datamsg_from_user()
280 list_add_tail(&chunk->frag_list, &msg->chunks); in sctp_datamsg_from_user()
283 return msg; in sctp_datamsg_from_user()
289 list_for_each_safe(pos, temp, &msg->chunks) { in sctp_datamsg_from_user()
294 sctp_datamsg_put(msg); in sctp_datamsg_from_user()
305 if (chunk->msg->abandoned) in sctp_chunk_abandoned()
313 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
325 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
335 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
338 chunk->msg->expires_at && in sctp_chunk_abandoned()
339 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
340 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
351 chunk->msg->send_failed = 1; in sctp_chunk_fail()
352 chunk->msg->send_error = error; in sctp_chunk_fail()