Commit 91a09e0c authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-improve-asoc-streams-management'

Xin Long says:

====================
sctp: improve asoc streams management

This patchset changes to define asoc->stream as an object, and also
improve some codes to make it more clearly.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6e7da286 ff356414
...@@ -377,10 +377,11 @@ typedef struct sctp_sender_hb_info { ...@@ -377,10 +377,11 @@ typedef struct sctp_sender_hb_info {
__u64 hb_nonce; __u64 hb_nonce;
} sctp_sender_hb_info_t; } sctp_sender_hb_info_t;
int sctp_stream_new(struct sctp_association *asoc, gfp_t gfp); int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
int sctp_stream_init(struct sctp_association *asoc, gfp_t gfp); gfp_t gfp);
void sctp_stream_free(struct sctp_stream *stream); void sctp_stream_free(struct sctp_stream *stream);
void sctp_stream_clear(struct sctp_stream *stream); void sctp_stream_clear(struct sctp_stream *stream);
void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new);
/* What is the current SSN number for this stream? */ /* What is the current SSN number for this stream? */
#define sctp_ssn_peek(stream, type, sid) \ #define sctp_ssn_peek(stream, type, sid) \
...@@ -1750,7 +1751,7 @@ struct sctp_association { ...@@ -1750,7 +1751,7 @@ struct sctp_association {
__u32 default_rcv_context; __u32 default_rcv_context;
/* Stream arrays */ /* Stream arrays */
struct sctp_stream *stream; struct sctp_stream stream;
/* All outbound chunks go through this structure. */ /* All outbound chunks go through this structure. */
struct sctp_outq outqueue; struct sctp_outq outqueue;
......
...@@ -246,7 +246,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a ...@@ -246,7 +246,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
if (!sctp_ulpq_init(&asoc->ulpq, asoc)) if (!sctp_ulpq_init(&asoc->ulpq, asoc))
goto fail_init; goto fail_init;
if (sctp_stream_new(asoc, gfp)) if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams,
0, gfp))
goto fail_init; goto fail_init;
/* Assume that peer would support both address types unless we are /* Assume that peer would support both address types unless we are
...@@ -291,7 +292,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a ...@@ -291,7 +292,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
return asoc; return asoc;
stream_free: stream_free:
sctp_stream_free(asoc->stream); sctp_stream_free(&asoc->stream);
fail_init: fail_init:
sock_put(asoc->base.sk); sock_put(asoc->base.sk);
sctp_endpoint_put(asoc->ep); sctp_endpoint_put(asoc->ep);
...@@ -365,7 +366,7 @@ void sctp_association_free(struct sctp_association *asoc) ...@@ -365,7 +366,7 @@ void sctp_association_free(struct sctp_association *asoc)
sctp_tsnmap_free(&asoc->peer.tsn_map); sctp_tsnmap_free(&asoc->peer.tsn_map);
/* Free stream information. */ /* Free stream information. */
sctp_stream_free(asoc->stream); sctp_stream_free(&asoc->stream);
if (asoc->strreset_chunk) if (asoc->strreset_chunk)
sctp_chunk_free(asoc->strreset_chunk); sctp_chunk_free(asoc->strreset_chunk);
...@@ -1151,7 +1152,7 @@ void sctp_assoc_update(struct sctp_association *asoc, ...@@ -1151,7 +1152,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
/* Reinitialize SSN for both local streams /* Reinitialize SSN for both local streams
* and peer's streams. * and peer's streams.
*/ */
sctp_stream_clear(asoc->stream); sctp_stream_clear(&asoc->stream);
/* Flush the ULP reassembly and ordered queue. /* Flush the ULP reassembly and ordered queue.
* Any data there will now be stale and will * Any data there will now be stale and will
...@@ -1177,11 +1178,8 @@ void sctp_assoc_update(struct sctp_association *asoc, ...@@ -1177,11 +1178,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
asoc->ctsn_ack_point = asoc->next_tsn - 1; asoc->ctsn_ack_point = asoc->next_tsn - 1;
asoc->adv_peer_ack_point = asoc->ctsn_ack_point; asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
if (sctp_state(asoc, COOKIE_WAIT)) { if (sctp_state(asoc, COOKIE_WAIT))
sctp_stream_free(asoc->stream); sctp_stream_update(&asoc->stream, &new->stream);
asoc->stream = new->stream;
new->stream = NULL;
}
if (!asoc->assoc_id) { if (!asoc->assoc_id) {
/* get a new association id since we don't have one /* get a new association id since we don't have one
......
...@@ -307,7 +307,7 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk) ...@@ -307,7 +307,7 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk)
if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) &&
time_after(jiffies, chunk->msg->expires_at)) { time_after(jiffies, chunk->msg->expires_at)) {
struct sctp_stream_out *streamout = struct sctp_stream_out *streamout =
&chunk->asoc->stream->out[chunk->sinfo.sinfo_stream]; &chunk->asoc->stream.out[chunk->sinfo.sinfo_stream];
if (chunk->sent_count) { if (chunk->sent_count) {
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++;
...@@ -320,7 +320,7 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk) ...@@ -320,7 +320,7 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk)
} else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) && } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) &&
chunk->sent_count > chunk->sinfo.sinfo_timetolive) { chunk->sent_count > chunk->sinfo.sinfo_timetolive) {
struct sctp_stream_out *streamout = struct sctp_stream_out *streamout =
&chunk->asoc->stream->out[chunk->sinfo.sinfo_stream]; &chunk->asoc->stream.out[chunk->sinfo.sinfo_stream];
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
streamout->abandoned_sent[SCTP_PR_INDEX(RTX)]++; streamout->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
......
...@@ -363,7 +363,7 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, ...@@ -363,7 +363,7 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc,
sctp_insert_list(&asoc->outqueue.abandoned, sctp_insert_list(&asoc->outqueue.abandoned,
&chk->transmitted_list); &chk->transmitted_list);
streamout = &asoc->stream->out[chk->sinfo.sinfo_stream]; streamout = &asoc->stream.out[chk->sinfo.sinfo_stream];
asoc->sent_cnt_removable--; asoc->sent_cnt_removable--;
asoc->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; asoc->abandoned_sent[SCTP_PR_INDEX(PRIO)]++;
streamout->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; streamout->abandoned_sent[SCTP_PR_INDEX(PRIO)]++;
...@@ -400,9 +400,9 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, ...@@ -400,9 +400,9 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc,
q->out_qlen -= chk->skb->len; q->out_qlen -= chk->skb->len;
asoc->sent_cnt_removable--; asoc->sent_cnt_removable--;
asoc->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; asoc->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++;
if (chk->sinfo.sinfo_stream < asoc->stream->outcnt) { if (chk->sinfo.sinfo_stream < asoc->stream.outcnt) {
struct sctp_stream_out *streamout = struct sctp_stream_out *streamout =
&asoc->stream->out[chk->sinfo.sinfo_stream]; &asoc->stream.out[chk->sinfo.sinfo_stream];
streamout->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; streamout->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++;
} }
...@@ -1036,7 +1036,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp) ...@@ -1036,7 +1036,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
/* RFC 2960 6.5 Every DATA chunk MUST carry a valid /* RFC 2960 6.5 Every DATA chunk MUST carry a valid
* stream identifier. * stream identifier.
*/ */
if (chunk->sinfo.sinfo_stream >= asoc->stream->outcnt) { if (chunk->sinfo.sinfo_stream >= asoc->stream.outcnt) {
/* Mark as failed send. */ /* Mark as failed send. */
sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM); sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM);
...@@ -1054,7 +1054,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp) ...@@ -1054,7 +1054,7 @@ static void sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
continue; continue;
} }
if (asoc->stream->out[sid].state == SCTP_STREAM_CLOSED) { if (asoc->stream.out[sid].state == SCTP_STREAM_CLOSED) {
sctp_outq_head_data(q, chunk); sctp_outq_head_data(q, chunk);
goto sctp_flush_out; goto sctp_flush_out;
} }
......
...@@ -361,8 +361,8 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) ...@@ -361,8 +361,8 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
sctp_seq_dump_remote_addrs(seq, assoc); sctp_seq_dump_remote_addrs(seq, assoc);
seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d " seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d "
"%8d %8d %8d %8d", "%8d %8d %8d %8d",
assoc->hbinterval, assoc->stream->incnt, assoc->hbinterval, assoc->stream.incnt,
assoc->stream->outcnt, assoc->max_retrans, assoc->stream.outcnt, assoc->max_retrans,
assoc->init_retries, assoc->shutdown_retries, assoc->init_retries, assoc->shutdown_retries,
assoc->rtx_data_chunks, assoc->rtx_data_chunks,
atomic_read(&sk->sk_wmem_alloc), atomic_read(&sk->sk_wmem_alloc),
......
...@@ -1544,7 +1544,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk) ...@@ -1544,7 +1544,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk)
/* All fragments will be on the same stream */ /* All fragments will be on the same stream */
sid = ntohs(chunk->subh.data_hdr->stream); sid = ntohs(chunk->subh.data_hdr->stream);
stream = chunk->asoc->stream; stream = &chunk->asoc->stream;
/* Now assign the sequence number to the entire message. /* Now assign the sequence number to the entire message.
* All fragments must have the same stream sequence number. * All fragments must have the same stream sequence number.
...@@ -2454,7 +2454,8 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk, ...@@ -2454,7 +2454,8 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
* stream sequence number shall be set to 0. * stream sequence number shall be set to 0.
*/ */
if (sctp_stream_init(asoc, gfp)) if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams,
asoc->c.sinit_max_instreams, gfp))
goto clean_up; goto clean_up;
if (!asoc->temp && sctp_assoc_set_id(asoc, gfp)) if (!asoc->temp && sctp_assoc_set_id(asoc, gfp))
......
...@@ -3958,7 +3958,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(struct net *net, ...@@ -3958,7 +3958,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(struct net *net,
/* Silently discard the chunk if stream-id is not valid */ /* Silently discard the chunk if stream-id is not valid */
sctp_walk_fwdtsn(skip, chunk) { sctp_walk_fwdtsn(skip, chunk) {
if (ntohs(skip->stream) >= asoc->stream->incnt) if (ntohs(skip->stream) >= asoc->stream.incnt)
goto discard_noforce; goto discard_noforce;
} }
...@@ -4029,7 +4029,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( ...@@ -4029,7 +4029,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
/* Silently discard the chunk if stream-id is not valid */ /* Silently discard the chunk if stream-id is not valid */
sctp_walk_fwdtsn(skip, chunk) { sctp_walk_fwdtsn(skip, chunk) {
if (ntohs(skip->stream) >= asoc->stream->incnt) if (ntohs(skip->stream) >= asoc->stream.incnt)
goto gen_shutdown; goto gen_shutdown;
} }
...@@ -6365,7 +6365,7 @@ static int sctp_eat_data(const struct sctp_association *asoc, ...@@ -6365,7 +6365,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
* and discard the DATA chunk. * and discard the DATA chunk.
*/ */
sid = ntohs(data_hdr->stream); sid = ntohs(data_hdr->stream);
if (sid >= asoc->stream->incnt) { if (sid >= asoc->stream.incnt) {
/* Mark tsn as received even though we drop it */ /* Mark tsn as received even though we drop it */
sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn)); sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
...@@ -6387,7 +6387,7 @@ static int sctp_eat_data(const struct sctp_association *asoc, ...@@ -6387,7 +6387,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
* and is invalid. * and is invalid.
*/ */
ssn = ntohs(data_hdr->ssn); ssn = ntohs(data_hdr->ssn);
if (ordered && SSN_lt(ssn, sctp_ssn_peek(asoc->stream, in, sid))) if (ordered && SSN_lt(ssn, sctp_ssn_peek(&asoc->stream, in, sid)))
return SCTP_IERROR_PROTO_VIOLATION; return SCTP_IERROR_PROTO_VIOLATION;
/* Send the data up to the user. Note: Schedule the /* Send the data up to the user. Note: Schedule the
......
...@@ -1920,7 +1920,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) ...@@ -1920,7 +1920,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
} }
/* Check for invalid stream. */ /* Check for invalid stream. */
if (sinfo->sinfo_stream >= asoc->stream->outcnt) { if (sinfo->sinfo_stream >= asoc->stream.outcnt) {
err = -EINVAL; err = -EINVAL;
goto out_free; goto out_free;
} }
...@@ -4497,8 +4497,8 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, ...@@ -4497,8 +4497,8 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
info->sctpi_rwnd = asoc->a_rwnd; info->sctpi_rwnd = asoc->a_rwnd;
info->sctpi_unackdata = asoc->unack_data; info->sctpi_unackdata = asoc->unack_data;
info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);
info->sctpi_instrms = asoc->stream->incnt; info->sctpi_instrms = asoc->stream.incnt;
info->sctpi_outstrms = asoc->stream->outcnt; info->sctpi_outstrms = asoc->stream.outcnt;
list_for_each(pos, &asoc->base.inqueue.in_chunk_list) list_for_each(pos, &asoc->base.inqueue.in_chunk_list)
info->sctpi_inqueue++; info->sctpi_inqueue++;
list_for_each(pos, &asoc->outqueue.out_chunk_list) list_for_each(pos, &asoc->outqueue.out_chunk_list)
...@@ -4727,8 +4727,8 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, ...@@ -4727,8 +4727,8 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
status.sstat_unackdata = asoc->unack_data; status.sstat_unackdata = asoc->unack_data;
status.sstat_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); status.sstat_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);
status.sstat_instrms = asoc->stream->incnt; status.sstat_instrms = asoc->stream.incnt;
status.sstat_outstrms = asoc->stream->outcnt; status.sstat_outstrms = asoc->stream.outcnt;
status.sstat_fragmentation_point = asoc->frag_point; status.sstat_fragmentation_point = asoc->frag_point;
status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc); status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc);
memcpy(&status.sstat_primary.spinfo_address, &transport->ipaddr, memcpy(&status.sstat_primary.spinfo_address, &transport->ipaddr,
...@@ -6600,10 +6600,10 @@ static int sctp_getsockopt_pr_streamstatus(struct sock *sk, int len, ...@@ -6600,10 +6600,10 @@ static int sctp_getsockopt_pr_streamstatus(struct sock *sk, int len,
goto out; goto out;
asoc = sctp_id2assoc(sk, params.sprstat_assoc_id); asoc = sctp_id2assoc(sk, params.sprstat_assoc_id);
if (!asoc || params.sprstat_sid >= asoc->stream->outcnt) if (!asoc || params.sprstat_sid >= asoc->stream.outcnt)
goto out; goto out;
streamout = &asoc->stream->out[params.sprstat_sid]; streamout = &asoc->stream.out[params.sprstat_sid];
if (policy == SCTP_PR_SCTP_NONE) { if (policy == SCTP_PR_SCTP_NONE) {
params.sprstat_abandoned_unsent = 0; params.sprstat_abandoned_unsent = 0;
params.sprstat_abandoned_sent = 0; params.sprstat_abandoned_sent = 0;
......
...@@ -35,70 +35,43 @@ ...@@ -35,70 +35,43 @@
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
int sctp_stream_new(struct sctp_association *asoc, gfp_t gfp) int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
gfp_t gfp)
{ {
struct sctp_stream *stream;
int i;
stream = kzalloc(sizeof(*stream), gfp);
if (!stream)
return -ENOMEM;
stream->outcnt = asoc->c.sinit_num_ostreams;
stream->out = kcalloc(stream->outcnt, sizeof(*stream->out), gfp);
if (!stream->out) {
kfree(stream);
return -ENOMEM;
}
for (i = 0; i < stream->outcnt; i++)
stream->out[i].state = SCTP_STREAM_OPEN;
asoc->stream = stream;
return 0;
}
int sctp_stream_init(struct sctp_association *asoc, gfp_t gfp)
{
struct sctp_stream *stream = asoc->stream;
int i; int i;
/* Initial stream->out size may be very big, so free it and alloc /* Initial stream->out size may be very big, so free it and alloc
* a new one with new outcnt to save memory. * a new one with new outcnt to save memory.
*/ */
kfree(stream->out); kfree(stream->out);
stream->outcnt = asoc->c.sinit_num_ostreams;
stream->out = kcalloc(stream->outcnt, sizeof(*stream->out), gfp); stream->out = kcalloc(outcnt, sizeof(*stream->out), gfp);
if (!stream->out) if (!stream->out)
goto nomem; return -ENOMEM;
stream->outcnt = outcnt;
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++)
stream->out[i].state = SCTP_STREAM_OPEN; stream->out[i].state = SCTP_STREAM_OPEN;
stream->incnt = asoc->c.sinit_max_instreams; if (!incnt)
stream->in = kcalloc(stream->incnt, sizeof(*stream->in), gfp); return 0;
stream->in = kcalloc(incnt, sizeof(*stream->in), gfp);
if (!stream->in) { if (!stream->in) {
kfree(stream->out); kfree(stream->out);
goto nomem; stream->out = NULL;
return -ENOMEM;
} }
return 0; stream->incnt = incnt;
nomem:
asoc->stream = NULL;
kfree(stream);
return -ENOMEM; return 0;
} }
void sctp_stream_free(struct sctp_stream *stream) void sctp_stream_free(struct sctp_stream *stream)
{ {
if (unlikely(!stream))
return;
kfree(stream->out); kfree(stream->out);
kfree(stream->in); kfree(stream->in);
kfree(stream);
} }
void sctp_stream_clear(struct sctp_stream *stream) void sctp_stream_clear(struct sctp_stream *stream)
...@@ -112,6 +85,19 @@ void sctp_stream_clear(struct sctp_stream *stream) ...@@ -112,6 +85,19 @@ void sctp_stream_clear(struct sctp_stream *stream)
stream->in[i].ssn = 0; stream->in[i].ssn = 0;
} }
void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new)
{
sctp_stream_free(stream);
stream->out = new->out;
stream->in = new->in;
stream->outcnt = new->outcnt;
stream->incnt = new->incnt;
new->out = NULL;
new->in = NULL;
}
static int sctp_send_reconf(struct sctp_association *asoc, static int sctp_send_reconf(struct sctp_association *asoc,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
...@@ -128,7 +114,7 @@ static int sctp_send_reconf(struct sctp_association *asoc, ...@@ -128,7 +114,7 @@ static int sctp_send_reconf(struct sctp_association *asoc,
int sctp_send_reset_streams(struct sctp_association *asoc, int sctp_send_reset_streams(struct sctp_association *asoc,
struct sctp_reset_streams *params) struct sctp_reset_streams *params)
{ {
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u16 i, str_nums, *str_list; __u16 i, str_nums, *str_list;
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
int retval = -EINVAL; int retval = -EINVAL;
...@@ -214,6 +200,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc, ...@@ -214,6 +200,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
int sctp_send_reset_assoc(struct sctp_association *asoc) int sctp_send_reset_assoc(struct sctp_association *asoc)
{ {
struct sctp_stream *stream = &asoc->stream;
struct sctp_chunk *chunk = NULL; struct sctp_chunk *chunk = NULL;
int retval; int retval;
__u16 i; __u16 i;
...@@ -230,8 +217,8 @@ int sctp_send_reset_assoc(struct sctp_association *asoc) ...@@ -230,8 +217,8 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
return -ENOMEM; return -ENOMEM;
/* Block further xmit of data until this request is completed */ /* Block further xmit of data until this request is completed */
for (i = 0; i < asoc->stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++)
asoc->stream->out[i].state = SCTP_STREAM_CLOSED; stream->out[i].state = SCTP_STREAM_CLOSED;
asoc->strreset_chunk = chunk; asoc->strreset_chunk = chunk;
sctp_chunk_hold(asoc->strreset_chunk); sctp_chunk_hold(asoc->strreset_chunk);
...@@ -241,8 +228,8 @@ int sctp_send_reset_assoc(struct sctp_association *asoc) ...@@ -241,8 +228,8 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
sctp_chunk_put(asoc->strreset_chunk); sctp_chunk_put(asoc->strreset_chunk);
asoc->strreset_chunk = NULL; asoc->strreset_chunk = NULL;
for (i = 0; i < asoc->stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++)
asoc->stream->out[i].state = SCTP_STREAM_OPEN; stream->out[i].state = SCTP_STREAM_OPEN;
return retval; return retval;
} }
...@@ -255,7 +242,7 @@ int sctp_send_reset_assoc(struct sctp_association *asoc) ...@@ -255,7 +242,7 @@ int sctp_send_reset_assoc(struct sctp_association *asoc)
int sctp_send_add_streams(struct sctp_association *asoc, int sctp_send_add_streams(struct sctp_association *asoc,
struct sctp_add_streams *params) struct sctp_add_streams *params)
{ {
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
struct sctp_chunk *chunk = NULL; struct sctp_chunk *chunk = NULL;
int retval = -ENOMEM; int retval = -ENOMEM;
__u32 outcnt, incnt; __u32 outcnt, incnt;
...@@ -357,7 +344,7 @@ struct sctp_chunk *sctp_process_strreset_outreq( ...@@ -357,7 +344,7 @@ struct sctp_chunk *sctp_process_strreset_outreq(
struct sctp_ulpevent **evp) struct sctp_ulpevent **evp)
{ {
struct sctp_strreset_outreq *outreq = param.v; struct sctp_strreset_outreq *outreq = param.v;
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u16 i, nums, flags = 0, *str_p = NULL; __u16 i, nums, flags = 0, *str_p = NULL;
__u32 result = SCTP_STRRESET_DENIED; __u32 result = SCTP_STRRESET_DENIED;
__u32 request_seq; __u32 request_seq;
...@@ -449,7 +436,7 @@ struct sctp_chunk *sctp_process_strreset_inreq( ...@@ -449,7 +436,7 @@ struct sctp_chunk *sctp_process_strreset_inreq(
struct sctp_ulpevent **evp) struct sctp_ulpevent **evp)
{ {
struct sctp_strreset_inreq *inreq = param.v; struct sctp_strreset_inreq *inreq = param.v;
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u32 result = SCTP_STRRESET_DENIED; __u32 result = SCTP_STRRESET_DENIED;
struct sctp_chunk *chunk = NULL; struct sctp_chunk *chunk = NULL;
__u16 i, nums, *str_p; __u16 i, nums, *str_p;
...@@ -523,7 +510,7 @@ struct sctp_chunk *sctp_process_strreset_tsnreq( ...@@ -523,7 +510,7 @@ struct sctp_chunk *sctp_process_strreset_tsnreq(
{ {
__u32 init_tsn = 0, next_tsn = 0, max_tsn_seen; __u32 init_tsn = 0, next_tsn = 0, max_tsn_seen;
struct sctp_strreset_tsnreq *tsnreq = param.v; struct sctp_strreset_tsnreq *tsnreq = param.v;
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u32 result = SCTP_STRRESET_DENIED; __u32 result = SCTP_STRRESET_DENIED;
__u32 request_seq; __u32 request_seq;
__u16 i; __u16 i;
...@@ -612,7 +599,7 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out( ...@@ -612,7 +599,7 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out(
struct sctp_ulpevent **evp) struct sctp_ulpevent **evp)
{ {
struct sctp_strreset_addstrm *addstrm = param.v; struct sctp_strreset_addstrm *addstrm = param.v;
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u32 result = SCTP_STRRESET_DENIED; __u32 result = SCTP_STRRESET_DENIED;
struct sctp_stream_in *streamin; struct sctp_stream_in *streamin;
__u32 request_seq, incnt; __u32 request_seq, incnt;
...@@ -687,7 +674,7 @@ struct sctp_chunk *sctp_process_strreset_addstrm_in( ...@@ -687,7 +674,7 @@ struct sctp_chunk *sctp_process_strreset_addstrm_in(
struct sctp_ulpevent **evp) struct sctp_ulpevent **evp)
{ {
struct sctp_strreset_addstrm *addstrm = param.v; struct sctp_strreset_addstrm *addstrm = param.v;
struct sctp_stream *stream = asoc->stream; struct sctp_stream *stream = &asoc->stream;
__u32 result = SCTP_STRRESET_DENIED; __u32 result = SCTP_STRRESET_DENIED;
struct sctp_stream_out *streamout; struct sctp_stream_out *streamout;
struct sctp_chunk *chunk = NULL; struct sctp_chunk *chunk = NULL;
...@@ -758,8 +745,8 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -758,8 +745,8 @@ struct sctp_chunk *sctp_process_strreset_resp(
union sctp_params param, union sctp_params param,
struct sctp_ulpevent **evp) struct sctp_ulpevent **evp)
{ {
struct sctp_stream *stream = &asoc->stream;
struct sctp_strreset_resp *resp = param.v; struct sctp_strreset_resp *resp = param.v;
struct sctp_stream *stream = asoc->stream;
struct sctp_transport *t; struct sctp_transport *t;
__u16 i, nums, flags = 0; __u16 i, nums, flags = 0;
sctp_paramhdr_t *req; sctp_paramhdr_t *req;
......
...@@ -764,7 +764,7 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq, ...@@ -764,7 +764,7 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq,
__u16 sid, csid, cssn; __u16 sid, csid, cssn;
sid = event->stream; sid = event->stream;
stream = ulpq->asoc->stream; stream = &ulpq->asoc->stream;
event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev; event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev;
...@@ -858,7 +858,7 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq, ...@@ -858,7 +858,7 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
/* Note: The stream ID must be verified before this routine. */ /* Note: The stream ID must be verified before this routine. */
sid = event->stream; sid = event->stream;
ssn = event->ssn; ssn = event->ssn;
stream = ulpq->asoc->stream; stream = &ulpq->asoc->stream;
/* Is this the expected SSN for this stream ID? */ /* Is this the expected SSN for this stream ID? */
if (ssn != sctp_ssn_peek(stream, in, sid)) { if (ssn != sctp_ssn_peek(stream, in, sid)) {
...@@ -893,7 +893,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) ...@@ -893,7 +893,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
struct sk_buff_head *lobby = &ulpq->lobby; struct sk_buff_head *lobby = &ulpq->lobby;
__u16 csid, cssn; __u16 csid, cssn;
stream = ulpq->asoc->stream; stream = &ulpq->asoc->stream;
/* We are holding the chunks by stream, by SSN. */ /* We are holding the chunks by stream, by SSN. */
skb_queue_head_init(&temp); skb_queue_head_init(&temp);
...@@ -958,7 +958,7 @@ void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn) ...@@ -958,7 +958,7 @@ void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn)
struct sctp_stream *stream; struct sctp_stream *stream;
/* Note: The stream ID must be verified before this routine. */ /* Note: The stream ID must be verified before this routine. */
stream = ulpq->asoc->stream; stream = &ulpq->asoc->stream;
/* Is this an old SSN? If so ignore. */ /* Is this an old SSN? If so ignore. */
if (SSN_lt(ssn, sctp_ssn_peek(stream, in, sid))) if (SSN_lt(ssn, sctp_ssn_peek(stream, in, sid)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment