Commit 05f8a616 authored by Seth Forshee's avatar Seth Forshee Committed by John W. Linville

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: default avatarSeth Forshee <seth.forshee@canonical.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Tested-by: default avatarDaniel Wagner <wagi@monom.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5c8067ca
...@@ -1264,6 +1264,17 @@ bool dma_rxreset(struct dma_pub *pub) ...@@ -1264,6 +1264,17 @@ bool dma_rxreset(struct dma_pub *pub)
return status == D64_RS0_RS_DISABLED; return status == D64_RS0_RS_DISABLED;
} }
/* Update count of available tx descriptors based on current DMA state */
static void dma_update_txavail(struct dma_info *di)
{
/*
* Available space is number of descriptors less the number of
* active descriptors and the number of queued AMPDU frames.
*/
di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1;
}
/* /*
* !! tx entry routine * !! tx entry routine
* WARNING: call must check the return value for error. * 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,7 +1336,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)
di->xmtptrbase + I2B(txout, struct dma64desc)); di->xmtptrbase + I2B(txout, struct dma64desc));
/* tx flow control */ /* tx flow control */
di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; dma_update_txavail(di);
return 0; return 0;
...@@ -1412,7 +1423,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) ...@@ -1412,7 +1423,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
di->txin = i; di->txin = i;
/* tx flow control */ /* tx flow control */
di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; dma_update_txavail(di);
return txp; return txp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment