Skip to content

Commit 9162e0e

Browse files
lxindavem330
authored andcommitted
sctp: implement enqueue_event for sctp_stream_interleave
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 <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bd4d627 commit 9162e0e

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

include/net/sctp/stream_interleave.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ struct sctp_stream_interleave {
4141
bool (*validate_data)(struct sctp_chunk *chunk);
4242
int (*ulpevent_data)(struct sctp_ulpq *ulpq,
4343
struct sctp_chunk *chunk, gfp_t gfp);
44+
int (*enqueue_event)(struct sctp_ulpq *ulpq,
45+
struct sctp_ulpevent *event);
4446
};
4547

4648
void sctp_stream_interleave_init(struct sctp_stream *stream);

net/sctp/associola.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
861861
event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
862862
0, spc_state, error, GFP_ATOMIC);
863863
if (event)
864-
sctp_ulpq_tail_event(&asoc->ulpq, event);
864+
asoc->stream.si->enqueue_event(&asoc->ulpq, event);
865865
}
866866

867867
/* Select new active and retran paths. */

net/sctp/chunk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void sctp_datamsg_destroy(struct sctp_datamsg *msg)
124124
ev = sctp_ulpevent_make_send_failed(asoc, chunk, sent,
125125
error, GFP_ATOMIC);
126126
if (ev)
127-
sctp_ulpq_tail_event(&asoc->ulpq, ev);
127+
asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
128128
}
129129

130130
sctp_chunk_put(chunk);

net/sctp/sm_sideeffect.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ static void sctp_cmd_process_operr(struct sctp_cmd_seq *cmds,
972972
if (!ev)
973973
return;
974974

975-
sctp_ulpq_tail_event(&asoc->ulpq, ev);
975+
asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
976976

977977
switch (err_hdr->cause) {
978978
case SCTP_ERROR_UNKNOWN_CHUNK:
@@ -1058,7 +1058,7 @@ static void sctp_cmd_assoc_change(struct sctp_cmd_seq *commands,
10581058
asoc->c.sinit_max_instreams,
10591059
NULL, GFP_ATOMIC);
10601060
if (ev)
1061-
sctp_ulpq_tail_event(&asoc->ulpq, ev);
1061+
asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
10621062
}
10631063

10641064
/* Helper function to generate an adaptation indication event */
@@ -1070,7 +1070,7 @@ static void sctp_cmd_adaptation_ind(struct sctp_cmd_seq *commands,
10701070
ev = sctp_ulpevent_make_adaptation_indication(asoc, GFP_ATOMIC);
10711071

10721072
if (ev)
1073-
sctp_ulpq_tail_event(&asoc->ulpq, ev);
1073+
asoc->stream.si->enqueue_event(&asoc->ulpq, ev);
10741074
}
10751075

10761076

@@ -1493,7 +1493,8 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
14931493
pr_debug("%s: sm_sideff: event_up:%p, ulpq:%p\n",
14941494
__func__, cmd->obj.ulpevent, &asoc->ulpq);
14951495

1496-
sctp_ulpq_tail_event(&asoc->ulpq, cmd->obj.ulpevent);
1496+
asoc->stream.si->enqueue_event(&asoc->ulpq,
1497+
cmd->obj.ulpevent);
14971498
break;
14981499

14991500
case SCTP_CMD_REPLY:

net/sctp/socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
22942294
if (!event)
22952295
return -ENOMEM;
22962296

2297-
sctp_ulpq_tail_event(&asoc->ulpq, event);
2297+
asoc->stream.si->enqueue_event(&asoc->ulpq, event);
22982298
}
22992299
}
23002300

net/sctp/stream_interleave.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ static struct sctp_stream_interleave sctp_stream_interleave_0 = {
552552
.assign_number = sctp_chunk_assign_ssn,
553553
.validate_data = sctp_validate_data,
554554
.ulpevent_data = sctp_ulpq_tail_data,
555+
.enqueue_event = sctp_ulpq_tail_event,
555556
};
556557

557558
static struct sctp_stream_interleave sctp_stream_interleave_1 = {
@@ -561,6 +562,7 @@ static struct sctp_stream_interleave sctp_stream_interleave_1 = {
561562
.assign_number = sctp_chunk_assign_mid,
562563
.validate_data = sctp_validate_idata,
563564
.ulpevent_data = sctp_ulpevent_idata,
565+
.enqueue_event = sctp_enqueue_event,
564566
};
565567

566568
void sctp_stream_interleave_init(struct sctp_stream *stream)

0 commit comments

Comments
 (0)