Re: [PATCH V3 15/16] RDMA/i40iw: Fix SD calculation for initial HMC creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 18, 2016 at 10:33:08AM -0500, Mustafa Ismail wrote:
> Correct SD calculation by using base address returned from commit FPM.
> This alleviates any assumptions on resource ordering and alignment
> requirement. Also consolidate SD estimation code into i40iw_est_sd().
> 
> Signed-off-by: Mustafa Ismail <mustafa.ismail@xxxxxxxxx>
> Signed-off-by: Faisal Latif <faisal.latif@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 93 +++++++++++++++++++++-----------
>  drivers/infiniband/hw/i40iw/i40iw_type.h |  2 +-
>  2 files changed, 62 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
> index 023a7ae..2c4b4d0 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
> @@ -114,16 +114,21 @@ static enum i40iw_status_code i40iw_cqp_poll_registers(
>   * i40iw_sc_parse_fpm_commit_buf - parse fpm commit buffer
>   * @buf: ptr to fpm commit buffer
>   * @info: ptr to i40iw_hmc_obj_info struct
> + * @sd: number of SDs for HMC objects
>   *
>   * parses fpm commit info and copy base value
>   * of hmc objects in hmc_info
>   */
>  static enum i40iw_status_code i40iw_sc_parse_fpm_commit_buf(
>  				u64 *buf,
> -				struct i40iw_hmc_obj_info *info)
> +				struct i40iw_hmc_obj_info *info,
> +				u32 *sd)
>  {
>  	u64 temp;

...

> +	size = info[k].cnt * info[k].size + info[k].base;
> +	if (size & 0x1FFFFF)
> +		*sd = (u32)((size >> 21) + 1); /* add 1 for remainder */
> +	else
> +		*sd = (u32)(size >> 21);
> +

The code above can be simplified a little bit.
  *sd = (u32)((size >> 21);
  if (size & 0x1FFFFF)
        *sd += 1;

>  	return 0;
>  }

...

> +
> +	if (size & 0x1FFFFF)
> +		sd = (size >> 21) + 1; /* add 1 for remainder */
> +	else
> +		sd = size >> 21;

The same as above.

> +
> +	if (!dev->is_pf) {
> +		/* 2MB alignment for VF PBLE HMC */
> +		size = hmc_info->hmc_obj[I40IW_HMC_IW_PBLE].cnt * hmc_info->hmc_obj[I40IW_HMC_IW_PBLE].size;
> +		if (size & 0x1FFFFF)
> +			sd += (size >> 21) + 1; /* add 1 for remainder */
> +		else
> +			sd += size >> 21;
> +	}

The same as above.

> +
> +	return sd;
> +}
> +

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux