netdev
[Top] [All Lists]

Re: [Patch] sctp: add receive buffer accounting to sctp (fwd)

To: Sridhar Samudrala <sri@xxxxxxxxxx>
Subject: Re: [Patch] sctp: add receive buffer accounting to sctp (fwd)
From: nhorman@xxxxxxxxxx
Date: Fri, 11 Mar 2005 10:48:36 -0500
Cc: nhorman@xxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, lksctp-developers@xxxxxxxxxxxxxxxxxxxxx
In-reply-to: <Pine.LNX.4.61.0503111947470.6007@xxxxxxxxxxxxxxxxxxxxx>
References: <Pine.LNX.4.61.0503030027590.8076@xxxxxxxxxxxxxxxxxxxxx> <20050309211632.6f70fe41.davem@xxxxxxxxxxxxx> <20050310120803.GA6341@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20050310154342.GG6341@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20050310183856.08cb5f7b.davem@xxxxxxxxxxxxx> <20050311125724.GB18122@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.61.0503111947470.6007@xxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4i
On Fri, Mar 11, 2005 at 07:58:50PM +0530, Sridhar Samudrala wrote:
> Neil,
> 
> I guess you may not have tried to compile SCTP with this patch. 
> 2.4 struct sock members do not have sk_ prefix.
> So you need to replace sk_rmem_alloc and sk_rcvbuf with rmem_alloc and
> rcvbuf.
> 
No, I compiled the kernel, I just forgot to enable CONFIG_IP_SCTP.  I must have
booted to a 2.6 kernel on my dev box by accident when I ran the tests.  I'm a
dummy, sorry :).  I'll repost the patch (after I veryify that I build and test
the actual code).

Regards, 
Neil


> Thanks
> Sridhar
> 
> On Fri, 11 Mar 2005 nhorman@xxxxxxxxxx wrote:
> 
> >On Thu, Mar 10, 2005 at 06:38:56PM -0800, David S. Miller wrote:
> >>On Thu, 10 Mar 2005 10:43:42 -0500
> >>nhorman@xxxxxxxxxx wrote:
> >>
> >>>Repost of my ealier rcvbuf patch.  No changes, but rediffed to apply 
> >>>cleanly to
> >>>the head of the bitkeeper tree.  Passes all lksctp regression tests
> >>
> >>Applied, thanks Neil.
> >
> >You're quite welcome.  Heres the 2.4 version of the same patch that you
> >requested.  Applies clean against the bitkeeper head.
> >
> >Signed-off-by: Neil Horman <nhorman@xxxxxxxxxx>
> >
> >[nhorman@hmsendeavour kernel]$ diffstat linux-2.4-sctp.rcvbuf.patch
> >input.c |   21 +++++++++++++++++++++
> >1 files changed, 21 insertions(+)
> >
> >
> >--- linux-2.4-sctp/net/sctp/input.c.orig     2005-03-10 
> >13:36:49.000000000 -0500
> >+++ linux-2.4-sctp/net/sctp/input.c  2005-03-10 13:51:25.000000000 -0500
> >@@ -100,6 +100,21 @@
> >     return 0;
> >}
> >
> >+/* The free routine for skbuffs that sctp receives */
> >+static void sctp_rfree(struct sk_buff *skb)
> >+{
> >+    atomic_sub(sizeof(struct sctp_chunk),&skb->sk->sk_rmem_alloc);
> >+    sock_rfree(skb);
> >+}
> >+
> >+/* The ownership wrapper routine to do receive buffer accounting */
> >+static void sctp_rcv_set_owner_r(struct sk_buff *skb, struct sock *sk)
> >+{
> >+    skb_set_owner_r(skb,sk);
> >+    skb->destructor = sctp_rfree;
> >+    atomic_add(sizeof(struct sctp_chunk),&sk->sk_rmem_alloc);
> >+}
> >+
> >/*
> > * This is the routine which IP calls when receiving an SCTP packet.
> > */
> >@@ -183,6 +198,10 @@
> >     rcvr = asoc ? &asoc->base : &ep->base;
> >     sk = rcvr->sk;
> >
> >+    if ((sk) && (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf))
> >+            goto discard_release;
> >+
> >+
> >     if (!ipsec_sk_policy(sk, skb))
> >             goto discard_release;
> >
> >@@ -197,6 +216,8 @@
> >             goto discard_release;
> >     }
> >
> >+    sctp_rcv_set_owner_r(skb,sk);
> >+
> >     /* Remember what endpoint is to handle this packet. */
> >     chunk->rcvr = rcvr;
> >
> >
> 
> -- 

-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@xxxxxxxxxx
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

Attachment: pgpUH0R5sjnsI.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>