public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Anand Khoje <anand.a.khoje@oracle.com>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com
Subject: Re: [PATCH v3 1/3] IB/core: Removed port validity check from ib_get_cached_subnet_prefix
Date: Wed, 9 Jun 2021 11:37:20 +0300	[thread overview]
Message-ID: <YMB9wEygi58hjDLy@unreal> (raw)
In-Reply-To: <20210609055534.855-2-anand.a.khoje@oracle.com>

On Wed, Jun 09, 2021 at 11:25:32AM +0530, Anand Khoje wrote:
> Removed port validity check from ib_get_cached_subnet_prefix()
> as this check is not needed because "port_num" is valid.
> 
> Suggested-by: Leon Romanovsky <leonro@nvidia.com>
> Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
> Signed-off-by: Haakon Bugge <haakon.bugge@oracle.com>
> 
> ---
> 
> v1 -> v2:
>     -	Added changes as per Leon's suggestion of removing port
>     validity check from ib_get_cached_subnet_prefix().
>     -	Split the v1 patch in 3 patches as per Leon's suggestion.
> v2 -> v3:
>     -	Added some formatting changes per Leon's suggestions
>     and removed return from ib_get_cached_subnet_prefix.
> 
> ---
>  drivers/infiniband/core/cache.c     |  6 +-----
>  drivers/infiniband/core/core_priv.h |  2 +-
>  drivers/infiniband/core/device.c    | 13 ++++---------
>  drivers/infiniband/core/security.c  |  7 ++-----
>  4 files changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
> index 3b0991fedd81..e957f0c915a3 100644
> --- a/drivers/infiniband/core/cache.c
> +++ b/drivers/infiniband/core/cache.c
> @@ -1069,19 +1069,15 @@ int ib_get_cached_pkey(struct ib_device *device,
>  }
>  EXPORT_SYMBOL(ib_get_cached_pkey);
>  
> -int ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num,
> +void ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num,
>  				u64 *sn_pfx)
>  {
>  	unsigned long flags;
>  
> -	if (!rdma_is_port_valid(device, port_num))
> -		return -EINVAL;
> -
>  	read_lock_irqsave(&device->cache_lock, flags);
>  	*sn_pfx = device->port_data[port_num].cache.subnet_prefix;
>  	read_unlock_irqrestore(&device->cache_lock, flags);
>  
> -	return 0;
>  }
>  EXPORT_SYMBOL(ib_get_cached_subnet_prefix);
>  
> diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
> index 29809dd30041..0b23f50fa958 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -214,7 +214,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
>  			     struct nlmsghdr *nlh,
>  			     struct netlink_ext_ack *extack);
>  
> -int ib_get_cached_subnet_prefix(struct ib_device *device,
> +void ib_get_cached_subnet_prefix(struct ib_device *device,
>  				u32 port_num,
>  				u64 *sn_pfx);
>  
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index c660cef66ac6..595128b26c34 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -886,15 +886,10 @@ static void ib_policy_change_task(struct work_struct *work)
>  
>  		rdma_for_each_port (dev, i) {
>  			u64 sp;
> -			int ret = ib_get_cached_subnet_prefix(dev,
> -							      i,
> -							      &sp);
> -
> -			WARN_ONCE(ret,
> -				  "ib_get_cached_subnet_prefix err: %d, this should never happen here\n",
> -				  ret);
> -			if (!ret)
> -				ib_security_cache_change(dev, i, sp);
> +
> +			ib_get_cached_subnet_prefix(dev, i, &sp);
> +
> +			ib_security_cache_change(dev, i, sp);

nitpick, the blank line is not needed.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2021-06-09  8:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  5:55 [PATCH v3 0/3] IB/core: Obtaining subnet_prefix from cache in Anand Khoje
2021-06-09  5:55 ` [PATCH v3 1/3] IB/core: Removed port validity check from ib_get_cached_subnet_prefix Anand Khoje
2021-06-09  8:37   ` Leon Romanovsky [this message]
2021-06-09  5:55 ` [PATCH v3 2/3] IB/core: Shuffle locks in ib_port_data to save memory Anand Khoje
2021-06-09  5:55 ` [PATCH v3 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Anand Khoje
2021-06-09  8:36   ` Leon Romanovsky
2021-06-09  9:26     ` Anand Khoje
2021-06-09 10:40       ` Leon Romanovsky
2021-06-14  3:32         ` Haakon Bugge
2021-06-14  7:25           ` Leon Romanovsky
2021-06-14 16:29             ` Haakon Bugge
2021-06-15  5:08               ` Leon Romanovsky
2021-06-15 16:13                 ` Haakon Bugge
2021-06-16 11:20                   ` Haakon Bugge
2021-06-16 12:43                     ` Leon Romanovsky

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=YMB9wEygi58hjDLy@unreal \
    --to=leon@kernel.org \
    --cc=anand.a.khoje@oracle.com \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.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