aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c3
-rw-r--r--include/linux/mlx4/device.h1
4 files changed, 7 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 7b445df6a66..e152837b75a 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -163,7 +163,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
163 props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm; 163 props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm;
164 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * 164 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
165 props->max_mcast_grp; 165 props->max_mcast_grp;
166 props->max_map_per_fmr = (1 << (32 - ilog2(dev->dev->caps.num_mpts))) - 1; 166 props->max_map_per_fmr = dev->dev->caps.max_fmr_maps;
167 167
168out: 168out:
169 kfree(in_mad); 169 kfree(in_mad);
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b502f..3e593ae56e0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1131,6 +1131,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1131 goto err_stop_fw; 1131 goto err_stop_fw;
1132 } 1132 }
1133 1133
1134 dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1;
1135
1134 init_hca.log_uar_sz = ilog2(dev->caps.num_uars); 1136 init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
1135 init_hca.uar_page_sz = PAGE_SHIFT - 12; 1137 init_hca.uar_page_sz = PAGE_SHIFT - 12;
1136 1138
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 25a80d71fb2..5b7c06e0cd0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -816,6 +816,9 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
816 u64 mtt_offset; 816 u64 mtt_offset;
817 int err = -ENOMEM; 817 int err = -ENOMEM;
818 818
819 if (max_maps > dev->caps.max_fmr_maps)
820 return -EINVAL;
821
819 if (page_shift < (ffs(dev->caps.page_size_cap) - 1) || page_shift >= 32) 822 if (page_shift < (ffs(dev->caps.page_size_cap) - 1) || page_shift >= 32)
820 return -EINVAL; 823 return -EINVAL;
821 824
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index aea61905499..263d2ae21ac 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -273,6 +273,7 @@ struct mlx4_caps {
273 int num_comp_vectors; 273 int num_comp_vectors;
274 int comp_pool; 274 int comp_pool;
275 int num_mpts; 275 int num_mpts;
276 int max_fmr_maps;
276 int num_mtts; 277 int num_mtts;
277 int fmr_reserved_mtts; 278 int fmr_reserved_mtts;
278 int reserved_mtts; 279 int reserved_mtts;