From owner-freebsd-wireless@FreeBSD.ORG Thu Jul 19 08:26:06 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 93FD0106566C for ; Thu, 19 Jul 2012 08:26:06 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 10C348FC0A for ; Thu, 19 Jul 2012 08:26:05 +0000 (UTC) Received: by lbon10 with SMTP id n10so4124423lbo.13 for ; Thu, 19 Jul 2012 01:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=8VjDCtR3hFDvjw+QYq5mHU8qANpKmKVnqByWYYYzgv0=; b=fpVhkIReaN1mjbimHEravsgQ1wwsqMGkNIxtGJM+xMUI4mwzczWNquCxvvq0BxIgHG 6YboF/NyevhFGIzlQcIqaZY0VrqHrMKnI1l9gnH8ocm2JwNs8M6TckBMFz2q1e2G74QM s4P+ym8LtdirM2BE/TsoY0Z0sfbtj5eDpjeT5rCdTUXPKh69kCnbGKhcmZ22CbKJdsXa jmx3puOMToyyRa+snUWvZOK6F43Fx3ALWatTg02dT9KcHx8Hyjv6B6//KHgktZjDHfs3 qAI5tc5Z/REhQjKNKapiGz9/Uk6UzN3jW6R8WCjPS61e70pn1hWsBf632EDnbfIupsVa XL2Q== MIME-Version: 1.0 Received: by 10.112.27.226 with SMTP id w2mr688564lbg.57.1342686364680; Thu, 19 Jul 2012 01:26:04 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.112.20.197 with HTTP; Thu, 19 Jul 2012 01:26:04 -0700 (PDT) Date: Thu, 19 Jul 2012 01:26:04 -0700 X-Google-Sender-Auth: qd7CSlI9Uns1cVDnZuNC5RR_VfQ Message-ID: From: Adrian Chadd To: freebsd-wireless@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Please test ath(4) on HEAD (was Fwd: svn commit: r238609 - 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: Thu, 19 Jul 2012 08:26:06 -0000 Hi all, I've been knee deep in the TX and RX path lately. This is to prepare the driver to support the newer 11n chips that Atheros makes. The below commit affects the TX path as a whole. I'd really appreciate it if people would test out station, access point and adhoc mode (and monitor/mesh if you have time.) Doubly so if you can test out say, multi-SSID AP mode with power sleep clients and 11n aggregate traffic, complete with some multicast traffic. I've tried it very lightly on my AR5210 (earliest) and AR9280 (almost the latest) NICs. I'll test the rest out later today. Thanks, Adrian ---------- Forwarded message ---------- From: Adrian Chadd Date: 18 July 2012 20:51 Subject: svn commit: r238609 - head/sys/dev/ath To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Author: adrian Date: Thu Jul 19 03:51:16 2012 New Revision: 238609 URL: http://svn.freebsd.org/changeset/base/238609 Log: Convert the TX path to use the new HAL methods for accessing the TX descriptor link pointers. This is required for the AR93xx and later chipsets. The RX path is slightly different - the legacy RX path directly accesses ath_desc->ds_link for now, however this isn't at all done for EDMA (FIFO) RX. Now, for those performing a little software archeology here: This is all a bit sub-optimal. "struct ath_desc" is only really relevant for the pre-AR93xx NICs - where ds_link and ds_data is always in the same location. The AR93xx and later NICs have different descriptor layouts altogether. Now, for AR93xx and later NICs, you should never directly reference ds_link and ds_data, as: * the RX descriptors don't have either - the data is _after_ the RX descriptor. They're just one large buffer. There's also no need for a per-descriptor RX buffer size as they're all fixed sizes. * the TX descriptors have 4 buffer and 4 length fields _and_ a link pointer. Each frame takes up one TX FIFO pointer, but it can contain multiple subframes (either multiple frames in a buffer, and/or multiple frames in an aggregate/RIFS burst.) * .. so, when TX frames are queued to a hardware queue, the link pointer is ONLY for buffers in that frame/aggregate. The next frame starts in a new FIFO pointer. * Finally, descriptor completion status is in a different ring. I'll write something up about that when its time to do so. This was inspired by Linux ath9k and the reference driver but is a reimplementation. Obtained from: Linux ath9k, Qualcomm Atheros Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Thu Jul 19 03:18:15 2012 (r238608) +++ head/sys/dev/ath/if_ath_beacon.c Thu Jul 19 03:51:16 2012 (r238609) @@ -277,14 +277,15 @@ ath_beacon_setup(struct ath_softc *sc, s flags = HAL_TXDESC_NOACK; if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol) { - ds->ds_link = bf->bf_daddr; /* self-linked */ + /* self-linked descriptor */ + ath_hal_settxdesclink(sc->sc_ah, ds, bf->bf_daddr); flags |= HAL_TXDESC_VEOL; /* * Let hardware handle antenna switching. */ antenna = sc->sc_txantenna; } else { - ds->ds_link = 0; + ath_hal_settxdesclink(sc->sc_ah, ds, 0); /* * Switch antenna every 4 beacons. * XXX assumes two antenna @@ -405,8 +406,10 @@ ath_beacon_proc(void *arg, int pending) if (vap != NULL && vap->iv_state >= IEEE80211_S_RUN) { bf = ath_beacon_generate(sc, vap); if (bf != NULL) { + /* XXX should do this using the ds */ *bflink = bf->bf_daddr; - bflink = &bf->bf_desc->ds_link; + ath_hal_gettxdesclinkptr(sc->sc_ah, + bf->bf_desc, &bflink); } } } Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Jul 19 03:18:15 2012 (r238608) +++ head/sys/dev/ath/if_ath_tx.c Thu Jul 19 03:51:16 2012 (r238609) @@ -310,9 +310,10 @@ ath_tx_chaindesclist(struct ath_softc *s for (i = 0; i < bf->bf_nseg; i++, ds++) { ds->ds_data = bf->bf_segs[i].ds_addr; if (i == bf->bf_nseg - 1) - ds->ds_link = 0; + ath_hal_settxdesclink(ah, ds, 0); else - ds->ds_link = bf->bf_daddr + sizeof(*ds) * (i + 1); + ath_hal_settxdesclink(ah, ds, + bf->bf_daddr + sizeof(*ds) * (i + 1)); ath_hal_filltxdesc(ah, ds , bf->bf_segs[i].ds_len /* segment length */ , i == 0 /* first segment */ @@ -350,9 +351,10 @@ ath_tx_chaindesclist_subframe(struct ath for (i = 0; i < bf->bf_nseg; i++, ds++) { ds->ds_data = bf->bf_segs[i].ds_addr; if (i == bf->bf_nseg - 1) - ds->ds_link = 0; + ath_hal_settxdesclink(ah, ds, 0); else - ds->ds_link = bf->bf_daddr + sizeof(*ds) * (i + 1); + ath_hal_settxdesclink(ah, ds, + bf->bf_daddr + sizeof(*ds) * (i + 1)); /* * This performs the setup for an aggregate frame. @@ -414,7 +416,8 @@ ath_tx_setds_11n(struct ath_softc *sc, s * to the beginning descriptor of this frame. */ if (bf_prev != NULL) - bf_prev->bf_lastds->ds_link = bf->bf_daddr; + ath_hal_settxdesclink(sc->sc_ah, bf_prev->bf_lastds, + bf->bf_daddr); /* Save a copy so we can link the next descriptor in */ bf_prev = bf; @@ -482,7 +485,7 @@ ath_tx_handoff_mcast(struct ath_softc *s *txq->axq_link = bf->bf_daddr; } ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); - txq->axq_link = &bf->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(sc->sc_ah, bf->bf_lastds, &txq->axq_link); } /* @@ -616,7 +619,7 @@ ath_tx_handoff_hw(struct ath_softc *sc, #endif /* IEEE80211_SUPPORT_TDMA */ if (bf->bf_state.bfs_aggr) txq->axq_aggr_depth++; - txq->axq_link = &bf->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); } } @@ -645,7 +648,7 @@ ath_txq_restart_dma(struct ath_softc *sc return; ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); - txq->axq_link = &bf_last->bf_lastds->ds_link; + ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); }