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
  * WARNING: call must check the return value for error.
                      di->xmtptrbase + I2B(txout, struct dma64desc));
 
        /* tx flow control */
-       di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1;
+       dma_update_txavail(di);
 
        return 0;
 
        di->txin = i;
 
        /* tx flow control */
-       di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1;
+       dma_update_txavail(di);
 
        return txp;