aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2012-11-15 09:07:56 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-11-20 14:04:23 -0500
commite041f65d5f00011049c7d6af0e31ce69ce9e2655 (patch)
tree575d0269dd148287689806f1cf58d36e05fc7209 /drivers/net
parent32d0f12a1611421abf70ff7c30d76c739aafad64 (diff)
brcmsmac: Remove internal tx queue
The brcmsmac internal tx buffering is problematic. The amount of buffering is excessive (228 packets in addition to the 256 slots in each DMA ring), and frames may be dropped due to a lack of flow control. This patch reworks the transmit code path to remove the internal buffering. Frames are immediately handed off to the DMA support rather than passing through an intermediate queue. Non-aggregate frames are queued immediately into the tx rings, and aggregate frames are queued temporarily in an AMPDU session until ready for transmit. Transmit flow control is also added to avoid dropping packets when the tx rings are full. Conceptually this is a separate change, but it's included in this commit because removing the tx queue without adding flow control could cause significant problems. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Tested-by: Daniel Wagner <wagi@monom.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/ampdu.c167
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/ampdu.h3
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/dma.c189
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/dma.h9
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c459
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.h33
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/pub.h13
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/types.h1
8 files changed, 316 insertions, 558 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
index 0b4a490a0397..c62fd3d058b5 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
@@ -813,133 +813,6 @@ void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session)
813 session->ampdu_len); 813 session->ampdu_len);
814} 814}
815 815
816int
817brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
818 struct sk_buff **pdu, int prec)
819{
820 struct brcms_c_info *wlc;
821 struct sk_buff *p;
822 struct brcms_ampdu_session session;
823 int err = 0;
824 u8 tid;
825
826 uint count, fifo, seg_cnt = 0;
827 struct scb *scb;
828 struct scb_ampdu *scb_ampdu;
829 struct scb_ampdu_tid_ini *ini;
830 struct ieee80211_tx_info *tx_info;
831 u16 qlen;
832 struct wiphy *wiphy;
833
834 wlc = ampdu->wlc;
835 wiphy = wlc->wiphy;
836 p = *pdu;
837
838 tid = (u8) (p->priority);
839
840 scb = &wlc->pri_scb;
841 scb_ampdu = &scb->scb_ampdu;
842 ini = &scb_ampdu->ini[tid];
843
844 /* Let pressure continue to build ... */
845 qlen = pktq_plen(&qi->q, prec);
846 if (ini->tx_in_transit > 0 &&
847 qlen < min(scb_ampdu->max_pdu, ini->ba_wsize))
848 /* Collect multiple MPDU's to be sent in the next AMPDU */
849 return -EBUSY;
850
851 /* at this point we intend to transmit an AMPDU */
852 brcms_c_ampdu_reset_session(&session, wlc);
853
854 while (p) {
855 struct ieee80211_tx_rate *txrate;
856
857 tx_info = IEEE80211_SKB_CB(p);
858 txrate = tx_info->status.rates;
859
860 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
861 err = brcms_c_prep_pdu(wlc, p, &fifo);
862 } else {
863 wiphy_err(wiphy, "%s: AMPDU flag is off!\n", __func__);
864 *pdu = NULL;
865 err = 0;
866 break;
867 }
868
869 if (err) {
870 if (err == -EBUSY) {
871 wiphy_err(wiphy, "wl%d: sendampdu: "
872 "prep_xdu retry\n", wlc->pub->unit);
873 *pdu = p;
874 break;
875 }
876
877 /* error in the packet; reject it */
878 wiphy_err(wiphy, "wl%d: sendampdu: prep_xdu "
879 "rejected\n", wlc->pub->unit);
880 *pdu = NULL;
881 break;
882 }
883
884 err = brcms_c_ampdu_add_frame(&session, p);
885 if (err == -ENOSPC) {
886 /*
887 * No space for this packet in the AMPDU.
888 * Requeue packet and proceed;
889 */
890 *pdu = p;
891 break;
892 } else if (err) {
893 /* Unexpected error; reject packet */
894 wiphy_err(wiphy, "wl%d: sendampdu: add_frame rejected",
895 wlc->pub->unit);
896 *pdu = NULL;
897 break;
898 }
899
900 seg_cnt += 1;
901
902 /*
903 * check to see if the next pkt is
904 * a candidate for aggregation
905 */
906 p = pktq_ppeek(&qi->q, prec);
907 if (p) {
908 tx_info = IEEE80211_SKB_CB(p);
909 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
910 /*
911 * check if there are enough
912 * descriptors available
913 */
914 if (*wlc->core->txavail[fifo] <= seg_cnt + 1) {
915 wiphy_err(wiphy, "%s: No fifo space "
916 "!!\n", __func__);
917 p = NULL;
918 continue;
919 }
920 /* next packet fit for aggregation so dequeue */
921 p = brcmu_pktq_pdeq(&qi->q, prec);
922 } else {
923 p = NULL;
924 }
925 }
926 } /* end while(p) */
927
928 count = skb_queue_len(&session.skb_list);
929 ini->tx_in_transit += count;
930
931 if (count) {
932 /* patch up first and last txh's */
933 brcms_c_ampdu_finalize(&session);
934
935 while ((p = skb_dequeue(&session.skb_list)) != NULL)
936 brcms_c_txfifo(wlc, fifo, p,
937 skb_queue_empty(&session.skb_list));
938 }
939 /* endif (count) */
940 return err;
941}
942
943static void 816static void
944brcms_c_ampdu_rate_status(struct brcms_c_info *wlc, 817brcms_c_ampdu_rate_status(struct brcms_c_info *wlc,
945 struct ieee80211_tx_info *tx_info, 818 struct ieee80211_tx_info *tx_info,
@@ -1113,9 +986,16 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
1113 /* either retransmit or send bar if ack not recd */ 986 /* either retransmit or send bar if ack not recd */
1114 if (!ack_recd) { 987 if (!ack_recd) {
1115 if (retry && (ini->txretry[index] < (int)retry_limit)) { 988 if (retry && (ini->txretry[index] < (int)retry_limit)) {
989 int ret;
1116 ini->txretry[index]++; 990 ini->txretry[index]++;
1117 ini->tx_in_transit--; 991 ini->tx_in_transit--;
1118 brcms_c_txq_enq(wlc, scb, p); 992 ret = brcms_c_txfifo(wlc, queue, p);
993 /*
994 * We shouldn't be out of space in the DMA
995 * ring here since we're reinserting a frame
996 * that was just pulled out.
997 */
998 WARN_ONCE(ret, "queue %d out of txds\n", queue);
1119 } else { 999 } else {
1120 /* Retry timeout */ 1000 /* Retry timeout */
1121 ini->tx_in_transit--; 1001 ini->tx_in_transit--;
@@ -1142,12 +1022,9 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
1142 1022
1143 p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); 1023 p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
1144 } 1024 }
1145 brcms_c_send_q(wlc);
1146 1025
1147 /* update rate state */ 1026 /* update rate state */
1148 antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel); 1027 antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel);
1149
1150 brcms_c_txfifo_complete(wlc, queue);
1151} 1028}
1152 1029
1153void 1030void
@@ -1204,7 +1081,6 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
1204 p = dma_getnexttxp(wlc->hw->di[queue], 1081 p = dma_getnexttxp(wlc->hw->di[queue],
1205 DMA_RANGE_TRANSMITTED); 1082 DMA_RANGE_TRANSMITTED);
1206 } 1083 }
1207 brcms_c_txfifo_complete(wlc, queue);
1208 } 1084 }
1209} 1085}
1210 1086
@@ -1244,23 +1120,6 @@ void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
1244} 1120}
1245 1121
1246/* 1122/*
1247 * callback function that helps flushing ampdu packets from a priority queue
1248 */
1249static bool cb_del_ampdu_pkt(struct sk_buff *mpdu, void *arg_a)
1250{
1251 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(mpdu);
1252 struct cb_del_ampdu_pars *ampdu_pars =
1253 (struct cb_del_ampdu_pars *)arg_a;
1254 bool rc;
1255
1256 rc = tx_info->flags & IEEE80211_TX_CTL_AMPDU ? true : false;
1257 rc = rc && (tx_info->rate_driver_data[0] == NULL || ampdu_pars->sta == NULL ||
1258 tx_info->rate_driver_data[0] == ampdu_pars->sta);
1259 rc = rc && ((u8)(mpdu->priority) == ampdu_pars->tid);
1260 return rc;
1261}
1262
1263/*
1264 * callback function that helps invalidating ampdu packets in a DMA queue 1123 * callback function that helps invalidating ampdu packets in a DMA queue
1265 */ 1124 */
1266static void dma_cb_fn_ampdu(void *txi, void *arg_a) 1125static void dma_cb_fn_ampdu(void *txi, void *arg_a)
@@ -1280,15 +1139,5 @@ static void dma_cb_fn_ampdu(void *txi, void *arg_a)
1280void brcms_c_ampdu_flush(struct brcms_c_info *wlc, 1139void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
1281 struct ieee80211_sta *sta, u16 tid) 1140 struct ieee80211_sta *sta, u16 tid)
1282{ 1141{
1283 struct brcms_txq_info *qi = wlc->pkt_queue;
1284 struct pktq *pq = &qi->q;
1285 int prec;
1286 struct cb_del_ampdu_pars ampdu_pars;
1287
1288 ampdu_pars.sta = sta;
1289 ampdu_pars.tid = tid;
1290 for (prec = 0; prec < pq->num_prec; prec++)
1291 brcmu_pktq_pflush(pq, prec, true, cb_del_ampdu_pkt,
1292 (void *)&ampdu_pars);
1293 brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu); 1142 brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu);
1294} 1143}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h
index 9a94923f850e..73d01e586109 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h
@@ -45,9 +45,6 @@ extern void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session);
45 45
46extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); 46extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc);
47extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu); 47extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu);
48extern int brcms_c_sendampdu(struct ampdu_info *ampdu,
49 struct brcms_txq_info *qi,
50 struct sk_buff **aggp, int prec);
51extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, 48extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
52 struct sk_buff *p, struct tx_status *txs); 49 struct sk_buff *p, struct tx_status *txs);
53extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); 50extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 6444cf1a2eb8..426b9a977164 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -19,12 +19,17 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <net/cfg80211.h>
23#include <net/mac80211.h>
22 24
23#include <brcmu_utils.h> 25#include <brcmu_utils.h>
24#include <aiutils.h> 26#include <aiutils.h>
25#include "types.h" 27#include "types.h"
28#include "main.h"
26#include "dma.h" 29#include "dma.h"
27#include "soc.h" 30#include "soc.h"
31#include "scb.h"
32#include "ampdu.h"
28 33
29/* 34/*
30 * dma register field offset calculation 35 * dma register field offset calculation
@@ -230,6 +235,9 @@ struct dma_info {
230 struct bcma_device *core; 235 struct bcma_device *core;
231 struct device *dmadev; 236 struct device *dmadev;
232 237
238 /* session information for AMPDU */
239 struct brcms_ampdu_session ampdu_session;
240
233 bool dma64; /* this dma engine is operating in 64-bit mode */ 241 bool dma64; /* this dma engine is operating in 64-bit mode */
234 bool addrext; /* this dma engine supports DmaExtendedAddrChanges */ 242 bool addrext; /* this dma engine supports DmaExtendedAddrChanges */
235 243
@@ -564,12 +572,13 @@ static bool _dma_alloc(struct dma_info *di, uint direction)
564 return dma64_alloc(di, direction); 572 return dma64_alloc(di, direction);
565} 573}
566 574
567struct dma_pub *dma_attach(char *name, struct si_pub *sih, 575struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc,
568 struct bcma_device *core,
569 uint txregbase, uint rxregbase, uint ntxd, uint nrxd, 576 uint txregbase, uint rxregbase, uint ntxd, uint nrxd,
570 uint rxbufsize, int rxextheadroom, 577 uint rxbufsize, int rxextheadroom,
571 uint nrxpost, uint rxoffset, uint *msg_level) 578 uint nrxpost, uint rxoffset, uint *msg_level)
572{ 579{
580 struct si_pub *sih = wlc->hw->sih;
581 struct bcma_device *core = wlc->hw->d11core;
573 struct dma_info *di; 582 struct dma_info *di;
574 u8 rev = core->id.rev; 583 u8 rev = core->id.rev;
575 uint size; 584 uint size;
@@ -714,6 +723,9 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
714 } 723 }
715 } 724 }
716 725
726 /* Initialize AMPDU session */
727 brcms_c_ampdu_reset_session(&di->ampdu_session, wlc);
728
717 DMA_TRACE("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n", 729 DMA_TRACE("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n",
718 di->ddoffsetlow, di->ddoffsethigh, 730 di->ddoffsetlow, di->ddoffsethigh,
719 di->dataoffsetlow, di->dataoffsethigh, 731 di->dataoffsetlow, di->dataoffsethigh,
@@ -1016,6 +1028,17 @@ static bool dma64_rxidle(struct dma_info *di)
1016 D64_RS0_CD_MASK)); 1028 D64_RS0_CD_MASK));
1017} 1029}
1018 1030
1031static bool dma64_txidle(struct dma_info *di)
1032{
1033 if (di->ntxd == 0)
1034 return true;
1035
1036 return ((bcma_read32(di->core,
1037 DMA64TXREGOFFS(di, status0)) & D64_XS0_CD_MASK) ==
1038 (bcma_read32(di->core, DMA64TXREGOFFS(di, ptr)) &
1039 D64_XS0_CD_MASK));
1040}
1041
1019/* 1042/*
1020 * post receive buffers 1043 * post receive buffers
1021 * return false is refill failed completely and ring is empty this will stall 1044 * return false is refill failed completely and ring is empty this will stall
@@ -1264,50 +1287,25 @@ bool dma_rxreset(struct dma_pub *pub)
1264 return status == D64_RS0_RS_DISABLED; 1287 return status == D64_RS0_RS_DISABLED;
1265} 1288}
1266 1289
1267/* Update count of available tx descriptors based on current DMA state */ 1290static void dma_txenq(struct dma_info *di, struct sk_buff *p)
1268static void dma_update_txavail(struct dma_info *di)
1269{ 1291{
1270 /*
1271 * Available space is number of descriptors less the number of
1272 * active descriptors and the number of queued AMPDU frames.
1273 */
1274 di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1;
1275}
1276
1277
1278/*
1279 * !! tx entry routine
1280 * WARNING: call must check the return value for error.
1281 * the error(toss frames) could be fatal and cause many subsequent hard
1282 * to debug problems
1283 */
1284int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)
1285{
1286 struct dma_info *di = (struct dma_info *)pub;
1287 unsigned char *data; 1292 unsigned char *data;
1288 uint len; 1293 uint len;
1289 u16 txout; 1294 u16 txout;
1290 u32 flags = 0; 1295 u32 flags = 0;
1291 dma_addr_t pa; 1296 dma_addr_t pa;
1292 1297
1293 DMA_TRACE("%s:\n", di->name);
1294
1295 txout = di->txout; 1298 txout = di->txout;
1296 1299
1300 if (WARN_ON(nexttxd(di, txout) == di->txin))
1301 return;
1302
1297 /* 1303 /*
1298 * obtain and initialize transmit descriptor entry. 1304 * obtain and initialize transmit descriptor entry.
1299 */ 1305 */
1300 data = p->data; 1306 data = p->data;
1301 len = p->len; 1307 len = p->len;
1302 1308
1303 /* no use to transmit a zero length packet */
1304 if (len == 0)
1305 return 0;
1306
1307 /* return nonzero if out of tx descriptors */
1308 if (nexttxd(di, txout) == di->txin)
1309 goto outoftxd;
1310
1311 /* get physical address of buffer start */ 1309 /* get physical address of buffer start */
1312 pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); 1310 pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE);
1313 1311
@@ -1329,15 +1327,106 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)
1329 1327
1330 /* bump the tx descriptor index */ 1328 /* bump the tx descriptor index */
1331 di->txout = txout; 1329 di->txout = txout;
1330}
1332 1331
1333 /* kick the chip */ 1332static void ampdu_finalize(struct dma_info *di)
1334 if (commit) 1333{
1335 bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), 1334 struct brcms_ampdu_session *session = &di->ampdu_session;
1336 di->xmtptrbase + I2B(txout, struct dma64desc)); 1335 struct sk_buff *p;
1336
1337 if (WARN_ON(skb_queue_empty(&session->skb_list)))
1338 return;
1339
1340 brcms_c_ampdu_finalize(session);
1341
1342 while (!skb_queue_empty(&session->skb_list)) {
1343 p = skb_dequeue(&session->skb_list);
1344 dma_txenq(di, p);
1345 }
1346
1347 bcma_write32(di->core, DMA64TXREGOFFS(di, ptr),
1348 di->xmtptrbase + I2B(di->txout, struct dma64desc));
1349 brcms_c_ampdu_reset_session(session, session->wlc);
1350}
1351
1352static void prep_ampdu_frame(struct dma_info *di, struct sk_buff *p)
1353{
1354 struct brcms_ampdu_session *session = &di->ampdu_session;
1355 int ret;
1356
1357 ret = brcms_c_ampdu_add_frame(session, p);
1358 if (ret == -ENOSPC) {
1359 /*
1360 * AMPDU cannot accomodate this frame. Close out the in-
1361 * progress AMPDU session and start a new one.
1362 */
1363 ampdu_finalize(di);
1364 ret = brcms_c_ampdu_add_frame(session, p);
1365 }
1366
1367 WARN_ON(ret);
1368}
1369
1370/* Update count of available tx descriptors based on current DMA state */
1371static void dma_update_txavail(struct dma_info *di)
1372{
1373 /*
1374 * Available space is number of descriptors less the number of
1375 * active descriptors and the number of queued AMPDU frames.
1376 */
1377 di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) -
1378 skb_queue_len(&di->ampdu_session.skb_list) - 1;
1379}
1380
1381/*
1382 * !! tx entry routine
1383 * WARNING: call must check the return value for error.
1384 * the error(toss frames) could be fatal and cause many subsequent hard
1385 * to debug problems
1386 */
1387int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub,
1388 struct sk_buff *p)
1389{
1390 struct dma_info *di = (struct dma_info *)pub;
1391 struct brcms_ampdu_session *session = &di->ampdu_session;
1392 struct ieee80211_tx_info *tx_info;
1393 bool is_ampdu;
1394
1395 DMA_TRACE("%s:\n", di->name);
1396
1397 /* no use to transmit a zero length packet */
1398 if (p->len == 0)
1399 return 0;
1400
1401 /* return nonzero if out of tx descriptors */
1402 if (di->dma.txavail == 0 || nexttxd(di, di->txout) == di->txin)
1403 goto outoftxd;
1404
1405 tx_info = IEEE80211_SKB_CB(p);
1406 is_ampdu = tx_info->flags & IEEE80211_TX_CTL_AMPDU;
1407 if (is_ampdu)
1408 prep_ampdu_frame(di, p);
1409 else
1410 dma_txenq(di, p);
1337 1411
1338 /* tx flow control */ 1412 /* tx flow control */
1339 dma_update_txavail(di); 1413 dma_update_txavail(di);
1340 1414
1415 /* kick the chip */
1416 if (is_ampdu) {
1417 /*
1418 * Start sending data if we've got a full AMPDU, there's
1419 * no more space in the DMA ring, or the ring isn't
1420 * currently transmitting.
1421 */
1422 if (skb_queue_len(&session->skb_list) == session->max_ampdu_frames ||
1423 di->dma.txavail == 0 || dma64_txidle(di))
1424 ampdu_finalize(di);
1425 } else {
1426 bcma_write32(di->core, DMA64TXREGOFFS(di, ptr),
1427 di->xmtptrbase + I2B(di->txout, struct dma64desc));
1428 }
1429
1341 return 0; 1430 return 0;
1342 1431
1343 outoftxd: 1432 outoftxd:
@@ -1345,7 +1434,35 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)
1345 brcmu_pkt_buf_free_skb(p); 1434 brcmu_pkt_buf_free_skb(p);
1346 di->dma.txavail = 0; 1435 di->dma.txavail = 0;
1347 di->dma.txnobuf++; 1436 di->dma.txnobuf++;
1348 return -1; 1437 return -ENOSPC;
1438}
1439
1440void dma_txflush(struct dma_pub *pub)
1441{
1442 struct dma_info *di = (struct dma_info *)pub;
1443 struct brcms_ampdu_session *session = &di->ampdu_session;
1444
1445 if (!skb_queue_empty(&session->skb_list))
1446 ampdu_finalize(di);
1447}
1448
1449int dma_txpending(struct dma_pub *pub)
1450{
1451 struct dma_info *di = (struct dma_info *)pub;
1452 return ntxdactive(di, di->txin, di->txout);
1453}
1454
1455/*
1456 * If we have an active AMPDU session and are not transmitting,
1457 * this function will force tx to start.
1458 */
1459void dma_kick_tx(struct dma_pub *pub)
1460{
1461 struct dma_info *di = (struct dma_info *)pub;
1462 struct brcms_ampdu_session *session = &di->ampdu_session;
1463
1464 if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di))
1465 ampdu_finalize(di);
1349} 1466}
1350 1467
1351/* 1468/*
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.h b/drivers/net/wireless/brcm80211/brcmsmac/dma.h
index cc269ee5c499..459abf13924a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.h
@@ -74,8 +74,7 @@ struct dma_pub {
74 uint txnobuf; /* tx out of dma descriptors */ 74 uint txnobuf; /* tx out of dma descriptors */
75}; 75};
76 76
77extern struct dma_pub *dma_attach(char *name, struct si_pub *sih, 77extern struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc,
78 struct bcma_device *d11core,
79 uint txregbase, uint rxregbase, 78 uint txregbase, uint rxregbase,
80 uint ntxd, uint nrxd, 79 uint ntxd, uint nrxd,
81 uint rxbufsize, int rxextheadroom, 80 uint rxbufsize, int rxextheadroom,
@@ -87,7 +86,11 @@ bool dma_rxfill(struct dma_pub *pub);
87bool dma_rxreset(struct dma_pub *pub); 86bool dma_rxreset(struct dma_pub *pub);
88bool dma_txreset(struct dma_pub *pub); 87bool dma_txreset(struct dma_pub *pub);
89void dma_txinit(struct dma_pub *pub); 88void dma_txinit(struct dma_pub *pub);
90int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit); 89int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub,
90 struct sk_buff *p0);
91void dma_txflush(struct dma_pub *pub);
92int dma_txpending(struct dma_pub *pub);
93void dma_kick_tx(struct dma_pub *pub);
91void dma_txsuspend(struct dma_pub *pub); 94void dma_txsuspend(struct dma_pub *pub);
92bool dma_txsuspended(struct dma_pub *pub); 95bool dma_txsuspended(struct dma_pub *pub);
93void dma_txresume(struct dma_pub *pub); 96void dma_txresume(struct dma_pub *pub);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index eebbe3024eba..5710dc0d93be 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -34,6 +34,7 @@
34#include "ucode_loader.h" 34#include "ucode_loader.h"
35#include "main.h" 35#include "main.h"
36#include "soc.h" 36#include "soc.h"
37#include "dma.h"
37 38
38/* watchdog timer, in unit of ms */ 39/* watchdog timer, in unit of ms */
39#define TIMER_INTERVAL_WATCHDOG 1000 40#define TIMER_INTERVAL_WATCHDOG 1000
@@ -236,12 +237,12 @@
236/* Max # of entries in Rx FIFO based on 4kb page size */ 237/* Max # of entries in Rx FIFO based on 4kb page size */
237#define NRXD 256 238#define NRXD 256
238 239
240/* Amount of headroom to leave in Tx FIFO */
241#define TX_HEADROOM 4
242
239/* try to keep this # rbufs posted to the chip */ 243/* try to keep this # rbufs posted to the chip */
240#define NRXBUFPOST 32 244#define NRXBUFPOST 32
241 245
242/* data msg txq hiwat mark */
243#define BRCMS_DATAHIWAT 50
244
245/* max # frames to process in brcms_c_recv() */ 246/* max # frames to process in brcms_c_recv() */
246#define RXBND 8 247#define RXBND 8
247/* max # tx status to process in wlc_txstatus() */ 248/* max # tx status to process in wlc_txstatus() */
@@ -303,6 +304,18 @@ static const u8 wme_ac2fifo[] = {
303 TX_AC_BK_FIFO 304 TX_AC_BK_FIFO
304}; 305};
305 306
307/* 802.1D Priority to precedence queue mapping */
308const u8 wlc_prio2prec_map[] = {
309 _BRCMS_PREC_BE, /* 0 BE - Best-effort */
310 _BRCMS_PREC_BK, /* 1 BK - Background */
311 _BRCMS_PREC_NONE, /* 2 None = - */
312 _BRCMS_PREC_EE, /* 3 EE - Excellent-effort */
313 _BRCMS_PREC_CL, /* 4 CL - Controlled Load */
314 _BRCMS_PREC_VI, /* 5 Vi - Video */
315 _BRCMS_PREC_VO, /* 6 Vo - Voice */
316 _BRCMS_PREC_NC, /* 7 NC - Network Control */
317};
318
306static const u16 xmtfifo_sz[][NFIFO] = { 319static const u16 xmtfifo_sz[][NFIFO] = {
307 /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */ 320 /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */
308 {20, 192, 192, 21, 17, 5}, 321 {20, 192, 192, 21, 17, 5},
@@ -350,6 +363,14 @@ static const u8 ac_to_fifo_mapping[IEEE80211_NUM_ACS] = {
350 [IEEE80211_AC_BK] = TX_AC_BK_FIFO, 363 [IEEE80211_AC_BK] = TX_AC_BK_FIFO,
351}; 364};
352 365
366/* Mapping of tx fifos to ieee80211 AC numbers */
367static const u8 fifo_to_ac_mapping[IEEE80211_NUM_ACS] = {
368 [TX_AC_BK_FIFO] = IEEE80211_AC_BK,
369 [TX_AC_BE_FIFO] = IEEE80211_AC_BE,
370 [TX_AC_VI_FIFO] = IEEE80211_AC_VI,
371 [TX_AC_VO_FIFO] = IEEE80211_AC_VO,
372};
373
353static u8 brcms_ac_to_fifo(u8 ac) 374static u8 brcms_ac_to_fifo(u8 ac)
354{ 375{
355 if (ac >= ARRAY_SIZE(ac_to_fifo_mapping)) 376 if (ac >= ARRAY_SIZE(ac_to_fifo_mapping))
@@ -357,6 +378,13 @@ static u8 brcms_ac_to_fifo(u8 ac)
357 return ac_to_fifo_mapping[ac]; 378 return ac_to_fifo_mapping[ac];
358} 379}
359 380
381static u8 brcms_fifo_to_ac(u8 fifo)
382{
383 if (fifo >= ARRAY_SIZE(fifo_to_ac_mapping))
384 return IEEE80211_AC_BE;
385 return fifo_to_ac_mapping[fifo];
386}
387
360/* Find basic rate for a given rate */ 388/* Find basic rate for a given rate */
361static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec) 389static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec)
362{ 390{
@@ -401,10 +429,15 @@ static bool brcms_deviceremoved(struct brcms_c_info *wlc)
401} 429}
402 430
403/* sum the individual fifo tx pending packet counts */ 431/* sum the individual fifo tx pending packet counts */
404static s16 brcms_txpktpendtot(struct brcms_c_info *wlc) 432static int brcms_txpktpendtot(struct brcms_c_info *wlc)
405{ 433{
406 return wlc->core->txpktpend[0] + wlc->core->txpktpend[1] + 434 int i;
407 wlc->core->txpktpend[2] + wlc->core->txpktpend[3]; 435 int pending = 0;
436
437 for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++)
438 if (wlc->hw->di[i])
439 pending += dma_txpending(wlc->hw->di[i]);
440 return pending;
408} 441}
409 442
410static bool brcms_is_mband_unlocked(struct brcms_c_info *wlc) 443static bool brcms_is_mband_unlocked(struct brcms_c_info *wlc)
@@ -827,8 +860,9 @@ static u32 brcms_c_setband_inact(struct brcms_c_info *wlc, uint bandunit)
827static bool 860static bool
828brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) 861brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
829{ 862{
830 struct sk_buff *p; 863 struct sk_buff *p = NULL;
831 uint queue; 864 uint queue = NFIFO;
865 struct dma_pub *dma = NULL;
832 struct d11txh *txh; 866 struct d11txh *txh;
833 struct scb *scb = NULL; 867 struct scb *scb = NULL;
834 bool free_pdu; 868 bool free_pdu;
@@ -840,6 +874,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
840 struct ieee80211_tx_info *tx_info; 874 struct ieee80211_tx_info *tx_info;
841 struct ieee80211_tx_rate *txrate; 875 struct ieee80211_tx_rate *txrate;
842 int i; 876 int i;
877 bool fatal = true;
843 878
844 /* discard intermediate indications for ucode with one legitimate case: 879 /* discard intermediate indications for ucode with one legitimate case:
845 * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, 880 * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
@@ -849,18 +884,19 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
849 if (!(txs->status & TX_STATUS_AMPDU) 884 if (!(txs->status & TX_STATUS_AMPDU)
850 && (txs->status & TX_STATUS_INTERMEDIATE)) { 885 && (txs->status & TX_STATUS_INTERMEDIATE)) {
851 BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); 886 BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n");
852 return false; 887 fatal = false;
888 goto out;
853 } 889 }
854 890
855 queue = txs->frameid & TXFID_QUEUE_MASK; 891 queue = txs->frameid & TXFID_QUEUE_MASK;
856 if (queue >= NFIFO) { 892 if (queue >= NFIFO)
857 p = NULL; 893 goto out;
858 goto fatal; 894
859 } 895 dma = wlc->hw->di[queue];
860 896
861 p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); 897 p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
862 if (p == NULL) 898 if (p == NULL)
863 goto fatal; 899 goto out;
864 900
865 txh = (struct d11txh *) (p->data); 901 txh = (struct d11txh *) (p->data);
866 mcl = le16_to_cpu(txh->MacTxControlLow); 902 mcl = le16_to_cpu(txh->MacTxControlLow);
@@ -875,7 +911,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
875 } 911 }
876 912
877 if (txs->frameid != le16_to_cpu(txh->TxFrameID)) 913 if (txs->frameid != le16_to_cpu(txh->TxFrameID))
878 goto fatal; 914 goto out;
879 tx_info = IEEE80211_SKB_CB(p); 915 tx_info = IEEE80211_SKB_CB(p);
880 h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); 916 h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
881 917
@@ -884,7 +920,8 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
884 920
885 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { 921 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
886 brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); 922 brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
887 return false; 923 fatal = false;
924 goto out;
888 } 925 }
889 926
890 supr_status = txs->status & TX_STATUS_SUPR_MASK; 927 supr_status = txs->status & TX_STATUS_SUPR_MASK;
@@ -968,8 +1005,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
968 totlen = p->len; 1005 totlen = p->len;
969 free_pdu = true; 1006 free_pdu = true;
970 1007
971 brcms_c_txfifo_complete(wlc, queue);
972
973 if (lastframe) { 1008 if (lastframe) {
974 /* remove PLCP & Broadcom tx descriptor header */ 1009 /* remove PLCP & Broadcom tx descriptor header */
975 skb_pull(p, D11_PHY_HDR_LEN); 1010 skb_pull(p, D11_PHY_HDR_LEN);
@@ -980,14 +1015,21 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
980 "tx_status\n", __func__); 1015 "tx_status\n", __func__);
981 } 1016 }
982 1017
983 return false; 1018 fatal = false;
984 1019
985 fatal: 1020 out:
986 if (p) 1021 if (fatal && p)
987 brcmu_pkt_buf_free_skb(p); 1022 brcmu_pkt_buf_free_skb(p);
988 1023
989 return true; 1024 if (dma && queue < NFIFO) {
1025 u16 ac_queue = brcms_fifo_to_ac(queue);
1026 if (dma->txavail > TX_HEADROOM && queue < TX_BCMC_FIFO &&
1027 ieee80211_queue_stopped(wlc->pub->ieee_hw, ac_queue))
1028 ieee80211_wake_queue(wlc->pub->ieee_hw, ac_queue);
1029 dma_kick_tx(dma);
1030 }
990 1031
1032 return fatal;
991} 1033}
992 1034
993/* process tx completion events in BMAC 1035/* process tx completion events in BMAC
@@ -1044,9 +1086,6 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
1044 if (n >= max_tx_num) 1086 if (n >= max_tx_num)
1045 morepending = true; 1087 morepending = true;
1046 1088
1047 if (!pktq_empty(&wlc->pkt_queue->q))
1048 brcms_c_send_q(wlc);
1049
1050 return morepending; 1089 return morepending;
1051} 1090}
1052 1091
@@ -1111,7 +1150,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
1111 * TX: TX_AC_BK_FIFO (TX AC Background data packets) 1150 * TX: TX_AC_BK_FIFO (TX AC Background data packets)
1112 * RX: RX_FIFO (RX data packets) 1151 * RX: RX_FIFO (RX data packets)
1113 */ 1152 */
1114 wlc_hw->di[0] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, 1153 wlc_hw->di[0] = dma_attach(name, wlc,
1115 (wme ? dmareg(DMA_TX, 0) : 0), 1154 (wme ? dmareg(DMA_TX, 0) : 0),
1116 dmareg(DMA_RX, 0), 1155 dmareg(DMA_RX, 0),
1117 (wme ? NTXD : 0), NRXD, 1156 (wme ? NTXD : 0), NRXD,
@@ -1125,7 +1164,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
1125 * (legacy) TX_DATA_FIFO (TX data packets) 1164 * (legacy) TX_DATA_FIFO (TX data packets)
1126 * RX: UNUSED 1165 * RX: UNUSED
1127 */ 1166 */
1128 wlc_hw->di[1] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, 1167 wlc_hw->di[1] = dma_attach(name, wlc,
1129 dmareg(DMA_TX, 1), 0, 1168 dmareg(DMA_TX, 1), 0,
1130 NTXD, 0, 0, -1, 0, 0, 1169 NTXD, 0, 0, -1, 0, 0,
1131 &brcm_msg_level); 1170 &brcm_msg_level);
@@ -1136,7 +1175,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
1136 * TX: TX_AC_VI_FIFO (TX AC Video data packets) 1175 * TX: TX_AC_VI_FIFO (TX AC Video data packets)
1137 * RX: UNUSED 1176 * RX: UNUSED
1138 */ 1177 */
1139 wlc_hw->di[2] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, 1178 wlc_hw->di[2] = dma_attach(name, wlc,
1140 dmareg(DMA_TX, 2), 0, 1179 dmareg(DMA_TX, 2), 0,
1141 NTXD, 0, 0, -1, 0, 0, 1180 NTXD, 0, 0, -1, 0, 0,
1142 &brcm_msg_level); 1181 &brcm_msg_level);
@@ -1146,7 +1185,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
1146 * TX: TX_AC_VO_FIFO (TX AC Voice data packets) 1185 * TX: TX_AC_VO_FIFO (TX AC Voice data packets)
1147 * (legacy) TX_CTL_FIFO (TX control & mgmt packets) 1186 * (legacy) TX_CTL_FIFO (TX control & mgmt packets)
1148 */ 1187 */
1149 wlc_hw->di[3] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, 1188 wlc_hw->di[3] = dma_attach(name, wlc,
1150 dmareg(DMA_TX, 3), 1189 dmareg(DMA_TX, 3),
1151 0, NTXD, 0, 0, -1, 1190 0, NTXD, 0, 0, -1,
1152 0, 0, &brcm_msg_level); 1191 0, 0, &brcm_msg_level);
@@ -2870,12 +2909,14 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc)
2870 uint i; 2909 uint i;
2871 2910
2872 /* free any posted tx packets */ 2911 /* free any posted tx packets */
2873 for (i = 0; i < NFIFO; i++) 2912 for (i = 0; i < NFIFO; i++) {
2874 if (wlc_hw->di[i]) { 2913 if (wlc_hw->di[i]) {
2875 dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); 2914 dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL);
2876 wlc->core->txpktpend[i] = 0; 2915 if (i < TX_BCMC_FIFO)
2877 BCMMSG(wlc->wiphy, "pktpend fifo %d clrd\n", i); 2916 ieee80211_wake_queue(wlc->pub->ieee_hw,
2917 brcms_fifo_to_ac(i));
2878 } 2918 }
2919 }
2879 2920
2880 /* free any posted rx packets */ 2921 /* free any posted rx packets */
2881 dma_rxreclaim(wlc_hw->di[RX_FIFO]); 2922 dma_rxreclaim(wlc_hw->di[RX_FIFO]);
@@ -3738,15 +3779,6 @@ brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM,
3738 return 0; 3779 return 0;
3739} 3780}
3740 3781
3741/*
3742 * Initialize the base precedence map for dequeueing
3743 * from txq based on WME settings
3744 */
3745static void brcms_c_tx_prec_map_init(struct brcms_c_info *wlc)
3746{
3747 wlc->tx_prec_map = BRCMS_PREC_BMP_ALL;
3748}
3749
3750/* push sw hps and wake state through hardware */ 3782/* push sw hps and wake state through hardware */
3751static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc) 3783static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)
3752{ 3784{
@@ -4797,56 +4829,6 @@ static void brcms_c_bss_default_init(struct brcms_c_info *wlc)
4797 bi->flags |= BRCMS_BSS_HT; 4829 bi->flags |= BRCMS_BSS_HT;
4798} 4830}
4799 4831
4800static struct brcms_txq_info *brcms_c_txq_alloc(struct brcms_c_info *wlc)
4801{
4802 struct brcms_txq_info *qi, *p;
4803
4804 qi = kzalloc(sizeof(struct brcms_txq_info), GFP_ATOMIC);
4805 if (qi != NULL) {
4806 /*
4807 * Have enough room for control packets along with HI watermark
4808 * Also, add room to txq for total psq packets if all the SCBs
4809 * leave PS mode. The watermark for flowcontrol to OS packets
4810 * will remain the same
4811 */
4812 brcmu_pktq_init(&qi->q, BRCMS_PREC_COUNT,
4813 2 * BRCMS_DATAHIWAT + PKTQ_LEN_DEFAULT);
4814
4815 /* add this queue to the the global list */
4816 p = wlc->tx_queues;
4817 if (p == NULL) {
4818 wlc->tx_queues = qi;
4819 } else {
4820 while (p->next != NULL)
4821 p = p->next;
4822 p->next = qi;
4823 }
4824 }
4825 return qi;
4826}
4827
4828static void brcms_c_txq_free(struct brcms_c_info *wlc,
4829 struct brcms_txq_info *qi)
4830{
4831 struct brcms_txq_info *p;
4832
4833 if (qi == NULL)
4834 return;
4835
4836 /* remove the queue from the linked list */
4837 p = wlc->tx_queues;
4838 if (p == qi)
4839 wlc->tx_queues = p->next;
4840 else {
4841 while (p != NULL && p->next != qi)
4842 p = p->next;
4843 if (p != NULL)
4844 p->next = p->next->next;
4845 }
4846
4847 kfree(qi);
4848}
4849
4850static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap) 4832static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap)
4851{ 4833{
4852 uint i; 4834 uint i;
@@ -4966,10 +4948,6 @@ uint brcms_c_detach(struct brcms_c_info *wlc)
4966 4948
4967 brcms_c_detach_module(wlc); 4949 brcms_c_detach_module(wlc);
4968 4950
4969
4970 while (wlc->tx_queues != NULL)
4971 brcms_c_txq_free(wlc, wlc->tx_queues);
4972
4973 brcms_c_detach_mfree(wlc); 4951 brcms_c_detach_mfree(wlc);
4974 return callbacks; 4952 return callbacks;
4975} 4953}
@@ -5275,7 +5253,6 @@ uint brcms_c_down(struct brcms_c_info *wlc)
5275 uint callbacks = 0; 5253 uint callbacks = 0;
5276 int i; 5254 int i;
5277 bool dev_gone = false; 5255 bool dev_gone = false;
5278 struct brcms_txq_info *qi;
5279 5256
5280 BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); 5257 BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
5281 5258
@@ -5314,10 +5291,6 @@ uint brcms_c_down(struct brcms_c_info *wlc)
5314 5291
5315 wlc_phy_mute_upd(wlc->band->pi, false, PHY_MUTE_ALL); 5292 wlc_phy_mute_upd(wlc->band->pi, false, PHY_MUTE_ALL);
5316 5293
5317 /* flush tx queues */
5318 for (qi = wlc->tx_queues; qi != NULL; qi = qi->next)
5319 brcmu_pktq_flush(&qi->q, true, NULL, NULL);
5320
5321 callbacks += brcms_b_down_finish(wlc->hw); 5294 callbacks += brcms_b_down_finish(wlc->hw);
5322 5295
5323 /* brcms_b_down_finish has done brcms_c_coredisable(). so clk is off */ 5296 /* brcms_b_down_finish has done brcms_c_coredisable(). so clk is off */
@@ -5991,85 +5964,6 @@ u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate)
5991 return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); 5964 return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2));
5992} 5965}
5993 5966
5994static bool
5995brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q,
5996 struct sk_buff *pkt, int prec, bool head)
5997{
5998 struct sk_buff *p;
5999 int eprec = -1; /* precedence to evict from */
6000
6001 /* Determine precedence from which to evict packet, if any */
6002 if (pktq_pfull(q, prec))
6003 eprec = prec;
6004 else if (pktq_full(q)) {
6005 p = brcmu_pktq_peek_tail(q, &eprec);
6006 if (eprec > prec) {
6007 wiphy_err(wlc->wiphy, "%s: Failing: eprec %d > prec %d"
6008 "\n", __func__, eprec, prec);
6009 return false;
6010 }
6011 }
6012
6013 /* Evict if needed */
6014 if (eprec >= 0) {
6015 bool discard_oldest;
6016
6017 discard_oldest = ac_bitmap_tst(0, eprec);
6018
6019 /* Refuse newer packet unless configured to discard oldest */
6020 if (eprec == prec && !discard_oldest) {
6021 wiphy_err(wlc->wiphy, "%s: No where to go, prec == %d"
6022 "\n", __func__, prec);
6023 return false;
6024 }
6025
6026 /* Evict packet according to discard policy */
6027 p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
6028 brcmu_pktq_pdeq_tail(q, eprec);
6029 brcmu_pkt_buf_free_skb(p);
6030 }
6031
6032 /* Enqueue */
6033 if (head)
6034 p = brcmu_pktq_penq_head(q, prec, pkt);
6035 else
6036 p = brcmu_pktq_penq(q, prec, pkt);
6037
6038 return true;
6039}
6040
6041/*
6042 * Attempts to queue a packet onto a multiple-precedence queue,
6043 * if necessary evicting a lower precedence packet from the queue.
6044 *
6045 * 'prec' is the precedence number that has already been mapped
6046 * from the packet priority.
6047 *
6048 * Returns true if packet consumed (queued), false if not.
6049 */
6050static bool brcms_c_prec_enq(struct brcms_c_info *wlc, struct pktq *q,
6051 struct sk_buff *pkt, int prec)
6052{
6053 return brcms_c_prec_enq_head(wlc, q, pkt, prec, false);
6054}
6055
6056void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
6057 struct sk_buff *sdu)
6058{
6059 struct brcms_txq_info *qi = wlc->pkt_queue; /* Check me */
6060 struct pktq *q = &qi->q;
6061 uint prec;
6062
6063 prec = brcms_ac_to_fifo(skb_get_queue_mapping(sdu));
6064 if (!brcms_c_prec_enq(wlc, q, sdu, prec)) {
6065 /*
6066 * we might hit this condtion in case
6067 * packet flooding from mac80211 stack
6068 */
6069 brcmu_pkt_buf_free_skb(sdu);
6070 }
6071}
6072
6073/* 5967/*
6074 * bcmc_fid_generate: 5968 * bcmc_fid_generate:
6075 * Generate frame ID for a BCMC packet. The frag field is not used 5969 * Generate frame ID for a BCMC packet. The frag field is not used
@@ -7230,70 +7124,33 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
7230 return 0; 7124 return 0;
7231} 7125}
7232 7126
7233void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, 7127static int brcms_c_tx(struct brcms_c_info *wlc, struct sk_buff *skb)
7234 struct ieee80211_hw *hw)
7235{ 7128{
7236 uint fifo; 7129 struct dma_pub *dma;
7237 struct scb *scb = &wlc->pri_scb; 7130 int fifo, ret = -ENOSPC;
7238 7131 struct d11txh *txh;
7239 fifo = brcms_ac_to_fifo(skb_get_queue_mapping(sdu)); 7132 u16 frameid = INVALIDFID;
7240 if (brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0))
7241 return;
7242 brcms_c_txq_enq(wlc, scb, sdu);
7243 brcms_c_send_q(wlc);
7244}
7245
7246void brcms_c_send_q(struct brcms_c_info *wlc)
7247{
7248 struct sk_buff *pkt[DOT11_MAXNUMFRAGS];
7249 int prec;
7250 u16 prec_map;
7251 int err = 0, i, count;
7252 uint fifo;
7253 struct brcms_txq_info *qi = wlc->pkt_queue;
7254 struct pktq *q = &qi->q;
7255 struct ieee80211_tx_info *tx_info;
7256 7133
7257 prec_map = wlc->tx_prec_map; 7134 fifo = brcms_ac_to_fifo(skb_get_queue_mapping(skb));
7135 dma = wlc->hw->di[fifo];
7136 txh = (struct d11txh *)(skb->data);
7258 7137
7259 /* Send all the enq'd pkts that we can. 7138 if (dma->txavail == 0) {
7260 * Dequeue packets with precedence with empty HW fifo only 7139 /*
7261 */ 7140 * We sometimes get a frame from mac80211 after stopping
7262 while (prec_map && (pkt[0] = brcmu_pktq_mdeq(q, prec_map, &prec))) { 7141 * the queues. This only ever seems to be a single frame
7263 tx_info = IEEE80211_SKB_CB(pkt[0]); 7142 * and is seems likely to be a race. TX_HEADROOM should
7264 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { 7143 * ensure that we have enough space to handle these stray
7265 err = brcms_c_sendampdu(wlc->ampdu, qi, pkt, prec); 7144 * packets, so warn if there isn't. If we're out of space
7266 } else { 7145 * in the tx ring and the tx queue isn't stopped then
7267 count = 1; 7146 * we've really got a bug; warn loudly if that happens.
7268 err = brcms_c_prep_pdu(wlc, pkt[0], &fifo); 7147 */
7269 if (!err) { 7148 wiphy_warn(wlc->wiphy,
7270 for (i = 0; i < count; i++) 7149 "Received frame for tx with no space in DMA ring\n");
7271 brcms_c_txfifo(wlc, fifo, pkt[i], true); 7150 WARN_ON(!ieee80211_queue_stopped(wlc->pub->ieee_hw,
7272 } 7151 skb_get_queue_mapping(skb)));
7273 } 7152 return -ENOSPC;
7274
7275 if (err == -EBUSY) {
7276 brcmu_pktq_penq_head(q, prec, pkt[0]);
7277 /*
7278 * If send failed due to any other reason than a
7279 * change in HW FIFO condition, quit. Otherwise,
7280 * read the new prec_map!
7281 */
7282 if (prec_map == wlc->tx_prec_map)
7283 break;
7284 prec_map = wlc->tx_prec_map;
7285 }
7286 } 7153 }
7287}
7288
7289void
7290brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
7291 bool commit)
7292{
7293 u16 frameid = INVALIDFID;
7294 struct d11txh *txh;
7295
7296 txh = (struct d11txh *) (p->data);
7297 7154
7298 /* When a BC/MC frame is being committed to the BCMC fifo 7155 /* When a BC/MC frame is being committed to the BCMC fifo
7299 * via DMA (NOT PIO), update ucode or BSS info as appropriate. 7156 * via DMA (NOT PIO), update ucode or BSS info as appropriate.
@@ -7301,16 +7158,6 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
7301 if (fifo == TX_BCMC_FIFO) 7158 if (fifo == TX_BCMC_FIFO)
7302 frameid = le16_to_cpu(txh->TxFrameID); 7159 frameid = le16_to_cpu(txh->TxFrameID);
7303 7160
7304 /*
7305 * Bump up pending count for if not using rpc. If rpc is
7306 * used, this will be handled in brcms_b_txfifo()
7307 */
7308 if (commit) {
7309 wlc->core->txpktpend[fifo] += 1;
7310 BCMMSG(wlc->wiphy, "pktpend inc 1 to %d\n",
7311 wlc->core->txpktpend[fifo]);
7312 }
7313
7314 /* Commit BCMC sequence number in the SHM frame ID location */ 7161 /* Commit BCMC sequence number in the SHM frame ID location */
7315 if (frameid != INVALIDFID) { 7162 if (frameid != INVALIDFID) {
7316 /* 7163 /*
@@ -7320,8 +7167,52 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
7320 brcms_b_write_shm(wlc->hw, M_BCMC_FID, frameid); 7167 brcms_b_write_shm(wlc->hw, M_BCMC_FID, frameid);
7321 } 7168 }
7322 7169
7323 if (dma_txfast(wlc->hw->di[fifo], p, commit) < 0) 7170 ret = brcms_c_txfifo(wlc, fifo, skb);
7171 /*
7172 * The only reason for brcms_c_txfifo to fail is because
7173 * there weren't any DMA descriptors, but we've already
7174 * checked for that. So if it does fail yell loudly.
7175 */
7176 WARN_ON_ONCE(ret);
7177
7178 return ret;
7179}
7180
7181void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
7182 struct ieee80211_hw *hw)
7183{
7184 uint fifo;
7185 struct scb *scb = &wlc->pri_scb;
7186
7187 fifo = brcms_ac_to_fifo(skb_get_queue_mapping(sdu));
7188 if (brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0))
7189 return;
7190 if (brcms_c_tx(wlc, sdu))
7191 dev_kfree_skb_any(sdu);
7192}
7193
7194int
7195brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p)
7196{
7197 struct dma_pub *dma = wlc->hw->di[fifo];
7198 int ret;
7199 u16 queue;
7200
7201 ret = dma_txfast(wlc, dma, p);
7202 if (ret < 0)
7324 wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n"); 7203 wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n");
7204
7205 /*
7206 * Stop queue if DMA ring is full. Reserve some free descriptors,
7207 * as we sometimes receive a frame from mac80211 after the queues
7208 * are stopped.
7209 */
7210 queue = skb_get_queue_mapping(p);
7211 if (dma->txavail <= TX_HEADROOM && fifo < TX_BCMC_FIFO &&
7212 !ieee80211_queue_stopped(wlc->pub->ieee_hw, queue))
7213 ieee80211_stop_queue(wlc->pub->ieee_hw, queue);
7214
7215 return ret;
7325} 7216}
7326 7217
7327u32 7218u32
@@ -7371,19 +7262,6 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,
7371 return rts_rspec; 7262 return rts_rspec;
7372} 7263}
7373 7264
7374void
7375brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo)
7376{
7377 wlc->core->txpktpend[fifo] -= 1;
7378 BCMMSG(wlc->wiphy, "pktpend dec 1 to %d\n",
7379 wlc->core->txpktpend[fifo]);
7380
7381 /* There is more room; mark precedences related to this FIFO sendable */
7382 wlc->tx_prec_map |= 1 << fifo;
7383
7384 /* figure out which bsscfg is being worked on... */
7385}
7386
7387/* Update beacon listen interval in shared memory */ 7265/* Update beacon listen interval in shared memory */
7388static void brcms_c_bcn_li_upd(struct brcms_c_info *wlc) 7266static void brcms_c_bcn_li_upd(struct brcms_c_info *wlc)
7389{ 7267{
@@ -7831,35 +7709,6 @@ void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
7831 brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend); 7709 brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
7832} 7710}
7833 7711
7834/* prepares pdu for transmission. returns BCM error codes */
7835int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)
7836{
7837 uint fifo;
7838 struct d11txh *txh;
7839 struct ieee80211_hdr *h;
7840 struct scb *scb;
7841
7842 txh = (struct d11txh *) (pdu->data);
7843 h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
7844
7845 /* get the pkt queue info. This was put at brcms_c_sendctl or
7846 * brcms_c_send for PDU */
7847 fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK;
7848
7849 scb = NULL;
7850
7851 *fifop = fifo;
7852
7853 /* return if insufficient dma resources */
7854 if (*wlc->core->txavail[fifo] < MAX_DMA_SEGS) {
7855 /* Mark precedences related to this FIFO, unsendable */
7856 /* A fifo is full. Clear precedences related to that FIFO */
7857 wlc->tx_prec_map &= ~(1 << fifo);
7858 return -EBUSY;
7859 }
7860 return 0;
7861}
7862
7863int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, 7712int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
7864 uint *blocks) 7713 uint *blocks)
7865{ 7714{
@@ -7925,13 +7774,15 @@ int brcms_c_get_curband(struct brcms_c_info *wlc)
7925void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop) 7774void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop)
7926{ 7775{
7927 int timeout = 20; 7776 int timeout = 20;
7777 int i;
7928 7778
7929 /* flush packet queue when requested */ 7779 /* Kick DMA to send any pending AMPDU */
7930 if (drop) 7780 for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++)
7931 brcmu_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL); 7781 if (wlc->hw->di[i])
7782 dma_txflush(wlc->hw->di[i]);
7932 7783
7933 /* wait for queue and DMA fifos to run dry */ 7784 /* wait for queue and DMA fifos to run dry */
7934 while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0) { 7785 while (brcms_txpktpendtot(wlc) > 0) {
7935 brcms_msleep(wlc->wl, 1); 7786 brcms_msleep(wlc->wl, 1);
7936 7787
7937 if (--timeout == 0) 7788 if (--timeout == 0)
@@ -8159,10 +8010,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
8159 brcms_rfkill_set_hw_state(wlc->wl); 8010 brcms_rfkill_set_hw_state(wlc->wl);
8160 } 8011 }
8161 8012
8162 /* send any enq'd tx packets. Just makes sure to jump start tx */
8163 if (!pktq_empty(&wlc->pkt_queue->q))
8164 brcms_c_send_q(wlc);
8165
8166 /* it isn't done and needs to be resched if macintstatus is non-zero */ 8013 /* it isn't done and needs to be resched if macintstatus is non-zero */
8167 return wlc->macintstatus != 0; 8014 return wlc->macintstatus != 0;
8168 8015
@@ -8234,9 +8081,6 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)
8234 bcma_set16(core, D11REGOFFS(ifs_ctl), IFS_USEEDCF); 8081 bcma_set16(core, D11REGOFFS(ifs_ctl), IFS_USEEDCF);
8235 brcms_c_edcf_setparams(wlc, false); 8082 brcms_c_edcf_setparams(wlc, false);
8236 8083
8237 /* Init precedence maps for empty FIFOs */
8238 brcms_c_tx_prec_map_init(wlc);
8239
8240 /* read the ucode version if we have not yet done so */ 8084 /* read the ucode version if we have not yet done so */
8241 if (wlc->ucode_rev == 0) { 8085 if (wlc->ucode_rev == 0) {
8242 wlc->ucode_rev = 8086 wlc->ucode_rev =
@@ -8409,15 +8253,6 @@ brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit,
8409 * Complete the wlc default state initializations.. 8253 * Complete the wlc default state initializations..
8410 */ 8254 */
8411 8255
8412 /* allocate our initial queue */
8413 wlc->pkt_queue = brcms_c_txq_alloc(wlc);
8414 if (wlc->pkt_queue == NULL) {
8415 wiphy_err(wl->wiphy, "wl%d: %s: failed to malloc tx queue\n",
8416 unit, __func__);
8417 err = 100;
8418 goto fail;
8419 }
8420
8421 wlc->bsscfg->wlc = wlc; 8256 wlc->bsscfg->wlc = wlc;
8422 8257
8423 wlc->mimoft = FT_HT; 8258 wlc->mimoft = FT_HT;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h
index 4e3af67c7dd7..8a58cc12d19d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h
@@ -239,7 +239,6 @@ struct brcms_core {
239 239
240 /* fifo */ 240 /* fifo */
241 uint *txavail[NFIFO]; /* # tx descriptors available */ 241 uint *txavail[NFIFO]; /* # tx descriptors available */
242 s16 txpktpend[NFIFO]; /* tx admission control */
243 242
244 struct macstat *macstat_snapshot; /* mac hw prev read values */ 243 struct macstat *macstat_snapshot; /* mac hw prev read values */
245}; 244};
@@ -379,19 +378,6 @@ struct brcms_hardware {
379 */ 378 */
380}; 379};
381 380
382/* TX Queue information
383 *
384 * Each flow of traffic out of the device has a TX Queue with independent
385 * flow control. Several interfaces may be associated with a single TX Queue
386 * if they belong to the same flow of traffic from the device. For multi-channel
387 * operation there are independent TX Queues for each channel.
388 */
389struct brcms_txq_info {
390 struct brcms_txq_info *next;
391 struct pktq q;
392 uint stopped; /* tx flow control bits */
393};
394
395/* 381/*
396 * Principal common driver data structure. 382 * Principal common driver data structure.
397 * 383 *
@@ -432,11 +418,8 @@ struct brcms_txq_info {
432 * WDlast: last time wlc_watchdog() was called. 418 * WDlast: last time wlc_watchdog() was called.
433 * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. 419 * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac.
434 * wme_retries: per-AC retry limits. 420 * wme_retries: per-AC retry limits.
435 * tx_prec_map: Precedence map based on HW FIFO space.
436 * fifo2prec_map[NFIFO]: pointer to fifo2_prec map based on WME.
437 * bsscfg: set of BSS configurations, idx 0 is default and always valid. 421 * bsscfg: set of BSS configurations, idx 0 is default and always valid.
438 * cfg: the primary bsscfg (can be AP or STA). 422 * cfg: the primary bsscfg (can be AP or STA).
439 * tx_queues: common TX Queue list.
440 * modulecb: 423 * modulecb:
441 * mimoft: SIGN or 11N. 424 * mimoft: SIGN or 11N.
442 * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. 425 * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode.
@@ -466,7 +449,6 @@ struct brcms_txq_info {
466 * tempsense_lasttime; 449 * tempsense_lasttime;
467 * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. 450 * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM.
468 * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. 451 * tx_duty_cycle_cck: maximum allowed duty cycle for CCK.
469 * pkt_queue: txq for transmit packets.
470 * wiphy: 452 * wiphy:
471 * pri_scb: primary Station Control Block 453 * pri_scb: primary Station Control Block
472 */ 454 */
@@ -530,13 +512,9 @@ struct brcms_c_info {
530 u16 edcf_txop[IEEE80211_NUM_ACS]; 512 u16 edcf_txop[IEEE80211_NUM_ACS];
531 513
532 u16 wme_retries[IEEE80211_NUM_ACS]; 514 u16 wme_retries[IEEE80211_NUM_ACS];
533 u16 tx_prec_map;
534 515
535 struct brcms_bss_cfg *bsscfg; 516 struct brcms_bss_cfg *bsscfg;
536 517
537 /* tx queue */
538 struct brcms_txq_info *tx_queues;
539
540 struct modulecb *modulecb; 518 struct modulecb *modulecb;
541 519
542 u8 mimoft; 520 u8 mimoft;
@@ -581,7 +559,6 @@ struct brcms_c_info {
581 u16 tx_duty_cycle_ofdm; 559 u16 tx_duty_cycle_ofdm;
582 u16 tx_duty_cycle_cck; 560 u16 tx_duty_cycle_cck;
583 561
584 struct brcms_txq_info *pkt_queue;
585 struct wiphy *wiphy; 562 struct wiphy *wiphy;
586 struct scb pri_scb; 563 struct scb pri_scb;
587}; 564};
@@ -633,11 +610,8 @@ struct brcms_bss_cfg {
633 struct brcms_bss_info *current_bss; 610 struct brcms_bss_info *current_bss;
634}; 611};
635 612
636extern void brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, 613extern int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo,
637 struct sk_buff *p, bool commit); 614 struct sk_buff *p);
638extern void brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo);
639extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
640 struct sk_buff *sdu);
641extern void brcms_c_print_txstatus(struct tx_status *txs); 615extern void brcms_c_print_txstatus(struct tx_status *txs);
642extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, 616extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
643 uint *blocks); 617 uint *blocks);
@@ -652,9 +626,6 @@ static inline void brcms_c_print_txdesc(struct d11txh *txh)
652 626
653extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); 627extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config);
654extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); 628extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags);
655extern void brcms_c_send_q(struct brcms_c_info *wlc);
656extern int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu,
657 uint *fifo);
658extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, 629extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec,
659 uint mac_len); 630 uint mac_len);
660extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, 631extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc,
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
index 40ccc6968887..0148dec104f0 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
@@ -200,19 +200,6 @@ enum wlc_par_id {
200/* WL11N Support */ 200/* WL11N Support */
201#define AMPDU_AGG_HOST 1 201#define AMPDU_AGG_HOST 1
202 202
203#define BRCMS_PREC_COUNT 4 /* Max precedence level implemented */
204
205/* Mask to describe all precedence levels */
206#define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
207
208/*
209 * This maps priority to one precedence higher - Used by PS-Poll response
210 * packets to simulate enqueue-at-head operation, but still maintain the
211 * order on the queue
212 */
213#define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
214 BRCMS_PREC_COUNT - 1)
215
216/* network protection config */ 203/* network protection config */
217#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */ 204#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
218#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */ 205#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/types.h b/drivers/net/wireless/brcm80211/brcmsmac/types.h
index e11ae83111e4..e3abc0ed502e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/types.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/types.h
@@ -281,7 +281,6 @@ struct ieee80211_tx_queue_params;
281struct brcms_info; 281struct brcms_info;
282struct brcms_c_info; 282struct brcms_c_info;
283struct brcms_hardware; 283struct brcms_hardware;
284struct brcms_txq_info;
285struct brcms_band; 284struct brcms_band;
286struct dma_pub; 285struct dma_pub;
287struct si_pub; 286struct si_pub;