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
@@ -291,7 +291,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
|
||||
return asoc;
|
||||
|
||||
stream_free:
|
||||
sctp_stream_free(asoc->stream);
|
||||
sctp_stream_free(&asoc->stream);
|
||||
fail_init:
|
||||
sock_put(asoc->base.sk);
|
||||
sctp_endpoint_put(asoc->ep);
|
||||
@@ -365,7 +365,7 @@ void sctp_association_free(struct sctp_association *asoc)
|
||||
sctp_tsnmap_free(&asoc->peer.tsn_map);
|
||||
|
||||
/* Free stream information. */
|
||||
sctp_stream_free(asoc->stream);
|
||||
sctp_stream_free(&asoc->stream);
|
||||
|
||||
if (asoc->strreset_chunk)
|
||||
sctp_chunk_free(asoc->strreset_chunk);
|
||||
@@ -1151,7 +1151,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
|
||||
/* Reinitialize SSN for both local streams
|
||||
* and peer's streams.
|
||||
*/
|
||||
sctp_stream_clear(asoc->stream);
|
||||
sctp_stream_clear(&asoc->stream);
|
||||
|
||||
/* Flush the ULP reassembly and ordered queue.
|
||||
* Any data there will now be stale and will
|
||||
@@ -1177,11 +1177,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
|
||||
asoc->ctsn_ack_point = asoc->next_tsn - 1;
|
||||
asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
|
||||
|
||||
if (sctp_state(asoc, COOKIE_WAIT)) {
|
||||
sctp_stream_free(asoc->stream);
|
||||
asoc->stream = new->stream;
|
||||
new->stream = NULL;
|
||||
}
|
||||
if (sctp_state(asoc, COOKIE_WAIT))
|
||||
sctp_stream_update(&asoc->stream, &new->stream);
|
||||
|
||||
if (!asoc->assoc_id) {
|
||||
/* get a new association id since we don't have one
|
||||
|
Reference in New Issue
Block a user