Lines Matching refs:msg
50 static void sctp_datamsg_init(struct sctp_datamsg *msg) in sctp_datamsg_init() argument
52 atomic_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_abandon = 0; in sctp_datamsg_init()
56 msg->can_delay = 1; 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 atomic_inc(&msg->refcnt); in sctp_datamsg_hold()
144 void sctp_datamsg_put(struct sctp_datamsg *msg) in sctp_datamsg_put() argument
146 if (atomic_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()
173 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()
186 msg->expires_at = jiffies + in sctp_datamsg_from_user()
188 msg->can_abandon = 1; in sctp_datamsg_from_user()
191 msg, msg->expires_at, jiffies); in sctp_datamsg_from_user()
245 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()
328 sctp_datamsg_assign(msg, chunk); in sctp_datamsg_from_user()
329 list_add_tail(&chunk->frag_list, &msg->chunks); in sctp_datamsg_from_user()
332 return msg; in sctp_datamsg_from_user()
338 list_for_each_safe(pos, temp, &msg->chunks) { in sctp_datamsg_from_user()
343 sctp_datamsg_put(msg); in sctp_datamsg_from_user()
350 struct sctp_datamsg *msg = chunk->msg; in sctp_chunk_abandoned() local
352 if (!msg->can_abandon) in sctp_chunk_abandoned()
355 if (time_after(jiffies, msg->expires_at)) in sctp_chunk_abandoned()
364 chunk->msg->send_failed = 1; in sctp_chunk_fail()
365 chunk->msg->send_error = error; in sctp_chunk_fail()