diff options
author | Olof Johansson <olof@lixom.net> | 2012-09-05 18:35:48 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-09-05 18:35:48 -0400 |
commit | 1875962377574b4edb7b164001e3e341c25290d5 (patch) | |
tree | 374a5299403ec21e2d9a66a6548ce876a388b589 /drivers/net/ethernet/mellanox/mlx4/icm.c | |
parent | 5cbee140a28c2746449ae31e85738043ae4da927 (diff) | |
parent | c88a79a7789b2909ad1cf69ea2c9142030bbd6f4 (diff) |
Merge branch 'soc-core' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/dt
* 'soc-core' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
ARM: mach-shmobile: Add compilation support for dtbs using 'make dtbs'
+ sync to 3.6-rc3
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/icm.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/icm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c index 88b7b3e75ab1..daf417923661 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.c +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c | |||
@@ -358,13 +358,14 @@ void mlx4_table_put_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, | |||
358 | } | 358 | } |
359 | 359 | ||
360 | int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table, | 360 | int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
361 | u64 virt, int obj_size, int nobj, int reserved, | 361 | u64 virt, int obj_size, u32 nobj, int reserved, |
362 | int use_lowmem, int use_coherent) | 362 | int use_lowmem, int use_coherent) |
363 | { | 363 | { |
364 | int obj_per_chunk; | 364 | int obj_per_chunk; |
365 | int num_icm; | 365 | int num_icm; |
366 | unsigned chunk_size; | 366 | unsigned chunk_size; |
367 | int i; | 367 | int i; |
368 | u64 size; | ||
368 | 369 | ||
369 | obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size; | 370 | obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size; |
370 | num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk; | 371 | num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk; |
@@ -380,10 +381,12 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table, | |||
380 | table->coherent = use_coherent; | 381 | table->coherent = use_coherent; |
381 | mutex_init(&table->mutex); | 382 | mutex_init(&table->mutex); |
382 | 383 | ||
384 | size = (u64) nobj * obj_size; | ||
383 | for (i = 0; i * MLX4_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) { | 385 | for (i = 0; i * MLX4_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) { |
384 | chunk_size = MLX4_TABLE_CHUNK_SIZE; | 386 | chunk_size = MLX4_TABLE_CHUNK_SIZE; |
385 | if ((i + 1) * MLX4_TABLE_CHUNK_SIZE > nobj * obj_size) | 387 | if ((i + 1) * MLX4_TABLE_CHUNK_SIZE > size) |
386 | chunk_size = PAGE_ALIGN(nobj * obj_size - i * MLX4_TABLE_CHUNK_SIZE); | 388 | chunk_size = PAGE_ALIGN(size - |
389 | i * MLX4_TABLE_CHUNK_SIZE); | ||
387 | 390 | ||
388 | table->icm[i] = mlx4_alloc_icm(dev, chunk_size >> PAGE_SHIFT, | 391 | table->icm[i] = mlx4_alloc_icm(dev, chunk_size >> PAGE_SHIFT, |
389 | (use_lowmem ? GFP_KERNEL : GFP_HIGHUSER) | | 392 | (use_lowmem ? GFP_KERNEL : GFP_HIGHUSER) | |