From owner-freebsd-usb@FreeBSD.ORG Wed Feb 20 07:35:53 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3822E1DF for ; Wed, 20 Feb 2013 07:35:53 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.c2i.net [212.247.155.2]) by mx1.freebsd.org (Postfix) with ESMTP id C1E1C7F3 for ; Wed, 20 Feb 2013 07:35:52 +0000 (UTC) X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Received: from [176.74.213.204] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 205622896; Wed, 20 Feb 2013 08:35:44 +0100 From: Hans Petter Selasky To: Aman Sawrup Subject: Re: Insufficient memory reserved for xfer->dma_page_ptr? Date: Wed, 20 Feb 2013 08:36:55 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.1-STABLE; KDE/4.8.4; amd64; ; ) References: <1360360082956-5785167.post@n5.nabble.com> <201302090001.57258.hselasky@c2i.net> <5123FC0B.70009@bluecoat.com> In-Reply-To: <5123FC0B.70009@bluecoat.com> X-Face: ?p&W)c( =?iso-8859-1?q?+80hU=3B=27=7B=2E=245K+zq=7BoC6y=7C=0A=09/D=27an*6mw?=>j'f:eBsex\Gi, Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 07:35:53 -0000 On Tuesday 19 February 2013 23:26:19 Aman Sawrup wrote: > I believe the amount of memory reserved needs to be much higher. For > example, if sizeof(struct usb_page) is 16 bytes, then for n_frbuffers of > 128 and parm->bufsize of 131072, we need the following amount of memory > reserved: > > parm->bufsize / USB_PAGE_SIZE * n_frbuffers * sizeof(struct usb_page) > = 131072 / 4096 * 128 * 16 > = 65536 Hi, The parm->bufsize is shared for all frbuffers, so the formula should be correct. In your computation you assume that parm->bufsize gives the maximum for each frbuffer. That is not the case. That means, when you configure bufsize, you must not exceed that size as a total when setting up frames. This include all transfer types. I think there are asserts for that so you should get a panic fairly quickly. --HPS