IB/core: Only update PKEY and GID caches on respective events
authorHåkon Bugge <haakon.bugge@oracle.com>
Tue, 25 May 2021 17:49:09 +0000 (19:49 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 28 May 2021 23:26:16 +0000 (20:26 -0300)
commitd58c23c9254894d438ce5c516745cf694eac86b7
treebcc6f5c8cacae8846893daea9ffd4e8809c9f82d
parent3f0d979efb82ce514ef1c6f135d0f118bf1bcea4
IB/core: Only update PKEY and GID caches on respective events

Both the PKEY and GID tables in an HCA can hold in the order of hundreds
entries. Reading them is 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.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/r/1621964949-28484-1-git-send-email-haakon.bugge@oracle.com
Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/cache.c