sctp: implement enqueue_event for sctp_stream_interleave
authorXin Long <lucien.xin@gmail.com>
Fri, 8 Dec 2017 13:04:05 +0000 (21:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Dec 2017 16:23:05 +0000 (11:23 -0500)
enqueue_event is added as a member of sctp_stream_interleave, used to
enqueue either data, idata or notification events into user socket rx
queue.

It replaces sctp_ulpq_tail_event used in the other places with
enqueue_event.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/stream_interleave.h
net/sctp/associola.c
net/sctp/chunk.c
net/sctp/sm_sideeffect.c
net/sctp/socket.c
net/sctp/stream_interleave.c

index 02f60f541f1e08775aef31d45e7b3fbb80d1926d..a0f61bc08ae8a8d3b5e39c4239628faa3f781f6a 100644 (file)
@@ -41,6 +41,8 @@ struct sctp_stream_interleave {
        bool    (*validate_data)(struct sctp_chunk *chunk);
        int     (*ulpevent_data)(struct sctp_ulpq *ulpq,
                                 struct sctp_chunk *chunk, gfp_t gfp);
+       int     (*enqueue_event)(struct sctp_ulpq *ulpq,
+                                struct sctp_ulpevent *event);
 };
 
 void sctp_stream_interleave_init(struct sctp_stream *stream);
index 69394f4d609116c3e56b5206b088abeda47dba27..837806dd57990af4b39147045f8eb53b5f34ec61 100644 (file)
@@ -861,7 +861,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
                event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
                                        0, spc_state, error, GFP_ATOMIC);
                if (event)
-                       sctp_ulpq_tail_event(&asoc->ulpq, event);
+                       asoc->stream.si->enqueue_event(&asoc->ulpq, event);
        }
 
        /* Select new active and retran paths. */
index 62adaaacc4abe9cf9802601c32965e8316363442..991a530c6b31667ec15b95a08035a5e8f71476f4 100644 (file)
@@ -124,7 +124,7 @@ static void sctp_datamsg_destroy(struct sctp_datamsg *msg)
                        ev = sctp_ulpevent_make_send_failed(asoc, chunk, sent,
                                                            error, GFP_ATOMIC);
                        if (ev)
-                               sctp_ulpq_tail_event(&asoc->ulpq, ev);
+                               asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
                }
 
                sctp_chunk_put(chunk);
index 9d25efb26a39833f76587abb357e2124338be35b..f4e5ecade936748d13b7e79af1cf925ecc04c46f 100644 (file)
@@ -972,7 +972,7 @@ static void sctp_cmd_process_operr(struct sctp_cmd_seq *cmds,
                if (!ev)
                        return;
 
-               sctp_ulpq_tail_event(&asoc->ulpq, ev);
+               asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
 
                switch (err_hdr->cause) {
                case SCTP_ERROR_UNKNOWN_CHUNK:
@@ -1058,7 +1058,7 @@ static void sctp_cmd_assoc_change(struct sctp_cmd_seq *commands,
                                            asoc->c.sinit_max_instreams,
                                            NULL, GFP_ATOMIC);
        if (ev)
-               sctp_ulpq_tail_event(&asoc->ulpq, ev);
+               asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
 }
 
 /* Helper function to generate an adaptation indication event */
@@ -1070,7 +1070,7 @@ static void sctp_cmd_adaptation_ind(struct sctp_cmd_seq *commands,
        ev = sctp_ulpevent_make_adaptation_indication(asoc, GFP_ATOMIC);
 
        if (ev)
-               sctp_ulpq_tail_event(&asoc->ulpq, ev);
+               asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
 }
 
 
@@ -1493,7 +1493,8 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
                        pr_debug("%s: sm_sideff: event_up:%p, ulpq:%p\n",
                                 __func__, cmd->obj.ulpevent, &asoc->ulpq);
 
-                       sctp_ulpq_tail_event(&asoc->ulpq, cmd->obj.ulpevent);
+                       asoc->stream.si->enqueue_event(&asoc->ulpq,
+                                                      cmd->obj.ulpevent);
                        break;
 
                case SCTP_CMD_REPLY:
index 3654e1ede7168e123b4df6f4a88e0f688a5ec7ba..c58a1fc029783e39d1e4748411fda61af6373780 100644 (file)
@@ -2294,7 +2294,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
                        if (!event)
                                return -ENOMEM;
 
-                       sctp_ulpq_tail_event(&asoc->ulpq, event);
+                       asoc->stream.si->enqueue_event(&asoc->ulpq, event);
                }
        }
 
index 823831101dc4d13a9f3389b55b790a294aaeed8d..e85397200230ade71e19cc841ec0f9660cb506c7 100644 (file)
@@ -552,6 +552,7 @@ static struct sctp_stream_interleave sctp_stream_interleave_0 = {
        .assign_number          = sctp_chunk_assign_ssn,
        .validate_data          = sctp_validate_data,
        .ulpevent_data          = sctp_ulpq_tail_data,
+       .enqueue_event          = sctp_ulpq_tail_event,
 };
 
 static struct sctp_stream_interleave sctp_stream_interleave_1 = {
@@ -561,6 +562,7 @@ static struct sctp_stream_interleave sctp_stream_interleave_1 = {
        .assign_number          = sctp_chunk_assign_mid,
        .validate_data          = sctp_validate_idata,
        .ulpevent_data          = sctp_ulpevent_idata,
+       .enqueue_event          = sctp_enqueue_event,
 };
 
 void sctp_stream_interleave_init(struct sctp_stream *stream)