diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2007-08-15 16:07:44 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 16:48:09 -0700 |
commit | 4d93df0abd50b9c9e2d4561439a1a1d21ec5e68f (patch) | |
tree | 47e5bde0c37ed7ce68032ffa9110f252533fc710 /net/sctp/ulpevent.c | |
parent | 13c99b248f06e0b71d925f162d8e3b0084886a21 (diff) | |
download | kernel_samsung_espresso10-4d93df0abd50b9c9e2d4561439a1a1d21ec5e68f.zip kernel_samsung_espresso10-4d93df0abd50b9c9e2d4561439a1a1d21ec5e68f.tar.gz kernel_samsung_espresso10-4d93df0abd50b9c9e2d4561439a1a1d21ec5e68f.tar.bz2 |
[SCTP]: Rewrite of sctp buffer management code
This patch introduces autotuning to the sctp buffer management code
similar to the TCP. The buffer space can be grown if the advertised
receive window still has room. This might happen if small message
sizes are used, which is common in telecom environmens.
New tunables are introduced that provide limits to buffer growth
and memory pressure is entered if to much buffer spaces is used.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/ulpevent.c')
-rw-r--r-- | net/sctp/ulpevent.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index bfecb35..5dc094b 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c @@ -685,6 +685,24 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, struct sctp_ulpevent *event = NULL; struct sk_buff *skb; size_t padding, len; + int rx_count; + + /* + * check to see if we need to make space for this + * new skb, expand the rcvbuffer if needed, or drop + * the frame + */ + if (asoc->ep->rcvbuf_policy) + rx_count = atomic_read(&asoc->rmem_alloc); + else + rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc); + + if (rx_count >= asoc->base.sk->sk_rcvbuf) { + + if ((asoc->base.sk->sk_userlocks & SOCK_RCVBUF_LOCK) || + (!sk_stream_rmem_schedule(asoc->base.sk, chunk->skb))) + goto fail; + } /* Clone the original skb, sharing the data. */ skb = skb_clone(chunk->skb, gfp); |