diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2012-11-15 09:07:53 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-11-20 14:03:37 -0500 |
commit | 05f8a6160491ea46636370fbacb4061c341d5d94 (patch) | |
tree | e59eb3ae6def081b7b67dd31d2a44f91f8de0d61 | |
parent | 5c8067caeecbabf8c60dbb73dd517d2a2aad16a5 (diff) |
brcmsmac: Add helper function for updating txavail count
Use this helper function rather than open-coding the same calculation in
multiple places.
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>
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmsmac/dma.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c index 5e53305bd9a9..6444cf1a2eb8 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c | |||
@@ -1264,6 +1264,17 @@ bool dma_rxreset(struct dma_pub *pub) | |||
1264 | return status == D64_RS0_RS_DISABLED; | 1264 | return status == D64_RS0_RS_DISABLED; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | /* Update count of available tx descriptors based on current DMA state */ | ||
1268 | static void dma_update_txavail(struct dma_info *di) | ||
1269 | { | ||
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 | |||
1267 | /* | 1278 | /* |
1268 | * !! tx entry routine | 1279 | * !! tx entry routine |
1269 | * WARNING: call must check the return value for error. | 1280 | * WARNING: call must check the return value for error. |
@@ -1325,7 +1336,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit) | |||
1325 | di->xmtptrbase + I2B(txout, struct dma64desc)); | 1336 | di->xmtptrbase + I2B(txout, struct dma64desc)); |
1326 | 1337 | ||
1327 | /* tx flow control */ | 1338 | /* tx flow control */ |
1328 | di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; | 1339 | dma_update_txavail(di); |
1329 | 1340 | ||
1330 | return 0; | 1341 | return 0; |
1331 | 1342 | ||
@@ -1412,7 +1423,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) | |||
1412 | di->txin = i; | 1423 | di->txin = i; |
1413 | 1424 | ||
1414 | /* tx flow control */ | 1425 | /* tx flow control */ |
1415 | di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; | 1426 | dma_update_txavail(di); |
1416 | 1427 | ||
1417 | return txp; | 1428 | return txp; |
1418 | 1429 | ||