From patchwork Mon Jul 23 16:48:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10540595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9A991823 for ; Mon, 23 Jul 2018 16:48:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D915F28C64 for ; Mon, 23 Jul 2018 16:48:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD95528CC0; Mon, 23 Jul 2018 16:48:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03CC28CA9 for ; Mon, 23 Jul 2018 16:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388703AbeGWRuW (ORCPT ); Mon, 23 Jul 2018 13:50:22 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:26625 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388283AbeGWRuV (ORCPT ); Mon, 23 Jul 2018 13:50:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1532364497; x=1563900497; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=xcaKTd/FtGEVtStYYzwJFM0Gcskw8mmel18YGkG8tPY=; b=Z3W+IN9owXMnbiGLSed80LwBmmpsiCoa+R8jAPrGL84/BvqXheCLw8Me 0LNi3anltX+BN43PYKOMPGD2JsrdfDFtPiNvLxMMllomaR6KIdvZMYNNW 4RjIlnsiLU+UgXjCS/b0Dpi7FJonlRrXd7A1Y0LoYyTPbxZ+rpw7Iuu/3 vnB5ETmB6aXe7OjXFZ4DutaPSyvfIqTzV4xWuJlQan2xx+imAiz+XakTs YSnVDbgyzfCaCDbBVtotN9qs1gOZo5HE2wWkQAq6Sb+VIuafrNxCRpTOF 4qoYSAu7Iq3l5Oq1ZxVrS10IgKN1221wTHgLkpdf++66HsUPMvltR59uB Q==; X-IronPort-AV: E=Sophos;i="5.51,393,1526313600"; d="scan'208";a="88094275" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Jul 2018 00:48:16 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 23 Jul 2018 09:36:26 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 23 Jul 2018 09:48:17 -0700 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Daniel Ahlin , Bart Van Assche Subject: [PATCH 2/5] srp_daemon: Move the pkey_index_to_pkey() definition Date: Mon, 23 Jul 2018 09:48:12 -0700 Message-Id: <20180723164815.26448-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723164815.26448-1-bart.vanassche@wdc.com> References: <20180723164815.26448-1-bart.vanassche@wdc.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality. Signed-off-by: Bart Van Assche --- srp_daemon/srp_daemon.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index 6356e1373f9a..08d1134dca7d 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -793,6 +793,24 @@ static int check_sm_cap(struct umad_resources *umad_res, int *mask_match) return 0; } +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) + return -1; + + *pkey = strtoul(pkey_str, NULL, 0); + if (*pkey) + pr_debug("discover Targets for P_key %04x (index %d)\n", + *pkey, pkey_index); + return 0; +} + static int set_class_port_info(struct umad_resources *umad_res, uint16_t dlid) { struct srp_ib_user_mad in_mad, out_mad; @@ -1071,24 +1089,6 @@ static int get_port_info(struct umad_resources *umad_res, uint16_t dlid, return 0; } -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) - return -1; - - *pkey = strtoul(pkey_str, NULL, 0); - if (*pkey) - pr_debug("discover Targets for P_key %04x (index %d)\n", - *pkey, pkey_index); - return 0; -} - static int get_shared_pkeys(struct resources *res, uint16_t dest_port_lid, uint16_t *pkeys)