aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-14 09:20:10 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-17 16:19:23 -0500
commit28d167086227969fd6586953ee4ac682a3c394ff (patch)
treef4dc62f175cc3b934aeadb72375967aba27937bd /drivers
parentc5992618259598ade82c386aa1595bf105e92d1f (diff)
ath9k: clean up code duplication around ath_tx_start
Merge initial processing for the CAB queue and regular tx. Also move ath_tx_cabq() to beacon.c and make it static. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c25
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c67
4 files changed, 39 insertions, 73 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 3fecd03cfb23..711100793081 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -323,7 +323,6 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
323 struct ath_tx_control *txctl); 323 struct ath_tx_control *txctl);
324void ath_tx_tasklet(struct ath_softc *sc); 324void ath_tx_tasklet(struct ath_softc *sc);
325void ath_tx_edma_tasklet(struct ath_softc *sc); 325void ath_tx_edma_tasklet(struct ath_softc *sc);
326void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb);
327int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 326int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
328 u16 tid, u16 *ssn); 327 u16 tid, u16 *ssn);
329void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 328void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 2377376c8d4d..30724a4e8bb2 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -109,6 +109,25 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
109 series, 4, 0); 109 series, 4, 0);
110} 110}
111 111
112static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
113{
114 struct ath_wiphy *aphy = hw->priv;
115 struct ath_softc *sc = aphy->sc;
116 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
117 struct ath_tx_control txctl;
118
119 memset(&txctl, 0, sizeof(struct ath_tx_control));
120 txctl.txq = sc->beacon.cabq;
121
122 ath_print(common, ATH_DBG_XMIT,
123 "transmitting CABQ packet, skb: %p\n", skb);
124
125 if (ath_tx_start(hw, skb, &txctl) != 0) {
126 ath_print(common, ATH_DBG_XMIT, "CABQ TX failed\n");
127 dev_kfree_skb_any(skb);
128 }
129}
130
112static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw, 131static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,
113 struct ieee80211_vif *vif) 132 struct ieee80211_vif *vif)
114{ 133{
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index cfec2ad664d8..6e93a53c5e32 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1187,12 +1187,10 @@ mutex_unlock:
1187static int ath9k_tx(struct ieee80211_hw *hw, 1187static int ath9k_tx(struct ieee80211_hw *hw,
1188 struct sk_buff *skb) 1188 struct sk_buff *skb)
1189{ 1189{
1190 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1191 struct ath_wiphy *aphy = hw->priv; 1190 struct ath_wiphy *aphy = hw->priv;
1192 struct ath_softc *sc = aphy->sc; 1191 struct ath_softc *sc = aphy->sc;
1193 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1192 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1194 struct ath_tx_control txctl; 1193 struct ath_tx_control txctl;
1195 int padpos, padsize;
1196 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1194 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1197 1195
1198 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { 1196 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
@@ -1243,29 +1241,6 @@ static int ath9k_tx(struct ieee80211_hw *hw,
1243 } 1241 }
1244 1242
1245 memset(&txctl, 0, sizeof(struct ath_tx_control)); 1243 memset(&txctl, 0, sizeof(struct ath_tx_control));
1246
1247 /*
1248 * As a temporary workaround, assign seq# here; this will likely need
1249 * to be cleaned up to work better with Beacon transmission and virtual
1250 * BSSes.
1251 */
1252 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
1253 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
1254 sc->tx.seq_no += 0x10;
1255 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
1256 hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
1257 }
1258
1259 /* Add the padding after the header if this is not already done */
1260 padpos = ath9k_cmn_padpos(hdr->frame_control);
1261 padsize = padpos & 3;
1262 if (padsize && skb->len>padpos) {
1263 if (skb_headroom(skb) < padsize)
1264 return -1;
1265 skb_push(skb, padsize);
1266 memmove(skb->data, skb->data + padsize, padpos);
1267 }
1268
1269 txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; 1244 txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)];
1270 1245
1271 ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); 1246 ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb);
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index c35033f1a5e0..f3f0d1c6ad0a 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1742,41 +1742,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
1742int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, 1742int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
1743 struct ath_tx_control *txctl) 1743 struct ath_tx_control *txctl)
1744{ 1744{
1745 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1746 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1745 struct ath_wiphy *aphy = hw->priv; 1747 struct ath_wiphy *aphy = hw->priv;
1746 struct ath_softc *sc = aphy->sc; 1748 struct ath_softc *sc = aphy->sc;
1747 struct ath_txq *txq = txctl->txq; 1749 struct ath_txq *txq = txctl->txq;
1748 struct ath_buf *bf; 1750 struct ath_buf *bf;
1749 int q;
1750
1751 bf = ath_tx_setup_buffer(hw, skb);
1752 if (unlikely(!bf))
1753 return -ENOMEM;
1754
1755 q = skb_get_queue_mapping(skb);
1756 spin_lock_bh(&txq->axq_lock);
1757 if (txq == sc->tx.txq_map[q] &&
1758 ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
1759 ath_mac80211_stop_queue(sc, q);
1760 txq->stopped = 1;
1761 }
1762 spin_unlock_bh(&txq->axq_lock);
1763
1764 ath_tx_start_dma(sc, bf, txctl);
1765
1766 return 0;
1767}
1768
1769void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1770{
1771 struct ath_wiphy *aphy = hw->priv;
1772 struct ath_softc *sc = aphy->sc;
1773 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1774 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1775 int padpos, padsize; 1751 int padpos, padsize;
1776 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1752 int q;
1777 struct ath_tx_control txctl;
1778
1779 memset(&txctl, 0, sizeof(struct ath_tx_control));
1780 1753
1781 /* 1754 /*
1782 * As a temporary workaround, assign seq# here; this will likely need 1755 * As a temporary workaround, assign seq# here; this will likely need
@@ -1793,30 +1766,30 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1793 /* Add the padding after the header if this is not already done */ 1766 /* Add the padding after the header if this is not already done */
1794 padpos = ath9k_cmn_padpos(hdr->frame_control); 1767 padpos = ath9k_cmn_padpos(hdr->frame_control);
1795 padsize = padpos & 3; 1768 padsize = padpos & 3;
1796 if (padsize && skb->len>padpos) { 1769 if (padsize && skb->len > padpos) {
1797 if (skb_headroom(skb) < padsize) { 1770 if (skb_headroom(skb) < padsize)
1798 ath_print(common, ATH_DBG_XMIT, 1771 return -ENOMEM;
1799 "TX CABQ padding failed\n"); 1772
1800 dev_kfree_skb_any(skb);
1801 return;
1802 }
1803 skb_push(skb, padsize); 1773 skb_push(skb, padsize);
1804 memmove(skb->data, skb->data + padsize, padpos); 1774 memmove(skb->data, skb->data + padsize, padpos);
1805 } 1775 }
1806 1776
1807 txctl.txq = sc->beacon.cabq; 1777 bf = ath_tx_setup_buffer(hw, skb);
1808 1778 if (unlikely(!bf))
1809 ath_print(common, ATH_DBG_XMIT, 1779 return -ENOMEM;
1810 "transmitting CABQ packet, skb: %p\n", skb);
1811 1780
1812 if (ath_tx_start(hw, skb, &txctl) != 0) { 1781 q = skb_get_queue_mapping(skb);
1813 ath_print(common, ATH_DBG_XMIT, "CABQ TX failed\n"); 1782 spin_lock_bh(&txq->axq_lock);
1814 goto exit; 1783 if (txq == sc->tx.txq_map[q] &&
1784 ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
1785 ath_mac80211_stop_queue(sc, q);
1786 txq->stopped = 1;
1815 } 1787 }
1788 spin_unlock_bh(&txq->axq_lock);
1816 1789
1817 return; 1790 ath_tx_start_dma(sc, bf, txctl);
1818exit: 1791
1819 dev_kfree_skb_any(skb); 1792 return 0;
1820} 1793}
1821 1794
1822/*****************/ 1795/*****************/