From: Oren Duer Date: Mon, 5 May 2008 22:56:52 +0000 (-0700) Subject: mlx4_core: Support creation of FMRs with pages smaller than 4K X-Git-Tag: v2.6.26-rc2~61^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5057ddccbcb4bf363af628d7963a7475f4114a7;p=linux-2.6 mlx4_core: Support creation of FMRs with pages smaller than 4K Don't hard code a test against a minimum page shift of 12, since the device may support smaller pages. Test against the actual smallest page size from the device capabilities. Signed-off-by: Oren Duer Signed-off-by: Jack Morgenstein Signed-off-by: Roland Dreier --- diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index cb46446b26..03a9abcce5 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c @@ -551,7 +551,7 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, u64 mtt_seg; int err = -ENOMEM; - if (page_shift < 12 || page_shift >= 32) + if (page_shift < (ffs(dev->caps.page_size_cap) - 1) || page_shift >= 32) return -EINVAL; /* All MTTs must fit in the same page */