aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/profile.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
commit0c2fe82a9b106f1c03719783134360586d718a69 (patch)
treeec1a18ca49f1e6724ef3a93727f5f73b7df61931 /drivers/net/ethernet/mellanox/mlx4/profile.c
parent5f0e685f316a1de6d3af8b23eaf46651faca32ab (diff)
parentf0e88aeb19dac00ed2e09fd4d39ee65f32d5e968 (diff)
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull InfiniBand/RDMA changes for the 3.4 merge window from Roland Dreier: "Nothing big really stands out; by patch count lots of fixes to the mlx4 driver plus some cleanups and fixes to the core and other drivers." * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (28 commits) mlx4_core: Scale size of MTT table with system RAM mlx4_core: Allow dynamic MTU configuration for IB ports IB/mlx4: Fix info returned when querying IBoE ports IB/mlx4: Fix possible missed completion event mlx4_core: Report thermal error events mlx4_core: Fix one more static exported function IB: Change CQE "csum_ok" field to a bit flag RDMA/iwcm: Reject connect requests if cmid is not in LISTEN state RDMA/cxgb3: Don't pass irq flags to flush_qp() mlx4_core: Get rid of redundant ext_port_cap flags RDMA/ucma: Fix AB-BA deadlock IB/ehca: Fix ilog2() compile failure IB: Use central enum for speed instead of hard-coded values IB/iser: Post initial receive buffers before sending the final login request IB/iser: Free IB connection resources in the proper place IB/srp: Consolidate repetitive sysfs code IB/srp: Use pr_fmt() and pr_err()/pr_warn() IB/core: Fix SDR rates in sysfs mlx4: Enforce device max FMR maps in FMR alloc IB/mlx4: Set bad_wr for invalid send opcode ...
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/profile.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/profile.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c
index 1129677daa62..06e5adeb76f7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/profile.c
+++ b/drivers/net/ethernet/mellanox/mlx4/profile.c
@@ -83,12 +83,31 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
83 u64 total_size = 0; 83 u64 total_size = 0;
84 struct mlx4_resource *profile; 84 struct mlx4_resource *profile;
85 struct mlx4_resource tmp; 85 struct mlx4_resource tmp;
86 struct sysinfo si;
86 int i, j; 87 int i, j;
87 88
88 profile = kcalloc(MLX4_RES_NUM, sizeof(*profile), GFP_KERNEL); 89 profile = kcalloc(MLX4_RES_NUM, sizeof(*profile), GFP_KERNEL);
89 if (!profile) 90 if (!profile)
90 return -ENOMEM; 91 return -ENOMEM;
91 92
93 /*
94 * We want to scale the number of MTTs with the size of the
95 * system memory, since it makes sense to register a lot of
96 * memory on a system with a lot of memory. As a heuristic,
97 * make sure we have enough MTTs to cover twice the system
98 * memory (with PAGE_SIZE entries).
99 *
100 * This number has to be a power of two and fit into 32 bits
101 * due to device limitations, so cap this at 2^31 as well.
102 * That limits us to 8TB of memory registration per HCA with
103 * 4KB pages, which is probably OK for the next few months.
104 */
105 si_meminfo(&si);
106 request->num_mtt =
107 roundup_pow_of_two(max_t(unsigned, request->num_mtt,
108 min(1UL << 31,
109 si.totalram >> (log_mtts_per_seg - 1))));
110
92 profile[MLX4_RES_QP].size = dev_cap->qpc_entry_sz; 111 profile[MLX4_RES_QP].size = dev_cap->qpc_entry_sz;
93 profile[MLX4_RES_RDMARC].size = dev_cap->rdmarc_entry_sz; 112 profile[MLX4_RES_RDMARC].size = dev_cap->rdmarc_entry_sz;
94 profile[MLX4_RES_ALTC].size = dev_cap->altc_entry_sz; 113 profile[MLX4_RES_ALTC].size = dev_cap->altc_entry_sz;