[openib-general] [PATCH] IB/mthca: HCA profile module parameters
Moni Shoua
monis at voltaire.com
Thu Nov 16 09:50:24 PST 2006
Roland Dreier wrote:
>The patch is line-wrapped and bizarrely corrupted and won't apply, eg:
>
> > + mthca_warn(mdev, "num_qp rounded to power of 2 (%d).\n",
> > + default_profile.num_qp); + }
>
>This is completely unnecessary:
>
> > +#define to_up_power_of_2(x) (x = roundup_pow_of_two(x))
>
>...just open code this.
>
>And this seems strange:
>
> > +#define is_power_of_2(x) (x>0 &&(x & (x - 1)))
>
>so there's no warning if someone passes in a negative value?? and
>it's backwards too, (x & (x - 1)) is 0 precisely for the powers of 2.
>Was this patch tested at all?
>
>Anyway, all this
>
> > + if (!is_power_of_2(default_profile.num_qp)){
> > + to_up_power_of_2(default_profile.num_qp);
> > + mthca_warn(mdev, "num_qp rounded to power of 2 (%d).\n",
> > + default_profile.num_qp); + }
>
>seems very repetive. Can't it be wrapped up in a function so we just
>do something like
>
> mthca_check_profile_value(&default_profile.num_qp);
> mthca_check_profile_value(&default_profile.rdb_per_qp);
> mthca_check_profile_value(&default_profile.num_cq);
>
>etc.
>
> - R.
>
>
>
Thanks for the comments
Lines became wrapped because I used a "wrong" email client. I'll
re-submit with another client but this would be in a new thread
because I still have problems reading mail with it and therefore I can't
reply to this thread. Sorry for the bother...
The patch was tested but unfortunately I sent the wrong one (not the
final).
The new version is the one I should have sent + changes according to the
comments here.
thanks
MoniS
More information about the general
mailing list