Deleted Added
full compact
if_ath_tx.c (232753) if_ath_tx.c (232764)
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 232753 2012-03-09 22:58:34Z adrian $");
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 232764 2012-03-10 04:14:04Z adrian $");
32
33/*
34 * Driver for the Atheros Wireless LAN controller.
35 *
36 * This software is derived from work of Atsushi Onoe; his contribution
37 * is greatly appreciated.
38 */
39

--- 1324 unchanged lines hidden (view full) ---

1364 * XXX aggregate scheduler so its serialised?
1365 */
1366int
1367ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni,
1368 struct ath_buf *bf, struct mbuf *m0)
1369{
1370 struct ieee80211vap *vap = ni->ni_vap;
1371 struct ath_vap *avp = ATH_VAP(vap);
32
33/*
34 * Driver for the Atheros Wireless LAN controller.
35 *
36 * This software is derived from work of Atsushi Onoe; his contribution
37 * is greatly appreciated.
38 */
39

--- 1324 unchanged lines hidden (view full) ---

1364 * XXX aggregate scheduler so its serialised?
1365 */
1366int
1367ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni,
1368 struct ath_buf *bf, struct mbuf *m0)
1369{
1370 struct ieee80211vap *vap = ni->ni_vap;
1371 struct ath_vap *avp = ATH_VAP(vap);
1372 int r;
1372 int r = 0;
1373 u_int pri;
1374 int tid;
1375 struct ath_txq *txq;
1376 int ismcast;
1377 const struct ieee80211_frame *wh;
1378 int is_ampdu, is_ampdu_tx, is_ampdu_pending;
1379 ieee80211_seq seqno;
1380 uint8_t type, subtype;

--- 16 unchanged lines hidden (view full) ---

1397 tid = ath_tx_gettid(sc, m0);
1398
1399 txq = sc->sc_ac2q[pri];
1400 wh = mtod(m0, struct ieee80211_frame *);
1401 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
1402 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
1403 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
1404
1373 u_int pri;
1374 int tid;
1375 struct ath_txq *txq;
1376 int ismcast;
1377 const struct ieee80211_frame *wh;
1378 int is_ampdu, is_ampdu_tx, is_ampdu_pending;
1379 ieee80211_seq seqno;
1380 uint8_t type, subtype;

--- 16 unchanged lines hidden (view full) ---

1397 tid = ath_tx_gettid(sc, m0);
1398
1399 txq = sc->sc_ac2q[pri];
1400 wh = mtod(m0, struct ieee80211_frame *);
1401 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
1402 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
1403 subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
1404
1405 /*
1406 * Enforce how deep the multicast queue can grow.
1407 *
1408 * XXX duplicated in ath_raw_xmit().
1409 */
1410 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
1411 ATH_TXQ_LOCK(sc->sc_cabq);
1412 ATH_TXQ_LOCK(&avp->av_mcastq);
1413
1414 if ((sc->sc_cabq->axq_depth + avp->av_mcastq.axq_depth) >
1415 sc->sc_txq_mcastq_maxdepth) {
1416 sc->sc_stats.ast_tx_mcastq_overflow++;
1417 r = ENOBUFS;
1418 }
1419
1420 ATH_TXQ_UNLOCK(&avp->av_mcastq);
1421 ATH_TXQ_UNLOCK(sc->sc_cabq);
1422
1423 if (r != 0) {
1424 m_freem(m0);
1425 return r;
1426 }
1427 }
1428
1405 /* A-MPDU TX */
1406 is_ampdu_tx = ath_tx_ampdu_running(sc, ATH_NODE(ni), tid);
1407 is_ampdu_pending = ath_tx_ampdu_pending(sc, ATH_NODE(ni), tid);
1408 is_ampdu = is_ampdu_tx | is_ampdu_pending;
1409
1410 DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ac=%d, is_ampdu=%d\n",
1411 __func__, tid, pri, is_ampdu);
1412

--- 316 unchanged lines hidden (view full) ---

1729int
1730ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
1731 const struct ieee80211_bpf_params *params)
1732{
1733 struct ieee80211com *ic = ni->ni_ic;
1734 struct ifnet *ifp = ic->ic_ifp;
1735 struct ath_softc *sc = ifp->if_softc;
1736 struct ath_buf *bf;
1429 /* A-MPDU TX */
1430 is_ampdu_tx = ath_tx_ampdu_running(sc, ATH_NODE(ni), tid);
1431 is_ampdu_pending = ath_tx_ampdu_pending(sc, ATH_NODE(ni), tid);
1432 is_ampdu = is_ampdu_tx | is_ampdu_pending;
1433
1434 DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ac=%d, is_ampdu=%d\n",
1435 __func__, tid, pri, is_ampdu);
1436

--- 316 unchanged lines hidden (view full) ---

1753int
1754ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
1755 const struct ieee80211_bpf_params *params)
1756{
1757 struct ieee80211com *ic = ni->ni_ic;
1758 struct ifnet *ifp = ic->ic_ifp;
1759 struct ath_softc *sc = ifp->if_softc;
1760 struct ath_buf *bf;
1737 int error;
1761 struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *);
1762 struct ieee80211vap *vap = ni->ni_vap;
1763 struct ath_vap *avp = ATH_VAP(vap);
1764 int error = 0;
1738
1739 ATH_PCU_LOCK(sc);
1740 if (sc->sc_inreset_cnt > 0) {
1741 device_printf(sc->sc_dev, "%s: sc_inreset_cnt > 0; bailing\n",
1742 __func__);
1743 error = EIO;
1744 ATH_PCU_UNLOCK(sc);
1745 goto bad0;

--- 4 unchanged lines hidden (view full) ---

1750 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) {
1751 DPRINTF(sc, ATH_DEBUG_XMIT, "%s: discard frame, %s", __func__,
1752 (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ?
1753 "!running" : "invalid");
1754 m_freem(m);
1755 error = ENETDOWN;
1756 goto bad;
1757 }
1765
1766 ATH_PCU_LOCK(sc);
1767 if (sc->sc_inreset_cnt > 0) {
1768 device_printf(sc->sc_dev, "%s: sc_inreset_cnt > 0; bailing\n",
1769 __func__);
1770 error = EIO;
1771 ATH_PCU_UNLOCK(sc);
1772 goto bad0;

--- 4 unchanged lines hidden (view full) ---

1777 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) {
1778 DPRINTF(sc, ATH_DEBUG_XMIT, "%s: discard frame, %s", __func__,
1779 (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ?
1780 "!running" : "invalid");
1781 m_freem(m);
1782 error = ENETDOWN;
1783 goto bad;
1784 }
1785
1758 /*
1786 /*
1787 * Enforce how deep the multicast queue can grow.
1788 *
1789 * XXX duplicated in ath_tx_start().
1790 */
1791 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
1792 ATH_TXQ_LOCK(sc->sc_cabq);
1793 ATH_TXQ_LOCK(&avp->av_mcastq);
1794
1795 if ((sc->sc_cabq->axq_depth + avp->av_mcastq.axq_depth) >
1796 sc->sc_txq_mcastq_maxdepth) {
1797 sc->sc_stats.ast_tx_mcastq_overflow++;
1798 error = ENOBUFS;
1799 }
1800
1801 ATH_TXQ_UNLOCK(&avp->av_mcastq);
1802 ATH_TXQ_UNLOCK(sc->sc_cabq);
1803
1804 if (error != 0) {
1805 m_freem(m);
1806 goto bad;
1807 }
1808 }
1809
1810 /*
1759 * Grab a TX buffer and associated resources.
1760 */
1761 bf = ath_getbuf(sc);
1762 if (bf == NULL) {
1763 sc->sc_stats.ast_tx_nobuf++;
1764 m_freem(m);
1765 error = ENOBUFS;
1766 goto bad;

--- 2231 unchanged lines hidden ---
1811 * Grab a TX buffer and associated resources.
1812 */
1813 bf = ath_getbuf(sc);
1814 if (bf == NULL) {
1815 sc->sc_stats.ast_tx_nobuf++;
1816 m_freem(m);
1817 error = ENOBUFS;
1818 goto bad;

--- 2231 unchanged lines hidden ---