This patch does not change any functionality. Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx> --- srp_daemon/srp_daemon.c | 11 +++-------- srp_daemon/srp_daemon.h | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index 08d1134dca7d..9be37f3ced1d 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -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) diff --git a/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon.h index b29beb3f2d6a..dcc848aa6ed5 100644 --- a/srp_daemon/srp_daemon.h +++ b/srp_daemon/srp_daemon.h @@ -234,6 +234,7 @@ struct ud_resources { }; struct umad_resources { + struct ibv_context *ib_ctx; int portid; int agent; char *port_sysfs_path; -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html