Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291980
b: refs/heads/master
c: db5a7a6
h: refs/heads/master
v: v3
  • Loading branch information
Roland Dreier committed Mar 12, 2012
1 parent 1621c41 commit 1a7f553
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 096335b3f9830b90d13aee77252cf6f5f12a258c
refs/heads/master: db5a7a65c05867cb6ff5cb6d556a0edfce631d2d
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/mellanox/mlx4/mlx4.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ struct mlx4_profile {
int num_cq;
int num_mcg;
int num_mpt;
int num_mtt;
unsigned num_mtt;
};

struct mlx4_fw {
Expand Down
19 changes: 19 additions & 0 deletions trunk/drivers/net/ethernet/mellanox/mlx4/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,31 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
u64 total_size = 0;
struct mlx4_resource *profile;
struct mlx4_resource tmp;
struct sysinfo si;
int i, j;

profile = kcalloc(MLX4_RES_NUM, sizeof(*profile), GFP_KERNEL);
if (!profile)
return -ENOMEM;

/*
* We want to scale the number of MTTs with the size of the
* system memory, since it makes sense to register a lot of
* memory on a system with a lot of memory. As a heuristic,
* make sure we have enough MTTs to cover twice the system
* memory (with PAGE_SIZE entries).
*
* This number has to be a power of two and fit into 32 bits
* due to device limitations, so cap this at 2^31 as well.
* That limits us to 8TB of memory registration per HCA with
* 4KB pages, which is probably OK for the next few months.
*/
si_meminfo(&si);
request->num_mtt =
roundup_pow_of_two(max_t(unsigned, request->num_mtt,
min(1UL << 31,
si.totalram >> (log_mtts_per_seg - 1))));

profile[MLX4_RES_QP].size = dev_cap->qpc_entry_sz;
profile[MLX4_RES_RDMARC].size = dev_cap->rdmarc_entry_sz;
profile[MLX4_RES_ALTC].size = dev_cap->altc_entry_sz;
Expand Down

0 comments on commit 1a7f553

Please sign in to comment.