linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org>
To: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH V3 15/16] RDMA/i40iw: Fix SD calculation for initial HMC creation
Date: Wed, 20 Apr 2016 11:25:39 +0300	[thread overview]
Message-ID: <20160420082539.GW6349@leon.nu> (raw)
In-Reply-To: <1460993589-9428-16-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-04-20  8:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 15:32 [PATCH V3 00/16] RDMA/Intel X722 iWARP driver update Mustafa Ismail
     [not found] ` <1460993589-9428-1-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-18 15:32   ` [PATCH V3 01/16] RDMA/i40iw: Fix overflow of region length Mustafa Ismail
2016-04-18 15:32   ` [PATCH V3 02/16] RDMA/i40iw: Correct QP size calculation Mustafa Ismail
2016-04-18 15:32   ` [PATCH V3 03/16] RDMA/i40iw: Fix refused connections Mustafa Ismail
2016-04-18 15:32   ` [PATCH V3 04/16] RDMA/i40iw: Correct max message size in query port Mustafa Ismail
2016-04-18 15:32   ` [PATCH V3 05/16] RDMA/i40iw: Do not set self-referencing pointer to NULL after free Mustafa Ismail
2016-04-18 15:32   ` [PATCH V3 06/16] RDMA/i40iw: Add qp table lock around AE processing Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 07/16] RDMA/i40iw: Set vendor_err only if there is an actual error Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 08/16] RDMA/i40iw: Populate vendor_id and vendor_part_id fields Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 09/16] RDMA/i40iw: Remove unused code and fix warning Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 10/16] RDMA/i40iw: Add virtual channel message queue Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 11/16] RDMA/i40iw: Correct return code check in add_pble_pool Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 12/16] RDMA/i40iw: Initialize max enabled vfs variable Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 13/16] RDMA/i40iw: Add base memory management extensions Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 14/16] RDMA/i40iw: Fix endian issues and warnings Mustafa Ismail
2016-04-18 15:33   ` [PATCH V3 15/16] RDMA/i40iw: Fix SD calculation for initial HMC creation Mustafa Ismail
     [not found]     ` <1460993589-9428-16-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-20  8:25       ` Leon Romanovsky [this message]
2016-04-18 15:33   ` [PATCH V3 16/16] RDMA/i40iw: Adding queue drain functions Mustafa Ismail
2016-04-29  2:39   ` [PATCH V3 00/16] RDMA/Intel X722 iWARP driver update Doug Ledford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160420082539.GW6349@leon.nu \
    --to=leon-2ukjvaziz/y@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).