IB/core: Add helpers for uncached GID and P_Key searches
Add ib_find_gid() and ib_find_pkey() functions that use uncached device queries. The calls might block but the returns are always up-to-date. Cache P_Key and GID table lengths in core to avoid extra port info queries. Signed-off-by: Yosef Etigin <yosefe@voltaire.com> Acked-by: Michael S. Tsirkin <mst@dev.mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
committed by
Roland Dreier
parent
8b8c8bca3a
commit
5eb620c81c
@@ -890,6 +890,8 @@ struct ib_device {
|
||||
spinlock_t client_data_lock;
|
||||
|
||||
struct ib_cache cache;
|
||||
int *pkey_tbl_len;
|
||||
int *gid_tbl_len;
|
||||
|
||||
u32 flags;
|
||||
|
||||
@@ -1118,6 +1120,12 @@ int ib_modify_port(struct ib_device *device,
|
||||
u8 port_num, int port_modify_mask,
|
||||
struct ib_port_modify *port_modify);
|
||||
|
||||
int ib_find_gid(struct ib_device *device, union ib_gid *gid,
|
||||
u8 *port_num, u16 *index);
|
||||
|
||||
int ib_find_pkey(struct ib_device *device,
|
||||
u8 port_num, u16 pkey, u16 *index);
|
||||
|
||||
/**
|
||||
* ib_alloc_pd - Allocates an unused protection domain.
|
||||
* @device: The device on which to allocate the protection domain.
|
||||
|
Reference in New Issue
Block a user