[MTHCA] Fix reserved MTTs calculation on mem-free HCAs (mlnx 2958)
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 26 Aug 2008 11:51:37 +0000 (11:51 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 26 Aug 2008 11:51:37 +0000 (11:51 +0000)
(Linux, 13/02/07, Michael S. Tsirkin, commit: c7d204e8fdf02f88d91707213f473805bcfb977b)

The reserved_mtts field has different meaning in Tavor and Arbel, so
we are wasting mtt entries on memfree. Fix the Arbel case to match
Tavor semantics.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1508 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mthca/kernel/mthca_cmd.c

index 81b3e97..47e3df4 100644 (file)
@@ -1004,7 +1004,11 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
        MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_EQ_OFFSET);
        dev_lim->max_eqs = 1 << (field & 0x7);
        MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_MTT_OFFSET);
-       dev_lim->reserved_mtts = 1 << (field >> 4);
+       if (mthca_is_memfree(dev))
+               dev_lim->reserved_mtts = ALIGN((1 << (field >> 4)) * sizeof(u64),
+                       MTHCA_MTT_SEG_SIZE) / MTHCA_MTT_SEG_SIZE;
+       else
+               dev_lim->reserved_mtts = 1 << (field >> 4);
        MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_MRW_SZ_OFFSET);
        dev_lim->max_mrw_sz = 1 << field;
        MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_MRW_OFFSET);