Lines Matching refs:msg
50 static void sctp_datamsg_init(struct sctp_datamsg *msg) in sctp_datamsg_init() argument
52 refcount_set(&msg->refcnt, 1); in sctp_datamsg_init()
53 msg->send_failed = 0; in sctp_datamsg_init()
54 msg->send_error = 0; in sctp_datamsg_init()
55 msg->can_delay = 1; in sctp_datamsg_init()
56 msg->abandoned = 0; in sctp_datamsg_init()
57 msg->expires_at = 0; in sctp_datamsg_init()
58 INIT_LIST_HEAD(&msg->chunks); in sctp_datamsg_init()
64 struct sctp_datamsg *msg; in sctp_datamsg_new() local
65 msg = kmalloc(sizeof(struct sctp_datamsg), gfp); in sctp_datamsg_new()
66 if (msg) { in sctp_datamsg_new()
67 sctp_datamsg_init(msg); in sctp_datamsg_new()
70 return msg; in sctp_datamsg_new()
73 void sctp_datamsg_free(struct sctp_datamsg *msg) in sctp_datamsg_free() argument
80 list_for_each_entry(chunk, &msg->chunks, frag_list) in sctp_datamsg_free()
83 sctp_datamsg_put(msg); in sctp_datamsg_free()
87 static void sctp_datamsg_destroy(struct sctp_datamsg *msg) in sctp_datamsg_destroy() argument
97 notify = msg->send_failed ? -1 : 0; in sctp_datamsg_destroy()
100 list_for_each_safe(pos, temp, &msg->chunks) { in sctp_datamsg_destroy()
106 if (msg->send_error) in sctp_datamsg_destroy()
107 error = msg->send_error; in sctp_datamsg_destroy()
134 kfree(msg); in sctp_datamsg_destroy()
138 static void sctp_datamsg_hold(struct sctp_datamsg *msg) in sctp_datamsg_hold() argument
140 refcount_inc(&msg->refcnt); in sctp_datamsg_hold()
144 void sctp_datamsg_put(struct sctp_datamsg *msg) in sctp_datamsg_put() argument
146 if (refcount_dec_and_test(&msg->refcnt)) in sctp_datamsg_put()
147 sctp_datamsg_destroy(msg); in sctp_datamsg_put()
151 static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) in sctp_datamsg_assign() argument
153 sctp_datamsg_hold(msg); in sctp_datamsg_assign()
154 chunk->msg = msg; in sctp_datamsg_assign()
174 struct sctp_datamsg *msg; in sctp_datamsg_from_user() local
177 msg = sctp_datamsg_new(GFP_KERNEL); in sctp_datamsg_from_user()
178 if (!msg) in sctp_datamsg_from_user()
187 msg->expires_at = jiffies + in sctp_datamsg_from_user()
239 msg->can_delay = 0; in sctp_datamsg_from_user()
292 sctp_datamsg_assign(msg, chunk); in sctp_datamsg_from_user()
293 list_add_tail(&chunk->frag_list, &msg->chunks); in sctp_datamsg_from_user()
296 return msg; in sctp_datamsg_from_user()
302 list_for_each_safe(pos, temp, &msg->chunks) { in sctp_datamsg_from_user()
307 sctp_datamsg_put(msg); in sctp_datamsg_from_user()
318 if (chunk->msg->abandoned) in sctp_chunk_abandoned()
326 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
338 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
348 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
351 chunk->msg->expires_at && in sctp_chunk_abandoned()
352 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
353 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
364 chunk->msg->send_failed = 1; in sctp_chunk_fail()
365 chunk->msg->send_error = error; in sctp_chunk_fail()