From patchwork Fri Mar 11 06:30:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 8562341 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 61E98C0553 for ; Fri, 11 Mar 2016 06:34:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 734F12026D for ; Fri, 11 Mar 2016 06:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E0012034F for ; Fri, 11 Mar 2016 06:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933170AbcCKGen (ORCPT ); Fri, 11 Mar 2016 01:34:43 -0500 Received: from mail-oi0-f48.google.com ([209.85.218.48]:33610 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755026AbcCKGej (ORCPT ); Fri, 11 Mar 2016 01:34:39 -0500 Received: by mail-oi0-f48.google.com with SMTP id d205so79020471oia.0 for ; Thu, 10 Mar 2016 22:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daterainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qG6qHOn6yMXdJhtVTEMgUeFxzsclvnVerPwbuvZ3Hto=; b=GRB/rGly5nzqxzuNsUuKfVBUXrypPlbA90o//fci7P3b04TXAPTYcOuGeGj0rIajqG Zqo+tddIbspzwRNvVNyythlGqbhTwn3VebWg0386WtYtNyrxwrH1CKSscsKmE1E4tQzK DJhMuXUBZMkW9VWk20gBmRPifGXcmAfga/cU2vBjA/81AvYRGhijMNJfeNTJ/pGLsLjw sdc//w8aJzMGI6AJHJKw1gXAiFBIETxP0+R/q2UFUzEH7HpHssQO5SWwtJl++lxtPm1N O0W/aQb4JK1+rGcfDsosnERdz5yLNokFL+qK+fUJHlG7l3ouNhf9kpmQuhDhwzefekzw BAoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qG6qHOn6yMXdJhtVTEMgUeFxzsclvnVerPwbuvZ3Hto=; b=BUQdt0H8a8mhPClJhVZZ2VPwhg90MUjZzpAq877ef2ObJZsmmQ2VldIByDwmQ9AgH0 otfWMRfWPj6fL7TWdtKObVVuL530C2HOSdUCvsh6icjOMfFXcnfCau6REZQEDA5+UWXO rRHZLUnwU3n2q/amrmr3y5dLeXzHbGgtMVZXB+RWK3Yq8ugefwqic16VtwXce2z9CpmT EAO1Xg7gS9lKD/0rZiDPslqd+04yWTg44lll7+V0T7YPSB9zAis1DuO5/0A90Pbnb4QV ScKLScvj9wYIkQpO/9EUnnCtDNUJdxSlo67FzTio+Ahj6lVKtSGFCE6isCAEyWycNE0O 9IAg== X-Gm-Message-State: AD7BkJJTfulUFnwxj4kvLZjItC9qR+wZuYUtM3qX3a+DZbjHxp3usSQsNs0gy1SLIMaK8g== X-Received: by 10.202.182.11 with SMTP id g11mr4351001oif.133.1457678078921; Thu, 10 Mar 2016 22:34:38 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id s81sm3540631oif.0.2016.03.10.22.34.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 Mar 2016 22:34:38 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , Christoph Hellwig , Hannes Reinecke , Mike Christie , Sagi Grimberg , Andy Grover , Sebastian Andrzej Siewior , Juergen Gross , Andrzej Pietrasiewicz , Chris Boot , Felipe Balbi , Nicholas Bellinger , Vu Pham , Bart Van Assche Subject: [PATCH-v4 06/14] ib_srpt: Convert to target_alloc_session usage Date: Fri, 11 Mar 2016 06:30:02 +0000 Message-Id: <1457677810-2478-7-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1457677810-2478-1-git-send-email-nab@daterainc.com> References: <1457677810-2478-1-git-send-email-nab@daterainc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Nicholas Bellinger This patch converts ib_srpt internal assignments of se_node_acl and transport_register_session() to use the new alloc_session method. Cc: Vu Pham Cc: Sagi Grimberg Cc: Bart Van Assche Signed-off-by: Nicholas Bellinger --- drivers/infiniband/ulp/srpt/ib_srpt.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0c37fee..72a671e 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2240,7 +2240,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, struct srp_login_rej *rej; struct ib_cm_rep_param *rep_param; struct srpt_rdma_ch *ch, *tmp_ch; - struct se_node_acl *se_acl; u32 it_iu_len; int i, ret = 0; unsigned char *p; @@ -2406,19 +2405,12 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, pr_debug("registering session %s\n", ch->sess_name); p = &ch->sess_name[0]; - ch->sess = transport_init_session(TARGET_PROT_NORMAL); - if (IS_ERR(ch->sess)) { - rej->reason = cpu_to_be32( - SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); - pr_debug("Failed to create session\n"); - goto destroy_ib; - } - try_again: - se_acl = core_tpg_get_initiator_node_acl(&sport->port_tpg_1, p); - if (!se_acl) { + ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0, + TARGET_PROT_NORMAL, p, ch, NULL); + if (IS_ERR(ch->sess)) { pr_info("Rejected login because no ACL has been" - " configured yet for initiator %s.\n", ch->sess_name); + " configured yet for initiator %s.\n", p); /* * XXX: Hack to retry of ch->i_port_id without leading '0x' */ @@ -2426,14 +2418,11 @@ try_again: p += 2; goto try_again; } - rej->reason = cpu_to_be32( + rej->reason = cpu_to_be32((PTR_ERR(ch->sess) == -ENOMEM) ? + SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES : SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); - transport_free_session(ch->sess); goto destroy_ib; } - ch->sess->se_node_acl = se_acl; - - transport_register_session(&sport->port_tpg_1, se_acl, ch->sess, ch); pr_debug("Establish connection sess=%p name=%s cm_id=%p\n", ch->sess, ch->sess_name, ch->cm_id);