[PATCH v7 20/50] powerpc/powernv: Improve DMA32 segment calculation
Daniel Axtens
dja at axtens.net
Fri Nov 20 14:14:48 AEDT 2015
> + total_weight = pnv_pci_ioda_total_dma_weight(phb);
> + weight = pnv_pci_ioda_pe_dma_weight(pe);
> + if (!total_weight || !weight)
> + return;
> +
> + segs = (weight * phb->ioda.dma32_count) / total_weight;
> + if (!segs)
> + segs = 1;
I'm a little bit concerned about rounding here. Having said that I've
also lost track of dma32_count: if it's big then rounding won't
matter. What's a typical dma32_count?
> +
> + /*
> + * Allocate continuous DMA32 segments. We begin with the expected
Very much a nit pick, but I think you mean s/continuous/contiguous/.
> + * number of segments. With one more attempt, the number of DMA32
> + * segments to be allocated is decreased by one until one segment
> + * is allocated successfully.
> + */
> + while (segs) {
> + found = false;
> + for (base = 0; base <= phb->ioda.dma32_count - segs; base++) {
> + for (i = base; i < base + segs; i++) {
> + if (phb->ioda.dma32_segmap[i] !=
> + IODA_INVALID_PE)
> + break;
> + }
> +
> + if (i >= base + segs) {
How would `i' ever be greater than base + segs? Should the test just
be 'if (i == base + segs) {'
> + found = true;
> + break;
> + }
> + }
Regards,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20151120/93d01d25/attachment.sig>
More information about the Linuxppc-dev
mailing list