Skip to content

Commit f659173

Browse files
committed
Merge branch 'sctp-shrink-stream-outq-in-the-right-place'
Xin Long says: ==================== sctp: shrink stream outq in the right place Patch 1 is an improvement, and Patch 2 is a bug fix. ==================== Acked-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents 2f2a7ff + 3ecdda3 commit f659173

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

net/sctp/stream.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@
2222
#include <net/sctp/sm.h>
2323
#include <net/sctp/stream_sched.h>
2424

25-
/* Migrates chunks from stream queues to new stream queues if needed,
26-
* but not across associations. Also, removes those chunks to streams
27-
* higher than the new max.
28-
*/
29-
static void sctp_stream_outq_migrate(struct sctp_stream *stream,
30-
struct sctp_stream *new, __u16 outcnt)
25+
static void sctp_stream_shrink_out(struct sctp_stream *stream, __u16 outcnt)
3126
{
3227
struct sctp_association *asoc;
3328
struct sctp_chunk *ch, *temp;
3429
struct sctp_outq *outq;
35-
int i;
3630

3731
asoc = container_of(stream, struct sctp_association, stream);
3832
outq = &asoc->outqueue;
@@ -56,6 +50,19 @@ static void sctp_stream_outq_migrate(struct sctp_stream *stream,
5650

5751
sctp_chunk_free(ch);
5852
}
53+
}
54+
55+
/* Migrates chunks from stream queues to new stream queues if needed,
56+
* but not across associations. Also, removes those chunks to streams
57+
* higher than the new max.
58+
*/
59+
static void sctp_stream_outq_migrate(struct sctp_stream *stream,
60+
struct sctp_stream *new, __u16 outcnt)
61+
{
62+
int i;
63+
64+
if (stream->outcnt > outcnt)
65+
sctp_stream_shrink_out(stream, outcnt);
5966

6067
if (new) {
6168
/* Here we actually move the old ext stuff into the new
@@ -1037,11 +1044,13 @@ struct sctp_chunk *sctp_process_strreset_resp(
10371044
nums = ntohs(addstrm->number_of_streams);
10381045
number = stream->outcnt - nums;
10391046

1040-
if (result == SCTP_STRRESET_PERFORMED)
1047+
if (result == SCTP_STRRESET_PERFORMED) {
10411048
for (i = number; i < stream->outcnt; i++)
10421049
SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
1043-
else
1050+
} else {
1051+
sctp_stream_shrink_out(stream, number);
10441052
stream->outcnt = number;
1053+
}
10451054

10461055
*evp = sctp_ulpevent_make_stream_change_event(asoc, flags,
10471056
0, nums, GFP_ATOMIC);

0 commit comments

Comments
 (0)