From owner-svn-src-user@FreeBSD.ORG Sat Jun 11 08:03:44 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD52D106564A; Sat, 11 Jun 2011 08:03:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93C1E8FC0C; Sat, 11 Jun 2011 08:03:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5B83iou064702; Sat, 11 Jun 2011 08:03:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B83ild064699; Sat, 11 Jun 2011 08:03:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106110803.p5B83ild064699@svn.freebsd.org> From: Adrian Chadd Date: Sat, 11 Jun 2011 08:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222979 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2011 08:03:44 -0000 Author: adrian Date: Sat Jun 11 08:03:44 2011 New Revision: 222979 URL: http://svn.freebsd.org/changeset/base/222979 Log: Some further digging shows that net80211 already takes care of refcounting the TX node references for me, so in theory (!) I shouldn't seen a node free until all pending TX packets have completed. For now, leave the functions in there which I was going to write to do this (primarily so I can have some checks before I do free the state!) Whilst I'm here, add a TID reference. Between this and the bf_node reference, enough information should (eventually) be available now for a completed packet (success, failure, filtered) to be matched back to its source node/TID queue. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sat Jun 11 07:42:18 2011 (r222978) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sat Jun 11 08:03:44 2011 (r222979) @@ -1319,11 +1319,9 @@ ath_tx_tid_init(struct ath_softc *sc, st * Mark packets currently in the hardware TXQ from this TID * as now having no parent software TXQ. * - * This is done when an ath_node goes away so any pending - * packets going out to the device are simply freed, rather - * than referencing some now-nonexisting ath_node. - * - * XXX make sure that access to the hardware TXQ is correctly locked! + * XXX not yet needed; there shouldn't be any packets left + * XXX for this node in any of the hardware queues; the node + * XXX isn't freed until the last TX packet has been sent. */ static void ath_tx_tid_txq_unmark(struct ath_softc *sc, struct ath_node *an, @@ -1333,15 +1331,32 @@ ath_tx_tid_txq_unmark(struct ath_softc * } /* + * Free any packets currently pending in the software TX queue. + * + * Since net80211 shouldn't free the node until the last packets + * have been sent, this function should never have to free any + * packets. + */ +static void +ath_tx_tid_free_pkts(struct ath_softc *sc, struct ath_node *an, + int tid) +{ + struct ath_tid *atid = &an->an_tid[tid]; + struct ieee80211_node *ni = &an->an_node; + + /* XXX TODO */ + /* For now, just print a loud warning if it occurs */ + if (! STAILQ_EMPTY(&atid->axq_q)) + device_printf(sc->sc_dev, "%s: AID %d TID %d queue not " + "empty on queue destroy!\n", + __func__, ni->ni_associd, tid); +} + +/* * Free the per-TID node state. * * This frees any packets currently in the software queue and frees * any other TID state. - * - * Since node destruction currenty doesn't wait for the last - * packets to be xmited, there needs to be a good place to - * mark packets currently in the hardware TX queue as - * now having no parent node! */ void ath_tx_tid_cleanup(struct ath_softc *sc, struct ath_node *an) @@ -1353,6 +1368,7 @@ ath_tx_tid_cleanup(struct ath_softc *sc, atid = &an->an_tid[i]; /* Free packets in sw queue */ + ath_tx_tid_free_pkts(sc, an, i); /* Mark hw-queued packets as having no parent now */ ath_tx_tid_txq_unmark(sc, an, i); Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Sat Jun 11 07:42:18 2011 (r222978) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Sat Jun 11 08:03:44 2011 (r222979) @@ -150,6 +150,7 @@ struct ath_buf { int bfs_hdrlen; /* length of this packet header */ int bfs_seqno; /* sequence number of this packet */ int bfs_retries; /* retry count */ + uint16_t bfs_tid; /* packet TID (or TID_MAX for no QoS) */ uint16_t bfs_al; /* length of aggregate */ uint16_t bfs_pktdur; /* packet duration (at current rate?) */ uint16_t bfs_nframes; /* number of frames in aggregate */