From owner-freebsd-usb@FreeBSD.ORG Wed Feb 20 14:44:14 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 427BA685 for ; Wed, 20 Feb 2013 14:44:14 +0000 (UTC) (envelope-from aman.sawrup@bluecoat.com) Received: from synonym.bluecoat.com (synonym.bluecoat.com [199.91.133.5]) by mx1.freebsd.org (Postfix) with ESMTP id 333B48CF for ; Wed, 20 Feb 2013 14:44:13 +0000 (UTC) Received: from [10.167.0.106] (aman-sawrup.waterloo.bluecoat.com [10.167.0.106]) by synonym.bluecoat.com (Postfix) with ESMTP id 07AEF7FE190; Wed, 20 Feb 2013 06:44:12 -0800 (PST) Message-ID: <5124E13C.10003@bluecoat.com> Date: Wed, 20 Feb 2013 09:44:12 -0500 From: Aman Sawrup User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: freebsd-usb@freebsd.org Subject: Re: Insufficient memory reserved for xfer->dma_page_ptr? References: <1360360082956-5785167.post@n5.nabble.com> <201302090001.57258.hselasky@c2i.net> <5123FC0B.70009@bluecoat.com> <201302200836.56015.hselasky@c2i.net> In-Reply-To: <201302200836.56015.hselasky@c2i.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 14:44:14 -0000 Hi Hans, If I understand correctly, I need to set bufsize in struct usb_config as follows: [UMASS_T_BBB_DATA_READ] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .frames = 128, .bufsize = UMASS_BULK_SIZE * 128, .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, .callback = &umass_t_bbb_data_read_callback, .timeout = 0, /* overwritten later */ }, Thanks Aman On 02/20/2013 02:36 AM, Hans Petter Selasky wrote: > 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