[openib-general] [PATCH v2] IB_mthca HCA profile module parameters

Roland Dreier rdreier at cisco.com
Thu Nov 16 12:13:10 PST 2006


We seem to be making negative progress :(

The patch is still corrupted, eg:

 > +module_param_named(num_mpt, default_profile.num_mpt, int, 0444);
 > +MODULE_PARM_DESC(num_mpt, +		"maximum number of memory
 > protection pable entries per HCA");

Indentation is completely borken:

 > +static int __devinit mthca_check_profile_value(int* pval,int pval_default){
 > +    /* value must be positive and power of 2 */
 > +    int old_pval = *pval;

No braces needed around one-statement blocks:

 > +    if (old_pval <= 0) {
 > +        *pval = pval_default;
 > +    } else if (!is_power_of_2(old_pval)) {

And that test is_power_of_2() is completely unnecessary -- just set
*pval to roundup_pow_of_two unconditionally (and kill the
is_power_of_2 macro completely).

 > +    if (mthca_check_profile_value(&default_profile.num_qp,
 > +                                  MTHCA_DEFAULT_NUM_QP)){
 > +		mthca_warn(mdev,"invalid num_qp passed. changed to %d.\n",
 > +                   default_profile.num_qp); +	}

You should be able to create a macro that passes the name of the
parameter in too, and move the if statement and the warning into
mthca_check_profile_value...

 - R.




More information about the general mailing list