From owner-freebsd-wireless@FreeBSD.ORG Sun Jul 29 02:11:25 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98D66106564A; Sun, 29 Jul 2012 02:11:25 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 58AE18FC12; Sun, 29 Jul 2012 02:11:25 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so7947116pbb.13 for ; Sat, 28 Jul 2012 19:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9XtxftE5fEH45fwvBVdYhWUTJdNT/7S3hzzFq/ME35Y=; b=I26SK1XS4/Ia4vUj7nSL/8QNTDpukuiNCTr/dYc4K/od6iKlJtW5Ce6pJGdSyZUDm/ upCLPZMgzLd/yXi+MFzKzGnEbApDJIiz6rOLl1Mf8iXjxaJ0LtGbouOEP7nvMokgrSDE rjrZv4qKZccDF4Bl+S+MRauf5fHlTmdD629nbnRsKz/2h+8vQZl+M4iDOFZrYNqlTeMV qxpgRQtPX/5ZnCWKwPh3tbk77vWBBfViHxhWETJZ2+rzq8PzIPSWbxWM9Mbbtna5Bjt3 3LKzWqGbdgOcWVqPA+NXpqeTtBLz0OVd4QtZynd4rwAPlnpB3zk+ZfzReIvqy4MfsNz1 WObg== MIME-Version: 1.0 Received: by 10.68.223.164 with SMTP id qv4mr24972775pbc.20.1343527884911; Sat, 28 Jul 2012 19:11:24 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.66.136 with HTTP; Sat, 28 Jul 2012 19:11:24 -0700 (PDT) In-Reply-To: <201207270548.q6R5mgiS070136@svn.freebsd.org> References: <201207270548.q6R5mgiS070136@svn.freebsd.org> Date: Sat, 28 Jul 2012 19:11:24 -0700 X-Google-Sender-Auth: RPiMqVoi9jWsPqj5aifDPYCf5kA Message-ID: From: Adrian Chadd To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org Subject: Re: svn commit: r238824 - head/sys/dev/ath X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jul 2012 02:11:25 -0000 Hi, This broke -HEAD. Let me go and figure out what I need to do to fix the descriptor offset math. It only showed up under heavy iperf testing. Ping wasn't enough to trigger the crash. :( Adrian On 26 July 2012 22:48, Adrian Chadd wrote: > Author: adrian > Date: Fri Jul 27 05:48:42 2012 > New Revision: 238824 > URL: http://svn.freebsd.org/changeset/base/238824 > > Log: > Migrate the descriptor allocation function to not care about the number > of buffers, only the number of descriptors. > > This involves: > > * Change the allocation function to not use nbuf at all; > * When calling it, pass in "nbuf * ndesc" to correctly update how many > descriptors are being allocated. > > Whilst here, fix the descriptor allocation code to correctly allocate > a larger buffer size if the Merlin 4KB WAR is required. It overallocates > descriptors when allocating a block that doesn't ever have a 4KB boundary > being crossed, but that can be fixed at a later stage. > > Modified: > head/sys/dev/ath/if_ath.c > head/sys/dev/ath/if_ath_misc.h > > Modified: head/sys/dev/ath/if_ath.c > ============================================================================== > --- head/sys/dev/ath/if_ath.c Fri Jul 27 05:37:01 2012 (r238823) > +++ head/sys/dev/ath/if_ath.c Fri Jul 27 05:48:42 2012 (r238824) > @@ -2773,7 +2773,7 @@ ath_load_cb(void *arg, bus_dma_segment_t > int > ath_descdma_alloc_desc(struct ath_softc *sc, > struct ath_descdma *dd, ath_bufhead *head, > - const char *name, int ds_size, int nbuf, int ndesc) > + const char *name, int ds_size, int ndesc) > { > #define DS2PHYS(_dd, _ds) \ > ((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc)) > @@ -2785,11 +2785,11 @@ ath_descdma_alloc_desc(struct ath_softc > dd->dd_descsize = ds_size; > > DPRINTF(sc, ATH_DEBUG_RESET, > - "%s: %s DMA: %u buffers %u desc/buf, %d bytes per descriptor\n", > - __func__, name, nbuf, ndesc, dd->dd_descsize); > + "%s: %s DMA: %u desc, %d bytes per descriptor\n", > + __func__, name, ndesc, dd->dd_descsize); > > dd->dd_name = name; > - dd->dd_desc_len = dd->dd_descsize * nbuf * ndesc; > + dd->dd_desc_len = dd->dd_descsize * ndesc; > > /* > * Merlin work-around: > @@ -2797,8 +2797,8 @@ ath_descdma_alloc_desc(struct ath_softc > * Assume one skipped descriptor per 4KB page. > */ > if (! ath_hal_split4ktrans(sc->sc_ah)) { > - int numdescpage = 4096 / (dd->dd_descsize * ndesc); > - dd->dd_desc_len = (nbuf / numdescpage + 1) * 4096; > + int numpages = dd->dd_desc_len / 4096; > + dd->dd_desc_len += ds_size * numpages; > } > > /* > @@ -2834,7 +2834,7 @@ ath_descdma_alloc_desc(struct ath_softc > &dd->dd_dmamap); > if (error != 0) { > if_printf(ifp, "unable to alloc memory for %u %s descriptors, " > - "error %u\n", nbuf * ndesc, dd->dd_name, error); > + "error %u\n", ndesc, dd->dd_name, error); > goto fail1; > } > > @@ -2883,7 +2883,7 @@ ath_descdma_setup(struct ath_softc *sc, > > /* Allocate descriptors */ > error = ath_descdma_alloc_desc(sc, dd, head, name, ds_size, > - nbuf, ndesc); > + nbuf * ndesc); > > /* Assume any errors during allocation were dealt with */ > if (error != 0) { > > Modified: head/sys/dev/ath/if_ath_misc.h > ============================================================================== > --- head/sys/dev/ath/if_ath_misc.h Fri Jul 27 05:37:01 2012 (r238823) > +++ head/sys/dev/ath/if_ath_misc.h Fri Jul 27 05:48:42 2012 (r238824) > @@ -86,7 +86,7 @@ extern void ath_setslottime(struct ath_s > > extern int ath_descdma_alloc_desc(struct ath_softc *sc, > struct ath_descdma *dd, ath_bufhead *head, const char *name, > - int ds_size, int nbuf, int ndesc); > + int ds_size, int ndesc); > extern int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, > ath_bufhead *head, const char *name, int ds_size, int nbuf, > int ndesc);