aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_memfree.c
diff options
context:
space:
mode:
authorRoland Dreier <roland@topspin.com>2005-04-16 18:26:13 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:26:13 -0400
commit86562a139182bb19c984347f9625b61f3e6f7815 (patch)
tree97984c9e04c31a5d2055e4bcac16bb11c923eca1 /drivers/infiniband/hw/mthca/mthca_memfree.c
parent79b61dceafce696d72661d23a02393566b1899ab (diff)
[PATCH] IB/mthca: map MPT/MTT context in mem-free mode
In mem-free mode, when allocating memory regions, make sure that the HCA has context memory mapped to cover the virtual space used for the MPT and MTTs being used. Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_memfree.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 7730b5960616..a70a1c712b4b 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -192,6 +192,38 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o
192 up(&table->mutex); 192 up(&table->mutex);
193} 193}
194 194
195int mthca_table_get_range(struct mthca_dev *dev, struct mthca_icm_table *table,
196 int start, int end)
197{
198 int inc = MTHCA_TABLE_CHUNK_SIZE / table->obj_size;
199 int i, err;
200
201 for (i = start; i <= end; i += inc) {
202 err = mthca_table_get(dev, table, i);
203 if (err)
204 goto fail;
205 }
206
207 return 0;
208
209fail:
210 while (i > start) {
211 i -= inc;
212 mthca_table_put(dev, table, i);
213 }
214
215 return err;
216}
217
218void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table,
219 int start, int end)
220{
221 int i;
222
223 for (i = start; i <= end; i += MTHCA_TABLE_CHUNK_SIZE / table->obj_size)
224 mthca_table_put(dev, table, i);
225}
226
195struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, 227struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
196 u64 virt, int obj_size, 228 u64 virt, int obj_size,
197 int nobj, int reserved, 229 int nobj, int reserved,