From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: target-devel <target-devel@vger.kernel.org>
Cc: linux-rdma <linux-rdma@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
Roland Dreier <roland@kernel.org>,
Or Gerlitz <ogerlitz@mellanox.com>,
Alexander Nezhinsky <alexandern@mellanox.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [RFC 07/11] iscsi-target: Add iser network portal attribute
Date: Fri, 8 Mar 2013 01:45:12 +0000 [thread overview]
Message-ID: <1362707116-31406-8-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1362707116-31406-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch adds a new network portal attribute for iser, that lives
under existing iscsi-target configfs layout at:
/sys/kernel/config/target/iscsi/$TARGETNAME/$TPGT/np/$PORTAL/iser
When lio_target_np_store_iser() is enabled, iscsit_tpg_add_network_portal()
will attempt to start an rdma_cma network portal for iser-target, only if
the external ib_isert module transport has been loaded.
When disabled, iscsit_tpg_del_network_portal() will cease iser login service
on the network portal, and release any external ib_isert module reference.
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
drivers/target/iscsi/iscsi_target_configfs.c | 75 ++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 78d75c8..c4625dd 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -124,8 +124,83 @@ out:
TF_NP_BASE_ATTR(lio_target, sctp, S_IRUGO | S_IWUSR);
+static ssize_t lio_target_np_show_iser(
+ struct se_tpg_np *se_tpg_np,
+ char *page)
+{
+ struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
+ struct iscsi_tpg_np, se_tpg_np);
+ struct iscsi_tpg_np *tpg_np_iser;
+ ssize_t rb;
+
+ tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND);
+ if (tpg_np_iser)
+ rb = sprintf(page, "1\n");
+ else
+ rb = sprintf(page, "0\n");
+
+ return rb;
+}
+
+static ssize_t lio_target_np_store_iser(
+ struct se_tpg_np *se_tpg_np,
+ const char *page,
+ size_t count)
+{
+ struct iscsi_np *np;
+ struct iscsi_portal_group *tpg;
+ struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np,
+ struct iscsi_tpg_np, se_tpg_np);
+ struct iscsi_tpg_np *tpg_np_iser = NULL;
+ char *endptr;
+ u32 op;
+ int rc;
+
+ op = simple_strtoul(page, &endptr, 0);
+ if ((op != 1) && (op != 0)) {
+ pr_err("Illegal value for tpg_enable: %u\n", op);
+ return -EINVAL;
+ }
+ np = tpg_np->tpg_np;
+ if (!np) {
+ pr_err("Unable to locate struct iscsi_np from"
+ " struct iscsi_tpg_np\n");
+ return -EINVAL;
+ }
+
+ tpg = tpg_np->tpg;
+ if (iscsit_get_tpg(tpg) < 0)
+ return -EINVAL;
+
+ if (op) {
+ tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr,
+ np->np_ip, tpg_np, ISCSI_INFINIBAND);
+ if (!tpg_np_iser || IS_ERR(tpg_np_iser))
+ goto out;
+ } else {
+ tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND);
+ if (!tpg_np_iser)
+ goto out;
+
+ rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser);
+ if (rc < 0)
+ goto out;
+ }
+
+ printk("lio_target_np_store_iser() done, op: %d\n", op);
+
+ iscsit_put_tpg(tpg);
+ return count;
+out:
+ iscsit_put_tpg(tpg);
+ return -EINVAL;
+}
+
+TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR);
+
static struct configfs_attribute *lio_target_portal_attrs[] = {
&lio_target_np_sctp.attr,
+ &lio_target_np_iser.attr,
NULL,
};
--
1.7.2.5
next prev parent reply other threads:[~2013-03-08 1:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 1:45 [RFC 00/11] Add support for iSCSI Extentions for RDMA (ISER) target Nicholas A. Bellinger
2013-03-08 1:45 ` [RFC 01/11] iscsi-target: Add iscsit_transport API template Nicholas A. Bellinger
2013-03-08 4:14 ` Roland Dreier
[not found] ` <CAG4TOxM=PDYXCAMNdRx629aAP+XF7oZmykg0k4b+a688PzzayA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-08 6:02 ` Nicholas A. Bellinger
2013-03-08 16:59 ` Roland Dreier
2013-03-08 12:36 ` Or Gerlitz
2013-03-08 21:26 ` Nicholas A. Bellinger
2013-03-22 17:23 ` Andy Grover
2013-03-22 22:29 ` Nicholas A. Bellinger
2013-03-08 1:45 ` [RFC 02/11] iscsi-target: Initial traditional TCP conversion to iscsit_transport Nicholas A. Bellinger
2013-03-22 17:23 ` Andy Grover
2013-03-22 22:38 ` Nicholas A. Bellinger
2013-03-08 1:45 ` [RFC 03/11] iscsi-target: Add iser-target parameter keys + setup during login Nicholas A. Bellinger
2013-03-22 17:23 ` Andy Grover
2013-03-22 22:57 ` Nicholas A. Bellinger
2013-03-08 1:45 ` [RFC 05/11] iscsi-target: Refactor RX PDU logic + export request PDU handling Nicholas A. Bellinger
[not found] ` <1362707116-31406-6-git-send-email-nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
2013-03-22 17:23 ` Andy Grover
2013-03-22 23:09 ` Nicholas A. Bellinger
[not found] ` <1362707116-31406-1-git-send-email-nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
2013-03-08 1:45 ` [RFC 04/11] iscsi-target: Add per transport iscsi_cmd alloc/free Nicholas A. Bellinger
2013-03-08 14:29 ` Asias He
2013-03-08 20:47 ` Nicholas A. Bellinger
[not found] ` <1362707116-31406-5-git-send-email-nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
2013-03-22 17:23 ` Andy Grover
2013-03-22 22:59 ` Nicholas A. Bellinger
2013-03-08 1:45 ` [RFC 06/11] iscsi-target: Refactor TX queue logic + export response PDU creation Nicholas A. Bellinger
2013-03-08 1:45 ` Nicholas A. Bellinger [this message]
2013-03-08 1:45 ` [RFC 08/11] iser-target: Add base + proto includes Nicholas A. Bellinger
2013-03-14 11:26 ` Or Gerlitz
2013-03-08 1:45 ` [RFC 09/11] iser-target: Add logic for verbs Nicholas A. Bellinger
2013-03-14 11:19 ` Or Gerlitz
[not found] ` <1362707116-31406-10-git-send-email-nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
2013-03-14 11:42 ` Or Gerlitz
2013-03-08 1:45 ` [RFC 10/11] iser-target: Add logic for core Nicholas A. Bellinger
2013-03-14 11:08 ` Or Gerlitz
2013-03-14 11:58 ` Or Gerlitz
2013-03-08 1:45 ` [RFC 11/11] iser-target: Add Makefile + Kconfig Nicholas A. Bellinger
2013-03-14 8:17 ` [RFC 00/11] Add support for iSCSI Extentions for RDMA (ISER) target Or Gerlitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362707116-31406-8-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=alexandern@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=roland@kernel.org \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox