diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-02-16 16:57:33 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-02-16 16:57:33 -0500 |
commit | 11282b32a4ed7bb5fc390c83a1d6b9bc8017882c (patch) | |
tree | 241e453062f9acae34fc00625097491c3e5f83e5 | |
parent | fc89afce349a70f73d9c0b6d91a15c4913f071a0 (diff) |
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>
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 0b9d053a599d..48f7c65e9aed 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -175,7 +175,9 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, | |||
175 | if (!ret) { | 175 | if (!ret) { |
176 | ++chunk->npages; | 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 | chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, | 181 | chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, |
180 | chunk->npages, | 182 | chunk->npages, |
181 | PCI_DMA_BIDIRECTIONAL); | 183 | PCI_DMA_BIDIRECTIONAL); |