From patchwork Mon Jan 25 08:11:00 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: 8104381 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 473859F859 for ; Mon, 25 Jan 2016 08:14:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A9D420364 for ; Mon, 25 Jan 2016 08:14:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CC4C2034F for ; Mon, 25 Jan 2016 08:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752755AbcAYIOX (ORCPT ); Mon, 25 Jan 2016 03:14:23 -0500 Received: from mail-oi0-f54.google.com ([209.85.218.54]:33429 "EHLO mail-oi0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753303AbcAYIOB (ORCPT ); Mon, 25 Jan 2016 03:14:01 -0500 Received: by mail-oi0-f54.google.com with SMTP id w75so82742266oie.0 for ; Mon, 25 Jan 2016 00:14:00 -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=JtV7ENgY8JcJi66QYDrBRLk9Jnxygo7xZncizyKw9Wk=; b=MM+KP/9l/+MPIXmo3jVtxBfBjfveTyKwCIxjgIR4MmC2c8B+TdyLWZkE5flimB7YXQ NUG8VBeC8GgSpeCgj5fHLm+WML5CSih/ummsW7WG+Fcw3pljvoZPmit2pBdSyN5+OlK/ kupssXJAoGbXDRZbZb3TGfOonZ0SPBFqWFbLrl/It4lHqfQtjAazFYbkorLq1Fz4IDT3 QlnmLtq+RFScaz50tW1Gv4JAVuJtYTajUBW2DTnjoaL9zxse9zsSK2if5HP+TB6INykf peKHviYYxfAq51VANfyp7LWFcdnHwKHq+bQvPfkGWmY4Y9S6XxKivzQknJO3OdjaMF46 58pA== 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=JtV7ENgY8JcJi66QYDrBRLk9Jnxygo7xZncizyKw9Wk=; b=erSKoLjDdV2sHc6PCo1mhv5dODIFqjiGHPHvEWt6ci9h9R3dQuOnUpeiWG7o+KFWqX QurUGJKsq3fI3qpWXgZhXpB7okDVhZEliSIm5Vpy9d01DTqiofHPdsTVe5+48qZadjUo LNnnNUBsTWOztA7u0/orAFVRwG2kEyatxJATdJ3EZZ/3S1iY/r1y/+jV6kBU8vAfvWU0 4Ye5tfmojfGenXzYdQXFCecFQaVgMQsphSUSMs7d0jMFr2/XG16Bv1BpxQ0rXldby6Pp AGZxgGr7GW7BQRLtIvoLTtTtYXG86aBUin6ba6z7Hd5QShuDpsllE1uCL7ZfhkDOLM4M LnZQ== X-Gm-Message-State: AG10YOQ67KDSGrUNQdq+JdPuAfppnVvGeCRn0PgYeqtw7rQ2b33jTsIJK4gBSdDijK+V4w== X-Received: by 10.202.98.5 with SMTP id w5mr7636994oib.88.1453709640614; Mon, 25 Jan 2016 00:14:00 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id v142sm9939087oie.28.2016.01.25.00.13.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Jan 2016 00:14:00 -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 , Nicholas Bellinger , Vu Pham Subject: [PATCH-v2 06/12] ib_srpt: Convert to target_alloc_session usage Date: Mon, 25 Jan 2016 08:11:00 +0000 Message-Id: <1453709466-6308-7-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1453709466-6308-1-git-send-email-nab@daterainc.com> References: <1453709466-6308-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 Cc: Vu Pham Cc: Sagi Grimberg 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 bc5470c..5a35c1f 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2387,7 +2387,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; @@ -2553,19 +2552,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' */ @@ -2573,14 +2565,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);