From patchwork Sun Jan 10 20:44:28 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: 7997901 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 0523A9F3F6 for ; Sun, 10 Jan 2016 20:48:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B51220382 for ; Sun, 10 Jan 2016 20:48:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B8412037F for ; Sun, 10 Jan 2016 20:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757577AbcAJUrg (ORCPT ); Sun, 10 Jan 2016 15:47:36 -0500 Received: from mail-oi0-f44.google.com ([209.85.218.44]:35985 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757483AbcAJUqt (ORCPT ); Sun, 10 Jan 2016 15:46:49 -0500 Received: by mail-oi0-f44.google.com with SMTP id o124so31858131oia.3 for ; Sun, 10 Jan 2016 12:46:49 -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=gavO59awu9tV893DEiKKIm12NzWepYN0k26Ry6RRof0=; b=yvOujqq33HJQhYcyUYTG6UOAVmtWsZ/8iRjKmQL15mXEqeTdrUwjxpmXmsmoXxU5gb mvjoRWmlBkfFa+R1FU6f4UfwVm4/AWO/9edAyFp+3vA79gydmdT8AlDS9UMG13rGVg3L 5W23GWZCUDTzrWW2R15j4YS7erXJZiJJCZukKMVMD3HySPfk0J+ybpC8EjEl53X+4Yla 0MnGRzIF8jrGWakOiUmiRAwVpPk08v/VyDs3j7piT3Tydm++tnx5mzX9A9OxX6fnw0RF fmsTtZuvcpq2wSzpuvoU30/XrNirjDtgrHmfYobBXJi5QCOyDZfzQG0rFtRt+FhvUqhw wK0A== 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=gavO59awu9tV893DEiKKIm12NzWepYN0k26Ry6RRof0=; b=U91RYSpJbS4nFKcPh8gICAH4nEGNg6g0/Cz98PMYji+aAg26D4fQCbNub+T9LqW7je gT26ylB9YraJ9qHxeWBBuYbtM807pYNX/mOLf9merUsiMi5lN9KwS3NJAoAfaZEgxJCG iBhOe9njUa2oU476Jf6CjUw404jJEFY+Z2UTVl+P20SUzQOc+tadh+GnXakdw49OAK15 UAImKjb2KWETWb8OJBahcGf3oeMBrMuyGHoRtGJ1aWVz7qq0tCehECzRXAneCtk3SBD1 3pvpldxbGwvbxhyPonHH3Wi3mfLx1V5wuRCh8tDkWYjjZqUdDVoVnqP35M9tuHxHzhu/ xvSA== X-Gm-Message-State: ALoCoQm4Mh3i1Y6a/U6s8o7+ua/9IMJiWw7BwF61k0gcQR5hz3WwozweS9oj3TWBJW58FVZ3z+HTGGNqJad2xTjtQFXS2NJC6A== X-Received: by 10.202.87.77 with SMTP id l74mr85940984oib.96.1452458809149; Sun, 10 Jan 2016 12:46:49 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id a65sm19935004oib.23.2016.01.10.12.46.48 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 10 Jan 2016 12:46:48 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lkml , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Vasu Dev , Vu Pham , Nicholas Bellinger Subject: [PATCH-for-4.6 6/6] ib_srpt: Convert to target_alloc_session usage Date: Sun, 10 Jan 2016 20:44:28 +0000 Message-Id: <1452458668-11034-7-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1452458668-11034-1-git-send-email-nab@daterainc.com> References: <1452458668-11034-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=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 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 2ef6466..44878a3 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);