Received: with ECARTIS (v1.0.0; list netdev); Thu, 30 Dec 2004 19:23:03 -0800 (PST) Received: from smtp.knology.net (smtp.knology.net [24.214.63.101]) by oss.sgi.com (8.13.0/8.13.0) with SMTP id iBV3MZro016281 for ; Thu, 30 Dec 2004 19:22:55 -0800 Received: (qmail 4542 invoked by uid 0); 31 Dec 2004 03:31:32 -0000 Received: from user-69-1-45-93.knology.net (HELO ori.thedillows.org) (69.1.45.93) by smtp6.knology.net with SMTP; 31 Dec 2004 03:31:32 -0000 Received: from ori.thedillows.org (localhost [127.0.0.1]) by ori.thedillows.org (8.13.1/8.13.1) with ESMTP id iBV3V8u9010615; Thu, 30 Dec 2004 22:31:08 -0500 Received: (from il1@localhost) by ori.thedillows.org (8.13.1/8.13.1/Submit) id iBV3V7K1010614; Thu, 30 Dec 2004 22:31:07 -0500 X-Authentication-Warning: ori.thedillows.org: il1 set sender to dave@thedillows.org using -f Subject: Re: [RFC 2.6.10 5/22] xfrm: Attempt to offload bundled xfrm_states for outbound xfrms From: David Dillow To: Francois Romieu Cc: Netdev , linux-kernel@vger.kernel.org In-Reply-To: <20041230233443.GB5247@electric-eye.fr.zoreil.com> References: <20041230035000.13@ori.thedillows.org> <20041230035000.14@ori.thedillows.org> <20041230233443.GB5247@electric-eye.fr.zoreil.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 30 Dec 2004 22:31:07 -0500 Message-Id: <1104463867.10590.2.camel@ori.thedillows.org> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) X-Virus-Scanned: ClamAV 0.80/645/Mon Dec 27 14:56:20 2004 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 13265 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: dave@thedillows.org Precedence: bulk X-list: netdev On Fri, 2004-12-31 at 00:34 +0100, Francois Romieu wrote: > David Dillow : > [...] > > diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c > > --- a/net/xfrm/xfrm_policy.c 2004-12-30 01:11:18 -05:00 > > +++ b/net/xfrm/xfrm_policy.c 2004-12-30 01:11:18 -05:00 > > @@ -705,6 +705,31 @@ > > }; > > } > > > > +static void xfrm_accel_bundle(struct dst_entry *dst) > > +{ > > + struct xfrm_bundle_list bundle, *xbl, *tmp; > > + struct net_device *dev = dst->dev; > > + INIT_LIST_HEAD(&bundle.node); > > + > > + if (dev && netif_running(dev) && (dev->features & NETIF_F_IPSEC)) { > > + while (dst) { > > + xbl = kmalloc(sizeof(*xbl), GFP_ATOMIC); > > + if (!xbl) > > + goto out; > > + > > + xbl->dst = dst; > > + list_add_tail(&xbl->node, &bundle.node); > > + dst = dst->child; > > + } > > + > > + dev->xfrm_bundle_add(dev, &bundle); > > + } > > + > > +out: > > + list_for_each_entry_safe(xbl, tmp, &bundle.node, node) > > + kfree(xbl); > > +} > > If the driver knows the max depth which is allowed, why not have it > allocate its own bundle-like struct during initialization one for once ? > Instead of pushing the bundle list, dst is walked by the code of > the device's own xyz_xfrm_bundle_add into the said circular list, > entries get overwriten if the dst chain is longer and when the end of > dst is reached, the bundle-like list is walked in reverse order. > It avoids a few failure points imho. Good idea! I'll see if I can't code it up. I definitely want to get rid of that GFP_ATOMIC allocation. -- David Dillow