From: Leon Romanovsky <leon@kernel.org>
To: "Håkon Bugge" <haakon.bugge@oracle.com>
Cc: Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@nvidia.com>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next] IB/core: Only update PKEY and GID caches on respective events
Date: Thu, 6 May 2021 10:29:16 +0300 [thread overview]
Message-ID: <YJOazOU65fI/WMwN@unreal> (raw)
In-Reply-To: <1620128784-3283-1-git-send-email-haakon.bugge@oracle.com>
On Tue, May 04, 2021 at 01:46:24PM +0200, Håkon Bugge wrote:
> Both the PKEY and GID tables in an HCA can hold in the order of
> hundreds entries. Reading them are expensive. Partly because the API
> for retrieving them only returns a single entry at a time. Further, on
> certain implementations, e.g., CX-3, the VFs are paravirtualized in
> this respect and have to rely on the PF driver to perform the
> read. This again demands VF to PF communication.
>
> IB Core's cache is refreshed on all events. Hence, filter the refresh
> of the PKEY and GID caches based on the event received being
> IB_EVENT_PKEY_CHANGE and IB_EVENT_GID_CHANGE respectively.
>
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
> ---
> drivers/infiniband/core/cache.c | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
> index 5c9fac7..531ae6b 100644
> --- a/drivers/infiniband/core/cache.c
> +++ b/drivers/infiniband/core/cache.c
> @@ -1472,10 +1472,14 @@ static int config_non_roce_gid_cache(struct ib_device *device,
> }
>
> static int
> -ib_cache_update(struct ib_device *device, u8 port, bool enforce_security)
> +ib_cache_update(struct ib_device *device, u8 port, enum ib_event_type event,
> + bool reg_dev, bool enforce_security)
> {
> struct ib_port_attr *tprops = NULL;
> - struct ib_pkey_cache *pkey_cache = NULL, *old_pkey_cache;
> + struct ib_pkey_cache *pkey_cache = NULL;
> + struct ib_pkey_cache *old_pkey_cache = NULL;
> + bool update_pkey_cache = (reg_dev || event == IB_EVENT_PKEY_CHANGE);
> + bool update_gid_cache = (reg_dev || event == IB_EVENT_GID_CHANGE);
I'm not super excited to see "events" in this function and would be more
happy to see it is handled in ib_cache_event_task() while the function
signature will be:
ib_cache_update(struct ib_device *device, u8 port, bool all_gids, bool
all_pkeys, bool enforce_security)
Thanks
next prev parent reply other threads:[~2021-05-06 7:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 11:46 [PATCH for-next] IB/core: Only update PKEY and GID caches on respective events Håkon Bugge
2021-05-04 14:15 ` Zhu Yanjun
2021-05-04 14:35 ` Haakon Bugge
2021-05-06 7:29 ` Leon Romanovsky [this message]
2021-05-06 7:43 ` Haakon Bugge
2021-05-06 8:06 ` 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=YJOazOU65fI/WMwN@unreal \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=haakon.bugge@oracle.com \
--cc=jgg@nvidia.com \
--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