From patchwork Sat Jan 30 07:05:50 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: 8169891 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 2CC119FBE9 for ; Sat, 30 Jan 2016 07:09:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54ABE20396 for ; Sat, 30 Jan 2016 07:09:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6985B20395 for ; Sat, 30 Jan 2016 07:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756494AbcA3HJA (ORCPT ); Sat, 30 Jan 2016 02:09:00 -0500 Received: from mail-ob0-f177.google.com ([209.85.214.177]:36749 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756372AbcA3HI4 (ORCPT ); Sat, 30 Jan 2016 02:08:56 -0500 Received: by mail-ob0-f177.google.com with SMTP id ba1so81463732obb.3 for ; Fri, 29 Jan 2016 23:08:56 -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=3LAeIVvYpspsNo3hwtethKY3Gxf1bBTqjqg5IqH3cbk=; b=fZgidPM5zMKN+cpGKQFtVfTt9UNHOxOFkiVl195lgvUHv7g4st4K5/M9zrYRICrsnx xyvblQ3ShGlcucgIy9jD5za4lK135QBOyUuLzXWgxvqyLd6KwW3mGKhIbeRMQEsQ6zt+ Rye5w0NWSe9hUKPw7VTOYmagYriMtlv6cCAfPtp86zvgYbhUfpgGEI+rdb7Fp2mPY8GM 61FGH1jmj/M9Iho2yWJQTDcAtdwEpZ9odg6B7XBm4uGN0XLhOoBsT16W5X4WugRshZYU dOF1xChKtHEqvg4CGhJxGN5jsWf50/h/5vGHEN25s0QbQnVGuI5P08lO4BZ4cSAaGQnz SCzw== 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=3LAeIVvYpspsNo3hwtethKY3Gxf1bBTqjqg5IqH3cbk=; b=gVVKaP5r4FA+PjcpY618aUpq9CpzY4GbnSlXisYJ2TQ5wF0Ewf+WbyJkXCv9Qcc1qs a0TH0XLU26YCbtRINKUxJfWXM3JXPumIXlJ3xCWg+VINejLa572XrfGdql5KFCsTnmV/ 78/p76cqeQtJ4kw6xvReUTjuPaNU5Ux9uYrfkgU1ktYsVTkR+fuQSbthiGV3nYBGFWeo pQySuCqNAz9wQ1qNQBQnwAq3sZB4XAYNQwRY+K3EwUZJQLTniPWIzIEt59UBg+2oia0f 0qQj75EV6RgeVj/ggiQ9dj1MRiHE7y474Lj1163bhWPN2aKiQ03K2GziZchCG9ErDw22 iGZw== X-Gm-Message-State: AG10YORpX8PFMamG/7BqfiT6URcWGsVXaqUs63yySr6GaXBdn24ePOnXmk3n9Itk+bUpzw== X-Received: by 10.60.128.195 with SMTP id nq3mr10122590oeb.52.1454137736295; Fri, 29 Jan 2016 23:08:56 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id f8sm8655678obs.3.2016.01.29.23.08.55 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Jan 2016 23:08:55 -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-v3 06/14] ib_srpt: Convert to target_alloc_session usage Date: Sat, 30 Jan 2016 07:05:50 +0000 Message-Id: <1454137558-30396-7-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1454137558-30396-1-git-send-email-nab@daterainc.com> References: <1454137558-30396-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 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);