]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mlx4_core: change resource quotas to enable supporting upstream-kernel guests
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Mon, 18 Feb 2013 10:34:59 +0000 (12:34 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:08 +0000 (14:45 -0700)
commitcf88f570e2e67409fa1fa3d7b50dd48cabab7e82
treeb68827ee6b4b5855cd5ee1272f86e9551e4684f7
parent66a5d978da93266403878b644809d778a36233da
mlx4_core: change resource quotas to enable supporting upstream-kernel guests

The resource-quota code passed non-power-of-2 quotas to guests.
In the upstream kernel (bugs), resource quotas for MPTs and QPs
are assumed to be powers-of-2. In MPT case, mlx4_init_mr_table
checks for num_mpts being a power-of-2 before checking if it
is running as a slave.

In the QP case, procedure mlx4_qp_alloc() assumes that
(num_qps - 1) is a power-of-2 when calling radix_tree_insert()
and radix_tree_delete().

In the MPT case, mlx4_init_mr_table() failed on the guest,
causing abort of the guest driver bringup.

In the QP case, although create-qp succeeded on the
hypervisor, the radix_tree_insert() call failed, resulting
in failure to create QPs with certain qp numbers.

The fix, for both cases, is to round-up the quota to the
next power-of-2 for guests for MPTs and QPs.  This does no
harm, as these two resources were not really meant to be
limited by an upper quota.  The guaranteed resources for QPs
and MPTs per VF/PF are not affected by this change.
The only effect is that no guest will ever be able to
actually reach its max-quota for QPs and MPTs.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c