Commit 190fb9c4 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

IB/core: Refer to RoCE port property to decide building cache

IB core maintains the GID cache entries for the GID table.
This cache table has to be maintained regardless of HCA's
support of GID table.
For IB and iWarp ports, cache is created by querying the HCA.
For RoCE cache is created based on netdev events.

Therefore just refer to the RoCE port property of the {device, port} to
decide whether to build cache by querying HCA or from netdev events.
There is no need to check if HCA support GID table or not.

ib_cache_update() referred to RoCE attribute before validating
port. Though in all current callers port is valid, it is incorrect
to query RoCE port property before validating the port. Therefore,
rdma_protocol_roce() check is done after rdma_is_port_valid() verifies
that port is valid.

Fixes: 115b68aa ("IB/ocrdma: Removed GID add/del null routines")
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 22d24f75
...@@ -1070,12 +1070,12 @@ static void ib_cache_update(struct ib_device *device, ...@@ -1070,12 +1070,12 @@ static void ib_cache_update(struct ib_device *device,
int i; int i;
int ret; int ret;
struct ib_gid_table *table; struct ib_gid_table *table;
bool use_roce_gid_table = bool use_roce_gid_table;
rdma_cap_roce_gid_table(device, port);
if (!rdma_is_port_valid(device, port)) if (!rdma_is_port_valid(device, port))
return; return;
use_roce_gid_table = rdma_protocol_roce(device, port);
table = device->cache.ports[port - rdma_start_port(device)].gid; table = device->cache.ports[port - rdma_start_port(device)].gid;
tprops = kmalloc(sizeof *tprops, GFP_KERNEL); tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment