@@ -796,15 +796,9 @@ static int check_sm_cap(struct umad_resources *umad_res, int *mask_match)
int pkey_index_to_pkey(struct umad_resources *umad_res, int pkey_index,
uint16_t *pkey)
{
- char pkey_file[18], pkey_str[16];
-
- /* Read pkey */
- snprintf(pkey_file, sizeof(pkey_file), "pkeys/%d", pkey_index);
- if (srpd_sys_read_string(umad_res->port_sysfs_path, pkey_file,
- pkey_str, sizeof(pkey_str)) < 0)
+ if (ibv_query_pkey(umad_res->ib_ctx, config->port_num, pkey_index,
+ pkey) < 0)
return -1;
-
- *pkey = strtoul(pkey_str, NULL, 0);
if (*pkey)
pr_debug("discover Targets for P_key %04x (index %d)\n",
*pkey, pkey_index);
@@ -1934,6 +1928,7 @@ static struct resources *alloc_res(void)
if (ret)
goto err;
res->res.ud_res = &res->ud_res;
+ res->umad_res.ib_ctx = res->ud_res.ib_ctx;
ret = sync_resources_init(&res->sync_res);
if (ret)
@@ -234,6 +234,7 @@ struct ud_resources {
};
struct umad_resources {
+ struct ibv_context *ib_ctx;
int portid;
int agent;
char *port_sysfs_path;
This patch does not change any functionality. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- srp_daemon/srp_daemon.c | 11 +++-------- srp_daemon/srp_daemon.h | 1 + 2 files changed, 4 insertions(+), 8 deletions(-)