sctp: define the member stream as an object instead of pointer in asoc
As Marcelo's suggestion, stream is a fixed size member of asoc and would not grow with more streams. To avoid an allocation for it, this patch is to define it as an object instead of pointer and update the places using it, also create sctp_stream_update() called in sctp_assoc_update() to migrate the stream info from one stream to another. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6e7da286e3
commit
cee360ab4d
@@ -1920,7 +1920,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
|
||||
}
|
||||
|
||||
/* Check for invalid stream. */
|
||||
if (sinfo->sinfo_stream >= asoc->stream->outcnt) {
|
||||
if (sinfo->sinfo_stream >= asoc->stream.outcnt) {
|
||||
err = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
@@ -4497,8 +4497,8 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
|
||||
info->sctpi_rwnd = asoc->a_rwnd;
|
||||
info->sctpi_unackdata = asoc->unack_data;
|
||||
info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);
|
||||
info->sctpi_instrms = asoc->stream->incnt;
|
||||
info->sctpi_outstrms = asoc->stream->outcnt;
|
||||
info->sctpi_instrms = asoc->stream.incnt;
|
||||
info->sctpi_outstrms = asoc->stream.outcnt;
|
||||
list_for_each(pos, &asoc->base.inqueue.in_chunk_list)
|
||||
info->sctpi_inqueue++;
|
||||
list_for_each(pos, &asoc->outqueue.out_chunk_list)
|
||||
@@ -4727,8 +4727,8 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
|
||||
status.sstat_unackdata = asoc->unack_data;
|
||||
|
||||
status.sstat_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);
|
||||
status.sstat_instrms = asoc->stream->incnt;
|
||||
status.sstat_outstrms = asoc->stream->outcnt;
|
||||
status.sstat_instrms = asoc->stream.incnt;
|
||||
status.sstat_outstrms = asoc->stream.outcnt;
|
||||
status.sstat_fragmentation_point = asoc->frag_point;
|
||||
status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc);
|
||||
memcpy(&status.sstat_primary.spinfo_address, &transport->ipaddr,
|
||||
@@ -6600,10 +6600,10 @@ static int sctp_getsockopt_pr_streamstatus(struct sock *sk, int len,
|
||||
goto out;
|
||||
|
||||
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;
|
||||
|
||||
streamout = &asoc->stream->out[params.sprstat_sid];
|
||||
streamout = &asoc->stream.out[params.sprstat_sid];
|
||||
if (policy == SCTP_PR_SCTP_NONE) {
|
||||
params.sprstat_abandoned_unsent = 0;
|
||||
params.sprstat_abandoned_sent = 0;
|
||||
|
Reference in New Issue
Block a user