From owner-freebsd-sparc Fri Jan 17 8:30:24 2003 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CBAF37B401; Fri, 17 Jan 2003 08:30:22 -0800 (PST) Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19D9343ED8; Fri, 17 Jan 2003 08:30:21 -0800 (PST) (envelope-from brandt@fokus.gmd.de) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id h0HGUDM26173; Fri, 17 Jan 2003 17:30:14 +0100 (MET) Date: Fri, 17 Jan 2003 17:30:13 +0100 (CET) From: Harti Brandt To: Thomas Moestl Cc: sparc@freebsd.org Subject: Re: Problem with iommu_dvmamap_create In-Reply-To: <20030117160857.GB304@crow.dom2ip.de> Message-ID: <20030117171317.F44530@beagle.fokus.gmd.de> References: <20030117151958.U715@beagle.fokus.gmd.de> <20030117160857.GB304@crow.dom2ip.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: <20030117171317.O44530@beagle.fokus.gmd.de> Content-Disposition: INLINE Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 17 Jan 2003, Thomas Moestl wrote: TM>Can you please make try the attached patch? I mostly posted it to this TM>list before it fixes some bogons which may be related (bugs in the TM>lowaddr and boundary handling) and adds some diagnostics. I also fixed TM>the two issues you noted below and KASSERT()ed that presz can't be 0. TM> TM>Can you also please post the exact map and tag creation calls? if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, HE_MAX_PDU, 3 * HE_CONFIG_MAX_TPD_PER_PACKET, HE_MAX_PDU, 0, &sc->tx_tag)) { device_printf(dev, "could not allocate TX tag\n"); error = ENOMEM; goto failed; } error = bus_dmamap_create(sc->tx_tag, 0, &t->map); if (error != 0) { HE_MAX_PDU is 65535 and HE_CONFIG_MAX_TPD_PER_PACKET is 11. TM>Hmmm, allocating with a size of 0 would of course be a bug, but I fail to TM>see what would cause presz to be 0 in the first place in your example - TM>maxpre will be IOMMU_MAX_PRE_SEG = 3 then, so (64k-1) / 3 = 21845. TM>It will always be > 0 if maxsize > min(maxseg, IOMMU_PRE_SEG), and all TM>else would be a bogus tag. Oh well, I see, I got it wrong. I was confused by all these MAX_PRE and maxpres. On a related topic. I just got a panic when actually using the map. There are two problems: the first is the definition of BUS_DMAMAP_NSEGS. These seems to be 128k/8k = 16. On the other hand MCLBYTES is 2048 so that a 64k PDU is segmented into 32 or more mbufs. I think, that NSEGS should be large enough to handle 64k PDUs so it should probably be 40 or so. The other problem is, that bus_dmamap_load_mbuf happily will try to load such a PDU. There is a check in iommu_dvmamap_load_buffer for the segment count and it sets error to EFBIG, but the function than fails to check that error. The return at the end should probably read 'return (error)'. I try your patch and tell you the results. Thanks, harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.gmd.de, brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message