summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2017-01-06 09:18:33 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-06 21:07:26 -0500
commita83863174a6137fb3e03f279c9dcdba9e35315d0 (patch)
tree0d0a508f3b8d59486d0faf49f7a7eee2d303a612
parentdf560056d960a3e164c179d89770d5a51b798537 (diff)
sctp: prepare asoc stream for stream reconf
sctp stream reconf, described in RFC 6525, needs a structure to save per stream information in assoc, like stream state. In the future, sctp stream scheduler also needs it to save some stream scheduler params and queues. This patchset is to prepare the stream array in assoc for stream reconf. It defines sctp_stream that includes stream arrays inside to replace ssnmap. Note that we use different structures for IN and OUT streams, as the members in per OUT stream will get more and more different from per IN stream. v1->v2: - put these patches into a smaller group. v2->v3: - define sctp_stream to contain stream arrays, and create stream.c to put stream-related functions. - merge 3 patches into 1, as new sctp_stream has the same name with before. Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sctp/structs.h76
-rw-r--r--net/sctp/Makefile2
-rw-r--r--net/sctp/associola.c13
-rw-r--r--net/sctp/objcnt.c2
-rw-r--r--net/sctp/sm_make_chunk.c10
-rw-r--r--net/sctp/sm_statefuns.c3
-rw-r--r--net/sctp/ssnmap.c125
-rw-r--r--net/sctp/stream.c85
-rw-r--r--net/sctp/ulpqueue.c36
10 files changed, 147 insertions, 206 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d8833a86cd7e..598d938b0d0a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -283,7 +283,6 @@ extern atomic_t sctp_dbg_objcnt_chunk;
283extern atomic_t sctp_dbg_objcnt_bind_addr; 283extern atomic_t sctp_dbg_objcnt_bind_addr;
284extern atomic_t sctp_dbg_objcnt_bind_bucket; 284extern atomic_t sctp_dbg_objcnt_bind_bucket;
285extern atomic_t sctp_dbg_objcnt_addr; 285extern atomic_t sctp_dbg_objcnt_addr;
286extern atomic_t sctp_dbg_objcnt_ssnmap;
287extern atomic_t sctp_dbg_objcnt_datamsg; 286extern atomic_t sctp_dbg_objcnt_datamsg;
288extern atomic_t sctp_dbg_objcnt_keys; 287extern atomic_t sctp_dbg_objcnt_keys;
289 288
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 87d56cc80a3c..4741ec240caf 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -82,7 +82,6 @@ struct sctp_outq;
82struct sctp_bind_addr; 82struct sctp_bind_addr;
83struct sctp_ulpq; 83struct sctp_ulpq;
84struct sctp_ep_common; 84struct sctp_ep_common;
85struct sctp_ssnmap;
86struct crypto_shash; 85struct crypto_shash;
87 86
88 87
@@ -377,54 +376,22 @@ typedef struct sctp_sender_hb_info {
377 __u64 hb_nonce; 376 __u64 hb_nonce;
378} __packed sctp_sender_hb_info_t; 377} __packed sctp_sender_hb_info_t;
379 378
380/* 379struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);
381 * RFC 2960 1.3.2 Sequenced Delivery within Streams 380void sctp_stream_free(struct sctp_stream *stream);
382 * 381void sctp_stream_clear(struct sctp_stream *stream);
383 * The term "stream" is used in SCTP to refer to a sequence of user
384 * messages that are to be delivered to the upper-layer protocol in
385 * order with respect to other messages within the same stream. This is
386 * in contrast to its usage in TCP, where it refers to a sequence of
387 * bytes (in this document a byte is assumed to be eight bits).
388 * ...
389 *
390 * This is the structure we use to track both our outbound and inbound
391 * SSN, or Stream Sequence Numbers.
392 */
393
394struct sctp_stream {
395 __u16 *ssn;
396 unsigned int len;
397};
398
399struct sctp_ssnmap {
400 struct sctp_stream in;
401 struct sctp_stream out;
402};
403
404struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
405 gfp_t gfp);
406void sctp_ssnmap_free(struct sctp_ssnmap *map);
407void sctp_ssnmap_clear(struct sctp_ssnmap *map);
408 382
409/* What is the current SSN number for this stream? */ 383/* What is the current SSN number for this stream? */
410static inline __u16 sctp_ssn_peek(struct sctp_stream *stream, __u16 id) 384#define sctp_ssn_peek(stream, type, sid) \
411{ 385 ((stream)->type[sid].ssn)
412 return stream->ssn[id];
413}
414 386
415/* Return the next SSN number for this stream. */ 387/* Return the next SSN number for this stream. */
416static inline __u16 sctp_ssn_next(struct sctp_stream *stream, __u16 id) 388#define sctp_ssn_next(stream, type, sid) \
417{ 389 ((stream)->type[sid].ssn++)
418 return stream->ssn[id]++;
419}
420 390
421/* Skip over this ssn and all below. */ 391/* Skip over this ssn and all below. */
422static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id, 392#define sctp_ssn_skip(stream, type, sid, ssn) \
423 __u16 ssn) 393 ((stream)->type[sid].ssn = ssn + 1)
424{ 394
425 stream->ssn[id] = ssn+1;
426}
427
428/* 395/*
429 * Pointers to address related SCTP functions. 396 * Pointers to address related SCTP functions.
430 * (i.e. things that depend on the address family.) 397 * (i.e. things that depend on the address family.)
@@ -1331,6 +1298,25 @@ struct sctp_inithdr_host {
1331 __u32 initial_tsn; 1298 __u32 initial_tsn;
1332}; 1299};
1333 1300
1301struct sctp_stream_out {
1302 __u16 ssn;
1303 __u8 state;
1304};
1305
1306struct sctp_stream_in {
1307 __u16 ssn;
1308};
1309
1310struct sctp_stream {
1311 struct sctp_stream_out *out;
1312 struct sctp_stream_in *in;
1313 __u16 outcnt;
1314 __u16 incnt;
1315};
1316
1317#define SCTP_STREAM_CLOSED 0x00
1318#define SCTP_STREAM_OPEN 0x01
1319
1334/* SCTP_GET_ASSOC_STATS counters */ 1320/* SCTP_GET_ASSOC_STATS counters */
1335struct sctp_priv_assoc_stats { 1321struct sctp_priv_assoc_stats {
1336 /* Maximum observed rto in the association during subsequent 1322 /* Maximum observed rto in the association during subsequent
@@ -1746,8 +1732,8 @@ struct sctp_association {
1746 /* Default receive parameters */ 1732 /* Default receive parameters */
1747 __u32 default_rcv_context; 1733 __u32 default_rcv_context;
1748 1734
1749 /* This tracks outbound ssn for a given stream. */ 1735 /* Stream arrays */
1750 struct sctp_ssnmap *ssnmap; 1736 struct sctp_stream *stream;
1751 1737
1752 /* All outbound chunks go through this structure. */ 1738 /* All outbound chunks go through this structure. */
1753 struct sctp_outq outqueue; 1739 struct sctp_outq outqueue;
diff --git a/net/sctp/Makefile b/net/sctp/Makefile
index 6c4f7496cec6..70f1b570bab9 100644
--- a/net/sctp/Makefile
+++ b/net/sctp/Makefile
@@ -11,7 +11,7 @@ sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
11 transport.o chunk.o sm_make_chunk.o ulpevent.o \ 11 transport.o chunk.o sm_make_chunk.o ulpevent.o \
12 inqueue.o outqueue.o ulpqueue.o \ 12 inqueue.o outqueue.o ulpqueue.o \
13 tsnmap.o bind_addr.o socket.o primitive.o \ 13 tsnmap.o bind_addr.o socket.o primitive.o \
14 output.o input.o debug.o ssnmap.o auth.o \ 14 output.o input.o debug.o stream.o auth.o \
15 offload.o 15 offload.o
16 16
17sctp_probe-y := probe.o 17sctp_probe-y := probe.o
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index d3cc30c25c41..36294f7fb9a7 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -358,8 +358,8 @@ void sctp_association_free(struct sctp_association *asoc)
358 358
359 sctp_tsnmap_free(&asoc->peer.tsn_map); 359 sctp_tsnmap_free(&asoc->peer.tsn_map);
360 360
361 /* Free ssnmap storage. */ 361 /* Free stream information. */
362 sctp_ssnmap_free(asoc->ssnmap); 362 sctp_stream_free(asoc->stream);
363 363
364 /* Clean up the bound address list. */ 364 /* Clean up the bound address list. */
365 sctp_bind_addr_free(&asoc->base.bind_addr); 365 sctp_bind_addr_free(&asoc->base.bind_addr);
@@ -1137,7 +1137,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
1137 /* Reinitialize SSN for both local streams 1137 /* Reinitialize SSN for both local streams
1138 * and peer's streams. 1138 * and peer's streams.
1139 */ 1139 */
1140 sctp_ssnmap_clear(asoc->ssnmap); 1140 sctp_stream_clear(asoc->stream);
1141 1141
1142 /* Flush the ULP reassembly and ordered queue. 1142 /* Flush the ULP reassembly and ordered queue.
1143 * Any data there will now be stale and will 1143 * Any data there will now be stale and will
@@ -1162,10 +1162,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
1162 1162
1163 asoc->ctsn_ack_point = asoc->next_tsn - 1; 1163 asoc->ctsn_ack_point = asoc->next_tsn - 1;
1164 asoc->adv_peer_ack_point = asoc->ctsn_ack_point; 1164 asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
1165 if (!asoc->ssnmap) { 1165 if (!asoc->stream) {
1166 /* Move the ssnmap. */ 1166 asoc->stream = new->stream;
1167 asoc->ssnmap = new->ssnmap; 1167 new->stream = NULL;
1168 new->ssnmap = NULL;
1169 } 1168 }
1170 1169
1171 if (!asoc->assoc_id) { 1170 if (!asoc->assoc_id) {
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 40e7fac96c41..105ac3327b28 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -51,7 +51,6 @@ SCTP_DBG_OBJCNT(bind_addr);
51SCTP_DBG_OBJCNT(bind_bucket); 51SCTP_DBG_OBJCNT(bind_bucket);
52SCTP_DBG_OBJCNT(chunk); 52SCTP_DBG_OBJCNT(chunk);
53SCTP_DBG_OBJCNT(addr); 53SCTP_DBG_OBJCNT(addr);
54SCTP_DBG_OBJCNT(ssnmap);
55SCTP_DBG_OBJCNT(datamsg); 54SCTP_DBG_OBJCNT(datamsg);
56SCTP_DBG_OBJCNT(keys); 55SCTP_DBG_OBJCNT(keys);
57 56
@@ -67,7 +66,6 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = {
67 SCTP_DBG_OBJCNT_ENTRY(bind_addr), 66 SCTP_DBG_OBJCNT_ENTRY(bind_addr),
68 SCTP_DBG_OBJCNT_ENTRY(bind_bucket), 67 SCTP_DBG_OBJCNT_ENTRY(bind_bucket),
69 SCTP_DBG_OBJCNT_ENTRY(addr), 68 SCTP_DBG_OBJCNT_ENTRY(addr),
70 SCTP_DBG_OBJCNT_ENTRY(ssnmap),
71 SCTP_DBG_OBJCNT_ENTRY(datamsg), 69 SCTP_DBG_OBJCNT_ENTRY(datamsg),
72 SCTP_DBG_OBJCNT_ENTRY(keys), 70 SCTP_DBG_OBJCNT_ENTRY(keys),
73}; 71};
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 9e9690b7afe1..a15d824a313d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1536,7 +1536,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk)
1536 1536
1537 /* All fragments will be on the same stream */ 1537 /* All fragments will be on the same stream */
1538 sid = ntohs(chunk->subh.data_hdr->stream); 1538 sid = ntohs(chunk->subh.data_hdr->stream);
1539 stream = &chunk->asoc->ssnmap->out; 1539 stream = chunk->asoc->stream;
1540 1540
1541 /* Now assign the sequence number to the entire message. 1541 /* Now assign the sequence number to the entire message.
1542 * All fragments must have the same stream sequence number. 1542 * All fragments must have the same stream sequence number.
@@ -1547,9 +1547,9 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk)
1547 ssn = 0; 1547 ssn = 0;
1548 } else { 1548 } else {
1549 if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) 1549 if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG)
1550 ssn = sctp_ssn_next(stream, sid); 1550 ssn = sctp_ssn_next(stream, out, sid);
1551 else 1551 else
1552 ssn = sctp_ssn_peek(stream, sid); 1552 ssn = sctp_ssn_peek(stream, out, sid);
1553 } 1553 }
1554 1554
1555 lchunk->subh.data_hdr->ssn = htons(ssn); 1555 lchunk->subh.data_hdr->ssn = htons(ssn);
@@ -2444,9 +2444,9 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
2444 if (!asoc->temp) { 2444 if (!asoc->temp) {
2445 int error; 2445 int error;
2446 2446
2447 asoc->ssnmap = sctp_ssnmap_new(asoc->c.sinit_max_instreams, 2447 asoc->stream = sctp_stream_new(asoc->c.sinit_max_instreams,
2448 asoc->c.sinit_num_ostreams, gfp); 2448 asoc->c.sinit_num_ostreams, gfp);
2449 if (!asoc->ssnmap) 2449 if (!asoc->stream)
2450 goto clean_up; 2450 goto clean_up;
2451 2451
2452 error = sctp_assoc_set_id(asoc, gfp); 2452 error = sctp_assoc_set_id(asoc, gfp);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 3382ef254e7b..0ceded37d20b 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -6274,9 +6274,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6274 * and is invalid. 6274 * and is invalid.
6275 */ 6275 */
6276 ssn = ntohs(data_hdr->ssn); 6276 ssn = ntohs(data_hdr->ssn);
6277 if (ordered && SSN_lt(ssn, sctp_ssn_peek(&asoc->ssnmap->in, sid))) { 6277 if (ordered && SSN_lt(ssn, sctp_ssn_peek(asoc->stream, in, sid)))
6278 return SCTP_IERROR_PROTO_VIOLATION; 6278 return SCTP_IERROR_PROTO_VIOLATION;
6279 }
6280 6279
6281 /* Send the data up to the user. Note: Schedule the 6280 /* Send the data up to the user. Note: Schedule the
6282 * SCTP_CMD_CHUNK_ULP cmd before the SCTP_CMD_GEN_SACK, as the SACK 6281 * SCTP_CMD_CHUNK_ULP cmd before the SCTP_CMD_GEN_SACK, as the SACK
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c
deleted file mode 100644
index b9c8521c1a98..000000000000
--- a/net/sctp/ssnmap.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/* SCTP kernel implementation
2 * Copyright (c) 2003 International Business Machines, Corp.
3 *
4 * This file is part of the SCTP kernel implementation
5 *
6 * These functions manipulate sctp SSN tracker.
7 *
8 * This SCTP implementation is free software;
9 * you can redistribute it and/or modify it under the terms of
10 * the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This SCTP implementation is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * ************************
17 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 * See the GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with GNU CC; see the file COPYING. If not, see
22 * <http://www.gnu.org/licenses/>.
23 *
24 * Please send any bug reports or fixes you make to the
25 * email address(es):
26 * lksctp developers <linux-sctp@vger.kernel.org>
27 *
28 * Written or modified by:
29 * Jon Grimm <jgrimm@us.ibm.com>
30 */
31
32#include <linux/types.h>
33#include <linux/slab.h>
34#include <net/sctp/sctp.h>
35#include <net/sctp/sm.h>
36
37static struct sctp_ssnmap *sctp_ssnmap_init(struct sctp_ssnmap *map, __u16 in,
38 __u16 out);
39
40/* Storage size needed for map includes 2 headers and then the
41 * specific needs of in or out streams.
42 */
43static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
44{
45 return sizeof(struct sctp_ssnmap) + (in + out) * sizeof(__u16);
46}
47
48
49/* Create a new sctp_ssnmap.
50 * Allocate room to store at least 'len' contiguous TSNs.
51 */
52struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
53 gfp_t gfp)
54{
55 struct sctp_ssnmap *retval;
56 int size;
57
58 size = sctp_ssnmap_size(in, out);
59 if (size <= KMALLOC_MAX_SIZE)
60 retval = kmalloc(size, gfp);
61 else
62 retval = (struct sctp_ssnmap *)
63 __get_free_pages(gfp, get_order(size));
64 if (!retval)
65 goto fail;
66
67 if (!sctp_ssnmap_init(retval, in, out))
68 goto fail_map;
69
70 SCTP_DBG_OBJCNT_INC(ssnmap);
71
72 return retval;
73
74fail_map:
75 if (size <= KMALLOC_MAX_SIZE)
76 kfree(retval);
77 else
78 free_pages((unsigned long)retval, get_order(size));
79fail:
80 return NULL;
81}
82
83
84/* Initialize a block of memory as a ssnmap. */
85static struct sctp_ssnmap *sctp_ssnmap_init(struct sctp_ssnmap *map, __u16 in,
86 __u16 out)
87{
88 memset(map, 0x00, sctp_ssnmap_size(in, out));
89
90 /* Start 'in' stream just after the map header. */
91 map->in.ssn = (__u16 *)&map[1];
92 map->in.len = in;
93
94 /* Start 'out' stream just after 'in'. */
95 map->out.ssn = &map->in.ssn[in];
96 map->out.len = out;
97
98 return map;
99}
100
101/* Clear out the ssnmap streams. */
102void sctp_ssnmap_clear(struct sctp_ssnmap *map)
103{
104 size_t size;
105
106 size = (map->in.len + map->out.len) * sizeof(__u16);
107 memset(map->in.ssn, 0x00, size);
108}
109
110/* Dispose of a ssnmap. */
111void sctp_ssnmap_free(struct sctp_ssnmap *map)
112{
113 int size;
114
115 if (unlikely(!map))
116 return;
117
118 size = sctp_ssnmap_size(map->in.len, map->out.len);
119 if (size <= KMALLOC_MAX_SIZE)
120 kfree(map);
121 else
122 free_pages((unsigned long)map, get_order(size));
123
124 SCTP_DBG_OBJCNT_DEC(ssnmap);
125}
diff --git a/net/sctp/stream.c b/net/sctp/stream.c
new file mode 100644
index 000000000000..f86de43cbbe5
--- /dev/null
+++ b/net/sctp/stream.c
@@ -0,0 +1,85 @@
1/* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2001, 2004
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001 Intel Corp.
6 *
7 * This file is part of the SCTP kernel implementation
8 *
9 * These functions manipulate sctp tsn mapping array.
10 *
11 * This SCTP implementation is free software;
12 * you can redistribute it and/or modify it under the terms of
13 * the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This SCTP implementation is distributed in the hope that it
18 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
19 * ************************
20 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 * See the GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with GNU CC; see the file COPYING. If not, see
25 * <http://www.gnu.org/licenses/>.
26 *
27 * Please send any bug reports or fixes you make to the
28 * email address(es):
29 * lksctp developers <linux-sctp@vger.kernel.org>
30 *
31 * Written or modified by:
32 * Xin Long <lucien.xin@gmail.com>
33 */
34
35#include <net/sctp/sctp.h>
36
37struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp)
38{
39 struct sctp_stream *stream;
40 int i;
41
42 stream = kzalloc(sizeof(*stream), gfp);
43 if (!stream)
44 return NULL;
45
46 stream->outcnt = outcnt;
47 stream->out = kcalloc(stream->outcnt, sizeof(*stream->out), gfp);
48 if (!stream->out) {
49 kfree(stream);
50 return NULL;
51 }
52 for (i = 0; i < stream->outcnt; i++)
53 stream->out[i].state = SCTP_STREAM_OPEN;
54
55 stream->incnt = incnt;
56 stream->in = kcalloc(stream->incnt, sizeof(*stream->in), gfp);
57 if (!stream->in) {
58 kfree(stream->out);
59 kfree(stream);
60 return NULL;
61 }
62
63 return stream;
64}
65
66void sctp_stream_free(struct sctp_stream *stream)
67{
68 if (unlikely(!stream))
69 return;
70
71 kfree(stream->out);
72 kfree(stream->in);
73 kfree(stream);
74}
75
76void sctp_stream_clear(struct sctp_stream *stream)
77{
78 int i;
79
80 for (i = 0; i < stream->outcnt; i++)
81 stream->out[i].ssn = 0;
82
83 for (i = 0; i < stream->incnt; i++)
84 stream->in[i].ssn = 0;
85}
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 84d0fdaf7de9..aa3624d50278 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -760,11 +760,11 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq,
760 struct sk_buff_head *event_list; 760 struct sk_buff_head *event_list;
761 struct sk_buff *pos, *tmp; 761 struct sk_buff *pos, *tmp;
762 struct sctp_ulpevent *cevent; 762 struct sctp_ulpevent *cevent;
763 struct sctp_stream *in; 763 struct sctp_stream *stream;
764 __u16 sid, csid, cssn; 764 __u16 sid, csid, cssn;
765 765
766 sid = event->stream; 766 sid = event->stream;
767 in = &ulpq->asoc->ssnmap->in; 767 stream = ulpq->asoc->stream;
768 768
769 event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev; 769 event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev;
770 770
@@ -782,11 +782,11 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq,
782 if (csid < sid) 782 if (csid < sid)
783 continue; 783 continue;
784 784
785 if (cssn != sctp_ssn_peek(in, sid)) 785 if (cssn != sctp_ssn_peek(stream, in, sid))
786 break; 786 break;
787 787
788 /* Found it, so mark in the ssnmap. */ 788 /* Found it, so mark in the stream. */
789 sctp_ssn_next(in, sid); 789 sctp_ssn_next(stream, in, sid);
790 790
791 __skb_unlink(pos, &ulpq->lobby); 791 __skb_unlink(pos, &ulpq->lobby);
792 792
@@ -849,7 +849,7 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
849 struct sctp_ulpevent *event) 849 struct sctp_ulpevent *event)
850{ 850{
851 __u16 sid, ssn; 851 __u16 sid, ssn;
852 struct sctp_stream *in; 852 struct sctp_stream *stream;
853 853
854 /* Check if this message needs ordering. */ 854 /* Check if this message needs ordering. */
855 if (SCTP_DATA_UNORDERED & event->msg_flags) 855 if (SCTP_DATA_UNORDERED & event->msg_flags)
@@ -858,10 +858,10 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
858 /* Note: The stream ID must be verified before this routine. */ 858 /* Note: The stream ID must be verified before this routine. */
859 sid = event->stream; 859 sid = event->stream;
860 ssn = event->ssn; 860 ssn = event->ssn;
861 in = &ulpq->asoc->ssnmap->in; 861 stream = ulpq->asoc->stream;
862 862
863 /* Is this the expected SSN for this stream ID? */ 863 /* Is this the expected SSN for this stream ID? */
864 if (ssn != sctp_ssn_peek(in, sid)) { 864 if (ssn != sctp_ssn_peek(stream, in, sid)) {
865 /* We've received something out of order, so find where it 865 /* We've received something out of order, so find where it
866 * needs to be placed. We order by stream and then by SSN. 866 * needs to be placed. We order by stream and then by SSN.
867 */ 867 */
@@ -870,7 +870,7 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
870 } 870 }
871 871
872 /* Mark that the next chunk has been found. */ 872 /* Mark that the next chunk has been found. */
873 sctp_ssn_next(in, sid); 873 sctp_ssn_next(stream, in, sid);
874 874
875 /* Go find any other chunks that were waiting for 875 /* Go find any other chunks that were waiting for
876 * ordering. 876 * ordering.
@@ -888,12 +888,12 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
888 struct sk_buff *pos, *tmp; 888 struct sk_buff *pos, *tmp;
889 struct sctp_ulpevent *cevent; 889 struct sctp_ulpevent *cevent;
890 struct sctp_ulpevent *event; 890 struct sctp_ulpevent *event;
891 struct sctp_stream *in; 891 struct sctp_stream *stream;
892 struct sk_buff_head temp; 892 struct sk_buff_head temp;
893 struct sk_buff_head *lobby = &ulpq->lobby; 893 struct sk_buff_head *lobby = &ulpq->lobby;
894 __u16 csid, cssn; 894 __u16 csid, cssn;
895 895
896 in = &ulpq->asoc->ssnmap->in; 896 stream = ulpq->asoc->stream;
897 897
898 /* We are holding the chunks by stream, by SSN. */ 898 /* We are holding the chunks by stream, by SSN. */
899 skb_queue_head_init(&temp); 899 skb_queue_head_init(&temp);
@@ -912,7 +912,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
912 continue; 912 continue;
913 913
914 /* see if this ssn has been marked by skipping */ 914 /* see if this ssn has been marked by skipping */
915 if (!SSN_lt(cssn, sctp_ssn_peek(in, csid))) 915 if (!SSN_lt(cssn, sctp_ssn_peek(stream, in, csid)))
916 break; 916 break;
917 917
918 __skb_unlink(pos, lobby); 918 __skb_unlink(pos, lobby);
@@ -932,8 +932,8 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
932 csid = cevent->stream; 932 csid = cevent->stream;
933 cssn = cevent->ssn; 933 cssn = cevent->ssn;
934 934
935 if (csid == sid && cssn == sctp_ssn_peek(in, csid)) { 935 if (csid == sid && cssn == sctp_ssn_peek(stream, in, csid)) {
936 sctp_ssn_next(in, csid); 936 sctp_ssn_next(stream, in, csid);
937 __skb_unlink(pos, lobby); 937 __skb_unlink(pos, lobby);
938 __skb_queue_tail(&temp, pos); 938 __skb_queue_tail(&temp, pos);
939 event = sctp_skb2event(pos); 939 event = sctp_skb2event(pos);
@@ -955,17 +955,17 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
955 */ 955 */
956void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn) 956void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn)
957{ 957{
958 struct sctp_stream *in; 958 struct sctp_stream *stream;
959 959
960 /* Note: The stream ID must be verified before this routine. */ 960 /* Note: The stream ID must be verified before this routine. */
961 in = &ulpq->asoc->ssnmap->in; 961 stream = ulpq->asoc->stream;
962 962
963 /* Is this an old SSN? If so ignore. */ 963 /* Is this an old SSN? If so ignore. */
964 if (SSN_lt(ssn, sctp_ssn_peek(in, sid))) 964 if (SSN_lt(ssn, sctp_ssn_peek(stream, in, sid)))
965 return; 965 return;
966 966
967 /* Mark that we are no longer expecting this SSN or lower. */ 967 /* Mark that we are no longer expecting this SSN or lower. */
968 sctp_ssn_skip(in, sid, ssn); 968 sctp_ssn_skip(stream, in, sid, ssn);
969 969
970 /* Go find any other chunks that were waiting for 970 /* Go find any other chunks that were waiting for
971 * ordering and deliver them if needed. 971 * ordering and deliver them if needed.