From owner-svn-src-all@freebsd.org Sun Jan 3 10:10:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EFD7A60897; Sun, 3 Jan 2016 10:10:13 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09387149C; Sun, 3 Jan 2016 10:10:12 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u03AACt3044713; Sun, 3 Jan 2016 10:10:12 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u03AACwR044712; Sun, 3 Jan 2016 10:10:12 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201601031010.u03AACwR044712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 3 Jan 2016 10:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293100 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 10:10:13 -0000 Author: avos Date: Sun Jan 3 10:10:11 2016 New Revision: 293100 URL: https://svnweb.freebsd.org/changeset/base/293100 Log: iwm: convert to ieee80211_tx_complete() Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4755 Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Sun Jan 3 10:06:10 2016 (r293099) +++ head/sys/dev/iwm/if_iwm.c Sun Jan 3 10:10:11 2016 (r293100) @@ -270,7 +270,7 @@ static void iwm_mvm_rx_rx_phy_cmd(struct static int iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *); static void iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_rx_data *); -static void iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, +static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_node *); static void iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *, @@ -2400,12 +2400,13 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, IWM_LOCK(sc); } -static void +static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct iwm_node *in) { struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data; - struct ieee80211vap *vap = in->in_ni.ni_vap; + struct ieee80211_node *ni = &in->in_ni; + struct ieee80211vap *vap = ni->ni_vap; int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK; int failack = tx_resp->failure_frame; @@ -2414,14 +2415,13 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_soft /* Update rate control statistics. */ if (status != IWM_TX_STATUS_SUCCESS && status != IWM_TX_STATUS_DIRECT_DONE) { - if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, 1); - ieee80211_ratectl_tx_complete(vap, &in->in_ni, + ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_FAILURE, &failack, NULL); + return (1); } else { - if_inc_counter(vap->iv_ifp, IFCOUNTER_OPACKETS, 1); - ieee80211_ratectl_tx_complete(vap, &in->in_ni, + ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &failack, NULL); - + return (0); } } @@ -2435,33 +2435,30 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_tx_ring *ring = &sc->txq[qid]; struct iwm_tx_data *txd = &ring->data[idx]; struct iwm_node *in = txd->in; + struct mbuf *m = txd->m; + int status; + + KASSERT(txd->done == 0, ("txd not done")); + KASSERT(txd->in != NULL, ("txd without node")); + KASSERT(txd->m != NULL, ("txd without mbuf")); - if (txd->done) { - device_printf(sc->sc_dev, - "%s: got tx interrupt that's already been handled!\n", - __func__); - return; - } bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); sc->sc_tx_timer = 0; - iwm_mvm_rx_tx_cmd_single(sc, pkt, in); + status = iwm_mvm_rx_tx_cmd_single(sc, pkt, in); /* Unmap and free mbuf. */ bus_dmamap_sync(ring->data_dmat, txd->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(ring->data_dmat, txd->map); - m_freem(txd->m); IWM_DPRINTF(sc, IWM_DEBUG_XMIT, "free txd %p, in %p\n", txd, txd->in); - KASSERT(txd->done == 0, ("txd not done")); txd->done = 1; - KASSERT(txd->in, ("txd without node")); - txd->m = NULL; txd->in = NULL; - ieee80211_free_node((struct ieee80211_node *)in); + + ieee80211_tx_complete(&in->in_ni, m, status); if (--ring->queued < IWM_TX_RING_LOMARK) { sc->qfullmsk &= ~(1 << ring->qid);