[openib-general] mr_table.max_mtt_order

Roland Dreier roland at topspin.com
Wed Mar 2 20:37:13 PST 2005


    Michael> Did I misunderstand something, or is there something that
    Michael> forces dev->limits.num_mtt_segs to be a power of 2?

Well, right now it's essentially hard coded to 1<<20, so it's OK for
now.  In general the buddy allocator used for allocating MTT entries
will break if

    Michael> 2. There are some places in mthca where we try to round
    Michael> some value up to the power of 2, some done by loops like
    Michael> this one.  I find them error-prone. Will you accept a
    Michael> patch replacing them with an inline function? Using fls,
    Michael> this function will also be more efficient than a linear
    Michael> loop.

I thought about this a little.  I think that any inline function
forces someone reading the code to look up what it does, no matter how
descriptive the name we come up with.  I think it would be better to
use fls() directly.  I'm already in the habit of using ffs() to
compute log_2 of powers of two but for some reason I never remember fls().

 - R.



More information about the general mailing list