Roland, two questions:

1. I'm looking at mthca_init_mr_table.
The following loop:

        for (i = 1, dev->mr_table.max_mtt_order = 0;
             i < dev->limits.num_mtt_segs;
             i <<= 1, ++dev->mr_table.max_mtt_order)
                ; /* nothing */

Seems to exit th first time when 
      (1 << (dev->mr_table.max_mtt_order) ) >= dev->limits.num_mtt_segs

So if dev->limits.num_mtt_segs is not a power of 2, 
  (1 << (dev->mr_table.max_mtt_order) ) > dev->limits.num_mtt_segs

and so max_mtt_order seems to be too large by 1?

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

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

-- 
MST - Michael S. Tsirkin
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to