[PATCH] dma/idxd: fix burst capacity calculation

Pai G, Sunil sunil.pai.g at intel.com
Mon Jan 10 14:09:02 CET 2022


Hi Bruce, Kevin

This patch seems to have uncovered a bug in the driver.
On applying, the idxd_burst_capacity API seems to return 0 for cases even when there are batch descriptors and ring space available.
Seems like there is a wraparound missing when calculating the descriptor ring space, causing this behavior.  

Below change seems to fix the issue.

@@ -483,7 +496,7 @@ idxd_burst_capacity(const void *dev_private, uint16_t vchan __rte_unused)
        /* For descriptors, check for wrap-around on write but not read */                   
        if (idxd->ids_returned > write_idx)                                                  
                write_idx += idxd->desc_ring_mask + 1;                                       
-       used_space = write_idx - idxd->ids_returned;                                         
+       used_space = (write_idx - idxd->ids_returned)&idxd->desc_ring_mask;                  

<snipped>

Could we include this fix in the current patch ?

Thanks and regards,
Sunil


More information about the dev mailing list