From patchwork Thu Oct 16 16:19:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikolova, Tatyana E" X-Patchwork-Id: 5092561 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B561B9F30B for ; Thu, 16 Oct 2014 16:20:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE70A201B9 for ; Thu, 16 Oct 2014 16:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF9652012B for ; Thu, 16 Oct 2014 16:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288AbaJPQUJ (ORCPT ); Thu, 16 Oct 2014 12:20:09 -0400 Received: from mga01.intel.com ([192.55.52.88]:62147 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbaJPQUJ (ORCPT ); Thu, 16 Oct 2014 12:20:09 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 16 Oct 2014 09:20:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,733,1406617200"; d="scan'208";a="606524981" Received: from tenikolo-mobl2.amr.corp.intel.com (HELO tenikolo-mobl1) ([10.122.74.49]) by fmsmga001.fm.intel.com with SMTP; 16 Oct 2014 09:19:55 -0700 Received: by tenikolo-mobl1 (sSMTP sendmail emulation); Thu, 16 Oct 2014 11:19:54 -0500 Date: Thu, 16 Oct 2014 11:19:54 -0500 From: Tatyana Nikolova To: Roland Dreier Cc: john.s.lacombe@intel.com, swise@opengridcomputing.com, linux-rdma@vger.kernel.org Subject: [PATCH 1/1] RDMA/core: Fixes for port mapper client registration Message-ID: <20141016161954.GA23268@TENIKOLO-MOBL2> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IWPM_REG_CLIENT and IWPM_PREV_REG_CLIENT are added: IWPM_REG_CLIENT is a client, registered with the user space port mapper daemon, available at the time of the client register pid request. IWPM_PREV_REG_CLIENT is a client, which has been IWPM_REG_CLIENT before the user space port mapper daemon is stopped. After restarting the port mapper, IWPM_PREV_REG_CLIENTs provide their mapping info to the port mapper daemon and they are allowed to send remove mapping requests aftewards. Signed-off-by: Tatyana Nikolova --- drivers/infiniband/core/iwpm_msg.c | 13 +++++++------ drivers/infiniband/core/iwpm_util.c | 1 + drivers/infiniband/core/iwpm_util.h | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c index ab08170..2aca295 100644 --- a/drivers/infiniband/core/iwpm_msg.c +++ b/drivers/infiniband/core/iwpm_msg.c @@ -67,7 +67,9 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) err_str = "Invalid port mapper client"; goto pid_query_error; } - if (iwpm_registered_client(nl_client)) + if (iwpm_registered_client(nl_client) == IWPM_REG_CLIENT) + return 0; + if (iwpm_user_pid == IWPM_PID_UNAVAILABLE) return 0; skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REG_PID, &nlh, nl_client); if (!skb) { @@ -106,7 +108,6 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL); if (ret) { skb = NULL; /* skb is freed in the netlink send-op handling */ - iwpm_set_registered(nl_client, 1); iwpm_user_pid = IWPM_PID_UNAVAILABLE; err_str = "Unable to send a nlmsg"; goto pid_query_error; @@ -144,7 +145,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) err_str = "Invalid port mapper client"; goto add_mapping_error; } - if (!iwpm_registered_client(nl_client)) { + if (iwpm_registered_client(nl_client) != IWPM_REG_CLIENT) { err_str = "Unregistered port mapper client"; goto add_mapping_error; } @@ -214,7 +215,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) err_str = "Invalid port mapper client"; goto query_mapping_error; } - if (!iwpm_registered_client(nl_client)) { + if (iwpm_registered_client(nl_client) != IWPM_REG_CLIENT) { err_str = "Unregistered port mapper client"; goto query_mapping_error; } @@ -388,7 +389,7 @@ int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb) pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", __func__, iwpm_user_pid); if (iwpm_valid_client(nl_client)) - iwpm_set_registered(nl_client, 1); + iwpm_set_registered(nl_client, IWPM_REG_CLIENT); register_pid_response_exit: nlmsg_request->request_done = 1; /* always for found nlmsg_request */ @@ -669,7 +670,7 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb) __func__, nl_client); return ret; } - iwpm_set_registered(nl_client, 0); + iwpm_set_registered(nl_client, IWPM_PREV_REG_CLIENT); atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); if (!iwpm_mapinfo_available()) return 0; diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index a626795..7a20a1b 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c @@ -106,6 +106,7 @@ int iwpm_exit(u8 nl_client) } mutex_unlock(&iwpm_admin_lock); iwpm_set_valid(nl_client, 0); + iwpm_set_registered(nl_client, 0); return 0; } EXPORT_SYMBOL(iwpm_exit); diff --git a/drivers/infiniband/core/iwpm_util.h b/drivers/infiniband/core/iwpm_util.h index ee2d9ff..b1dfd1a 100644 --- a/drivers/infiniband/core/iwpm_util.h +++ b/drivers/infiniband/core/iwpm_util.h @@ -58,6 +58,9 @@ #define IWPM_PID_UNDEFINED -1 #define IWPM_PID_UNAVAILABLE -2 +#define IWPM_REG_CLIENT 1 +#define IWPM_PREV_REG_CLIENT 2 + struct iwpm_nlmsg_request { struct list_head inprocess_list; __u32 nlmsg_seq;