[SCTP]: Include ulpevents in socket receive buffer accounting.
Also introduces a sysctl option to configure the receive buffer accounting policy to be either at socket or association level. Default is all the associations on the same socket share the receive buffer. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
19c7e9eef5
commit
049b3ff5a8
@@ -177,10 +177,10 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
|
||||
* RFC 6 - A SCTP receiver MUST be able to receive a minimum of
|
||||
* 1500 bytes in one SCTP packet.
|
||||
*/
|
||||
if (sk->sk_rcvbuf < SCTP_DEFAULT_MINWINDOW)
|
||||
if ((sk->sk_rcvbuf/2) < SCTP_DEFAULT_MINWINDOW)
|
||||
asoc->rwnd = SCTP_DEFAULT_MINWINDOW;
|
||||
else
|
||||
asoc->rwnd = sk->sk_rcvbuf;
|
||||
asoc->rwnd = sk->sk_rcvbuf/2;
|
||||
|
||||
asoc->a_rwnd = asoc->rwnd;
|
||||
|
||||
@@ -192,6 +192,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
|
||||
/* Set the sndbuf size for transmit. */
|
||||
asoc->sndbuf_used = 0;
|
||||
|
||||
/* Initialize the receive memory counter */
|
||||
atomic_set(&asoc->rmem_alloc, 0);
|
||||
|
||||
init_waitqueue_head(&asoc->wait);
|
||||
|
||||
asoc->c.my_vtag = sctp_generate_tag(ep);
|
||||
@@ -400,6 +403,8 @@ static void sctp_association_destroy(struct sctp_association *asoc)
|
||||
spin_unlock_bh(&sctp_assocs_id_lock);
|
||||
}
|
||||
|
||||
BUG_TRAP(!atomic_read(&asoc->rmem_alloc));
|
||||
|
||||
if (asoc->base.malloced) {
|
||||
kfree(asoc);
|
||||
SCTP_DBG_OBJCNT_DEC(assoc);
|
||||
|
Reference in New Issue
Block a user