Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/mthca: Fix allocation of ICM chunks in coherent memory

The change to allow allocating ICM chunks from coherent memory did not
increment the count of sg entries properly, so a chunk that required
more than allocation would not be mapped properly by the HCA.

Fix this by adding the missing increment of chunk->nsg.

Signed-off-by: Roland Dreier <rolandd@cisco.com>

+3 -1
+3 -1
drivers/infiniband/hw/mthca/mthca_memfree.c
··· 175 175 if (!ret) { 176 176 ++chunk->npages; 177 177 178 - if (!coherent && chunk->npages == MTHCA_ICM_CHUNK_LEN) { 178 + if (coherent) 179 + ++chunk->nsg; 180 + else if (chunk->npages == MTHCA_ICM_CHUNK_LEN) { 179 181 chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, 180 182 chunk->npages, 181 183 PCI_DMA_BIDIRECTIONAL);