diff options
author | Jack Wang <jinpu.wang@profitbricks.com> | 2017-01-02 13:17:36 +0100 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-01-12 22:59:55 -0500 |
commit | aaaca121c7cf9217ab81d9db0a04835d52aabebe (patch) | |
tree | efaef9192a68a244e50d44903a13d687df8c2ec2 /drivers/infiniband/core | |
parent | 27d41d29c7f093f6f77843624fbb080c1b4a8b9c (diff) |
RDMA/core: add port state cache
We need a port state cache in ib_core, later we will use in rdma_cm.
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Michael Wang <yun.wang@profitbricks.com>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/cache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index ae04826e82fc..87fd7c39fbc0 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1105,6 +1105,8 @@ static void ib_cache_update(struct ib_device *device, } device->cache.lmc_cache[port - rdma_start_port(device)] = tprops->lmc; + device->cache.port_state_cache[port - rdma_start_port(device)] = + tprops->state; write_unlock_irq(&device->cache.lock); @@ -1164,7 +1166,11 @@ int ib_cache_setup_one(struct ib_device *device) (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); - if (!device->cache.pkey_cache || + device->cache.port_state_cache = kmalloc(sizeof *device->cache.port_state_cache * + (rdma_end_port(device) - + rdma_start_port(device) + 1), + GFP_KERNEL); + if (!device->cache.pkey_cache || !device->cache.port_state_cache || !device->cache.lmc_cache) { err = -ENOMEM; goto free; @@ -1190,6 +1196,7 @@ err: free: kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); return err; } @@ -1211,6 +1218,7 @@ void ib_cache_release_one(struct ib_device *device) gid_table_release_one(device); kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); } void ib_cache_cleanup_one(struct ib_device *device) |