rebase to upstream snapshot 2.0.873-134-g6aa2c9b

add patch to improve GIL lock performance in libiscsi
split Python 2 and Python 3 bindings out into subpackages
This commit is contained in:
Chris Leech 2015-06-09 23:11:22 -07:00
parent 16c84799b2
commit 929689a76c
118 changed files with 41103 additions and 107014 deletions

View File

@ -1,43 +0,0 @@
From 71cd021b74a7094b5186a42bfe59a35e2fa66018 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 5 Sep 2012 16:18:16 -0500
Subject: iscsid: fix iscsid segfault during qla4xxx login
If the kernel sends multiple ISCSI_KEVENT_CONN_LOGIN_STATE
events for the same login event iscsid will segault.
When we get a conn error we will set the r_stage to reopen, then when
session_conn_process_login handles the first login event we set the r_stage
to R_STAGE_NO_CHANGE. But then it looks like if we get a second login event
r_stage is no_change and session_conn_process_login will run again and
call mgmt_ipc_write_rsp on a bad qtask.
---
usr/initiator.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/usr/initiator.c b/usr/initiator.c
index 79ca32c..d475358 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -993,7 +993,7 @@ static void session_scan_host(struct iscsi_session *session, int hostno,
exit(0);
} else if (pid > 0) {
reap_inc();
- if (qtask) {
+ if (qtask && qtask->mgmt_ipc_fd >= 0) {
close(qtask->mgmt_ipc_fd);
free(qtask);
}
@@ -1618,6 +1618,9 @@ static void session_conn_process_login(void *data)
if (state == ISCSI_CONN_STATE_FREE)
goto failed_login;
+ if (conn->state == ISCSI_CONN_STATE_LOGGED_IN)
+ return;
+
conn->state = ISCSI_CONN_STATE_LOGGED_IN;
/*
* ok we were in_login and now we got the notification that we are
--
1.7.11.7

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
From f0a8c95426d21413d9980d31740e193208e3280e Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 5 Sep 2012 14:14:20 -0700
Subject: ISCSISTART: Bring up the corresponding network interface for iboot
This is needed for the iSCSI offload boot.
Snip from M. Christie:
Note that we must bring up the interface before iface_setup_from_boot_context,
because we will want iscsi_sysfs_get_host_no_from_hwaddress to be able to match
a MAC to a iscsi host. For some bnx2i cards, the card has to be ifupd for the
iscsi interface to have a MAC. If it is not ifupd we have seen MACs with all
zeros or no iscsi_hosts on different cards.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
usr/iface.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/usr/iface.c b/usr/iface.c
index 3a9582e..4028e34 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -917,6 +917,10 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
transport_name))
t = iscsi_sysfs_get_transport_by_name(transport_name);
+ if (net_ifup_netdev(context->iface))
+ log_warning("Could not bring up netdev %s for boot",
+ context->iface);
+
hostno = iscsi_sysfs_get_host_no_from_hwaddress(context->mac,
&rc);
if (rc) {
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From 24a4d8156786dfd91dcc17b2472653e963ebd028 Mon Sep 17 00:00:00 2001
From a6b6a38a783a29951a3c91f95416ebec69ea2375 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 10:59:44 -0700
Subject: idmb_rec_write, check for tpgt first
Subject: [PATCH] idmb_rec_write, check for tpgt first
Factor out the check for a tpgt to a single place, before going crazy on
the rec files. Makes flow of this function easier to follow, and preps
@ -11,10 +11,10 @@ for splitting it up.
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index 1e4f8c8..0a88699 100644
index 198a5ef..caec94f 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1849,6 +1849,10 @@ static int idbm_rec_write(node_rec_t *rec)
@@ -2041,6 +2041,10 @@ static int idbm_rec_write(node_rec_t *rec)
if (rc)
goto free_portal;
@ -25,7 +25,7 @@ index 1e4f8c8..0a88699 100644
rc = stat(portal, &statb);
if (rc) {
rc = 0;
@@ -1857,23 +1861,11 @@ static int idbm_rec_write(node_rec_t *rec)
@@ -2049,23 +2053,11 @@ static int idbm_rec_write(node_rec_t *rec)
* set the tgpt. In new versions you must pass all the info in
* from the start
*/
@ -51,5 +51,5 @@ index 1e4f8c8..0a88699 100644
*/
if (unlink(portal)) {
--
1.8.1.4
2.1.0

View File

@ -1,7 +1,7 @@
From 954a9492b5ed1de5907ad2a7d7cc0ae6215d8fac Mon Sep 17 00:00:00 2001
From c9247e2ad8b8e2b6cebdb5e5de4e0949f0d3db8c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 11:34:31 -0700
Subject: idbm_rec_write, seperate old and new style writes
Subject: [PATCH] idbm_rec_write, seperate old and new style writes
Duplicates a small bit of code, but easier to understand and extened.
---
@ -9,10 +9,10 @@ Duplicates a small bit of code, but easier to understand and extened.
1 file changed, 79 insertions(+), 37 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index 0a88699..cb6ffd1 100644
index caec94f..63265c2 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1808,7 +1808,7 @@ mkdir_portal:
@@ -2000,7 +2000,7 @@ mkdir_portal:
return f;
}
@ -21,15 +21,15 @@ index 0a88699..cb6ffd1 100644
{
struct stat statb;
FILE *f;
@@ -1820,38 +1820,8 @@ static int idbm_rec_write(node_rec_t *rec)
log_error("Could not alloc portal\n");
@@ -2012,38 +2012,8 @@ static int idbm_rec_write(node_rec_t *rec)
log_error("Could not alloc portal");
return ISCSI_ERR_NOMEM;
}
-
- snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
- if (access(portal, F_OK) != 0) {
- if (mkdir(portal, 0660) != 0) {
- log_error("Could not make %s: %s\n", portal,
- log_error("Could not make %s: %s", portal,
- strerror(errno));
- rc = ISCSI_ERR_IDBM;
- goto free_portal;
@ -39,7 +39,7 @@ index 0a88699..cb6ffd1 100644
- snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name);
- if (access(portal, F_OK) != 0) {
- if (mkdir(portal, 0660) != 0) {
- log_error("Could not make %s: %s\n", portal,
- log_error("Could not make %s: %s", portal,
- strerror(errno));
- rc = ISCSI_ERR_IDBM;
- goto free_portal;
@ -60,8 +60,8 @@ index 0a88699..cb6ffd1 100644
rc = stat(portal, &statb);
if (rc) {
@@ -1872,11 +1842,11 @@ static int idbm_rec_write(node_rec_t *rec)
log_error("Could not convert %s: %s\n", portal,
@@ -2064,11 +2034,11 @@ static int idbm_rec_write(node_rec_t *rec)
log_error("Could not convert %s: %s", portal,
strerror(errno));
rc = ISCSI_ERR_IDBM;
- goto unlock;
@ -74,8 +74,8 @@ index 0a88699..cb6ffd1 100644
}
mkdir_portal:
@@ -1887,24 +1857,96 @@ mkdir_portal:
log_error("Could not make dir %s: %s\n",
@@ -2079,24 +2049,96 @@ mkdir_portal:
log_error("Could not make dir %s: %s",
portal, strerror(errno));
rc = ISCSI_ERR_IDBM;
- goto unlock;
@ -90,7 +90,7 @@ index 0a88699..cb6ffd1 100644
+/* open_conf: */
f = fopen(portal, "w");
if (!f) {
log_error("Could not open %s: %sd\n", portal, strerror(errno));
log_error("Could not open %s: %s", portal, strerror(errno));
rc = ISCSI_ERR_IDBM;
- goto unlock;
+ goto free_portal;
@ -112,7 +112,7 @@ index 0a88699..cb6ffd1 100644
+
+ portal = malloc(PATH_MAX);
+ if (!portal) {
+ log_error("Could not alloc portal\n");
+ log_error("Could not alloc portal");
+ return ISCSI_ERR_NOMEM;
+ }
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR,
@ -120,7 +120,7 @@ index 0a88699..cb6ffd1 100644
+
+ f = fopen(portal, "w");
+ if (!f) {
+ log_error("Could not open %s: %sd\n", portal, strerror(errno));
+ log_error("Could not open %s: %sd", portal, strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
+ }
@ -138,14 +138,14 @@ index 0a88699..cb6ffd1 100644
+
+ portal = malloc(PATH_MAX);
+ if (!portal) {
+ log_error("Could not alloc portal\n");
+ log_error("Could not alloc portal");
+ return ISCSI_ERR_NOMEM;
+ }
+
+ snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
+ if (access(portal, F_OK) != 0) {
+ if (mkdir(portal, 0660) != 0) {
+ log_error("Could not make %s: %s\n", portal,
+ log_error("Could not make %s: %s", portal,
+ strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
@ -155,7 +155,7 @@ index 0a88699..cb6ffd1 100644
+ snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name);
+ if (access(portal, F_OK) != 0) {
+ if (mkdir(portal, 0660) != 0) {
+ log_error("Could not make %s: %s\n", portal,
+ log_error("Could not make %s: %s", portal,
+ strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
@ -176,5 +176,5 @@ index 0a88699..cb6ffd1 100644
free_portal:
free(portal);
--
1.8.1.4
2.1.0

View File

@ -1,35 +0,0 @@
From d81fd4903cebb1d00aa48b0718d20e34b00dfde1 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 26 Sep 2012 21:19:39 -0500
Subject: iscsi tools: fix compile error when OFFLOAD_BOOT_SUPPORT defined
Fix compile error when OFFLOAD_BOOT_SUPPORT is defined and fix
warning when it is defined.
---
usr/iface.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/iface.c b/usr/iface.c
index 4028e34..4f81a76 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -894,7 +894,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
struct boot_context *context)
{
struct iscsi_transport *t = NULL;
- char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
uint32_t hostno;
if (strlen(context->initiatorname))
@@ -910,6 +909,8 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
} else if (strlen(context->iface)) {
/* this ifdef is only temp until distros and firmwares are updated */
#ifdef OFFLOAD_BOOT_SUPPORTED
+ char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
+ int rc;
memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN);
/* make sure offload driver is loaded */
--
1.7.11.7

View File

@ -1,32 +0,0 @@
From 13d08e79090421fbf67fd727aada487ea23ecc2d Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Thu, 27 Sep 2012 13:57:12 -0700
Subject: ISCSID: Passing more net params from ibft to iface
Added the passing of the vlan_id, subnet_mask, and gateway attributes
from the ibft context to the iface struct for the connection request.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
usr/iface.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/usr/iface.c b/usr/iface.c
index 4f81a76..c86892e 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -962,6 +962,11 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
sizeof(iface->hwaddress));
strlcpy(iface->ipaddress, context->ipaddr,
sizeof(iface->ipaddress));
+ iface->vlan_id = atoi(context->vlan);
+ strlcpy(iface->subnet_mask, context->mask,
+ sizeof(iface->subnet_mask));
+ strlcpy(iface->gateway, context->gateway,
+ sizeof(iface->gateway));
log_debug(1, "iface " iface_fmt "\n", iface_str(iface));
return 1;
}
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From ef61cd4912e90c8202598f2fa4e9f1842a5b5822 Mon Sep 17 00:00:00 2001
From 6143b83d2a0a313b1588ec0949fdf61e38f3b980 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 12:39:07 -0700
Subject: idbw_rec_write, pick tpgt from existing record
Subject: [PATCH] idbw_rec_write, pick tpgt from existing record
On a static add (-m node -o new) without a user specified tpgt, looks
for existing new style records with tpgt before creating an old style
@ -12,7 +12,7 @@ updated new style record instead.
1 file changed, 40 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index cb6ffd1..0410079 100644
index 63265c2..d8f42b6 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -27,6 +27,7 @@
@ -32,7 +32,7 @@ index cb6ffd1..0410079 100644
static void
idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri)
{
@@ -2082,12 +2085,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
@@ -2076,12 +2079,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
FILE *f;
char *portal;
int rc = 0;
@ -42,7 +42,7 @@ index cb6ffd1..0410079 100644
portal = malloc(PATH_MAX);
if (!portal) {
log_error("Could not alloc portal\n");
log_error("Could not alloc portal");
return ISCSI_ERR_NOMEM;
}
+
@ -83,5 +83,5 @@ index cb6ffd1..0410079 100644
rec->name, rec->conn[0].address, rec->conn[0].port);
--
1.8.3.1
2.1.0

View File

@ -1,62 +0,0 @@
From 9dd181dcb1ca299cd82075b8e598fc57d87ee1c0 Mon Sep 17 00:00:00 2001
From: Jim Ramsay <jim_ramsay@dell.com>
Date: Wed, 3 Oct 2012 09:57:43 -0400
Subject: iscsi tools: Convert '-r' argument to an integer before checking if
it is a path
If there is a file in the CWD named '1' and you were trying to run
'iscsiadm -m session -r 1 ...', the command would fail with "1 is not a
directory".
Root cause: The code that parses the -r option's argument tries lstat(2)
first, falling back to atoi(3) only if lstat fails.
This change inverts the order of checks, first with strtol(3) to see if
the argument given is a positive integer, then falling back to lstat(2)
only if it is not.
Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
---
usr/iscsi_sysfs.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 123dde3..4015b35 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -740,7 +740,7 @@ int iscsi_sysfs_session_has_leadconn(uint32_t sid)
* /sys/devices/platform/hostH/sessionS/targetH:B:I
* /sys/devices/platform/hostH/sessionS
*
- * return the sid S. If just the sid is passed in it will be covnerted
+ * return the sid S. If just the sid is passed in it will be converted
* to a int.
*/
int iscsi_sysfs_get_sid_from_path(char *session)
@@ -748,15 +748,16 @@ int iscsi_sysfs_get_sid_from_path(char *session)
struct sysfs_device *dev_parent, *dev;
struct stat statb;
char devpath[PATH_SIZE];
+ char *end;
+ int sid;
+
+ sid = strtol(session, &end, 10);
+ if (sid > 0 && *session != '\0' && *end == '\0')
+ return sid;
if (lstat(session, &statb)) {
- log_debug(1, "Could not stat %s failed with %d",
- session, errno);
- if (index(session, '/')) {
- log_error("%s is an invalid session path\n", session);
- exit(1);
- }
- return atoi(session);
+ log_error("%s is an invalid session ID or path\n", session);
+ exit(1);
}
if (!S_ISDIR(statb.st_mode) && !S_ISLNK(statb.st_mode)) {
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From 1c3b1d23e0b3f17399ffd4463cafad813b0444d5 Mon Sep 17 00:00:00 2001
From d8eb7f9f08f3371aa153779ee6dafb6b04afb914 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 19 Dec 2012 15:07:36 -0800
Subject: update systemd service files, add iscsi.service for starting
Subject: [PATCH] update systemd service files, add iscsi.service for starting
sessions on boot
Signed-off-by: Chris Leech <cleech@redhat.com>
@ -89,5 +89,5 @@ index 832451d..58a8d12 100644
[Socket]
ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
--
1.7.11.7
2.1.0

View File

@ -1,49 +0,0 @@
From 97db3db45c7e96888ea48a54ff19b7ff5d08cca6 Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Wed, 24 Oct 2012 15:37:28 -0700
Subject: Update README for removal of DBM requirement
Removed in 093b1f4 (2006)
Signed-off-by: Andy Grover <agrover@redhat.com>
---
README | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/README b/README
index 7364b2d..ec22098 100644
--- a/README
+++ b/README
@@ -159,15 +159,20 @@ Usage: iscsid [OPTION]
5. Open-iSCSI Configuration Utility
===================================
-Open-iSCSI persistent configuration is implemented as a DBM database
-available on all Linux installations.
-
-The database contains two tables:
-
-- Discovery table (/etc/iscsi/send_targets);
-- Node table (/etc/iscsi/nodes).
-
-The regular place for iSCSI database files: /etc/iscsi/nodes
+Open-iSCSI persistent configuration is stored in a number of
+directories under a configuration root directory, using a flat-file
+format. This configuration root directory is /etc/iscsi by default,
+but may also commonly be in /var/lib/iscsi.
+
+Configuration is contained in directories for:
+
+- nodes
+- slp
+- isns
+- static
+- fw
+- send_targets
+- ifaces
The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database.
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From 8f79529354b4023c371e00091f11bdd523497639 Mon Sep 17 00:00:00 2001
From 33c39eb2242c01ead31aaaa964bc17a60dbf1582 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Aug 2013 07:18:25 -0700
Subject: iscsi boot related service file updates
Subject: [PATCH] iscsi boot related service file updates
make sure iscsid gets started if there are any boot sessions running
add reload target to fix double session problem when restarting from NM
@ -12,7 +12,7 @@ don't rely on session list passed from initrd, never got fully implemented
etc/systemd/iscsi_mark_root_nodes | 14 --------------
3 files changed, 15 insertions(+), 15 deletions(-)
create mode 100644 etc/systemd/iscsi-mark-root-nodes
delete mode 100644 etc/systemd/iscsi_mark_root_nodes
delete mode 100755 etc/systemd/iscsi_mark_root_nodes
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
new file mode 100644
@ -34,10 +34,10 @@ index 0000000..157be62
+systemctl start iscsid.service
+
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index 7b4efee..d5712bd 100644
index bbd52fd..0309e2f 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -10,10 +10,11 @@ ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
@@ -10,10 +10,11 @@ ConditionPathExists=/etc/iscsi/initiatorname.iscsi
[Service]
Type=oneshot
RemainAfterExit=true
@ -51,7 +51,7 @@ index 7b4efee..d5712bd 100644
[Install]
WantedBy=sysinit.target
diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes
deleted file mode 100644
deleted file mode 100755
index c68475c..0000000
--- a/etc/systemd/iscsi_mark_root_nodes
+++ /dev/null
@ -71,5 +71,5 @@ index c68475c..0000000
-done < $SESSION_FILE
-
--
1.8.1.4
2.1.0

View File

@ -1,80 +0,0 @@
From 2d086a831dc16d10729d6fce17bed3ade3efd16c Mon Sep 17 00:00:00 2001
From: Tomasz Torcz <tomek@pipebreaker.pl>
Date: Wed, 28 Nov 2012 13:37:06 +0100
Subject: iscsid,iscsiadm: fix abstract socket length in bind() call
For abstract sockets, the addrlen parameter should be the actual
length of socket's name. Otherwise socket gets padded with some
number of NULs.
---
usr/iscsid_req.c | 10 ++++++----
usr/mgmt_ipc.c | 9 +++++----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 0902011..1c4678d 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -56,7 +56,7 @@ static void iscsid_startup(void)
static int iscsid_connect(int *fd, int start_iscsid)
{
- int nsec;
+ int nsec, addr_len;
struct sockaddr_un addr;
*fd = socket(AF_LOCAL, SOCK_STREAM, 0);
@@ -65,15 +65,17 @@ static int iscsid_connect(int *fd, int start_iscsid)
return ISCSI_ERR_ISCSID_NOTCONN;
}
+ addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
+
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
- strlen(ISCSIADM_NAMESPACE));
+ memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
+
/*
* Trying to connect with exponential backoff
*/
for (nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) {
- if (connect(*fd, (struct sockaddr *) &addr, sizeof(addr)) == 0)
+ if (connect(*fd, (struct sockaddr *) &addr, addr_len) == 0)
/* Connection established */
return ISCSI_SUCCESS;
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index 5c39c2e..a1dafc9 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -43,7 +43,7 @@
int
mgmt_ipc_listen(void)
{
- int fd, err;
+ int fd, err, addr_len;
struct sockaddr_un addr;
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
@@ -52,12 +52,13 @@ mgmt_ipc_listen(void)
return fd;
}
+ addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
+
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
- strlen(ISCSIADM_NAMESPACE));
+ memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
- if ((err = bind(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) {
+ if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) {
log_error("Can not bind IPC socket");
close(fd);
return err;
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From c255c2cd43afeaefa428237a3200f02fb238d89e Mon Sep 17 00:00:00 2001
From 067a87077e35e4df3564b42c675394797afa59c8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:37:13 -0800
Subject: update initscripts and docs
Subject: [PATCH] update initscripts and docs
---
README | 9 +++------
@ -10,7 +10,7 @@ Subject: update initscripts and docs
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/README b/README
index ec22098..2a8319a 100644
index 06d1b6f..0ac4529 100644
--- a/README
+++ b/README
@@ -74,11 +74,6 @@ the cache sync command will fail.
@ -25,7 +25,7 @@ index ec22098..2a8319a 100644
By default the kernel's iSCSI modules will be used. Running:
make
@@ -997,7 +992,7 @@ Red Hat or Fedora:
@@ -1118,7 +1113,7 @@ Red Hat or Fedora:
-----------------
To start open-iscsi in Red Hat/Fedora you can do:
@ -34,7 +34,7 @@ index ec22098..2a8319a 100644
To get open-iscsi to automatically start at run time you may have to
run:
@@ -1205,6 +1200,8 @@ iscsid will only perform rediscovery when it gets a SCN from the server.
@@ -1326,6 +1321,8 @@ iscsid will only perform rediscovery when it gets a SCN from the server.
# linux-isns (SLES's iSNS server) where it sometimes does not send SCN
# events in the proper format, so they may not get handled.
@ -44,7 +44,7 @@ index ec22098..2a8319a 100644
Example:
--------
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index ef76dc0..ac1d231 100644
index c30a7dc..cfa6844 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -17,10 +17,10 @@
@ -58,9 +58,9 @@ index ef76dc0..ac1d231 100644
-iscsid.startup = /sbin/iscsid
+# iscsid.startup = /sbin/iscsid
#############################
@@ -36,8 +36,8 @@ iscsid.startup = /sbin/iscsid
# Check for active mounts on devices reachable through a session
# and refuse to logout if there are any. Defaults to "No".
@@ -39,8 +39,8 @@ iscsid.startup = /sbin/iscsid
# To request that the iscsi initd scripts startup a session set to "automatic".
# node.startup = automatic
#
@ -71,7 +71,7 @@ index ef76dc0..ac1d231 100644
# For "automatic" startup nodes, setting this to "Yes" will try logins on each
# available iface until one succeeds, and then stop. The default "No" will try
@@ -259,28 +259,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
@@ -262,28 +262,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# To allow the targets to control the setting of the digest checking,
@ -108,10 +108,10 @@ index ef76dc0..ac1d231 100644
# For multipath configurations, you may want more than one session to be
# created on each iface record. If node.session.nr_sessions is greater
diff --git a/usr/idbm.c b/usr/idbm.c
index 4d30aa9..a1d7d37 100644
index d8f42b6..589078c 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -399,9 +399,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
@@ -512,9 +512,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
"None,CRC32C", num, 1);
sprintf(key, CONN_DATA_DIGEST, i);
@ -126,5 +126,5 @@ index 4d30aa9..a1d7d37 100644
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
"No", "Yes", num, 1);
--
1.7.11.7
2.1.0

View File

@ -1,79 +0,0 @@
From 5d0e19fcc1cea77a72647cf96c5d3d773e8ee277 Mon Sep 17 00:00:00 2001
From: Tomasz Torcz <tomek@pipebreaker.pl>
Date: Wed, 28 Nov 2012 13:37:07 +0100
Subject: iscsid: implement systemd-compatible socket activation
---
usr/mgmt_ipc.c | 29 +++++++++++++++++++++++++++++
usr/mgmt_ipc.h | 1 +
2 files changed, 30 insertions(+)
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index a1dafc9..87bd346 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -39,6 +39,7 @@
#define PEERUSER_MAX 64
#define EXTMSG_MAX (64 * 1024)
+#define SD_SOCKET_FDS_START 3
int
mgmt_ipc_listen(void)
@@ -46,6 +47,12 @@ mgmt_ipc_listen(void)
int fd, err, addr_len;
struct sockaddr_un addr;
+ /* first check if we have fd handled by systemd */
+ fd = mgmt_ipc_systemd();
+ if (fd >= 0)
+ return fd;
+
+ /* manually establish a socket */
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if (fd < 0) {
log_error("Can not create IPC socket");
@@ -73,6 +80,28 @@ mgmt_ipc_listen(void)
return fd;
}
+int mgmt_ipc_systemd(void)
+{
+ const char *env;
+
+ env = getenv("LISTEN_PID");
+
+ if (!env || (strtoul(env, NULL, 10) != getpid()))
+ return -EINVAL;
+
+ env = getenv("LISTEN_FDS");
+
+ if (!env)
+ return -EINVAL;
+
+ if (strtoul(env, NULL, 10) != 1) {
+ log_error("Did not receive exactly one IPC socket from systemd");
+ return -EINVAL;
+ }
+
+ return SD_SOCKET_FDS_START;
+}
+
void
mgmt_ipc_close(int fd)
{
diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h
index 7d8ce72..55972ed 100644
--- a/usr/mgmt_ipc.h
+++ b/usr/mgmt_ipc.h
@@ -112,6 +112,7 @@ typedef int mgmt_ipc_fn_t(struct queue_task *);
struct queue_task;
void mgmt_ipc_write_rsp(struct queue_task *qtask, int err);
int mgmt_ipc_listen(void);
+int mgmt_ipc_systemd(void);
void mgmt_ipc_close(int fd);
void mgmt_ipc_handle(int accept_fd);
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From 8c287d6b8c1edf51c2f91878d72822d33aa8348b Mon Sep 17 00:00:00 2001
From f60148c57a269a5dc79a8138e3b9775611ff20d0 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:38:45 -0800
Subject: use var for config
Subject: [PATCH] use var for config
---
README | 33 ++++++++++++++++-----------------
@ -144,10 +144,10 @@ index 0ac4529..e7c7bf5 100644
Note that for iSNS the poll_interval does not have to be set. If not set,
iscsid will only perform rediscovery when it gets a SCN from the server.
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index 05793b2..334520a 100644
index f046236..3a581e3 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -103,7 +103,7 @@ This option is only valid for ping submode.
@@ -241,7 +241,7 @@ This option is only valid for ping submode.
.TP
\fB\-I\fR, \fB\-\-interface=\fI[iface]\fR
The interface argument specifies the iSCSI interface to use for the operation.
@ -156,7 +156,7 @@ index 05793b2..334520a 100644
iSCSI (qla4xxx) the iface config must have the hardware address
(iface.hwaddress = port's MAC address)
and the driver/transport_name (iface.transport_name). The iface's name is
@@ -180,7 +180,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and
@@ -318,7 +318,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and
\fInode\fR, all of their respective records are displayed; for \fIsession\fR,
all active sessions and connections are displayed; for \fIfw\fR, all boot
firmware values are displayed; for \fIhost\fR, all iSCSI hosts are displayed;
@ -165,7 +165,7 @@ index 05793b2..334520a 100644
.TP
\fB\-n\fR, \fB\-\-name=\fIname\fR
@@ -565,10 +565,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
@@ -703,10 +703,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
The file containing the iSCSI InitiatorName and InitiatorAlias read by
\fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP
@ -179,19 +179,19 @@ index 05793b2..334520a 100644
.SH "SEE ALSO"
diff --git a/usr/idbm.c b/usr/idbm.c
index ce9fb6a..c3c8de5 100644
index 589078c..a57a445 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2919,9 +2919,9 @@ free_info:
@@ -2917,9 +2917,9 @@ free_info:
int idbm_init(idbm_get_config_file_fn *fn)
{
/* make sure root db dir is there */
- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
- if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
- log_error("Could not make %s %d\n", ISCSI_CONFIG_ROOT,
- log_error("Could not make %s %d", ISCSI_CONFIG_ROOT,
+ if (access(ISCSIVAR, F_OK) != 0) {
+ if (mkdir(ISCSIVAR, 0660) != 0) {
+ log_error("Could not make %s %d\n", ISCSIVAR,
+ log_error("Could not make %s %d", ISCSIVAR,
errno);
return errno;
}
@ -235,5 +235,5 @@ index 01f7074..f396918 100644
struct iface_rec;
struct list_head;
--
1.9.3
2.1.0

View File

@ -1,54 +0,0 @@
From c34e0bdcbafdb6f9304e1474d51fe1c789c5dea2 Mon Sep 17 00:00:00 2001
From: Tomasz Torcz <tomek@pipebreaker.pl>
Date: Wed, 28 Nov 2012 13:37:08 +0100
Subject: iscsid: add example unit files for systemd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Those two units, based on the work by Jóhann B. Guðmundsson, exploit
on-demand socket activation in iscsid.
---
etc/systemd/iscsid.service | 13 +++++++++++++
etc/systemd/iscsid.socket | 9 +++++++++
2 files changed, 22 insertions(+)
create mode 100644 etc/systemd/iscsid.service
create mode 100644 etc/systemd/iscsid.socket
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
new file mode 100644
index 0000000..028e0b3
--- /dev/null
+++ b/etc/systemd/iscsid.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Open-iSCSI
+Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
+After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
+
+[Service]
+Type=forking
+PIDFile=/var/run/iscsid.pid
+ExecStart=/usr/sbin/iscsid
+ExecStop=/sbin/iscsiadm -k 0 2
+
+[Install]
+WantedBy=multi-user.target
diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket
new file mode 100644
index 0000000..832451d
--- /dev/null
+++ b/etc/systemd/iscsid.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=Open-iSCSI iscsid Socket
+Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
+
+[Socket]
+ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
+
+[Install]
+WantedBy=sockets.target
--
1.7.11.7

View File

@ -1,7 +1,7 @@
From bf7f9118ab2f1a5302dafa198d3351f6f977b7bd Mon Sep 17 00:00:00 2001
From b346b33b7a0031cb9e727be994fa4a05d18b5f66 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:40:04 -0800
Subject: use red hat for name
Subject: [PATCH] use red hat for name
---
utils/iscsi-iname.c | 2 +-
@ -21,5 +21,5 @@ index 6347edc..cb2f6c8 100644
/* try to feed some entropy from the pool to MD5 in order to get
--
1.7.11.7
2.1.0

View File

@ -1,61 +0,0 @@
From a7afdf46c3193eb102cc6ec2a3b61e8d36794437 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 14 Dec 2012 12:40:27 -0600
Subject: iscsi tools: fix get_random_bytes error handling
Bug report from Rahul:
There seems to be a bug in function get_random_bytes(). I reported
this earlier as well but somehow it didn't appear here.
get_random_bytes(unsigned char *data, unsigned int length)
{
long r;
unsigned n;
int fd;
fd = open("/dev/urandom", O_RDONLY);
while (length > 0) {
if (!fd || read(fd, &r, sizeof(long)) != -1) <<<< the condition is
incorrect
---
usr/auth.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/usr/auth.c b/usr/auth.c
index c924545..4ff0425 100644
--- a/usr/auth.c
+++ b/usr/auth.c
@@ -189,24 +189,24 @@ get_random_bytes(unsigned char *data, unsigned int length)
long r;
unsigned n;
- int fd;
+ int fd, r_size = sizeof(r);
fd = open("/dev/urandom", O_RDONLY);
while (length > 0) {
- if (!fd || read(fd, &r, sizeof(long)) != -1)
+ if (fd == -1 || read(fd, &r, r_size) != r_size)
r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 4);
n = r & 0x7;
- if (!fd || read(fd, &r, sizeof(long)) != -1)
+ if (fd == -1 || read(fd, &r, r_size) != r_size)
r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 5);
n = (n << 3) | (r & 0x7);
- if (!fd || read(fd, &r, sizeof(long)) != -1)
+ if (fd == -1 || read(fd, &r, r_size) != r_size)
r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 5);
--
1.7.11.7

View File

@ -1,4 +1,4 @@
From 793dbd33535efd3ef1170487624f2b95168a0ec7 Mon Sep 17 00:00:00 2001
From c76c0965e20aa2a0df13b02cf080594d1a1f7c04 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 26 Jan 2015 12:57:11 -0800
Subject: [PATCH] libiscsi
@ -45,10 +45,10 @@ Subject: [PATCH] libiscsi
create mode 100644 libiscsi/tests/test_set_auth.c
diff --git a/Makefile b/Makefile
index f8a393b..05411e1 100644
index 1ef9273..859f13f 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile
@@ -44,6 +44,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile
$(MAKE) -C usr
$(MAKE) -C utils
$(MAKE) -C iscsiuio
@ -56,7 +56,7 @@ index f8a393b..05411e1 100644
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -61,6 +62,7 @@ kernel: force
@@ -75,6 +76,7 @@ kernel: force
force: ;
clean:
@ -3910,20 +3910,20 @@ index 0000000..a21f888
+ return rc;
+}
diff --git a/usr/Makefile b/usr/Makefile
index 3d8ee22..e731545 100644
index e23fee1..12780e4 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -31,7 +31,7 @@ endif
OPTFLAGS ?= -O2 -g
CFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-isns \
CFLAGS += $(WARNFLAGS) -I../include -I. -I../utils/open-isns \
- -D$(OSNAME) $(IPC_CFLAGS)
+ -D$(OSNAME) $(IPC_CFLAGS) -DISNS_ENABLE
PROGRAMS = iscsid iscsiadm iscsistart
# libc compat files
diff --git a/usr/discovery.c b/usr/discovery.c
index 635ec8d..df6d3f1 100644
index 38968ca..ab89c69 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -36,6 +36,7 @@
@ -3963,10 +3963,10 @@ index 635ec8d..df6d3f1 100644
int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list)
diff --git a/usr/idbm.c b/usr/idbm.c
index c3c8de5..ff39438 100644
index a57a445..00151b5 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1711,9 +1711,9 @@ int idbm_print_all_discovery(int info_level)
@@ -1709,9 +1709,9 @@ int idbm_print_all_discovery(int info_level)
* fn should return -1 if it skipped the rec, a ISCSI_ERR error code if
* the operation failed or 0 if fn was run successfully.
*/

View File

@ -1,597 +0,0 @@
From 2ff28eacd7c98d438a1864a09a124991ff2e1189 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Tue, 28 May 2013 02:18:08 -0500
Subject: ISCSID: Added socket communication hooks for uip
From Eddie Wai:
This patch adds the communication path between iscsid->iscsiuio.
It utilizes the set_net_config func ptr in the iscsi_transport_template
to initiate the callbacks.
Two new files are introduced: uip_mgmt_ipc.h and uip_mgmt_ipc.c
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
include/iscsi_err.h | 2 +
usr/Makefile | 3 +-
usr/initiator.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++-
usr/initiator.h | 4 ++
usr/initiator_common.c | 34 +++++++++++++++
usr/iscsid_req.c | 91 +++++++++++++++++++++++++++++++++++++++-
usr/iscsid_req.h | 2 +
usr/transport.c | 2 +
usr/transport.h | 3 ++
usr/uip_mgmt_ipc.c | 41 ++++++++++++++++++
usr/uip_mgmt_ipc.h | 73 ++++++++++++++++++++++++++++++++
11 files changed, 363 insertions(+), 4 deletions(-)
create mode 100644 usr/uip_mgmt_ipc.c
create mode 100644 usr/uip_mgmt_ipc.h
diff --git a/include/iscsi_err.h b/include/iscsi_err.h
index aabea4e..1139133 100644
--- a/include/iscsi_err.h
+++ b/include/iscsi_err.h
@@ -62,6 +62,8 @@ enum {
ISCSI_ERR_OP_NOT_SUPP = 27,
/* device or resource in use */
ISCSI_ERR_BUSY = 28,
+ /* Operation failed, but retrying layer may succeed */
+ ISCSI_ERR_AGAIN = 29,
/* Always last. Indicates end of error code space */
ISCSI_MAX_ERR_VAL,
diff --git a/usr/Makefile b/usr/Makefile
index 673b7f1..33b517c 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -40,7 +40,8 @@ SYSDEPS_SRCS = $(wildcard ../utils/sysdeps/*.o)
ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \
sha1.o iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \
iscsi_net_util.o iscsid_req.o transport.o iser.o cxgbi.o be2iscsi.o \
- initiator_common.o iscsi_err.o $(IPC_OBJ) $(SYSDEPS_SRCS)
+ initiator_common.o iscsi_err.o uip_mgmt_ipc.o \
+ $(IPC_OBJ) $(SYSDEPS_SRCS)
# core initiator files
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o kern_err_table.o
diff --git a/usr/initiator.c b/usr/initiator.c
index d475358..86df222 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -45,6 +45,7 @@
#include "iscsi_sysfs.h"
#include "iscsi_settings.h"
#include "iface.h"
+#include "host.h"
#include "sysdeps.h"
#include "iscsi_err.h"
#include "kern_err_table.h"
@@ -557,6 +558,48 @@ static int iscsi_conn_connect(struct iscsi_conn *conn, queue_task_t *qtask)
return 0;
}
+static void iscsi_uio_poll_login_timedout(void *data)
+{
+ struct queue_task *qtask = data;
+ struct iscsi_conn *conn = qtask->conn;
+ iscsi_session_t *session = conn->session;
+
+ log_debug(3, "timeout waiting for UIO ...\n");
+ mgmt_ipc_write_rsp(qtask, ISCSI_ERR_TRANS_TIMEOUT);
+ conn_delete_timers(conn);
+ __session_destroy(session);
+}
+
+static int iscsi_sched_uio_poll(queue_task_t *qtask)
+{
+ struct iscsi_conn *conn = qtask->conn;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_transport *t = session->t;
+ struct iscsi_ev_context *ev_context;
+
+ if (!t->template->set_net_config)
+ return 0;
+
+ ev_context = iscsi_ev_context_get(conn, 0);
+ if (!ev_context) {
+ /* while reopening the recv pool should be full */
+ log_error("BUG: __session_conn_reopen could "
+ "not get conn context for recv.");
+ return -ENOMEM;
+ }
+
+ ev_context->data = qtask;
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
+
+ iscsi_sched_ev_context(ev_context, conn, 0, EV_UIO_POLL);
+
+ log_debug(3, "Setting login UIO poll timer %p timeout %d",
+ &conn->login_timer, conn->login_timeout);
+ actor_timer(&conn->login_timer, conn->login_timeout * 1000,
+ iscsi_uio_poll_login_timedout, qtask);
+ return -EAGAIN;
+}
+
static void
__session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
int redirected)
@@ -598,6 +641,11 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
if (!redirected)
session->reopen_cnt++;
+ /* uIP will needs to be re-triggered on the connection re-open */
+ if (iscsi_set_net_config(conn->session->t, conn->session,
+ &conn->session->nrec.iface) != 0)
+ goto queue_reopen;
+
if (iscsi_conn_connect(conn, qtask)) {
delay = ISCSI_CONN_ERR_REOPEN_DELAY;
goto queue_reopen;
@@ -1670,6 +1718,53 @@ failed_login:
}
+static void session_conn_uio_poll(void *data)
+{
+ struct iscsi_ev_context *ev_context = data;
+ iscsi_conn_t *conn = ev_context->conn;
+ struct iscsi_session *session = conn->session;
+ queue_task_t *qtask = ev_context->data;
+ int rc;
+
+ log_debug(4, "retrying uio poll");
+ rc = iscsi_set_net_config(session->t, session,
+ &conn->session->nrec.iface);
+ if (rc != 0) {
+ if (rc == ISCSI_ERR_AGAIN) {
+ ev_context->data = qtask;
+ iscsi_sched_ev_context(ev_context, conn, 2,
+ EV_UIO_POLL);
+ return;
+ } else {
+ log_error("session_conn_uio_poll() "
+ "connection failure [0x%x]", rc);
+ actor_delete(&conn->login_timer);
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_INTERNAL);
+ iscsi_ev_context_put(ev_context);
+ return;
+ }
+ }
+
+ iscsi_ev_context_put(ev_context);
+ actor_delete(&conn->login_timer);
+ log_debug(4, "UIO ready trying connect");
+
+ /* uIP is ready try to connect */
+ if (gettimeofday(&conn->initial_connect_time, NULL))
+ log_error("Could not get initial connect time. If "
+ "login errors iscsid may give up the initial "
+ "login early. You should manually login.");
+
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
+ if (iscsi_conn_connect(conn, qtask)) {
+ int delay = ISCSI_CONN_ERR_REOPEN_DELAY;
+
+ log_debug(4, "Waiting %u seconds before trying to reconnect.\n",
+ delay);
+ queue_delayed_reopen(qtask, delay);
+ }
+}
+
static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
struct iscsi_conn *conn, unsigned long tmo,
int event)
@@ -1711,6 +1806,11 @@ static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
ev_context);
actor_schedule(&ev_context->actor);
break;
+ case EV_UIO_POLL:
+ actor_new(&ev_context->actor, session_conn_uio_poll,
+ ev_context);
+ actor_schedule(&ev_context->actor);
+ break;
case EV_CONN_LOGOUT_TIMER:
actor_timer(&ev_context->actor, tmo * 1000,
iscsi_logout_timedout, ev_context);
@@ -1844,7 +1944,17 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
conn = &session->conn[0];
qtask->conn = conn;
- if (iscsi_host_set_net_params(&rec->iface, session)) {
+ rc = iscsi_host_set_net_params(&rec->iface, session);
+ if (rc == ISCSI_ERR_AGAIN) {
+ iscsi_sched_uio_poll(qtask);
+ /*
+ * Cannot block iscsid, so caller is going to internally
+ * retry the operation.
+ */
+ qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
+ qtask->rsp.err = ISCSI_SUCCESS;
+ return ISCSI_SUCCESS;
+ } else if (rc) {
__session_destroy(session);
return ISCSI_ERR_LOGIN;
}
diff --git a/usr/initiator.h b/usr/initiator.h
index b45caab..d6dc02e 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -83,6 +83,7 @@ typedef enum iscsi_event_e {
EV_CONN_LOGOUT_TIMER,
EV_CONN_STOP,
EV_CONN_LOGIN,
+ EV_UIO_POLL,
} iscsi_event_e;
struct queue_task;
@@ -353,5 +354,8 @@ extern void iscsi_copy_operational_params(struct iscsi_conn *conn,
extern int iscsi_setup_authentication(struct iscsi_session *session,
struct iscsi_auth_config *auth_cfg);
extern int iscsi_setup_portal(struct iscsi_conn *conn, char *address, int port);
+extern int iscsi_set_net_config(struct iscsi_transport *t,
+ iscsi_session_t *session,
+ struct iface_rec *iface);
#endif /* INITIATOR_H */
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index ef6820c..eb72795 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -562,6 +562,36 @@ TODO handle this
return 0;
}
+int iscsi_set_net_config(struct iscsi_transport *t, iscsi_session_t *session,
+ struct iface_rec *iface)
+{
+ if (t->template->set_net_config) {
+ /* uip needs the netdev name */
+ struct host_info hinfo;
+ int hostno, rc;
+
+ /* this assumes that the netdev or hw address is going to be
+ set */
+ hostno = iscsi_sysfs_get_host_no_from_hwinfo(iface, &rc);
+ if (rc) {
+ log_debug(4, "Couldn't get host no.\n");
+ return rc;
+ }
+
+ /* uip needs the netdev name */
+ if (!strlen(iface->netdev)) {
+ memset(&hinfo, 0, sizeof(hinfo));
+ hinfo.host_no = hostno;
+ iscsi_sysfs_get_hostinfo_by_host_no(&hinfo);
+ strcpy(iface->netdev, hinfo.iface.netdev);
+ }
+
+ return t->template->set_net_config(t, iface, session);
+ }
+
+ return 0;
+}
+
int iscsi_host_set_net_params(struct iface_rec *iface,
struct iscsi_session *session)
{
@@ -600,6 +630,10 @@ int iscsi_host_set_net_params(struct iface_rec *iface,
log_warning("Could not brining up netdev %s. Try running "
"'ifup %s' first if login fails.", netdev, netdev);
+ rc = iscsi_set_net_config(t, session, iface);
+ if (rc != 0)
+ return rc;
+
rc = host_set_param(t, session->hostno,
ISCSI_HOST_PARAM_IPADDRESS,
iface->ipaddress, ISCSI_STRING);
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 1c4678d..15f6353 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -32,6 +33,7 @@
#include "iscsi_util.h"
#include "config.h"
#include "iscsi_err.h"
+#include "uip_mgmt_ipc.h"
static void iscsid_startup(void)
{
@@ -54,7 +56,7 @@ static void iscsid_startup(void)
#define MAXSLEEP 128
-static int iscsid_connect(int *fd, int start_iscsid)
+static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
{
int nsec, addr_len;
struct sockaddr_un addr;
@@ -69,7 +71,8 @@ static int iscsid_connect(int *fd, int start_iscsid)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
+ memcpy((char *) &addr.sun_path + 1, unix_sock_name,
+ strlen(unix_sock_name));
/*
* Trying to connect with exponential backoff
@@ -98,6 +101,11 @@ static int iscsid_connect(int *fd, int start_iscsid)
return ISCSI_ERR_ISCSID_NOTCONN;
}
+static int iscsid_connect(int *fd, int start_iscsid)
+{
+ return ipc_connect(fd, ISCSIADM_NAMESPACE, start_iscsid);
+}
+
int iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid)
{
int err;
@@ -194,3 +202,82 @@ int iscsid_req_by_sid(iscsiadm_cmd_e cmd, int sid)
return err;
return iscsid_req_wait(cmd, fd);
}
+
+static int uip_connect(int *fd)
+{
+ return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0);
+}
+
+int uip_broadcast(void *buf, size_t buf_len)
+{
+ int err;
+ int fd;
+ iscsid_uip_rsp_t rsp;
+ int flags;
+ int count;
+
+ err = uip_connect(&fd);
+ if (err) {
+ log_warning("uIP daemon is not up");
+ return err;
+ }
+
+ log_debug(3, "connected to uIP daemon");
+
+ /* Send the data to uIP */
+ err = write(fd, buf, buf_len);
+ if (err != buf_len) {
+ log_error("got write error (%d/%d), daemon died?",
+ err, errno);
+ close(fd);
+ return ISCSI_ERR_ISCSID_COMM_ERR;
+ }
+
+ log_debug(3, "send iface config to uIP daemon");
+
+ /* Set the socket to a non-blocking read, this way if there are
+ * problems waiting for uIP, iscsid can bailout early */
+ flags = fcntl(fd, F_GETFL, 0);
+ if (flags == -1)
+ flags = 0;
+ err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ if (err) {
+ log_error("could not set uip broadcast to non-blocking: %d",
+ errno);
+ close(fd);
+ return ISCSI_ERR;
+ }
+
+#define MAX_UIP_BROADCAST_READ_TRIES 3
+ for (count = 0; count < MAX_UIP_BROADCAST_READ_TRIES; count++) {
+ /* Wait for the response */
+ err = read(fd, &rsp, sizeof(rsp));
+ if (err == sizeof(rsp)) {
+ log_debug(3, "Broadcasted to uIP with length: %ld "
+ "cmd: 0x%x rsp: 0x%x\n", buf_len,
+ rsp.command, rsp.err);
+ err = 0;
+ break;
+ } else if ((err == -1) && (errno == EAGAIN)) {
+ usleep(250000);
+ continue;
+ } else {
+ log_error("Could not read response (%d/%d), daemon "
+ "died?", err, errno);
+ err = ISCSI_ERR;
+ break;
+ }
+ }
+
+ if (count == MAX_UIP_BROADCAST_READ_TRIES) {
+ log_error("Could not broadcast to uIP after %d tries",
+ count);
+ err = ISCSI_ERR_AGAIN;
+ } else if (rsp.err != ISCSID_UIP_MGMT_IPC_DEVICE_UP) {
+ log_debug(3, "Device is not ready\n");
+ err = ISCSI_ERR_AGAIN;
+ }
+
+ close(fd);
+ return err;
+}
diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h
index 68f5256..4fff43d 100644
--- a/usr/iscsid_req.h
+++ b/usr/iscsid_req.h
@@ -33,4 +33,6 @@ extern int iscsid_req_by_rec(int cmd, struct node_rec *rec);
extern int iscsid_req_by_sid_async(int cmd, int sid, int *fd);
extern int iscsid_req_by_sid(int cmd, int sid);
+extern int uip_broadcast(void *buf, size_t buf_len);
+
#endif
diff --git a/usr/transport.c b/usr/transport.c
index e6e3dfc..10212af 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -35,6 +35,7 @@
#include "log.h"
#include "iscsi_util.h"
#include "iscsi_sysfs.h"
+#include "uip_mgmt_ipc.h"
#include "cxgbi.h"
#include "be2iscsi.h"
#include "iser.h"
@@ -79,6 +80,7 @@ struct iscsi_transport_template bnx2i = {
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
+ .set_net_config = uip_broadcast_params,
};
struct iscsi_transport_template be2iscsi = {
diff --git a/usr/transport.h b/usr/transport.h
index 672561b..5dcf872 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -35,6 +35,9 @@ struct iscsi_transport_template {
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
void (*create_conn) (struct iscsi_conn *conn);
+ int (*set_net_config) (struct iscsi_transport *t,
+ struct iface_rec *iface,
+ struct iscsi_session *session);
};
/* represents data path provider */
diff --git a/usr/uip_mgmt_ipc.c b/usr/uip_mgmt_ipc.c
new file mode 100644
index 0000000..f3074ee
--- /dev/null
+++ b/usr/uip_mgmt_ipc.c
@@ -0,0 +1,41 @@
+/*
+ * uIP iSCSI Daemon/Admin Management IPC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+
+#include <string.h>
+
+#include "log.h"
+#include "uip_mgmt_ipc.h"
+#include "iscsid_req.h"
+
+int uip_broadcast_params(struct iscsi_transport *t,
+ struct iface_rec *iface,
+ struct iscsi_session *session)
+{
+ struct iscsid_uip_broadcast broadcast;
+
+ log_debug(3, "broadcasting to uip\n");
+
+ memset(&broadcast, 0, sizeof(broadcast));
+
+ broadcast.header.command = ISCSID_UIP_IPC_GET_IFACE;
+ broadcast.header.payload_len = sizeof(*iface);
+
+ memcpy(&broadcast.u.iface_rec, iface, sizeof(*iface));
+
+ return uip_broadcast(&broadcast,
+ sizeof(iscsid_uip_broadcast_header_t) +
+ sizeof(*iface));
+}
diff --git a/usr/uip_mgmt_ipc.h b/usr/uip_mgmt_ipc.h
new file mode 100644
index 0000000..29a4769
--- /dev/null
+++ b/usr/uip_mgmt_ipc.h
@@ -0,0 +1,73 @@
+/*
+ * uIP iSCSI Daemon/Admin Management IPC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+#ifndef UIP_MGMT_IPC_H
+#define UIP_MGMT_IPC_H
+
+#include "types.h"
+#include "iscsi_if.h"
+#include "config.h"
+#include "mgmt_ipc.h"
+
+#include "initiator.h"
+#include "transport.h"
+
+#define ISCSID_UIP_NAMESPACE "ISCSID_UIP_ABSTRACT_NAMESPACE"
+
+typedef enum iscsid_uip_cmd {
+ ISCSID_UIP_IPC_UNKNOWN = 0,
+ ISCSID_UIP_IPC_GET_IFACE = 1,
+
+ __ISCSID_UIP_IPC_MAX_COMMAND
+} iscsid_uip_cmd_e;
+
+typedef struct iscsid_uip_broadcast_header {
+ iscsid_uip_cmd_e command;
+ uint32_t payload_len;
+} iscsid_uip_broadcast_header_t;
+
+/* IPC Request */
+typedef struct iscsid_uip_broadcast {
+ struct iscsid_uip_broadcast_header header;
+
+ union {
+ /* messages */
+ struct ipc_broadcast_iface_rec {
+ struct iface_rec rec;
+ } iface_rec;
+ } u;
+} iscsid_uip_broadcast_t;
+
+typedef enum iscsid_uip_mgmt_ipc_err {
+ ISCSID_UIP_MGMT_IPC_OK = 0,
+ ISCSID_UIP_MGMT_IPC_ERR = 1,
+ ISCSID_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
+ ISCSID_UIP_MGMT_IPC_ERR_NOMEM = 3,
+ ISCSID_UIP_MGMT_IPC_DEVICE_UP = 4,
+ ISCSID_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
+} iscsid_uip_mgmt_ipc_err_e;
+
+/* IPC Response */
+typedef struct iscsid_uip_mgmt_rsp {
+ iscsid_uip_cmd_e command;
+ iscsid_uip_mgmt_ipc_err_e err;
+} iscsid_uip_rsp_t;
+
+extern int uip_broadcast_params(struct iscsi_transport *t,
+ struct iface_rec *iface,
+ struct iscsi_session *session);
+
+
+#endif /* UIP_MGMT_IPC_H */
--
1.8.1.4

View File

@ -1,17 +1,17 @@
From aa58a042ec20575143c1a5c813c9552a286aeb0e Mon Sep 17 00:00:00 2001
From 8c5e8c8afba875944daa61fadc3add41475fab61 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 17:09:24 -0800
Subject: remove the offload boot supported ifdef
Subject: [PATCH] remove the offload boot supported ifdef
---
usr/iface.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index c86892e..f5441c0 100644
index 0a7f0bb..753ed37 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -895,6 +895,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
@@ -996,6 +996,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
{
struct iscsi_transport *t = NULL;
uint32_t hostno;
@ -19,7 +19,7 @@ index c86892e..f5441c0 100644
if (strlen(context->initiatorname))
strlcpy(iface->iname, context->initiatorname,
@@ -907,10 +908,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
@@ -1009,10 +1010,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
return 0;
}
} else if (strlen(context->iface)) {
@ -30,7 +30,7 @@ index c86892e..f5441c0 100644
memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN);
/* make sure offload driver is loaded */
@@ -936,9 +934,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
@@ -1038,9 +1036,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
}
strlcpy(iface->netdev, context->iface, sizeof(iface->netdev));
@ -41,5 +41,5 @@ index c86892e..f5441c0 100644
return 0;
--
1.7.11.7
2.1.0

View File

@ -1,70 +0,0 @@
From c9ff6b4ce766a25da4a2e9f9f4836139c9c2331e Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 15 Feb 2013 16:58:37 -0800
Subject: ISCSID: Modified the Makefile for iscsiuio compilation
This patch modifies the open-iscsi Makefile to include the compilation,
binary/manpage install, and clean of the iscsiuio source.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
Makefile | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index c5d9700..0b7bb98 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ mandir = $(prefix)/share/man
etcdir = /etc
initddir = $(etcdir)/init.d
-MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8
-PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname
+MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 iscsiuio/docs/iscsiuio.8
+PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname iscsiuio/src/unix/iscsiuio
INSTALL = install
ETCFILES = etc/iscsid.conf
IFACEFILES = etc/iface.example
@@ -26,24 +26,29 @@ IFACEFILES = etc/iface.example
all: user
-user: utils/open-isns/Makefile
+user: utils/open-isns/Makefile iscsiuio/Makefile
$(MAKE) -C utils/open-isns
$(MAKE) -C utils/sysdeps
$(MAKE) -C utils/fwparam_ibft
$(MAKE) -C usr
$(MAKE) -C utils
+ $(MAKE) -C iscsiuio
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@echo "Built iSCSI daemon: usr/iscsid"
@echo "Built management application: usr/iscsiadm"
@echo "Built boot tool: usr/iscsistart"
+ @echo "Built iscsiuio daemon: iscsiuio/src/unix/iscsiuio"
@echo
@echo "Read README file for detailed information."
utils/open-isns/Makefile: utils/open-isns/configure utils/open-isns/Makefile.in
cd utils/open-isns; ./configure CFLAGS="$(OPTFLAGS)" --with-security=no
+iscsiuio/Makefile: iscsiuio/configure iscsiuio/Makefile.in
+ cd iscsiuio; ./configure
+
kernel: force
$(MAKE) -C kernel
@echo "Kernel Compilation complete Output file"
@@ -61,6 +66,7 @@ clean:
$(MAKE) -C utils clean
$(MAKE) -C usr clean
$(MAKE) -C kernel clean
+ $(MAKE) -C iscsiuio clean
$(MAKE) -C utils/open-isns clean
$(MAKE) -C utils/open-isns distclean
--
1.8.1.4

View File

@ -1,7 +1,7 @@
From 822b53e6c9ebb0fe7236ebd3b4c73b009100592d Mon Sep 17 00:00:00 2001
From c9994e01142feb7010d695747062367c5dfd5c4d Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 22 Jan 2013 14:27:12 -0800
Subject: iscsiuio systemd unit files
Subject: [PATCH] iscsiuio systemd unit files
---
etc/systemd/iscsiuio.service | 17 +++++++++++++++++
@ -49,5 +49,5 @@ index 0000000..d42cedc
+[Install]
+WantedBy=sockets.target
--
1.7.11.7
2.1.0

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,15 @@
From c3d2b8f3de5b6161845304cf46982d2c5a9918b6 Mon Sep 17 00:00:00 2001
From 5e8feef0fd14fc6247df2aaf2e514f2301c74ae0 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu Feb 21 21:05:39 PST 2013
Subject: disable iscsid.startup from iscsiadm, prefer systemd socket activation
Date: Thu, 21 Feb 2013 21:05:39 -0800
Subject: [PATCH] disable iscsid.startup from iscsiadm, prefer systemd socket
activation
---
etc/iscsid.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index ac1d231..5851fa5 100644
index cfa6844..db395df 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -17,7 +17,7 @@
@ -21,5 +22,5 @@ index ac1d231..5851fa5 100644
# Default for upstream open-iscsi scripts (uncomment to activate).
# iscsid.startup = /sbin/iscsid
--
1.7.11.7
2.1.0

View File

@ -1,4 +1,4 @@
From ab79bdb20e37216ca969e06d63a952acfd023963 Mon Sep 17 00:00:00 2001
From 63852a2853d190f9305c9c4056843fd79ab8219c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 28 May 2013 13:12:27 -0700
Subject: [PATCH] Don't check for autostart sessions if iscsi is not used (bug
@ -13,7 +13,7 @@ there are no node records at all.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index bbd52fd..7b4efee 100644
index 0309e2f..d5712bd 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,7 +5,7 @@ DefaultDependencies=no
@ -26,5 +26,5 @@ index bbd52fd..7b4efee 100644
[Service]
Type=oneshot
--
1.8.1.4
2.1.0

File diff suppressed because it is too large Load Diff

View File

@ -1,107 +0,0 @@
From 28336bc000520e89670ce29360697a71a42b5e24 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 22 Mar 2013 07:35:52 -0400
Subject: Manpage changes for flashnode submode support for host mode.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index 7c209f6..b4c7388 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -16,7 +16,7 @@ iscsiadm \- open-iscsi administration utility
\fBiscsiadm\fR \-m fw [\-l]
-\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ]
+\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] ]
\fBiscsiadm\fR \-k priority
@@ -47,6 +47,12 @@ daemon (iscsid) be running.
This option is only valid for ping submode.
.TP
+\fB\-A\fR, \fB\-\-portal_type=\fI[ipv4|ipv6]\fR
+Specify the portal type for the new flash node entry to be created.
+.IP
+This option is only valid for flashnode submode of host mode and only with \fInew\fR operation.
+
+.TP
\fB\-b\fR, \fB\-\-packetsize=\fIpacketsize\fP
Specify the ping \fIpacketsize\fR.
@@ -66,6 +72,12 @@ Currently iscsiadm support ping as submode for iface. For example,
iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i interval
+For host, it supports chap and flashnode as submodes. For example,
+
+iscsiadm -m host -H hostno -C chap -v chap_tbl_idx -o operation
+
+iscsiadm -m host -H hostno -C flashnode -x flashnode_idx -o operation
+
.TP
\fB\-d\fR, \fB\-\-debug=\fIdebug_level\fP
print debugging information. Valid values for debug_level are 0 to 8.
@@ -170,8 +182,9 @@ for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed.
.TP
\fB\-n\fR, \fB\-\-name=\fIname\fR
-Specify a field \fIname\fR in a record. For use with the \fIupdate\fR
-operator.
+In node mode, specify a field \fIname\fR in a record. In flashnode submode of host mode, specify name of the flash node parameter.
+
+For use with the \fIupdate\fR operator.
.IP
.TP
@@ -181,6 +194,8 @@ Specifies a database operator \fIop\fR. \fIop\fR must be one of
.IP
For iface mode, \fIapply\fR and \fIapplyall\fR are also applicable.
.IP
+For flashnode submode of host mode, \fIlogin\fR and \fIlogout\fR are also applicable.
+.IP
This option is valid for all modes except fw. Delete should not be used on a running session. If it is iscsiadm will stop the session and then delete the
record.
.IP
@@ -210,6 +225,12 @@ sid is passed in.
.IP
\fIapplyall\fR will cause the network settings to take effect on all the ifaces whose MAC address or host number matches that of the specific host.
+.IP
+\fIlogin\fR will log into the specified flash node entry.
+
+.IP
+\fIlogout\fR does the logout from the given flash node entry.
+
.TP
\fB\-p\fR, \fB\-\-portal=\fIip[:port]\fR
Use target portal with ip-address \fIip\fR and \fIport\fR. If port is not passed
@@ -292,12 +313,18 @@ for session mode).
\fB\-v\fR, \fB\-\-value=\fIvalue\fR
Specify a \fIvalue\fR for use with the \fIupdate\fR operator.
.IP
-This option is only valid for node mode.
+This option is only valid for node mode and flashnode submode of host mode.
.TP
\fB\-V\fR, \fB\-\-version\fR
display version and exit
+.TP
+\fB\-x\fR, \fB\-\-flashnode_idx=\fIindex\fR
+Specify the \fIindex\fR of the flash node to operate on.
+.IP
+This option is only valid for flashnode submode of host mode.
+
.SH DISCOVERY TYPES
iSCSI defines 3 discovery types: SendTargets, SLP, and iSNS.
--
1.8.1.4

View File

@ -1,4 +1,4 @@
From 89e9c2ff66d069b812fabcd4fefe453bbcea73e4 Mon Sep 17 00:00:00 2001
From c285ea2f418f0dcba8526966c68610dc1f34edbb Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 25 Nov 2013 22:28:12 -0800
Subject: [PATCH] start socket listeners on iscsiadm command
@ -10,7 +10,7 @@ without manually starting the systemd units
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index 1fd3000..412f130 100644
index db395df..16c00f0 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -17,7 +17,8 @@
@ -24,5 +24,5 @@ index 1fd3000..412f130 100644
# Default for upstream open-iscsi scripts (uncomment to activate).
# iscsid.startup = /sbin/iscsid
--
1.8.3.1
2.1.0

View File

@ -1,105 +0,0 @@
From 65998ba3f2413069aa2242645712969d62d9c140 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 22 Mar 2013 07:35:53 -0400
Subject: README changes for flashnode submode support for host mode.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
README | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/README b/README
index ec22098..29b00a9 100644
--- a/README
+++ b/README
@@ -406,6 +406,29 @@ Usage: iscsiadm [OPTION]
is connected to.
3 = Print iscsi params used.
4 = Print SCSI info like LUNs, device state.
+ -m host --host=hostno|MAC -C flashnode
+ Display list of all the targets in adapter's
+ flash (flash node), for the specified host,
+ with ip, port, tpgt and iqn.
+ -m host --host=hostno|MAC -C flashnode --op=[NEW] --portal_type=[ipv4|ipv6]
+ Create new flash node entry for the given host of the
+ specified portal_type. This returns the index of the
+ newly created entry on success.
+ -m host --host=hostno|MAC -C flashnode --flashnode_idx=[flashnode index] \
+ --op=[UPDATE] --name=[name] --value=[value]
+ Update the params of the speficied flash node.
+ The [name] and [value] pairs must be provided for the
+ params that need to be updated. Multiple params can
+ be updated using a single command.
+ -m host --host=hostno|MAC -C flashnode--flashnode_idx=[flashnode index] \
+ --op=[SHOW | DELETE | LOGIN | LOGOUT]
+ op=DELETE|LOGIN|LOGOUT will perform deletion/login/
+ logout operation on the specified flash node.
+
+ op=SHOW will list all params with the values for the
+ specified flash node. This is the default operation.
+
+ See the iscsiadm example section for more info.
-d, --debug debuglevel print debugging information
-V, --version display version and exit
-h, --help display this help and exit
@@ -960,6 +983,56 @@ To now log into targets it is the same as with sofware iscsi. See section
./iscsiadm -m session -P 1
+
+ Host mode with flashnode submode:
+
+ - Display list of flash nodes for a host
+
+ ./iscsiadm -m host -H 6 -C flashnode
+
+ This will print list of all the flash node entries for the given host 6
+ along with their ip, port, tpgt and iqn values.
+
+ - Display all parameters of a flash node entry for a host
+
+ ./iscsiadm -m host -H 6 -C flashnode -x 0
+
+ This will list all the parameter name,value pairs for flash node entry at
+ index 0 of host 6.
+
+ - Add a new flash node entry for a host
+
+ ./iscsiadm -m host -H 6 -C flashnode -o new -A ipv4
+ or
+ ./iscsiadm -m host -H 6 -C flashnode -o new -A ipv6
+
+ This will add new flash node entry for the given host 6 with portal
+ type of either ipv4 or ipv6. The new operation returns the index of
+ the newly created flash node entry.
+
+ - Update a flashnode entry
+ ./iscsiadm -m host -H 6 -C flashnode -x 1 -o update \
+ -n flashnode.conn[0].ipaddress -v 192.168.1.12 \
+ -n flashnode.session.targetname \
+ -v iqn.2002-03.com.compellent:5000d310004b0716
+
+ This will update the values of ipaddress and targetname params of
+ flash node entry at index 1 of host 6.
+
+ - Login to a flash node entry
+ ./iscsiadm -m host -H 6 -C flashnode -x 1 -o login
+
+ - Logout from a flash node entry
+ ./iscsiadm -m host -H 6 -C flashnode -x 1 -o logout
+ or
+ ./iscsiadm -m session -r $sid -u
+
+ Logout can be performed either using the flash node index or using the
+ corresponding session index.
+
+ - Delete a flash node entry
+ ./iscsiadm -m host -H 6 -C flashnode -x 1 -o delete
+
6. Configuration
================
--
1.8.1.4

View File

@ -1,4 +1,4 @@
From 1c0f37a8ae48daa3ae1c37cdac7c0789299180eb Mon Sep 17 00:00:00 2001
From 55764ecafcc1df70111cbcb9643a77182b53a8e7 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 24 Feb 2014 09:33:33 -0800
Subject: [PATCH] Revert "iscsiadm: return error when login fails"
@ -6,7 +6,6 @@ Subject: [PATCH] Revert "iscsiadm: return error when login fails"
This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691.
Done to address RHBZ #1015563
---
usr/session_mgmt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@ -31,5 +30,5 @@ index 87b8e00..3815b1d 100644
}
--
1.8.3.1
2.1.0

View File

@ -1,30 +0,0 @@
From 8d3e9e5c3e1813b372f84d3bcca08bbe479f7f63 Mon Sep 17 00:00:00 2001
From: Lee Duncan <leeman.duncan@gmail.com>
Date: Tue, 21 May 2013 14:16:38 -0700
Subject: PATCH 1 of 1] correctly check return value of nice()
The nice() call can return a negative value, since
it returns the previous nice value.
Signed-off-by: Lee Duncan <leeman.duncan@gmail.com>
---
usr/iscsi_util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
index 5e3420e..ac86847 100644
--- a/usr/iscsi_util.c
+++ b/usr/iscsi_util.c
@@ -60,7 +60,8 @@ int oom_adjust(void)
char path[ISCSI_OOM_PATH_LEN];
struct stat statb;
- if (nice(-10) < 0)
+ errno = 0;
+ if (nice(-10) == -1 && errno != 0)
log_debug(1, "Could not increase process priority: %s",
strerror(errno));
--
1.8.1.4

View File

@ -1,7 +1,7 @@
From 83f291bd475f3d11abaf1f7346732f75af585ed8 Mon Sep 17 00:00:00 2001
From 6ee8a34d108d8d3663da057cad210372e80cb65c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 26 Feb 2014 16:33:48 -0800
Subject: update handling of boot sessions
Subject: [PATCH] update handling of boot sessions
force start iscsiuio if needed, socket activation does not seem to be
working for recovery
@ -10,7 +10,7 @@ working for recovery
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
index 157be62..d106ac6 100644
index 157be62..60dcd70 100644
--- a/etc/systemd/iscsi-mark-root-nodes
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -1,13 +1,30 @@
@ -51,5 +51,5 @@ index 157be62..d106ac6 100644
+fi
--
1.8.3.1
2.1.0

View File

@ -1,55 +0,0 @@
From 7a5cd01731e0eb86960cc4fa543136b7e3a86e1e Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Mon, 13 May 2013 03:19:54 -0500
Subject: Allow firmware mode to use debug flag
From Lee Duncan:
When iscsiadm is called with "-m fw", the debug flag can be
useful.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
doc/iscsiadm.8 | 2 +-
usr/iscsiadm.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index b4c7388..6b15fcd 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -14,7 +14,7 @@ iscsiadm \- open-iscsi administration utility
\fBiscsiadm\fR \-m iface [ \-hV ] [ \-d debug_level ] [ \-P printlevel ] [ \-I ifacename | \-H hostno|MAC ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ] [ \-C ping [ \-a ip ] [ \-b packetsize ] [ \-c count ] [ \-i interval ] ]
-\fBiscsiadm\fR \-m fw [\-l]
+\fBiscsiadm\fR \-m fw [ \-d debug_level ] [\-l]
\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] ]
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 5a18522..df76df9 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -135,7 +135,7 @@ iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,au
[ [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\
-iscsiadm -m fw [ -l ]\n\
+iscsiadm -m fw [ -d debug_level ] [ -l ]\n\
iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ] | [ -C flashnode [ -o operation ] [ -A portal_type ] [ -x flashnode_idx ] [ -n name ] [ -v value ] ] ]\n\
iscsiadm -k priority\n");
}
@@ -2987,7 +2987,7 @@ main(int argc, char **argv)
usage(ISCSI_ERR_INVAL);
if (mode == MODE_FW) {
- if ((rc = verify_mode_params(argc, argv, "ml", 0))) {
+ if ((rc = verify_mode_params(argc, argv, "dml", 0))) {
log_error("fw mode: option '-%c' is not "
"allowed/supported", rc);
rc = ISCSI_ERR_INVAL;
--
1.8.1.4

View File

@ -1,4 +1,4 @@
From 969e26197c792ec5377d2c261a934a9c907e82f0 Mon Sep 17 00:00:00 2001
From 3e2bcef50b2b0a68f4ae9fb32a1cb67189b7a203 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 14 Mar 2014 09:22:21 -0700
Subject: [PATCH] update iscsi.service for boot session recovery
@ -30,5 +30,5 @@ index d5712bd..3de76c5 100644
ExecReload=/sbin/iscsiadm -m node --loginall=automatic
--
1.8.3.1
2.1.0

View File

@ -1,37 +0,0 @@
From f1994bc91688889e4b7ffbca687739023f2a815b Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Fri, 8 Mar 2013 11:11:13 -0800
Subject: iscsiadm: return error when login fails
When login fails because there are too many sessions we should be
returning an error code so that userland is aware that something
is amiss.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
usr/session_mgmt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index ec1f43a..0b7373f 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
goto done;
}
if (session_count >= rec->session.nr_sessions) {
- log_debug(1, "%s: %d session%s requested, but %d "
+ log_warning("%s: %d session%s requested, but %d "
"already present.",
rec->iface.name, rec->session.nr_sessions,
rec->session.nr_sessions == 1 ? "" : "s",
session_count);
- rc = 0;
+ rc = ISCSI_ERR_SESS_EXISTS;
goto done;
}
--
1.8.1.4

View File

@ -1,4 +1,4 @@
From 347e6120213efda47a45443b4e366ed1400433c1 Mon Sep 17 00:00:00 2001
From 275312e70e0b076532af25fe93c05bbbd15a2295 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 17 Sep 2014 09:58:39 -0700
Subject: [PATCH] updates to iscsi.service
@ -37,5 +37,5 @@ index 3de76c5..ad7be34 100644
[Install]
WantedBy=sysinit.target
--
1.9.3
2.1.0

View File

@ -1,217 +0,0 @@
From 2991867601094b39ca1cf7e14d8eefecda14ffb7 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Tue, 22 Jan 2013 10:44:27 -0700
Subject: iscsiadm: bind ifaces to portals found using isns
Bug and patch from Jayamohan Kallickal at Emulex.
This adds support to be able to use isns discovery and
bind the portals found to offload ifaces. Note that
this does not do iSNS through the offload card. It
uses a normal net connection but portals that are found
will be setup to login using the offload card.
The problem with the previous code was that isns
discovery code was not reading in the iface info before
binding, so the resulting setup was not binding the offload
card to the record.
[Minor cleanup of patch by Mike Christie]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
usr/iscsiadm.c | 127 ++++++++++++++++++++++++++++++---------------------------
1 file changed, 66 insertions(+), 61 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index df76df9..efe6383 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1133,17 +1133,55 @@ do_software_sendtargets(discovery_rec_t *drec, struct list_head *ifaces,
return rc;
}
+static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
+ int info_level, int do_login, int op)
+{
+ struct list_head rec_list;
+ struct node_rec *rec, *tmp;
+ int rc;
+
+ INIT_LIST_HEAD(&rec_list);
+ /*
+ * compat: if the user did not pass any op then we do all
+ * ops for them
+ */
+ if (!op)
+ op = OP_NEW | OP_DELETE | OP_UPDATE;
+
+
+ rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
+ &rec_list);
+ if (rc) {
+ log_error("Could not perform iSNS discovery: %s",
+ iscsi_err_to_str(rc));
+ return rc;
+ } else if (list_empty(&rec_list)) {
+ log_error("No portals found");
+ return ISCSI_ERR_NO_OBJS_FOUND;
+ }
+
+ rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op);
+
+ list_for_each_entry_safe(rec, tmp, &rec_list, list) {
+ list_del(&rec->list);
+ free(rec);
+ }
+
+ return rc;
+}
+
static int
-do_sendtargets(discovery_rec_t *drec, struct list_head *ifaces,
- int info_level, int do_login, int op, int sync_drec)
+do_target_discovery(discovery_rec_t *drec, struct list_head *ifaces,
+ int info_level, int do_login, int op, int sync_drec)
{
+
struct iface_rec *tmp, *iface;
int rc, host_no;
struct iscsi_transport *t;
if (list_empty(ifaces)) {
ifaces = NULL;
- goto sw_st;
+ goto sw_discovery;
}
/* we allow users to mix hw and sw iscsi so we have to sort it out */
@@ -1177,59 +1215,30 @@ do_sendtargets(discovery_rec_t *drec, struct list_head *ifaces,
continue;
}
- if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
- do_offload_sendtargets(drec, host_no, do_login);
- list_del(&iface->list);
- free(iface);
- }
+ if (drec->type == DISCOVERY_TYPE_SENDTARGETS)
+ if (t->caps & CAP_SENDTARGETS_OFFLOAD) {
+ do_offload_sendtargets(drec, host_no, do_login);
+ list_del(&iface->list);
+ free(iface);
+ }
}
if (list_empty(ifaces))
return ISCSI_ERR_NO_OBJS_FOUND;
-sw_st:
- return do_software_sendtargets(drec, ifaces, info_level, do_login,
- op, sync_drec);
-}
-
-static int do_isns(discovery_rec_t *drec, struct list_head *ifaces,
- int info_level, int do_login, int op)
-{
- struct list_head rec_list;
- struct node_rec *rec, *tmp;
- int rc;
-
- INIT_LIST_HEAD(&rec_list);
- /*
- * compat: if the user did not pass any op then we do all
- * ops for them
- */
- if (!op)
- op = OP_NEW | OP_DELETE | OP_UPDATE;
-
- drec->type = DISCOVERY_TYPE_ISNS;
-
- rc = idbm_bind_ifaces_to_nodes(discovery_isns, drec, ifaces,
- &rec_list);
- if (rc) {
- log_error("Could not perform iSNS discovery: %s",
- iscsi_err_to_str(rc));
- return rc;
- } else if (list_empty(&rec_list)) {
- log_error("No portals found");
- return ISCSI_ERR_NO_OBJS_FOUND;
- }
-
- rc = exec_disc_op_on_recs(drec, &rec_list, info_level, do_login, op);
-
- list_for_each_entry_safe(rec, tmp, &rec_list, list) {
- list_del(&rec->list);
- free(rec);
+sw_discovery:
+ switch (drec->type) {
+ case DISCOVERY_TYPE_SENDTARGETS:
+ return do_software_sendtargets(drec, ifaces, info_level,
+ do_login, op, sync_drec);
+ case DISCOVERY_TYPE_ISNS:
+ return do_isns(drec, ifaces, info_level, do_login, op);
+ default:
+ log_debug(1, "Unknown Discovery Type : %d\n", drec->type);
}
-
- return rc;
}
+
static int
verify_mode_params(int argc, char **argv, char *allowed, int skip_m)
{
@@ -2394,15 +2403,9 @@ static int exec_discover(int disc_type, char *ip, int port,
rc = 0;
switch (disc_type) {
case DISCOVERY_TYPE_SENDTARGETS:
- /*
- * idbm_add_discovery call above handles drec syncing so
- * we always pass in 0 here.
- */
- rc = do_sendtargets(drec, ifaces, info_level, do_login, op,
- 0);
- break;
case DISCOVERY_TYPE_ISNS:
- rc = do_isns(drec, ifaces, info_level, do_login, op);
+ rc = do_target_discovery(drec, ifaces, info_level, do_login, op,
+ 0);
break;
default:
log_error("Unsupported discovery type.");
@@ -2535,8 +2538,7 @@ static int exec_disc_op(int disc_type, char *ip, int port,
idbm_sendtargets_defaults(&drec.u.sendtargets);
strlcpy(drec.address, ip, sizeof(drec.address));
drec.port = port;
-
- rc = do_sendtargets(&drec, ifaces, info_level,
+ rc = do_target_discovery(&drec, ifaces, info_level,
do_login, op, 1);
if (rc)
goto done;
@@ -2559,7 +2561,9 @@ static int exec_disc_op(int disc_type, char *ip, int port,
else
drec.port = port;
- rc = do_isns(&drec, ifaces, info_level, do_login, op);
+ drec.type = DISCOVERY_TYPE_ISNS;
+ rc = do_target_discovery(&drec, ifaces, info_level,
+ do_login, op, 0);
if (rc)
goto done;
break;
@@ -2590,8 +2594,9 @@ static int exec_disc_op(int disc_type, char *ip, int port,
}
if ((do_discover || do_login) &&
drec.type == DISCOVERY_TYPE_SENDTARGETS) {
- rc = do_sendtargets(&drec, ifaces, info_level,
- do_login, op, 0);
+ rc = do_target_discovery(&drec, ifaces,
+ info_level, do_login,
+ op, 0);
} else if (op == OP_NOOP || op == OP_SHOW) {
if (!idbm_print_discovery_info(&drec,
do_show)) {
--
1.8.1.4

View File

@ -1,7 +1,7 @@
From 56d9d1c6a02dcad0915c0673f9cd2e653c86302f Mon Sep 17 00:00:00 2001
From ed34e9b47b883f4cf9d5ea03b5e6cc12cc010f07 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 13 Jan 2015 16:30:01 -0800
Subject: [PATCH] 0171-make-session-shutdown-a-seperate-service.patch
Subject: [PATCH] make-session-shutdown-a-seperate-service.patch
---
etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++

View File

@ -1,32 +0,0 @@
From 71f0db9ccb46be357c9b6505d35340150795996c Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Thu, 9 May 2013 13:57:49 +0530
Subject: iscsiadm: Check for mode is not required when creating params list
There is no need to explicitly check for mode while creating the params
list of name/value pairs.
Reported-by: Leeman Duncan <leeman.duncan@gmail.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iscsiadm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index efe6383..84d5a27 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -2962,9 +2962,7 @@ main(int argc, char **argv)
usage(0);
}
- if ((mode == MODE_IFACE ||
- (mode == MODE_HOST && sub_mode == MODE_FLASHNODE)) &&
- name && value) {
+ if (name && value) {
param = idbm_alloc_user_param(name, value);
if (!param) {
log_error("Cannot allocate memory for params.");
--
1.8.1.4

View File

@ -0,0 +1,71 @@
From 1f7fd558c4da3c92bdae67646504eaec16e6081f Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 12 Feb 2015 16:01:48 -0800
Subject: [PATCH] honor all requested delays in iscsi_sched_ev_context
The session_conn_uio_poll function reschedules itself in the same was as
session_conn_poll, by calling iscsi_sched_ev_context with a delay. That
delay needs to not be ignored.
Actually, most all of the cases in iscsi_sched_ev_context can use
actor_timer to ensure any passed delay argument is honored (even if most
of them are passed as 0).
Signed-off-by: Chris Leech <cleech@redhat.com>
---
usr/initiator.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/usr/initiator.c b/usr/initiator.c
index 3b39c5d..93a3c27 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1800,9 +1800,8 @@ static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
ev_context->conn = conn;
switch (event) {
case EV_CONN_RECV_PDU:
- actor_init(&ev_context->actor, session_conn_recv_pdu,
- ev_context);
- actor_schedule(&ev_context->actor);
+ actor_timer(&ev_context->actor, tmo,
+ session_conn_recv_pdu, ev_context);
break;
case EV_CONN_ERROR:
error = *(enum iscsi_err *)ev_context->data;
@@ -1820,27 +1819,24 @@ static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
actor_schedule(&ev_context->actor);
break;
case EV_CONN_LOGIN:
- actor_init(&ev_context->actor, session_conn_process_login,
- ev_context);
- actor_schedule(&ev_context->actor);
+ actor_timer(&ev_context->actor, tmo,
+ session_conn_process_login, ev_context);
break;
case EV_CONN_POLL:
actor_timer(&ev_context->actor, tmo,
session_conn_poll, ev_context);
break;
case EV_UIO_POLL:
- actor_init(&ev_context->actor, session_conn_uio_poll,
- ev_context);
- actor_schedule(&ev_context->actor);
+ actor_timer(&ev_context->actor, tmo,
+ session_conn_uio_poll, ev_context);
break;
case EV_CONN_LOGOUT_TIMER:
actor_timer(&ev_context->actor, tmo,
iscsi_logout_timedout, ev_context);
break;
case EV_CONN_STOP:
- actor_init(&ev_context->actor, iscsi_stop,
- ev_context);
- actor_schedule(&ev_context->actor);
+ actor_timer(&ev_context->actor, tmo,
+ iscsi_stop, ev_context);
break;
default:
log_error("Invalid event type %d.", event);
--
2.1.0

View File

@ -1,46 +0,0 @@
From 2d0a0570b4d067f0b4e100f0cbab190efcfe3c67 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 29 May 2013 12:00:40 -0500
Subject: iscsid/iscsiadm: add support for emulex one connect storage
From Chris Moore.
Add support for emulex one connect storage driver.
---
iscsiuio/config.status | 0
usr/transport.c | 8 ++++++++
2 files changed, 8 insertions(+)
mode change 100644 => 100755 iscsiuio/config.status
diff --git a/iscsiuio/config.status b/iscsiuio/config.status
old mode 100644
new mode 100755
diff --git a/usr/transport.c b/usr/transport.c
index 10212af..52b7674 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -99,6 +99,13 @@ struct iscsi_transport_template qla4xxx = {
.ep_disconnect = ktransport_ep_disconnect,
};
+struct iscsi_transport_template ocs = {
+ .name = "ocs",
+ .ep_connect = ktransport_ep_connect,
+ .ep_poll = ktransport_ep_poll,
+ .ep_disconnect = ktransport_ep_disconnect,
+};
+
static struct iscsi_transport_template *iscsi_transport_templates[] = {
&iscsi_tcp,
&iscsi_iser,
@@ -107,6 +114,7 @@ static struct iscsi_transport_template *iscsi_transport_templates[] = {
&bnx2i,
&qla4xxx,
&be2iscsi,
+ &ocs,
NULL
};
--
1.8.1.4

View File

@ -0,0 +1,56 @@
From 8b7dc01508ee5a47566d2270d2e164c0435bdfe3 Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Mon, 11 May 2015 13:16:26 +0200
Subject: [PATCH] Add macros to release GIL lock
Other threads are blocked when GIL is not released before the time consuming
functions.
---
libiscsi/pylibiscsi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
index 8800853..40b5955 100644
--- a/libiscsi/pylibiscsi.c
+++ b/libiscsi/pylibiscsi.c
@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self)
static PyObject *PyIscsiNode_login(PyObject *self)
{
PyIscsiNode *node = (PyIscsiNode *)self;
+ int ret;
- if (libiscsi_node_login(context, &node->node)) {
+ Py_BEGIN_ALLOW_THREADS
+ ret = libiscsi_node_login(context, &node->node);
+ Py_END_ALLOW_THREADS
+
+ if (ret) {
PyErr_SetString(PyExc_IOError,
libiscsi_get_error_string(context));
return NULL;
@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
const struct libiscsi_auth_info *authinfo = NULL;
struct libiscsi_node *found_nodes;
PyObject* found_node_list;
+ int ret;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
kwlist, &address, &port,
@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
}
}
- if (libiscsi_discover_sendtargets(context, address, port, authinfo,
- &nr_found, &found_nodes)) {
+ Py_BEGIN_ALLOW_THREADS
+ ret = libiscsi_discover_sendtargets(context, address, port, authinfo,
+ &nr_found, &found_nodes);
+ Py_END_ALLOW_THREADS
+
+ if (ret) {
PyErr_SetString(PyExc_IOError,
libiscsi_get_error_string(context));
return NULL;
--
2.1.0

View File

@ -1,607 +0,0 @@
From 669d4aeb6103c236e7cba94bbbb3c3098f8b4b15 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 19 Jun 2013 14:48:27 -0700
Subject: ISCSIUIO: Updated iscsiuio to version 0.7.8.1b for perf optimization
uIP v0.7.8.1b (May 01, 2013)
=======================================================
Enhancements
------------
1. Change: Performance optimization by caching the page size
Impact: All
2. Change: Fixed a bug in the tx completion interrupt handler
Impact: 10G only
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/README | 9 ++-
iscsiuio/RELEASE.TXT | 15 ++++-
iscsiuio/configure | 124 ++++++++++++++++++++---------------------
iscsiuio/configure.ac | 4 +-
iscsiuio/docs/iscsiuio.8 | 8 +--
iscsiuio/src/unix/libs/bnx2.c | 14 ++---
iscsiuio/src/unix/libs/bnx2x.c | 19 ++++---
iscsiuio/src/unix/nic.c | 1 +
iscsiuio/src/unix/nic.h | 6 +-
9 files changed, 108 insertions(+), 92 deletions(-)
diff --git a/iscsiuio/README b/iscsiuio/README
index 1a6386f..e7e5fe4 100644
--- a/iscsiuio/README
+++ b/iscsiuio/README
@@ -1,6 +1,6 @@
Iscsiuio Userspace Tool
-Version 0.7.6.1g
-Jan 14, 2013
+Version 0.7.8.1b
+May 01, 2013
------------------------------------------------------
This tool is to be used in conjunction with the Broadcom NetXtreme II Linux
@@ -189,9 +189,8 @@ To run the daemon in debug mode please pass the parameter '-d <debug level>'
where the following debug levels are defined:
-PACKET 5 - Print all messages
-DEBUG 4 - Print debug messages
-INFO 3 - Print messages needed to follow the uIP code
+DEBUG 4 - Print all messages
+INFO 3 - Print messages needed to follow the uIP code (default)
WARN 2 - Print warning messages
ERROR 1 - Only print critical errors
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index 2fa19bb..de70667 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -1,7 +1,7 @@
Release Notes
Broadcom uIP Linux Driver
- Version 0.7.6.1g
- 01/14/2013
+ Version 0.7.8.1b
+ 05/01/2013
Broadcom Corporation
5300 California Avenue,
@@ -10,6 +10,16 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
+uIP v0.7.8.1b (May 01, 2013)
+=======================================================
+ Enhancements
+ ------------
+ 1. Change: Performance optimization by caching the page size
+ Impact: All
+
+ 2. Change: Fixed a bug in the tx completion interrupt handler
+ Impact: 10G only
+
uIP v0.7.6.1g (Jan 14, 2013)
=======================================================
@@ -1986,3 +1996,4 @@ uIP v0.5.0b (Nov 24, 2009)
1. Change: Add Broadcom 10G iSCSI offload support
Impact: Linux
+
diff --git a/iscsiuio/configure b/iscsiuio/configure
index 1852551..2740598 100755
--- a/iscsiuio/configure
+++ b/iscsiuio/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.6.1g.
+# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.8.1b.
#
# Report bugs to <eddie.wai@broadcom.com>.
#
@@ -72,9 +72,9 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='iscsiuio'
PACKAGE_TARNAME='iscsiuio'
-PACKAGE_VERSION='0.7.6.1g'
-PACKAGE_STRING='iscsiuio 0.7.6.1g'
+PACKAGE_VERSION='0.7.8.1b'
+PACKAGE_STRING='iscsiuio 0.7.8.1b'
PACKAGE_BUGREPORT='eddie.wai@broadcom.com'
# Factoring default headers for most tests.
@@ -870,10 +870,10 @@ $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures iscsiuio 0.7.6.1g to adapt to many kinds of systems.
+\`configure' configures iscsiuio 0.7.8.1b to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1020,7 +1020,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of iscsiuio 0.7.6.1g:";;
+ short | recursive ) echo "Configuration of iscsiuio 0.7.8.1b:";;
esac
cat <<\_ACEOF
@@ -1160,7 +1160,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-iscsiuio configure 0.7.6.1g
+iscsiuio configure 0.7.8.1b
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1174,7 +1174,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by iscsiuio $as_me 0.7.6.1g, which was
+It was created by iscsiuio $as_me 0.7.8.1b, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -11743,7 +11743,7 @@ echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "$cross_compiling" = yes; then :
+ if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -11843,7 +11843,7 @@ echo $ECHO_N "checking whether a statically linked program can dlopen itself...
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "$cross_compiling" = yes; then :
+ if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self_static=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -21519,9 +21519,9 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
@@ -21705,7 +21705,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by iscsiuio $as_me 0.7.6.1g, which was
+This file was extended by iscsiuio $as_me 0.7.8.1b, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21768,7 +21768,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-iscsiuio config.status 0.7.6.1g
+iscsiuio config.status 0.7.8.1b
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -22113,10 +22113,10 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
@@ -22132,10 +22132,10 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
@@ -22470,10 +22470,10 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
@@ -22489,10 +22489,10 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
@@ -22524,10 +22524,10 @@ $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X$ac_file |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`/stamp-h$_am_stamp_count
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -22546,10 +22546,10 @@ $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_dest" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
@@ -22565,10 +22565,10 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
@@ -22662,10 +22662,10 @@ $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
else
continue
fi
@@ -22695,10 +22695,10 @@ $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p $dirpart/$fdir
else
@@ -22714,10 +22714,10 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
@@ -22762,4 +22762,4 @@ if test "$no_create" != yes; then
# would make configure fail if this is the last instruction.
$ac_cs_success || { (exit 1); exit 1; }
fi
-#
+
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index 34f0481..e9a5e32 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -11,9 +11,9 @@ dnl Benjamin Li (benli@broadcom.com)
dnl
PACKAGE=iscsiuio
-VERSION=0.7.6.1g
+VERSION=0.7.8.1b
-AC_INIT(iscsiuio, 0.7.6.1g, eddie.wai@broadcom.com)
+AC_INIT(iscsiuio, 0.7.8.1b, eddie.wai@broadcom.com)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_CONFIG_HEADER(config.h)
diff --git a/iscsiuio/docs/iscsiuio.8 b/iscsiuio/docs/iscsiuio.8
index 2f577bc..ea21d78 100644
--- a/iscsiuio/docs/iscsiuio.8
+++ b/iscsiuio/docs/iscsiuio.8
@@ -3,9 +3,9 @@
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation.
.\"
-.\" bnx2.4,v 0.7.6.1g
+.\" bnx2.4,v 0.7.8.1b
.\"
-.TH iscsiuio 8 "01/14/2013" "Broadcom Corporation"
+.TH iscsiuio 8 "05/01/2013" "Broadcom Corporation"
.\"
.\" NAME part
.\"
@@ -81,6 +81,6 @@ Display this help and exit.
.\" AUTHOR part
.\"
.SH AUTHOR
-Eddie Wai \- eddie.wai@broadcom.com
-.P
Benjamin Li \- benli@broadcom.com
+.P
+Eddie Wai \- eddie.wai@broadcom.com
diff --git a/iscsiuio/src/unix/libs/bnx2.c b/iscsiuio/src/unix/libs/bnx2.c
index b72b8ce..91c44e5 100644
--- a/iscsiuio/src/unix/libs/bnx2.c
+++ b/iscsiuio/src/unix/libs/bnx2.c
@@ -576,7 +576,7 @@ static int bnx2_open(nic_t *nic)
bp->sblk_map = mmap(NULL, bp->status_blk_size,
PROT_READ | PROT_WRITE, MAP_SHARED,
- nic->fd, (off_t) getpagesize());
+ nic->fd, (off_t) nic->page_size);
if (bp->sblk_map == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap status block: %s",
nic->log_name, strerror(errno));
@@ -602,9 +602,9 @@ static int bnx2_open(nic_t *nic)
BNX2_SBLK_EVEN_IDX(bp->status_blk.msi->rx2));
}
- bp->tx_ring = mmap(NULL, 2 * getpagesize(),
+ bp->tx_ring = mmap(NULL, 2 * nic->page_size,
PROT_READ | PROT_WRITE, MAP_SHARED, nic->fd,
- (off_t) 2 * getpagesize());
+ (off_t) 2 * nic->page_size);
if (bp->tx_ring == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap tx ring: %s",
nic->log_name, strerror(errno));
@@ -614,7 +614,7 @@ static int bnx2_open(nic_t *nic)
bp->bufs = mmap(NULL, (bp->rx_ring_size + 1) * bp->rx_buffer_size,
PROT_READ | PROT_WRITE,
- MAP_SHARED, nic->fd, (off_t) 3 * getpagesize());
+ MAP_SHARED, nic->fd, (off_t) 3 * nic->page_size);
if (bp->bufs == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap buffers: %s",
nic->log_name, strerror(errno));
@@ -693,7 +693,7 @@ static int bnx2_open(nic_t *nic)
return 0;
error_bufs:
- munmap(bp->tx_ring, 2 * getpagesize());
+ munmap(bp->tx_ring, 2 * nic->page_size);
error_tx_ring:
munmap(bp->status_blk.msi, bp->status_blk_size);
@@ -765,7 +765,7 @@ static int bnx2_uio_close_resources(nic_t *nic, NIC_SHUTDOWN_T graceful)
}
if (bp->tx_ring != NULL) {
- rc = munmap(bp->tx_ring, 2 * getpagesize());
+ rc = munmap(bp->tx_ring, 2 * nic->page_size);
if (rc != 0)
LOG_WARN(PFX "%s: Couldn't unmap tx_rings",
nic->log_name);
@@ -884,7 +884,7 @@ void bnx2_start_xmit(nic_t *nic, size_t len, u16_t vlan_id)
uint16_t ring_prod;
struct tx_bd *txbd;
struct rx_bd *rxbd;
- rxbd = (struct rx_bd *)(((__u8 *) bp->tx_ring) + getpagesize());
+ rxbd = (struct rx_bd *)(((__u8 *) bp->tx_ring) + nic->page_size);
if ((rxbd->rx_bd_haddr_hi == 0) && (rxbd->rx_bd_haddr_lo == 0)) {
LOG_PACKET(PFX "%s: trying to transmit when device is closed",
diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index c6e92cf..36fc48e 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -818,7 +818,7 @@ static int bnx2x_open(nic_t *nic)
bp->status_blk.def = mmap(NULL, bp->status_blk_size,
PROT_READ | PROT_WRITE, MAP_SHARED,
- nic->fd, (off_t) getpagesize());
+ nic->fd, (off_t) nic->page_size);
if (bp->status_blk.def == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap status block: %s",
nic->log_name, strerror(errno));
@@ -827,10 +827,10 @@ static int bnx2x_open(nic_t *nic)
goto open_error;
}
- bp->tx_ring = mmap(NULL, 4 * getpagesize(),
+ bp->tx_ring = mmap(NULL, 4 * nic->page_size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_LOCKED,
- nic->fd, (off_t) 2 * getpagesize());
+ nic->fd, (off_t) 2 * nic->page_size);
if (bp->tx_ring == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap tx ring: %s",
nic->log_name, strerror(errno));
@@ -840,12 +840,12 @@ static int bnx2x_open(nic_t *nic)
}
bp->rx_comp_ring.cqe = (union eth_rx_cqe *)
- (((__u8 *) bp->tx_ring) + 2 * getpagesize());
+ (((__u8 *) bp->tx_ring) + 2 * nic->page_size);
bp->bufs = mmap(NULL, (bp->rx_ring_size + 1) * bp->rx_buffer_size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_LOCKED,
- nic->fd, (off_t) 3 * getpagesize());
+ nic->fd, (off_t) 3 * nic->page_size);
if (bp->bufs == MAP_FAILED) {
LOG_INFO(PFX "%s: Could not mmap buffers: %s",
nic->log_name, strerror(errno));
@@ -937,7 +937,7 @@ static int bnx2x_open(nic_t *nic)
bp->rx_prod_io = BAR_USTRORM_INTMEM +
USTORM_RX_PRODS_OFFSET(bp->port, bp->client_id);
- bp->tx_doorbell = bp->cid * getpagesize() + 0x40;
+ bp->tx_doorbell = bp->cid * nic->page_size + 0x40;
bp->get_rx_cons = bnx2x_get_rx;
bp->get_tx_cons = bnx2x_get_tx;
@@ -1073,7 +1073,7 @@ SF:
open_error:
if (bp->tx_ring) {
- munmap(bp->tx_ring, 4 * getpagesize());
+ munmap(bp->tx_ring, 4 * nic->page_size);
bp->tx_ring = NULL;
}
@@ -1150,7 +1150,7 @@ static int bnx2x_uio_close_resources(nic_t *nic, NIC_SHUTDOWN_T graceful)
}
if (bp->tx_ring != NULL) {
- rc = munmap(bp->tx_ring, 4 * getpagesize());
+ rc = munmap(bp->tx_ring, 4 * nic->page_size);
if (rc != 0)
LOG_WARN(PFX "%s: Couldn't unmap tx_rings",
nic->log_name);
@@ -1284,7 +1284,7 @@ void bnx2x_start_xmit(nic_t *nic, size_t len, u16_t vlan_id)
struct eth_tx_start_bd *txbd;
struct eth_tx_bd *txbd2;
struct eth_rx_bd *rx_bd;
- rx_bd = (struct eth_rx_bd *)(((__u8 *) bp->tx_ring) + getpagesize());
+ rx_bd = (struct eth_rx_bd *)(((__u8 *) bp->tx_ring) + nic->page_size);
if ((rx_bd->addr_hi == 0) && (rx_bd->addr_lo == 0)) {
LOG_PACKET(PFX "%s: trying to transmit when device is closed",
@@ -1539,6 +1539,7 @@ static int bnx2x_clear_tx_intr(nic_t *nic)
LOG_ERR(PFX "bnx2x tx lock with prod == cons");
pthread_mutex_unlock(&nic->xmit_mutex);
+ return 0;
}
return -EAGAIN;
}
diff --git a/iscsiuio/src/unix/nic.c b/iscsiuio/src/unix/nic.c
index 457797d..7c3f4d5 100644
--- a/iscsiuio/src/unix/nic.c
+++ b/iscsiuio/src/unix/nic.c
@@ -400,6 +400,7 @@ nic_t *nic_init()
nic->tx_packet_queue = NULL;
nic->nic_library = NULL;
nic->pci_id = NULL;
+ nic->page_size = getpagesize();
/* nic_mutex is used to protect nic ops */
pthread_mutex_init(&nic->nic_mutex, NULL);
diff --git a/iscsiuio/src/unix/nic.h b/iscsiuio/src/unix/nic.h
index 7d2d078..7d1ae28 100644
--- a/iscsiuio/src/unix/nic.h
+++ b/iscsiuio/src/unix/nic.h
@@ -140,7 +140,9 @@ typedef struct nic_interface {
time_t start_time;
struct uip_stack ustack;
-#define IFACE_NUM_INVALID -1
+
+#define IFACE_NUM_PRESENT (1<<0)
+#define IFACE_NUM_INVALID -1
int iface_num;
int request_type;
} nic_interface_t;
@@ -247,6 +249,8 @@ typedef struct nic {
uint32_t intr_count; /* Total UIO interrupt count */
+ int page_size;
+
/* Held for nic ops manipulation */
pthread_mutex_t nic_mutex;
--
1.8.1.4

View File

@ -1,43 +0,0 @@
From f0d81b5ea1170274c57be7ee7989dc7bb0b64b84 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 26 Jun 2013 11:57:39 -0700
Subject: Fix discovery error return without return value
openSUSE Build Service compiler noticed that one discovery
error path did not have a return value, so an appropriate
error is now being returned.
Signed-of-by: Lee Duncan <lduncan@suse.com>
---
include/iscsi_err.h | 2 ++
usr/iscsiadm.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/include/iscsi_err.h b/include/iscsi_err.h
index 1139133..125f443 100644
--- a/include/iscsi_err.h
+++ b/include/iscsi_err.h
@@ -64,6 +64,8 @@ enum {
ISCSI_ERR_BUSY = 28,
/* Operation failed, but retrying layer may succeed */
ISCSI_ERR_AGAIN = 29,
+ /* unknown discovery type */
+ ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE = 30,
/* Always last. Indicates end of error code space */
ISCSI_MAX_ERR_VAL,
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 84d5a27..5030894 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1235,6 +1235,7 @@ sw_discovery:
return do_isns(drec, ifaces, info_level, do_login, op);
default:
log_debug(1, "Unknown Discovery Type : %d\n", drec->type);
+ return ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE;
}
}
--
1.8.1.4

View File

@ -1,29 +0,0 @@
From 5569a3d9d0933a226860284cbad8b0c04f1ba0e5 Mon Sep 17 00:00:00 2001
From: Jan Vesely <jvesely@redhat.com>
Date: Wed, 26 Jun 2013 14:45:57 +0200
Subject: iscsid: Fix strlen parameter
The target socket name is passed as parameter, don't use the hardwired
one.
Signed-off-by: Jan Vesely <jvesely@redhat.com>
---
usr/iscsid_req.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 15f6353..715c0aa 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -67,7 +67,7 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
return ISCSI_ERR_ISCSID_NOTCONN;
}
- addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
+ addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(unix_sock_name) + 1;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
--
1.8.1.4

View File

@ -1,50 +0,0 @@
From fef4db2784fac34fa99468de09c386114b228b36 Mon Sep 17 00:00:00 2001
From: Jan Vesely <jvesely@redhat.com>
Date: Wed, 26 Jun 2013 15:55:12 +0200
Subject: iscsiuio: Change socket bind to use the same struct size as iscsid
Without this patch connections to iscsiuio fail, and strace prints:
connect(8, {sa_family=AF_FILE, path=@"ISCSID_UIP_ABSTRACT_NAMESPACE"}, 32) = -1 ECONNREFUSED (Connection refused)
Note that updating mgmt_ipc_listen and ipc_connect to use sizeof(addr) instead
of the precomputed values also fixes the issue.
Looks like "(Null bytes in the name have no special significance.)" [man 7 unix] is the culprit here.
Signed-off-by: Jan Vesely <jvesely@redhat.com>
---
iscsiuio/src/unix/iscsid_ipc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index 5c097e6..e22de0d 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -958,7 +958,7 @@ static void *iscsid_loop(void *arg)
*/
int iscsid_init()
{
- int rc;
+ int rc, addr_len;
struct sockaddr_un addr;
iscsid_opts.fd = socket(AF_LOCAL, SOCK_STREAM, 0);
@@ -967,12 +967,14 @@ int iscsid_init()
return iscsid_opts.fd;
}
+ addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSID_UIP_NAMESPACE) + 1;
+
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
memcpy((char *)&addr.sun_path + 1, ISCSID_UIP_NAMESPACE,
strlen(ISCSID_UIP_NAMESPACE));
- rc = bind(iscsid_opts.fd, (struct sockaddr *)&addr, sizeof(addr));
+ rc = bind(iscsid_opts.fd, (struct sockaddr *)&addr, addr_len);
if (rc < 0) {
LOG_ERR(PFX "Can not bind IPC socket: %s", strerror(errno));
goto error;
--
1.8.1.4

View File

@ -1,299 +0,0 @@
From 3c5ec3835d5fd57a993cb814ecd74b48419a7459 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Mon, 29 Jul 2013 14:13:36 -0500
Subject: Make rescan run in parallel
Patch from Saggi Mizrahi:
This fixes a problem where a host which is inaccessible would block the
scan of other hosts in the system.
[compilation and minor cosmetic fixes by Mike Christie]
Signed-off-by: Saggi Mizrahi <smizrahi@redhat.com>
---
usr/host.c | 2 +-
usr/initiator.c | 3 ++-
usr/iscsi_sysfs.c | 61 +++++++++++++++++++++++++++++++++++++++++++++---------
usr/iscsi_sysfs.h | 3 ++-
usr/iscsiadm.c | 18 +++++++++-------
usr/iscsid.c | 3 ++-
usr/session_info.c | 4 ++--
usr/session_mgmt.c | 7 ++++---
8 files changed, 74 insertions(+), 27 deletions(-)
diff --git a/usr/host.c b/usr/host.c
index b03e50f..1fcb350 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -242,7 +242,7 @@ static int host_info_print_tree(void *data, struct host_info *hinfo)
link_info.data = &hinfo->host_no;
err = iscsi_sysfs_for_each_session(&link_info, &num_found,
- session_info_create_list);
+ session_info_create_list, 0);
if (err || !num_found)
return 0;
diff --git a/usr/initiator.c b/usr/initiator.c
index 86df222..a3b24b7 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1855,7 +1855,8 @@ static int session_is_running(node_rec_t *rec)
if (session_find_by_rec(rec))
return 1;
- if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_session))
+ if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_session,
+ 0))
return 1;
return 0;
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 64a4ce7..aed10a3 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -24,6 +24,7 @@
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/wait.h>
#include "log.h"
#include "initiator.h"
@@ -1167,11 +1168,13 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
}
int iscsi_sysfs_for_each_session(void *data, int *nr_found,
- iscsi_sysfs_session_op_fn *fn)
+ iscsi_sysfs_session_op_fn *fn,
+ int in_parallel)
{
struct dirent **namelist;
- int rc = 0, n, i;
+ int rc = 0, n, i, chldrc = 0;
struct session_info *info;
+ pid_t pid = 0;
info = calloc(1, sizeof(*info));
if (!info)
@@ -1193,14 +1196,52 @@ int iscsi_sysfs_for_each_session(void *data, int *nr_found,
continue;
}
- rc = fn(data, info);
- if (rc > 0)
- break;
- else if (rc == 0)
- (*nr_found)++;
- else
- /* if less than zero it means it was not a match */
- rc = 0;
+ if (in_parallel) {
+ pid = fork();
+ }
+ if (pid == 0) {
+ rc = fn(data, info);
+ if (in_parallel) {
+ exit(rc);
+ } else {
+ if (rc > 0) {
+ break;
+ } else if (rc == 0) {
+ (*nr_found)++;
+ } else {
+ /* if less than zero it means it was not a match */
+ rc = 0;
+ }
+ }
+ } else if (pid < 0) {
+ log_error("could not fork() for session %s, err %d",
+ namelist[i]->d_name, errno);
+ }
+ }
+
+ if (in_parallel) {
+ while (1) {
+ if (wait(&chldrc) < 0) {
+ /*
+ * ECHILD means no more children which is
+ * expected to happen sooner or later.
+ */
+ if (errno != ECHILD) {
+ rc = errno;
+ }
+ break;
+ }
+
+ if ((chldrc > 0) && (rc == 0)) {
+ /*
+ * The non-parallel code path returns the first
+ * error so this keeps the same semantics.
+ */
+ rc = chldrc;
+ } else if (chldrc == 0) {
+ (*nr_found)++;
+ }
+ }
}
for (i = 0; i < n; i++)
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h
index d130d36..9a56105 100644
--- a/usr/iscsi_sysfs.h
+++ b/usr/iscsi_sysfs.h
@@ -51,7 +51,8 @@ extern int iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no,
int *nr_found,
iscsi_sysfs_iface_op_fn *fn);
extern int iscsi_sysfs_for_each_session(void *data, int *nr_found,
- iscsi_sysfs_session_op_fn *fn);
+ iscsi_sysfs_session_op_fn *fn,
+ int in_parallel);
extern int iscsi_sysfs_for_each_host(void *data, int *nr_found,
iscsi_sysfs_host_op_fn *fn);
extern uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err);
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 5030894..da0a3ec 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -347,7 +347,8 @@ match_startup_mode(node_rec_t *rec, char *mode)
}
static int
-for_each_session(struct node_rec *rec, iscsi_sysfs_session_op_fn *fn)
+for_each_session(struct node_rec *rec, iscsi_sysfs_session_op_fn *fn,
+ int in_parallel)
{
int err, num_found = 0;
@@ -355,7 +356,8 @@ for_each_session(struct node_rec *rec, iscsi_sysfs_session_op_fn *fn)
num_found = 1;
err = fn(rec, rec->session.info);
} else {
- err = iscsi_sysfs_for_each_session(rec, &num_found, fn);
+ err = iscsi_sysfs_for_each_session(rec, &num_found, fn,
+ in_parallel);
}
if (err)
log_error("Could not execute operation on all sessions: %s",
@@ -435,7 +437,7 @@ logout_by_startup(char *mode)
rc = iscsi_logout_portals(mode, &nr_found, 1, __logout_by_startup);
if (rc == ISCSI_ERR_NO_OBJS_FOUND)
log_error("No matching sessions found");
- return rc;
+ return rc;
}
struct startup_data {
@@ -479,7 +481,7 @@ __do_leading_login(void *data, struct list_head *list, struct node_rec *rec)
* If there is an existing session that matcthes the target,
* the leading login is complete.
*/
- if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_target)) {
+ if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_target, 0)) {
log_debug(1, "Skipping %s: Already a session for that target",
rec->name);
return -1;
@@ -579,7 +581,7 @@ login_by_startup(char *mode)
list_for_each_entry_safe(rec, tmp_rec, &startup.leading_logins,
list) {
if (!iscsi_sysfs_for_each_session(rec, &nr_found,
- iscsi_match_target))
+ iscsi_match_target, 0))
missed_leading_login++;
/*
* Cleanup the list, since 'iscsi_login_portals_safe'
@@ -1210,7 +1212,7 @@ do_target_discovery(discovery_rec_t *drec, struct list_head *ifaces,
host_no = iscsi_sysfs_get_host_no_from_hwinfo(iface, &rc);
if (rc || host_no == -1) {
log_debug(1, "Could not match iface" iface_fmt " to "
- "host.", iface_str(iface));
+ "host.", iface_str(iface));
/* try software iscsi */
continue;
}
@@ -2116,12 +2118,12 @@ static int exec_node_op(int op, int do_login, int do_logout,
}
if (do_rescan) {
- rc = for_each_session(rec, rescan_portal);
+ rc = for_each_session(rec, rescan_portal, 1);
goto out;
}
if (do_stats) {
- rc = for_each_session(rec, session_stats);
+ rc = for_each_session(rec, session_stats, 0);
goto out;
}
diff --git a/usr/iscsid.c b/usr/iscsid.c
index b4bb65b..8f19220 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -511,7 +511,8 @@ int main(int argc, char *argv[])
if (pid == 0) {
int nr_found = 0;
/* child */
- iscsi_sysfs_for_each_session(NULL, &nr_found, sync_session);
+ /* TODO - test with async support enabled */
+ iscsi_sysfs_for_each_session(NULL, &nr_found, sync_session, 0);
exit(0);
} else if (pid < 0) {
log_error("Fork failed error %d: existing sessions"
diff --git a/usr/session_info.c b/usr/session_info.c
index 1f84c49..de156c6 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -368,7 +368,7 @@ int session_info_print(int info_level, struct session_info *info, int do_show)
num_found = 1;
} else
err = iscsi_sysfs_for_each_session(info, &num_found,
- session_info_print_flat);
+ session_info_print_flat, 0);
break;
case 3:
version = iscsi_sysfs_get_iscsi_kernel_version();
@@ -403,7 +403,7 @@ int session_info_print(int info_level, struct session_info *info, int do_show)
link_info.match_fn = NULL;
err = iscsi_sysfs_for_each_session(&link_info, &num_found,
- session_info_create_list);
+ session_info_create_list, 0);
if (err || !num_found)
break;
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index 0b7373f..87b8e00 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -172,7 +172,7 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
* that are missing.
*/
rc = iscsi_sysfs_for_each_session(rec, &session_count,
- iscsi_match_session_count);
+ iscsi_match_session_count, 0);
if (rc) {
log_error("Could not count current number of sessions");
goto done;
@@ -421,7 +421,7 @@ int iscsi_logout_portals(void *data, int *nr_found, int wait,
*nr_found = 0;
err = iscsi_sysfs_for_each_session(&link_info, nr_found,
- session_info_create_list);
+ session_info_create_list, 0);
if (err && !list_empty(&session_list))
log_error("Could not read in all sessions: %s",
iscsi_err_to_str(err));
@@ -466,7 +466,8 @@ free_list:
int iscsi_check_for_running_session(struct node_rec *rec)
{
int nr_found = 0;
- if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_session))
+ if (iscsi_sysfs_for_each_session(rec, &nr_found, iscsi_match_session,
+ 0))
return 1;
return 0;
}
--
1.8.1.4

View File

@ -1,213 +0,0 @@
From 3256b93ee3025bf76757001ff3d24914c4c4af28 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 9 Jul 2013 08:17:14 -0400
Subject: [PATCH] iscsiadm: Correctly check for invalid hostno and flashnode
index
In host mode, correctly compare for invalid hostno and flashnode index.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/flashnode.h | 2 ++
usr/host.h | 2 ++
usr/iscsiadm.c | 48 ++++++++++++++++++++++++++++++------------------
usr/types.h | 1 +
4 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/usr/flashnode.h b/usr/flashnode.h
index c1de9cc..2950fb5 100644
--- a/usr/flashnode.h
+++ b/usr/flashnode.h
@@ -26,6 +26,8 @@
#include "config.h"
#include "auth.h"
+#define MAX_FLASHNODE_IDX UINT_MAX
+
typedef enum portal_type {
IPV4,
IPV6,
diff --git a/usr/host.h b/usr/host.h
index 894ab91..db44cfa 100644
--- a/usr/host.h
+++ b/usr/host.h
@@ -5,6 +5,8 @@
#include "types.h"
#include "config.h"
+#define MAX_HOST_NO UINT_MAX
+
#define MAX_CHAP_BUF_SZ 4096
#define REQ_CHAP_BUF_SZ (MAX_CHAP_BUF_SZ + sizeof(struct iscsi_uevent))
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index da0a3ec..c7337ae 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1744,20 +1744,22 @@ exit_logout_sid:
}
static int exec_flashnode_op(int op, int info_level, uint32_t host_no,
- uint32_t flashnode_idx, int type,
+ uint64_t fnode_idx, int type,
struct list_head *params)
{
struct iscsi_transport *t = NULL;
int rc = ISCSI_SUCCESS;
char *portal_type;
+ uint32_t flashnode_idx;
if (op != OP_SHOW && op != OP_NOOP && op != OP_NEW &&
- flashnode_idx == 0xffffffff) {
+ fnode_idx > MAX_FLASHNODE_IDX) {
log_error("Invalid flashnode index");
rc = ISCSI_ERR_INVAL;
goto exit_flashnode_op;
}
+ flashnode_idx = (uint32_t)fnode_idx;
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t) {
log_error("Could not match hostno %u to transport.", host_no);
@@ -1768,7 +1770,7 @@ static int exec_flashnode_op(int op, int info_level, uint32_t host_no,
switch (op) {
case OP_NOOP:
case OP_SHOW:
- if (flashnode_idx == 0xffffffff)
+ if (fnode_idx > MAX_FLASHNODE_IDX)
rc = list_flashnodes(info_level, host_no);
else
rc = get_flashnode_info(host_no, flashnode_idx);
@@ -1880,7 +1882,7 @@ static int verify_iface_params(struct list_head *params, struct node_rec *rec)
/* TODO: merge iter helpers and clean them up, so we can use them here */
static int exec_iface_op(int op, int do_show, int info_level,
- struct iface_rec *iface, uint32_t host_no,
+ struct iface_rec *iface, uint64_t host_no,
struct list_head *params)
{
struct host_info hinfo;
@@ -2001,9 +2003,9 @@ update_fail:
printf("%s applied.\n", iface->name);
break;
case OP_APPLY_ALL:
- if (host_no == -1) {
- log_error("Applyall requires a host number or MAC "
- "passed in with the --host argument.");
+ if (host_no > MAX_HOST_NO) {
+ log_error("Applyall requires a valid host number or MAC"
+ " passed in with the --host argument.");
rc = ISCSI_ERR_INVAL;
break;
}
@@ -2014,7 +2016,7 @@ update_fail:
memset(&hinfo, 0, sizeof(struct host_info));
hinfo.host_no = host_no;
if (iscsi_sysfs_get_hostinfo_by_host_no(&hinfo)) {
- log_error("Could not match host%u to ifaces.", host_no);
+ log_error("Could not match host%lu to ifaces.", host_no);
rc = ISCSI_ERR_INVAL;
break;
}
@@ -2025,7 +2027,7 @@ update_fail:
break;
}
- printf("Applied settings to ifaces attached to host%u.\n",
+ printf("Applied settings to ifaces attached to host%lu.\n",
host_no);
break;
default:
@@ -2637,10 +2639,10 @@ done:
return rc;
}
-static uint32_t parse_host_info(char *optarg, int *rc)
+static uint64_t parse_host_info(char *optarg, int *rc)
{
int err = 0;
- uint32_t host_no = -1;
+ uint64_t host_no;
*rc = 0;
if (strstr(optarg, ":")) {
@@ -2653,8 +2655,11 @@ static uint32_t parse_host_info(char *optarg, int *rc)
*rc = ISCSI_ERR_INVAL;
}
} else {
- host_no = strtoul(optarg, NULL, 10);
- if (errno) {
+ host_no = strtoull(optarg, NULL, 10);
+ if (errno || (host_no > MAX_HOST_NO)) {
+ if (host_no > MAX_HOST_NO)
+ errno = ERANGE;
+
log_error("Invalid host no %s. %s.",
optarg, strerror(errno));
*rc = ISCSI_ERR_INVAL;
@@ -2806,13 +2811,14 @@ main(int argc, char **argv)
int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0;
int packet_size=32, ping_count=1, ping_interval=0;
int do_discover = 0, sub_mode = -1;
- int flashnode_idx = -1, portal_type = -1;
+ int portal_type = -1;
struct sigaction sa_old;
struct sigaction sa_new;
struct list_head ifaces;
struct iface_rec *iface = NULL, *tmp;
struct node_rec *rec = NULL;
- uint32_t host_no = -1;
+ uint64_t host_no = (uint64_t)MAX_HOST_NO + 1;
+ uint64_t flashnode_idx = (uint64_t)MAX_FLASHNODE_IDX + 1;
struct user_param *param;
struct list_head params;
@@ -2956,7 +2962,13 @@ main(int argc, char **argv)
ISCSI_VERSION_STR);
return 0;
case 'x':
- flashnode_idx = atoi(optarg);
+ flashnode_idx = strtoull(optarg, NULL, 10);
+ if (errno) {
+ log_error("Invalid flashnode index %s. %s.",
+ optarg, strerror(errno));
+ rc = ISCSI_ERR_INVAL;
+ goto free_ifaces;
+ }
break;
case 'A':
portal_type = str_to_portal_type(optarg);
@@ -3022,7 +3034,7 @@ main(int argc, char **argv)
if (sub_mode != -1) {
switch (sub_mode) {
case MODE_CHAP:
- if (!op || !host_no) {
+ if (!op || (host_no > MAX_HOST_NO)) {
log_error("CHAP mode requires host "
"no and valid operation");
rc = ISCSI_ERR_INVAL;
@@ -3032,7 +3044,7 @@ main(int argc, char **argv)
value);
break;
case MODE_FLASHNODE:
- if (!host_no) {
+ if (host_no > MAX_HOST_NO) {
log_error("FLASHNODE mode requires host no");
rc = ISCSI_ERR_INVAL;
break;
diff --git a/usr/types.h b/usr/types.h
index 77e3f97..9d9ba86 100644
--- a/usr/types.h
+++ b/usr/types.h
@@ -10,6 +10,7 @@
#include <netinet/in.h>
#include <stdint.h>
#include <sys/types.h>
+#include <limits.h>
/*
* using the __be types allows stricter static
--
1.8.3.1

View File

@ -1,74 +0,0 @@
From 181af9ac81bccbf8e63a755d48babb2e65de1d4e Mon Sep 17 00:00:00 2001
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Date: Tue, 9 Jul 2013 08:17:15 -0400
Subject: [PATCH] iscsi tools: Print additional session info for flashnode
session
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/session_info.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/usr/session_info.c b/usr/session_info.c
index de156c6..2f48e65 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -64,20 +64,32 @@ void session_info_free_list(struct list_head *list)
}
}
+static char *get_iscsi_node_type(struct session_info *info)
+{
+ int pid = iscsi_sysfs_session_user_created(info->sid);
+
+ if (!pid)
+ return "flash";
+ else
+ return "non-flash";
+}
+
static int session_info_print_flat(void *data, struct session_info *info)
{
struct iscsi_transport *t = iscsi_sysfs_get_transport_by_sid(info->sid);
if (strchr(info->persistent_address, '.'))
- printf("%s: [%d] %s:%d,%d %s\n",
+ printf("%s: [%d] %s:%d,%d %s (%s)\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
else
- printf("%s: [%d] [%s]:%d,%d %s\n",
+ printf("%s: [%d] [%s]:%d,%d %s (%s)\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
return 0;
}
@@ -230,7 +242,8 @@ void session_info_print_tree(struct list_head *list, char *prefix,
list_for_each_entry(curr, list, list) {
if (!prev || strcmp(prev->targetname, curr->targetname)) {
- printf("%sTarget: %s\n", prefix, curr->targetname);
+ printf("%sTarget: %s (%s)\n", prefix, curr->targetname,
+ get_iscsi_node_type(curr));
prev = NULL;
}
@@ -278,6 +291,7 @@ void session_info_print_tree(struct list_head *list, char *prefix,
printf("%s\t\tSID: %d\n", prefix, curr->sid);
print_iscsi_state(curr->sid, prefix);
}
+
if (flags & SESSION_INFO_ISCSI_TIM) {
printf("%s\t\t*********\n", prefix);
printf("%s\t\tTimeouts:\n", prefix);
--
1.8.3.1

View File

@ -1,369 +0,0 @@
From 82c853344888c2d541d6445a08ab31cbcf1c140f Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 11 Sep 2013 17:31:39 -0700
Subject: [PATCH] iscsi tools: sync iscsi_if.h with kernel space
This patches syncs iscsi_if.h with upstream commit
commit ae542edb11c79706cd74d7bd54ebd7702965a7f3
Author: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon Jul 1 05:54:11 2013 -0400
[SCSI] scsi_transport_iscsi: Exporting new attrs for iscsi session
and conne
---
include/iscsi_if.h | 204 ++++++++++++++++++-------------------------------
usr/initiator.c | 12 +--
usr/initiator.h | 1 +
usr/initiator_common.c | 38 +++++----
4 files changed, 99 insertions(+), 156 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 20f2bc2..01d38e7 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -495,47 +495,64 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+ ISCSI_PARAM_CHAP_IN_IDX,
+ ISCSI_PARAM_CHAP_OUT_IDX,
+
+ ISCSI_PARAM_BOOT_ROOT,
+ ISCSI_PARAM_BOOT_NIC,
+ ISCSI_PARAM_BOOT_TARGET,
+
+ ISCSI_PARAM_AUTO_SND_TGT_DISABLE,
+ ISCSI_PARAM_DISCOVERY_SESS,
+ ISCSI_PARAM_PORTAL_TYPE,
+ ISCSI_PARAM_CHAP_AUTH_EN,
+ ISCSI_PARAM_DISCOVERY_LOGOUT_EN,
+ ISCSI_PARAM_BIDI_CHAP_EN,
+ ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL,
+
+ ISCSI_PARAM_DEF_TIME2WAIT,
+ ISCSI_PARAM_DEF_TIME2RETAIN,
+ ISCSI_PARAM_MAX_SEGMENT_SIZE,
+ ISCSI_PARAM_STATSN,
+ ISCSI_PARAM_KEEPALIVE_TMO,
+ ISCSI_PARAM_LOCAL_PORT,
+ ISCSI_PARAM_TSID,
+ ISCSI_PARAM_DEF_TASKMGMT_TMO,
+
+ ISCSI_PARAM_TCP_TIMESTAMP_STAT,
+ ISCSI_PARAM_TCP_WSF_DISABLE,
+ ISCSI_PARAM_TCP_NAGLE_DISABLE,
+ ISCSI_PARAM_TCP_TIMER_SCALE,
+ ISCSI_PARAM_TCP_TIMESTAMP_EN,
+ ISCSI_PARAM_TCP_XMIT_WSF,
+ ISCSI_PARAM_TCP_RECV_WSF,
+ ISCSI_PARAM_IP_FRAGMENT_DISABLE,
+ ISCSI_PARAM_IPV4_TOS,
+ ISCSI_PARAM_IPV6_TC,
+ ISCSI_PARAM_IPV6_FLOW_LABEL,
+ ISCSI_PARAM_IS_FW_ASSIGNED_IPV6,
+
+ ISCSI_PARAM_DISCOVERY_PARENT_IDX,
+ ISCSI_PARAM_DISCOVERY_PARENT_TYPE,
/* must always be last */
ISCSI_PARAM_MAX,
};
-#define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH)
-#define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH)
-#define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN)
-#define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN)
-#define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN)
-#define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T)
-#define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN)
-#define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST)
-#define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST)
-#define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN)
-#define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN)
-#define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL)
-#define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN)
-#define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN)
-#define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN)
-#define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME)
-#define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT)
-#define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS)
-#define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT)
-#define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO)
-#define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT)
-#define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS)
-#define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME)
-#define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN)
-#define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD)
-#define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN)
-#define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT)
-#define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO)
-#define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO)
-#define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO)
-#define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO)
-#define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO)
-#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
-#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
-#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
-#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
-#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
+/* iSCSI HBA params */
+enum iscsi_host_param {
+ ISCSI_HOST_PARAM_HWADDRESS,
+ ISCSI_HOST_PARAM_INITIATOR_NAME,
+ ISCSI_HOST_PARAM_NETDEV_NAME,
+ ISCSI_HOST_PARAM_IPADDRESS,
+ ISCSI_HOST_PARAM_PORT_STATE,
+ ISCSI_HOST_PARAM_PORT_SPEED,
+ ISCSI_HOST_PARAM_MAX,
+};
+
+/* portal type */
+#define PORTAL_TYPE_IPV4 "ipv4"
+#define PORTAL_TYPE_IPV6 "ipv6"
/* iSCSI Flash Target params */
enum iscsi_flashnode_param {
@@ -603,106 +620,32 @@ enum iscsi_flashnode_param {
ISCSI_FLASHNODE_MAX,
};
-#define ISCSI_FNODE_IS_FW_ASSIGNED_IPV6 \
- (1ULL << ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6)
-#define ISCSI_FNODE_PORTAL_TYPE (1ULL << ISCSI_FLASHNODE_PORTAL_TYPE)
-#define ISCSI_FNODE_AUTO_SND_TGT_DISABLE \
- (1ULL << ISCSI_FLASHNODE_OPT_AUTO_SND_TGT_DISABLE)
-#define ISCSI_FNODE_DISCOVERY_SESS \
- (1ULL << ISCSI_FLASHNODE_OPT_DISCOVERY_SESS)
-#define ISCSI_FNODE_ENTRY_EN (1ULL << ISCSI_FLASHNODE_ENTRY_EN)
-#define ISCSI_FNODE_HDR_DGST_EN (1ULL << ISCSI_FLASHNODE_HDR_DGST_EN)
-#define ISCSI_FNODE_DATA_DGST_EN (1ULL << ISCSI_FLASHNODE_DATA_DGST_EN)
-#define ISCSI_FNODE_IMM_DATA_EN (1ULL << ISCSI_FLASHNODE_IMM_DATA_EN)
-#define ISCSI_FNODE_INITIAL_R2T_EN (1ULL << ISCSI_FLASHNODE_INITIAL_R2T_EN)
-#define ISCSI_FNODE_DATASEQ_INORDER \
- (1ULL << ISCSI_FLASHNODE_DATASEQ_INORDER)
-#define ISCSI_FNODE_PDU_INORDER (1ULL << ISCSI_FLASHNODE_PDU_INORDER)
-#define ISCSI_FNODE_CHAP_AUTH_EN (1ULL << ISCSI_FLASHNODE_CHAP_AUTH_EN)
-#define ISCSI_FNODE_SNACK_REQ_EN (1ULL << ISCSI_FLASHNODE_SNACK_REQ_EN)
-#define ISCSI_FNODE_DISCOVERY_LOGOUT_EN \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN)
-#define ISCSI_FNODE_BIDI_CHAP_EN (1ULL << ISCSI_FLASHNODE_BIDI_CHAP_EN)
-#define ISCSI_FNODE_DISCOVERY_AUTH_OPTIONAL \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL)
-#define ISCSI_FNODE_ERL (1ULL << ISCSI_FLASHNODE_ERL)
-#define ISCSI_FNODE_TCP_TIMESTAMP_STAT \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT)
-#define ISCSI_FNODE_TCP_NAGLE_DISABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_NAGLE_DISABLE)
-#define ISCSI_FNODE_TCP_WSF_DISABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_WSF_DISABLE)
-#define ISCSI_FNODE_TCP_TIMER_SCALE \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMER_SCALE)
-#define ISCSI_FNODE_TCP_TIMESTAMP_ENABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMESTAMP_ENABLE)
-#define ISCSI_FNODE_IP_FRAG_DISABLE \
- (1ULL << ISCSI_FLASHNODE_IP_FRAG_DISABLE)
-#define ISCSI_FNODE_MAX_RECV_DLENGTH \
- (1ULL << ISCSI_FLASHNODE_MAX_RECV_DLENGTH)
-#define ISCSI_FNODE_MAX_XMIT_DLENGTH \
- (1ULL << ISCSI_FLASHNODE_MAX_XMIT_DLENGTH)
-#define ISCSI_FNODE_FIRST_BURST (1ULL << ISCSI_FLASHNODE_FIRST_BURST)
-#define ISCSI_FNODE_DEF_TIME2WAIT (1ULL << ISCSI_FLASHNODE_DEF_TIME2WAIT)
-#define ISCSI_FNODE_DEF_TIME2RETAIN \
- (1ULL << ISCSI_FLASHNODE_DEF_TIME2RETAIN)
-#define ISCSI_FNODE_MAX_R2T (1ULL << ISCSI_FLASHNODE_MAX_R2T)
-#define ISCSI_FNODE_KEEPALIVE_TMO (1ULL << ISCSI_FLASHNODE_KEEPALIVE_TMO)
-#define ISCSI_FNODE_ISID (1ULL << ISCSI_FLASHNODE_ISID)
-#define ISCSI_FNODE_TSID (1ULL << ISCSI_FLASHNODE_TSID)
-#define ISCSI_FNODE_PORT (1ULL << ISCSI_FLASHNODE_PORT)
-#define ISCSI_FNODE_MAX_BURST (1ULL << ISCSI_FLASHNODE_MAX_BURST)
-#define ISCSI_FNODE_DEF_TMF_TMO (1ULL << ISCSI_FLASHNODE_DEF_TMF_TMO)
-#define ISCSI_FNODE_IPADDR (1ULL << ISCSI_FLASHNODE_IPADDR)
-#define ISCSI_FNODE_ALIAS (1ULL << ISCSI_FLASHNODE_ALIAS)
-#define ISCSI_FNODE_REDIRECT_IPADDR \
- (1ULL << ISCSI_FLASHNODE_REDIRECT_IPADDR)
-#define ISCSI_FNODE_MAX_SEGMENT_SIZE \
- (1ULL << ISCSI_FLASHNODE_MAX_SEGMENT_SIZE)
-#define ISCSI_FNODE_LOCAL_PORT (1ULL << ISCSI_FLASHNODE_LOCAL_PORT)
-#define ISCSI_FNODE_IPV4_TOS (1ULL << ISCSI_FLASHNODE_IPV4_TOS)
-#define ISCSI_FNODE_IPV6_TC (1ULL << ISCSI_FLASHNODE_IPV6_TC)
-#define ISCSI_FNODE_IPV6_FLOW_LABEL \
- (1ULL << ISCSI_FLASHNODE_IPV6_FLOW_LABEL)
-#define ISCSI_FNODE_NAME (1ULL << ISCSI_FLASHNODE_NAME)
-#define ISCSI_FNODE_TPGT (1ULL << ISCSI_FLASHNODE_TPGT)
-#define ISCSI_FNODE_LINK_LOCAL_IPV6 \
- (1ULL << ISCSI_FLASHNODE_LINK_LOCAL_IPV6)
-#define ISCSI_FNODE_DISCOVERY_PARENT_IDX \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX)
-#define ISCSI_FNODE_DISCOVERY_PARENT_TYPE \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE)
-#define ISCSI_FNODE_TCP_XMIT_WSF (1ULL << ISCSI_FLASHNODE_TCP_XMIT_WSF)
-#define ISCSI_FNODE_TCP_RECV_WSF (1ULL << ISCSI_FLASHNODE_TCP_RECV_WSF)
-#define ISCSI_FNODE_CHAP_IN_IDX (1ULL << ISCSI_FLASHNODE_CHAP_IN_IDX)
-#define ISCSI_FNODE_CHAP_OUT_IDX (1ULL << ISCSI_FLASHNODE_CHAP_OUT_IDX)
-#define ISCSI_FNODE_USERNAME (1ULL << ISCSI_FLASHNODE_USERNAME)
-#define ISCSI_FNODE_USERNAME_IN (1ULL << ISCSI_FLASHNODE_USERNAME_IN)
-#define ISCSI_FNODE_PASSWORD (1ULL << ISCSI_FLASHNODE_PASSWORD)
-#define ISCSI_FNODE_PASSWORD_IN (1ULL << ISCSI_FLASHNODE_PASSWORD_IN)
-#define ISCSI_FNODE_STATSN (1ULL << ISCSI_FLASHNODE_STATSN)
-#define ISCSI_FNODE_EXP_STATSN (1ULL << ISCSI_FLASHNODE_EXP_STATSN)
-#define ISCSI_FNODE_IS_BOOT_TGT (1ULL << ISCSI_FLASHNODE_IS_BOOT_TGT)
-
struct iscsi_flashnode_param_info {
uint32_t len; /* Actual length of the param */
uint16_t param; /* iscsi param value */
uint8_t value[0]; /* length sized value follows */
} __attribute__((__packed__));
-/* iSCSI HBA params */
-enum iscsi_host_param {
- ISCSI_HOST_PARAM_HWADDRESS,
- ISCSI_HOST_PARAM_INITIATOR_NAME,
- ISCSI_HOST_PARAM_NETDEV_NAME,
- ISCSI_HOST_PARAM_IPADDRESS,
- ISCSI_HOST_PARAM_MAX,
+enum iscsi_discovery_parent_type {
+ ISCSI_DISC_PARENT_UNKNOWN = 0x1,
+ ISCSI_DISC_PARENT_SENDTGT = 0x2,
+ ISCSI_DISC_PARENT_ISNS = 0x3,
};
-#define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS)
-#define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME)
-#define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME)
-#define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS)
+/* iSCSI port Speed */
+enum iscsi_port_speed {
+ ISCSI_PORT_SPEED_UNKNOWN = 0x1,
+ ISCSI_PORT_SPEED_10MBPS = 0x2,
+ ISCSI_PORT_SPEED_100MBPS = 0x4,
+ ISCSI_PORT_SPEED_1GBPS = 0x8,
+ ISCSI_PORT_SPEED_10GBPS = 0x10,
+};
+
+/* iSCSI port state */
+enum iscsi_port_state {
+ ISCSI_PORT_STATE_DOWN = 0x1,
+ ISCSI_PORT_STATE_UP = 0x2,
+};
/* iSCSI PING status/error code */
enum iscsi_ping_status_code {
@@ -739,7 +682,7 @@ enum iscsi_ping_status_code {
#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
and verification */
-#define CAP_LOGIN_OFFLOAD 0x4000 /* offload normal session login */
+#define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */
/*
* These flags describes reason of stop_conn() call
@@ -807,7 +750,6 @@ enum chap_type_e {
#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
-
struct iscsi_chap_rec {
uint16_t chap_tbl_idx;
enum chap_type_e chap_type;
diff --git a/usr/initiator.c b/usr/initiator.c
index a3b24b7..79d1779 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -384,17 +384,7 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t)
/* setup authentication variables for the session*/
iscsi_setup_authentication(session, &rec->session.auth);
- session->param_mask = ~0ULL;
- if (!(t->caps & CAP_MULTI_R2T))
- session->param_mask &= ~ISCSI_MAX_R2T;
- if (!(t->caps & CAP_HDRDGST))
- session->param_mask &= ~ISCSI_HDRDGST_EN;
- if (!(t->caps & CAP_DATADGST))
- session->param_mask &= ~ISCSI_DATADGST_EN;
- if (!(t->caps & CAP_MARKERS)) {
- session->param_mask &= ~ISCSI_IFMARKER_EN;
- session->param_mask &= ~ISCSI_OFMARKER_EN;
- }
+ iscsi_session_init_params(session);
hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, &rc);
if (!rc) {
diff --git a/usr/initiator.h b/usr/initiator.h
index d6dc02e..680640c 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -357,5 +357,6 @@ extern int iscsi_setup_portal(struct iscsi_conn *conn, char *address, int port);
extern int iscsi_set_net_config(struct iscsi_transport *t,
iscsi_session_t *session,
struct iface_rec *iface);
+extern void iscsi_session_init_params(struct iscsi_session *session);
#endif /* INITIATOR_H */
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index eb72795..0fb7edc 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,12 +324,32 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
}
+static inline void iscsi_session_clear_param(struct iscsi_session *session,
+ int param)
+{
+ session->param_mask &= ~(1ULL << param);
+}
+
+void iscsi_session_init_params(struct iscsi_session *session)
+{
+ session->param_mask = ~0ULL;
+ if (!(session->t->caps & CAP_MULTI_R2T))
+ iscsi_session_clear_param(session, ISCSI_PARAM_MAX_R2T);
+ if (!(session->t->caps & CAP_HDRDGST))
+ iscsi_session_clear_param(session, ISCSI_PARAM_HDRDGST_EN);
+ if (!(session->t->caps & CAP_DATADGST))
+ iscsi_session_clear_param(session, ISCSI_PARAM_DATADGST_EN);
+ if (!(session->t->caps & CAP_MARKERS)) {
+ iscsi_session_clear_param(session, ISCSI_PARAM_IFMARKER_EN);
+ iscsi_session_clear_param(session, ISCSI_PARAM_OFMARKER_EN);
+ }
+}
+
#define MAX_SESSION_PARAMS 32
int iscsi_session_set_params(struct iscsi_conn *conn)
{
struct iscsi_session *session = conn->session;
- struct iscsi_transport *t = session->t;
int i, rc;
uint32_t one = 1, zero = 0;
struct connparam {
@@ -499,22 +519,12 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
},
};
- session->param_mask = ~0ULL;
- if (!(t->caps & CAP_MULTI_R2T))
- session->param_mask &= ~ISCSI_MAX_R2T;
- if (!(t->caps & CAP_HDRDGST))
- session->param_mask &= ~ISCSI_HDRDGST_EN;
- if (!(t->caps & CAP_DATADGST))
- session->param_mask &= ~ISCSI_DATADGST_EN;
- if (!(t->caps & CAP_MARKERS)) {
- session->param_mask &= ~ISCSI_IFMARKER_EN;
- session->param_mask &= ~ISCSI_OFMARKER_EN;
- }
+ iscsi_session_init_params(session);
/* some llds will send nops internally */
if (!iscsi_sysfs_session_supports_nop(session->id)) {
- session->param_mask &= ~ISCSI_PING_TMO;
- session->param_mask &= ~ISCSI_RECV_TMO;
+ iscsi_session_clear_param(session, ISCSI_PARAM_PING_TMO);
+ iscsi_session_clear_param(session, ISCSI_PARAM_RECV_TMO);
}
/* Entered full-feature phase! */
--
1.8.3.1

View File

@ -1,152 +0,0 @@
From 5992173f13550d75659fec1d7e1f6e87895d560a Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 11 Sep 2013 23:59:31 -0700
Subject: [PATCH] [PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the
session
Patch and description from Eddie Wai:
Three new session sysfs parameters are introduced:
boot_root - holds the ibft boot root folder name
boot_nic - holds the ibft boot ethernetN name
boot_target - holds the ibft boot targetN name
This patch copies over the /sys/firmware/<boot_root>/ethernetN/targetN
info
from the boot context to the node_rec.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
include/fw_context.h | 3 +++
include/iscsi_proto.h | 1 +
usr/config.h | 3 +++
usr/idbm.c | 6 ++++++
usr/initiator_common.c | 14 +++++++++++++-
utils/fwparam_ibft/fwparam_sysfs.c | 8 ++++++++
6 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -30,6 +30,9 @@
struct boot_context {
struct list_head list;
+ char boot_root[BOOT_NAME_MAXLEN];
+ char boot_nic[BOOT_NAME_MAXLEN];
+ char boot_target[BOOT_NAME_MAXLEN];
/* target settings */
int target_port;
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
+++ b/include/iscsi_proto.h
@@ -619,6 +619,7 @@ struct iscsi_reject {
#define KEY_MAXLEN 64
#define VALUE_MAXLEN 255
#define TARGET_NAME_MAXLEN VALUE_MAXLEN
+#define BOOT_NAME_MAXLEN 256
#define ISCSI_DEF_MAX_RECV_SEG_LEN 8192
#define ISCSI_MIN_MAX_RECV_SEG_LEN 512
diff --git a/usr/config.h b/usr/config.h
index 998caff..d457bdd 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -201,6 +201,9 @@ typedef struct session_rec {
* allowed to be initiated on this record
*/
unsigned char multiple;
+ char boot_root[BOOT_NAME_MAXLEN];
+ char boot_nic[BOOT_NAME_MAXLEN];
+ char boot_target[BOOT_NAME_MAXLEN];
} session_rec_t;
#define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index bc06058..1e4f8c8 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2748,6 +2748,12 @@ struct node_rec *idbm_create_rec_from_boot_context(struct boot_context *context)
strlen((char *)context->chap_password);
rec->session.auth.password_in_length =
strlen((char *)context->chap_password_in);
+ strlcpy(rec->session.boot_root, context->boot_root,
+ sizeof(context->boot_root));
+ strlcpy(rec->session.boot_nic, context->boot_nic,
+ sizeof(context->boot_nic));
+ strlcpy(rec->session.boot_target, context->boot_target,
+ sizeof(context->boot_target));
iface_setup_from_boot_context(&rec->iface, context);
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 0fb7edc..e2e87a1 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -345,7 +345,7 @@ void iscsi_session_init_params(struct iscsi_session *session)
}
}
-#define MAX_SESSION_PARAMS 32
+#define MAX_SESSION_PARAMS 35
int iscsi_session_set_params(struct iscsi_conn *conn)
{
@@ -516,6 +516,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session->initiator_name,
.type = ISCSI_STRING,
+ }, {
+ .param = ISCSI_PARAM_BOOT_ROOT,
+ .value = session->nrec.session.boot_root,
+ .type = ISCSI_STRING,
+ }, {
+ .param = ISCSI_PARAM_BOOT_NIC,
+ .value = session->nrec.session.boot_nic,
+ .type = ISCSI_STRING,
+ }, {
+ .param = ISCSI_PARAM_BOOT_TARGET,
+ .value = session->nrec.session.boot_target,
+ .type = ISCSI_STRING,
},
};
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
index 3997363..2f37b59 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id,
strlcpy(context->scsi_host_name, subsys,
sizeof(context->scsi_host_name));
+ memset(&context->boot_nic, 0, sizeof(context->boot_nic));
+ snprintf(context->boot_nic, sizeof(context->boot_nic), "%s", id);
+
sysfs_get_str(id, subsys, "ip-addr", context->ipaddr,
sizeof(context->ipaddr));
sysfs_get_str(id, subsys, "vlan", context->vlan,
@@ -224,6 +227,8 @@ static void fill_initiator_context(char *subsys, struct boot_context *context)
sizeof(context->initiatorname));
sysfs_get_str("initiator", subsys, "isid", context->isid,
sizeof(context->isid));
+
+ strlcpy(context->boot_root, subsys, sizeof(context->boot_root));
}
static int fill_tgt_context(char *subsys, char *id,
struct boot_context *context)
@@ -240,6 +245,9 @@ static int fill_tgt_context(char *subsys, char *id,
if (rc)
return rc;
+ memset(&context->boot_target, 0, sizeof(context->boot_target));
+ snprintf(context->boot_target, sizeof(context->boot_target), "%s", id);
+
/*
* We can live without the rest of they do not exist. If we
* failed to get them we will figure it out when we login.
--
1.8.3.1

View File

@ -1,104 +0,0 @@
From 487c312c96379e45648c782cee5b0d469cba80d0 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 23 Aug 2013 14:04:11 -0700
Subject: [PATCH] ISCSID: Added the extraction of the session boot info
This patch does the work to extract the corresponding
<boot_root>->ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.
This is only populated for iscsi_tcp and bnx2i.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
usr/iscsi_sysfs.c | 40 ++++++++++++++++++++++++++++++++++++++++
usr/transport.c | 1 +
usr/transport.h | 1 +
3 files changed, 42 insertions(+)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index aed10a3..56cb90c 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -674,6 +674,43 @@ free_fnode:
return rc;
}
+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
+{
+ char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
+ char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
+
+ /* Extract boot info */
+ strlcpy(boot_name, "boot_target", sizeof(boot_name));
+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
+ boot_content, BOOT_NAME_MAXLEN))
+ return -1;
+ strlcpy(boot_name, "boot_nic", sizeof(boot_name));
+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
+ BOOT_NAME_MAXLEN))
+ return -1;
+ strlcpy(boot_name, "boot_root", sizeof(boot_name));
+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
+ BOOT_NAME_MAXLEN))
+ return -1;
+
+ /* If all boot_root/boot_target/boot_nic exist, then extract the
+ info from the boot nic */
+ if (sysfs_get_str(boot_nic, boot_root, "vlan", boot_content,
+ BOOT_NAME_MAXLEN))
+ log_debug(5, "could not read %s/%s/vlan", boot_root, boot_nic);
+ else
+ iface->vlan_id = atoi(boot_content);
+
+ if (sysfs_get_str(boot_nic, boot_root, "subnet-mask",
+ iface->subnet_mask, NI_MAXHOST))
+ log_debug(5, "could not read %s/%s/subnet", boot_root,
+ boot_nic);
+
+ log_debug(5, "sysfs read boot returns %s/%s/ vlan = %d subnet = %s",
+ boot_root, boot_nic, iface->vlan_id, iface->subnet_mask);
+ return 0;
+}
+
/*
* Read in iface settings based on host and session values. If
* session is not passed in, then the ifacename will not be set. And
@@ -802,6 +839,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no,
}
}
+ if (session && t->template->use_boot_info)
+ iscsi_sysfs_read_boot(iface, session);
+
if (!iface_kern_id)
goto done;
diff --git a/usr/transport.c b/usr/transport.c
index 52b7674..2f38519 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -77,6 +77,7 @@ struct iscsi_transport_template cxgb4i = {
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.set_host_ip = 1,
+ .use_boot_info = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 5dcf872..388e4b1 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -31,6 +31,7 @@ struct iscsi_transport_template {
* the host's ip address.
*/
uint8_t set_host_ip;
+ uint8_t use_boot_info;
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
--
1.8.3.1

View File

@ -1,57 +0,0 @@
From 3b4b45001b6d8412aad76a55347de42d30d694f7 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 23 Aug 2013 14:04:12 -0700
Subject: [PATCH] ISCSID: Added iface content override fix
Patch provided by Mike Christie.
This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
usr/iscsid.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 8f19220..d1756ef 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct session_info *info)
strlcpy(rec->name, info->targetname, TARGET_NAME_MAXLEN);
rec->conn[0].port = info->persistent_port;
strlcpy(rec->conn[0].address, info->persistent_address, NI_MAXHOST);
- memcpy(&rec->iface, &info->iface, sizeof(struct iface_rec));
rec->tpgt = info->tpgt;
- iface_copy(&rec->iface, &info->iface);
iscsi_sysfs_get_negotiated_session_conf(info->sid, &session_conf);
iscsi_sysfs_get_negotiated_conn_conf(info->sid, &conn_conf);
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info *info)
log_warning("Could not read data from db. Using default and "
"currently negotiated values\n");
setup_rec_from_negotiated_values(&rec, info);
+ iface_copy(&rec.iface, &info->iface);
} else {
/*
* we have a valid record and iface so lets merge
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info *info)
memset(&sysfsrec, 0, sizeof(node_rec_t));
setup_rec_from_negotiated_values(&sysfsrec, info);
/*
- * target, portal and iface name values have to be the same
+ * target, portal and iface values have to be the same
* or we would not have found the record, so just copy
- * CHAP and iface settings.
+ * CHAP settings.
*/
memcpy(&rec.session.auth, &sysfsrec.session.auth,
sizeof(struct iscsi_auth_config));
- memcpy(&rec.iface, &info->iface, sizeof(rec.iface));
}
/* multiple drivers could be connected to the same portal */
--
1.8.3.1

View File

@ -1,103 +0,0 @@
From 1fa1b51356c0ea6e1d30f2d370b3b766d4230537 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Thu, 5 Dec 2013 18:12:32 -0600
Subject: [PATCH] iscsi tools: Bug fix on IPC address copy (version 2)
This patch merges Yufei Ren <yufei.ren@stonybrook.edu> patch
with comments from the list plus what I think is a bug in the
addr_len usage.
For the addr_len use, it looks like we were using that as the
arg to memcpy, but that value included the length of the pathname
string and also the offset of sun_path in the sockaddr_un and so
that is too long.
---
usr/iscsi_util.c | 12 ++++++++++++
usr/iscsi_util.h | 3 +++
usr/iscsid_req.c | 7 +------
usr/mgmt_ipc.c | 6 +-----
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
index ac86847..9dbfbfd 100644
--- a/usr/iscsi_util.c
+++ b/usr/iscsi_util.c
@@ -25,16 +25,28 @@
#include <string.h>
#include <errno.h>
#include <ctype.h>
+#include <sys/socket.h>
+#include <sys/un.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/resource.h>
+#include "sysdeps.h"
#include "log.h"
#include "iscsi_settings.h"
#include "iface.h"
#include "session_info.h"
#include "iscsi_util.h"
+int setup_abstract_addr(struct sockaddr_un *addr, char *unix_sock_name)
+{
+ memset(addr, 0, sizeof(*addr));
+ addr->sun_family = AF_LOCAL;
+ strlcpy(addr->sun_path + 1, unix_sock_name, sizeof(addr->sun_path) - 1);
+ return offsetof(struct sockaddr_un, sun_path) +
+ strlen(addr->sun_path + 1) + 1;
+}
+
void daemon_init(void)
{
int fd;
diff --git a/usr/iscsi_util.h b/usr/iscsi_util.h
index 110dfa8..ff725eb 100644
--- a/usr/iscsi_util.h
+++ b/usr/iscsi_util.h
@@ -26,4 +26,7 @@ extern int __iscsi_match_session(struct node_rec *rec, char *targetname,
extern char *strstrip(char *s);
extern char *cfg_get_string_param(char *pathname, const char *key);
+struct sockaddr_un;
+extern int setup_abstract_addr(struct sockaddr_un *addr, char *unix_sock_name);
+
#endif
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 715c0aa..0e91dee 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -67,12 +67,7 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
return ISCSI_ERR_ISCSID_NOTCONN;
}
- addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(unix_sock_name) + 1;
-
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_LOCAL;
- memcpy((char *) &addr.sun_path + 1, unix_sock_name,
- strlen(unix_sock_name));
+ addr_len = setup_abstract_addr(&addr, unix_sock_name);
/*
* Trying to connect with exponential backoff
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index 87bd346..a82c063 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -59,11 +59,7 @@ mgmt_ipc_listen(void)
return fd;
}
- addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
-
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_LOCAL;
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
+ addr_len = setup_abstract_addr(&addr, ISCSIADM_NAMESPACE);
if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) {
log_error("Can not bind IPC socket");
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 360a40f8a83e08a09b34cb12e269c793028b315e Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:28 -0400
Subject: [PATCH] flashnode: Add support to set ISCSI_FLASHNODE_CHAP_OUT_IDX
param
Add support to set the chap_out_idx session param of flashnode
entry.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/flashnode.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/usr/flashnode.c b/usr/flashnode.c
index da1392a..fe5ab57 100644
--- a/usr/flashnode.c
+++ b/usr/flashnode.c
@@ -449,6 +449,12 @@ int flashnode_build_config(struct list_head *params,
fnode->sess.portal_type,
sizeof(fnode->sess.portal_type)))
count++;
+ } else if (!strcmp(param->name,
+ to_key(FLASHNODE_SESS_CHAP_OUT_IDX))) {
+ if (!flashnode_fill_uint32(fnode, &iov[count],
+ ISCSI_FLASHNODE_CHAP_OUT_IDX,
+ fnode->sess.chap_out_idx))
+ count++;
} else if (!strcmp(param->name, to_key(FLASHNODE_CONN_PORT))) {
if (fnode->conn[0].port)
port = fnode->conn[0].port;
--
1.8.3.1

View File

@ -1,146 +0,0 @@
From b3913c5943b6e908a1bb8ce83a2e79200d0ceed9 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:29 -0400
Subject: [PATCH] iscsiadm: Use '-x' option instead of '-v' to specify
chap_tbl_idx
Make appropriate changes to use -x option for chap_tbl_idx cmdline
param. This is done because -v option is used along with -n option
to get the name/value pair.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/host.h | 1 +
usr/iscsiadm.c | 36 +++++++++++++++++-------------------
2 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/usr/host.h b/usr/host.h
index db44cfa..52e5b9e 100644
--- a/usr/host.h
+++ b/usr/host.h
@@ -7,6 +7,7 @@
#define MAX_HOST_NO UINT_MAX
+#define MAX_CHAP_ENTRIES 2048
#define MAX_CHAP_BUF_SZ 4096
#define REQ_CHAP_BUF_SZ (MAX_CHAP_BUF_SZ + sizeof(struct iscsi_uevent))
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index c7337ae..beabdf0 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -115,7 +115,7 @@ static struct option const long_options[] =
{"packetsize", required_argument, NULL, 'b'},
{"count", required_argument, NULL, 'c'},
{"interval", required_argument, NULL, 'i'},
- {"flashnode_idx", optional_argument, NULL, 'x'},
+ {"index", optional_argument, NULL, 'x'},
{"portal_type", optional_argument, NULL, 'A'},
{NULL, 0, NULL, 0},
};
@@ -136,7 +136,7 @@ iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,au
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\
iscsiadm -m fw [ -d debug_level ] [ -l ]\n\
-iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ] | [ -C flashnode [ -o operation ] [ -A portal_type ] [ -x flashnode_idx ] [ -n name ] [ -v value ] ] ]\n\
+iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
iscsiadm -k priority\n");
}
exit(status);
@@ -1426,18 +1426,10 @@ exit_chap_info:
return rc;
}
-static int delete_host_chap_info(uint32_t host_no, char *value)
+static int delete_host_chap_info(uint32_t host_no, uint16_t chap_tbl_idx)
{
struct iscsi_transport *t = NULL;
int fd, rc = 0;
- uint16_t chap_tbl_idx;
-
- if (!value) {
- log_error("CHAP deletion requires --value=table_index.");
- return ISCSI_ERR_INVAL;
- }
-
- chap_tbl_idx = (uint16_t)atoi(value);
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t) {
@@ -1472,22 +1464,28 @@ exit_delete_chap:
}
static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
- char *value)
+ uint64_t chap_index)
{
int rc = ISCSI_ERR_INVAL;
+ if (op != OP_SHOW && (chap_index > (uint64_t)MAX_CHAP_ENTRIES)) {
+ log_error("Invalid chap table index.");
+ goto exit_chap_op;
+ }
+
switch (op) {
case OP_SHOW:
rc = get_host_chap_info(host_no);
break;
case OP_DELETE:
- rc = delete_host_chap_info(host_no, value);
+ rc = delete_host_chap_info(host_no, chap_index);
break;
default:
log_error("Invalid operation.");
break;
}
+exit_chap_op:
return rc;
}
@@ -2818,7 +2816,7 @@ main(int argc, char **argv)
struct iface_rec *iface = NULL, *tmp;
struct node_rec *rec = NULL;
uint64_t host_no = (uint64_t)MAX_HOST_NO + 1;
- uint64_t flashnode_idx = (uint64_t)MAX_FLASHNODE_IDX + 1;
+ uint64_t index = (uint64_t)MAX_FLASHNODE_IDX + 1;
struct user_param *param;
struct list_head params;
@@ -2962,9 +2960,9 @@ main(int argc, char **argv)
ISCSI_VERSION_STR);
return 0;
case 'x':
- flashnode_idx = strtoull(optarg, NULL, 10);
+ index = strtoull(optarg, NULL, 10);
if (errno) {
- log_error("Invalid flashnode index %s. %s.",
+ log_error("Invalid index %s. %s.",
optarg, strerror(errno));
rc = ISCSI_ERR_INVAL;
goto free_ifaces;
@@ -3041,7 +3039,7 @@ main(int argc, char **argv)
break;
}
rc = exec_host_chap_op(op, info_level, host_no,
- value);
+ index);
break;
case MODE_FLASHNODE:
if (host_no > MAX_HOST_NO) {
@@ -3051,8 +3049,8 @@ main(int argc, char **argv)
}
rc = exec_flashnode_op(op, info_level, host_no,
- flashnode_idx,
- portal_type, &params);
+ index, portal_type,
+ &params);
break;
default:
log_error("Invalid Sub Mode");
--
1.8.3.1

View File

@ -1,53 +0,0 @@
From 0c4022d865d81a0fb2fc6dcba8df72a6da753cfe Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:30 -0400
Subject: [PATCH] iscsiadm: Man page changes to use -x option for chap_tbl_idx
Changes in iscsiadm man page to use -x option instead of -v option
for chap_tbl_idx cmdline param.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index 6b15fcd..0e8149c 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -16,7 +16,7 @@ iscsiadm \- open-iscsi administration utility
\fBiscsiadm\fR \-m fw [ \-d debug_level ] [\-l]
-\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] ]
+\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
\fBiscsiadm\fR \-k priority
@@ -74,7 +74,7 @@ iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i inter
For host, it supports chap and flashnode as submodes. For example,
-iscsiadm -m host -H hostno -C chap -v chap_tbl_idx -o operation
+iscsiadm -m host -H hostno -C chap -x chap_tbl_idx -o operation
iscsiadm -m host -H hostno -C flashnode -x flashnode_idx -o operation
@@ -320,10 +320,10 @@ This option is only valid for node mode and flashnode submode of host mode.
display version and exit
.TP
-\fB\-x\fR, \fB\-\-flashnode_idx=\fIindex\fR
-Specify the \fIindex\fR of the flash node to operate on.
+\fB\-x\fR, \fB\-\-index=\fIindex\fR
+Specify the \fIindex\fR of the entity to operate on.
.IP
-This option is only valid for flashnode submode of host mode.
+This option is only valid for chap and flashnode submodes of host mode.
.SH DISCOVERY TYPES
iSCSI defines 3 discovery types: SendTargets, SLP, and iSNS.
--
1.8.3.1

View File

@ -1,47 +0,0 @@
From 38b2993786c26a2c7bb79a42fc8c644720b4507c Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:31 -0400
Subject: [PATCH] README changes to use long option --index instead of
--flashnode_idx
This change supports use of -x option instead of -v option for
chap_tbl_idx cmdline param.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
README | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README b/README
index 29b00a9..dda16c9 100644
--- a/README
+++ b/README
@@ -393,7 +393,7 @@ Usage: iscsiadm [OPTION]
See below for examples.
-m iface --interface=iscsi_ifacename -C ping --ip=[ipaddr] --packetsize=[size]
--count=[count] --interval=[interval]
- -m host --host=hostno|MAC --print=level -C chap --op=[op] --value=[chap_tbl_idx]
+ -m host --host=hostno|MAC --print=level -C chap --op=[op] --index=[chap_tbl_idx]
Display information for a specific host. The host
can be passed in by host number or by MAC address.
If a host is not passed in then info
@@ -414,13 +414,13 @@ Usage: iscsiadm [OPTION]
Create new flash node entry for the given host of the
specified portal_type. This returns the index of the
newly created entry on success.
- -m host --host=hostno|MAC -C flashnode --flashnode_idx=[flashnode index] \
+ -m host --host=hostno|MAC -C flashnode --index=[flashnode index] \
--op=[UPDATE] --name=[name] --value=[value]
Update the params of the speficied flash node.
The [name] and [value] pairs must be provided for the
params that need to be updated. Multiple params can
be updated using a single command.
- -m host --host=hostno|MAC -C flashnode--flashnode_idx=[flashnode index] \
+ -m host --host=hostno|MAC -C flashnode --index=[flashnode index] \
--op=[SHOW | DELETE | LOGIN | LOGOUT]
op=DELETE|LOGIN|LOGOUT will perform deletion/login/
logout operation on the specified flash node.
--
1.8.3.1

View File

@ -1,590 +0,0 @@
From 062718a9579a10ea7c87e46162f80e3f57e80b67 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:32 -0400
Subject: [PATCH] iscsiadm: Add support to set CHAP entry using host chap mode
Provide support to add and update CHAP entry using chap submode of
iscsiadm host mode.
Both, new and update, iscsiadm operations perform the same function.
Currently only one entry can be added or updated at a time.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
include/iscsi_if.h | 19 ++++-
usr/host.c | 110 ++++++++++++++++++++++++++++
usr/host.h | 1 +
usr/idbm.c | 8 ++-
usr/idbm.h | 1 +
usr/iscsi_ipc.h | 3 +
usr/iscsiadm.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++---
usr/netlink.c | 25 +++++++
8 files changed, 360 insertions(+), 14 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 01d38e7..0284662 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -74,8 +74,9 @@ enum iscsi_uevent_e {
ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28,
ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
+ ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31,
- ISCSI_UEVENT_MAX = ISCSI_UEVENT_LOGOUT_FLASHNODE_SID,
+ ISCSI_UEVENT_MAX = ISCSI_UEVENT_SET_CHAP,
/* up events */
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -318,8 +319,16 @@ enum iscsi_param_type {
ISCSI_HOST_PARAM, /* iscsi_host_param */
ISCSI_NET_PARAM, /* iscsi_net_param */
ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
+ ISCSI_CHAP_PARAM, /* iscsi_chap_param */
};
+/* structure for minimalist usecase */
+struct iscsi_param_info {
+ uint32_t len; /* Actual length of the param value */
+ uint16_t param; /* iscsi param */
+ uint8_t value[0]; /* length sized value follows */
+} __attribute__((__packed__));
+
struct iscsi_iface_param_info {
uint32_t iface_num; /* iface number, 0 - n */
uint32_t len; /* Actual length of the param */
@@ -748,6 +757,14 @@ enum chap_type_e {
CHAP_TYPE_IN,
};
+enum iscsi_chap_param {
+ ISCSI_CHAP_PARAM_INDEX,
+ ISCSI_CHAP_PARAM_CHAP_TYPE,
+ ISCSI_CHAP_PARAM_USERNAME,
+ ISCSI_CHAP_PARAM_PASSWORD,
+ ISCSI_CHAP_PARAM_PASSWORD_LEN
+};
+
#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
struct iscsi_chap_rec {
diff --git a/usr/host.c b/usr/host.c
index 1fcb350..f2052d3 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -34,6 +34,7 @@
#include "initiator.h"
#include "iface.h"
#include "iscsi_err.h"
+#include "iscsi_netlink.h"
static int match_host_to_session(void *data, struct session_info *info)
{
@@ -314,3 +315,112 @@ int host_info_print(int info_level, uint32_t host_no)
}
return 0;
}
+
+static int chap_fill_param_uint(struct iovec *iov, int param,
+ uint32_t param_val, int param_len)
+{
+ struct iscsi_param_info *param_info;
+ struct nlattr *attr;
+ int len;
+ uint8_t val8 = 0;
+ uint16_t val16 = 0;
+ uint32_t val32 = 0;
+ char *val = NULL;
+
+ len = sizeof(struct iscsi_param_info) + param_len;
+ iov->iov_base = iscsi_nla_alloc(param, len);
+ if (!iov->iov_base)
+ return 1;
+
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+
+ param_info = (struct iscsi_param_info *)ISCSI_NLA_DATA(attr);
+ param_info->param = param;
+ param_info->len = param_len;
+
+ switch (param_len) {
+ case 1:
+ val8 = (uint8_t)param_val;
+ val = (char *)&val8;
+ break;
+
+ case 2:
+ val16 = (uint16_t)param_val;
+ val = (char *)&val16;
+ break;
+
+ case 4:
+ val32 = (uint32_t)param_val;
+ val = (char *)&val32;
+ break;
+
+ default:
+ goto free;
+ }
+ memcpy(param_info->value, val, param_len);
+
+ return 0;
+
+free:
+ free(iov->iov_base);
+ iov->iov_base = NULL;
+ iov->iov_len = 0;
+ return 1;
+}
+
+static int chap_fill_param_str(struct iovec *iov, int param, char *param_val,
+ int param_len)
+{
+ struct iscsi_param_info *param_info;
+ struct nlattr *attr;
+ int len;
+
+ len = sizeof(struct iscsi_param_info) + param_len;
+ iov->iov_base = iscsi_nla_alloc(param, len);
+ if (!iov->iov_base)
+ return 1;
+
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+
+ param_info = (struct iscsi_param_info *)ISCSI_NLA_DATA(attr);
+ param_info->param = param;
+ param_info->len = param_len;
+ memcpy(param_info->value, param_val, param_len);
+ return 0;
+}
+
+int chap_build_config(struct iscsi_chap_rec *crec, struct iovec *iovs)
+{
+ struct iovec *iov = NULL;
+ int count = 0;
+
+ /* start at 2, because 0 is for nlmsghdr and 1 for event */
+ iov = iovs + 2;
+
+ if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_INDEX,
+ crec->chap_tbl_idx,
+ sizeof(crec->chap_tbl_idx)))
+ count++;
+
+ if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_CHAP_TYPE,
+ crec->chap_type, sizeof(crec->chap_type)))
+ count++;
+
+ if (!chap_fill_param_str(&iov[count], ISCSI_CHAP_PARAM_USERNAME,
+ crec->username, strlen(crec->username)))
+ count++;
+
+ if (!chap_fill_param_str(&iov[count], ISCSI_CHAP_PARAM_PASSWORD,
+ (char *)crec->password,
+ strlen((char *)crec->password)))
+ count++;
+
+ if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_PASSWORD_LEN,
+ crec->password_length,
+ sizeof(crec->password_length)))
+ count++;
+
+ return count;
+}
diff --git a/usr/host.h b/usr/host.h
index 52e5b9e..149aa0d 100644
--- a/usr/host.h
+++ b/usr/host.h
@@ -17,5 +17,6 @@ struct host_info {
};
extern int host_info_print(int info_level, uint32_t host_no);
+extern int chap_build_config(struct iscsi_chap_rec *crec, struct iovec *iovs);
#endif
diff --git a/usr/idbm.c b/usr/idbm.c
index 1e4f8c8..6b6f57c 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -456,7 +456,7 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_uint16(IFACE_PORT, ri, r, port, IDBM_SHOW, num, 1);
}
-static void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
+void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
{
int num = 0;
@@ -465,14 +465,14 @@ static void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
if (r->chap_type == CHAP_TYPE_OUT) {
__recinfo_str(HOST_AUTH_USERNAME, ri, r, username, IDBM_SHOW,
- num, 0);
+ num, 1);
__recinfo_str(HOST_AUTH_PASSWORD, ri, r, password, IDBM_MASKED,
num, 1);
__recinfo_int(HOST_AUTH_PASSWORD_LEN, ri, r, password_length,
IDBM_HIDE, num, 1);
} else {
__recinfo_str(HOST_AUTH_USERNAME_IN, ri, r, username, IDBM_SHOW,
- num, 0);
+ num, 1);
__recinfo_str(HOST_AUTH_PASSWORD_IN, ri, r, password,
IDBM_MASKED, num, 1);
__recinfo_int(HOST_AUTH_PASSWORD_IN_LEN, ri, r, password_length,
@@ -852,6 +852,8 @@ updated:
check_password_param(discovery.sendtargets.auth.password_in);
check_password_param(discovery.slp.auth.password);
check_password_param(discovery.slp.auth.password_in);
+ check_password_param(host.auth.password);
+ check_password_param(host.auth.password_in);
return 0;
}
diff --git a/usr/idbm.h b/usr/idbm.h
index 5e4038d..b9020fe 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
@@ -185,6 +185,7 @@ extern struct node_rec *
idbm_create_rec_from_boot_context(struct boot_context *context);
extern int idbm_print_host_chap_info(struct iscsi_chap_rec *chap);
+extern void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri);
extern int idbm_print_flashnode_info(struct flashnode_rec *target);
extern void idbm_recinfo_flashnode(struct flashnode_rec *r, recinfo_t *ri);
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index b6665cb..a32da1c 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -143,6 +143,9 @@ struct iscsi_ipc {
uint16_t chap_tbl_idx, uint32_t num_entries,
char *chap_buf, uint32_t *valid_chap_entries);
+ int (*set_chap) (uint64_t transport_handle, uint32_t host_no,
+ struct iovec *iovs, uint32_t param_count);
+
int (*delete_chap) (uint64_t transport_handle, uint32_t host_no,
uint16_t chap_tbl_idx);
int (*set_flash_node_params) (uint64_t transport_handle,
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index beabdf0..045259b 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -115,7 +115,7 @@ static struct option const long_options[] =
{"packetsize", required_argument, NULL, 'b'},
{"count", required_argument, NULL, 'c'},
{"interval", required_argument, NULL, 'i'},
- {"index", optional_argument, NULL, 'x'},
+ {"index", required_argument, NULL, 'x'},
{"portal_type", optional_argument, NULL, 'A'},
{NULL, 0, NULL, 0},
};
@@ -1426,11 +1426,193 @@ exit_chap_info:
return rc;
}
+static int fill_host_chap_rec(struct list_head *params,
+ struct iscsi_chap_rec *crec, recinfo_t *cinfo,
+ uint16_t chap_tbl_idx, int type, int *param_count)
+{
+ struct user_param *param;
+ int rc = 0;
+
+ crec->chap_tbl_idx = chap_tbl_idx;
+ crec->chap_type = type;
+
+ idbm_recinfo_host_chap(crec, cinfo);
+
+ list_for_each_entry(param, params, list) {
+ rc = idbm_rec_update_param(cinfo, param->name, param->value, 0);
+ if (rc)
+ break;
+ }
+
+ if (!rc)
+ *param_count += 3; /* index, type and password_length */
+
+ return rc;
+}
+
+static int verify_host_chap_params(struct list_head *params, int *type,
+ int *param_count)
+{
+ struct user_param *param;
+ int username = -1;
+ int password = -1;
+ int rc = 0;
+
+ list_for_each_entry(param, params, list) {
+ *param_count += 1;
+
+ if (!strcmp(param->name, HOST_AUTH_USERNAME))
+ username = CHAP_TYPE_OUT;
+ else if (!strcmp(param->name, HOST_AUTH_PASSWORD))
+ password = CHAP_TYPE_OUT;
+ else if (!strcmp(param->name, HOST_AUTH_USERNAME_IN))
+ username = CHAP_TYPE_IN;
+ else if (!strcmp(param->name, HOST_AUTH_PASSWORD_IN))
+ password = CHAP_TYPE_IN;
+ else
+ continue;
+ }
+
+ if ((username == CHAP_TYPE_OUT) && (password == CHAP_TYPE_OUT)) {
+ if (type)
+ *type = CHAP_TYPE_OUT;
+
+ rc = ISCSI_SUCCESS;
+ } else if ((username == CHAP_TYPE_IN) && (password == CHAP_TYPE_IN)) {
+ if (type)
+ *type = CHAP_TYPE_IN;
+
+ rc = ISCSI_SUCCESS;
+ } else {
+ rc = ISCSI_ERR;
+ }
+
+ return rc;
+}
+
+static int set_host_chap_info(uint32_t host_no, uint64_t chap_index,
+ struct list_head *params)
+{
+ struct iscsi_transport *t = NULL;
+ struct iscsi_chap_rec crec;
+ recinfo_t *chap_info = NULL;
+ struct iovec *iovs = NULL;
+ struct iovec *iov = NULL;
+ int type;
+ int param_count;
+ int param_used;
+ int rc = 0;
+ int fd, i = 0;
+
+ if (list_empty(params)) {
+ log_error("Chap username/password not provided.");
+ goto exit_set_chap;
+ }
+
+ chap_info = idbm_recinfo_alloc(MAX_KEYS);
+ if (!chap_info) {
+ log_error("Out of Memory.");
+ rc = ISCSI_ERR_NOMEM;
+ goto exit_set_chap;
+ }
+
+ t = iscsi_sysfs_get_transport_by_hba(host_no);
+ if (!t) {
+ log_error("Could not match hostno %d to transport.", host_no);
+ rc = ISCSI_ERR_TRANS_NOT_FOUND;
+ goto free_info_rec;
+ }
+
+ rc = verify_host_chap_params(params, &type, &param_count);
+ if (rc) {
+ log_error("Invalid username/password pair passed. Unable to determine the type of chap entry");
+ rc = ISCSI_ERR_INVAL;
+ goto free_info_rec;
+ }
+
+ if (param_count > 2) {
+ log_error("Only one pair of username/password can be passed.");
+ rc = ISCSI_ERR;
+ goto free_info_rec;
+ }
+
+ memset(&crec, 0, sizeof(crec));
+ rc = fill_host_chap_rec(params, &crec, chap_info, chap_index, type,
+ &param_count);
+ if (rc) {
+ log_error("Unable to fill CHAP record");
+ goto free_info_rec;
+ }
+
+ /* +2 for event and nlmsghdr */
+ param_count += 2;
+ iovs = calloc((param_count * sizeof(struct iovec)),
+ sizeof(char));
+ if (!iovs) {
+ log_error("Out of Memory.");
+ rc = ISCSI_ERR_NOMEM;
+ goto free_info_rec;
+ }
+
+ /* param_used gives actual number of iovecs used for chap */
+ param_used = chap_build_config(&crec, iovs);
+ if (!param_used) {
+ log_error("Build chap config failed.");
+ rc = ISCSI_ERR;
+ goto free_iovec;
+ }
+
+ fd = ipc->ctldev_open();
+ if (fd < 0) {
+ rc = ISCSI_ERR_INTERNAL;
+ log_error("Netlink open failed.");
+ goto free_iovec;
+ }
+
+ rc = ipc->set_chap(t->handle, host_no, iovs, param_count);
+ if (rc < 0) {
+ log_error("CHAP setting failed");
+ if (rc == -EBUSY) {
+ rc = ISCSI_ERR_BUSY;
+ log_error("CHAP index %d is in use.",
+ crec.chap_tbl_idx);
+ } else {
+ rc = ISCSI_ERR;
+ }
+
+ goto exit_set_chap;
+ }
+
+ ipc->ctldev_close();
+
+free_iovec:
+ /* start at 2, because 0 is for nlmsghdr and 1 for event */
+ iov = iovs + 2;
+ for (i = 0; i < param_used; i++, iov++) {
+ if (iov->iov_base)
+ free(iov->iov_base);
+ }
+
+ free(iovs);
+
+free_info_rec:
+ if (chap_info)
+ free(chap_info);
+
+exit_set_chap:
+ return rc;
+}
+
static int delete_host_chap_info(uint32_t host_no, uint16_t chap_tbl_idx)
{
struct iscsi_transport *t = NULL;
int fd, rc = 0;
+ if (chap_tbl_idx > MAX_CHAP_ENTRIES) {
+ log_error("Invalid chap table index.");
+ goto exit_delete_chap;
+ }
+
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t) {
log_error("Could not match hostno %d to "
@@ -1464,19 +1646,18 @@ exit_delete_chap:
}
static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
- uint64_t chap_index)
+ uint64_t chap_index, struct list_head *params)
{
int rc = ISCSI_ERR_INVAL;
- if (op != OP_SHOW && (chap_index > (uint64_t)MAX_CHAP_ENTRIES)) {
- log_error("Invalid chap table index.");
- goto exit_chap_op;
- }
-
switch (op) {
case OP_SHOW:
rc = get_host_chap_info(host_no);
break;
+ case OP_NEW:
+ case OP_UPDATE:
+ rc = set_host_chap_info(host_no, chap_index, params);
+ break;
case OP_DELETE:
rc = delete_host_chap_info(host_no, chap_index);
break;
@@ -1485,7 +1666,6 @@ static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
break;
}
-exit_chap_op:
return rc;
}
@@ -2816,7 +2996,7 @@ main(int argc, char **argv)
struct iface_rec *iface = NULL, *tmp;
struct node_rec *rec = NULL;
uint64_t host_no = (uint64_t)MAX_HOST_NO + 1;
- uint64_t index = (uint64_t)MAX_FLASHNODE_IDX + 1;
+ uint64_t index = ULLONG_MAX;
struct user_param *param;
struct list_head params;
@@ -3038,8 +3218,12 @@ main(int argc, char **argv)
rc = ISCSI_ERR_INVAL;
break;
}
+
+ if (index == ULLONG_MAX)
+ index = (uint64_t)MAX_CHAP_ENTRIES + 1;
+
rc = exec_host_chap_op(op, info_level, host_no,
- index);
+ index, &params);
break;
case MODE_FLASHNODE:
if (host_no > MAX_HOST_NO) {
@@ -3048,6 +3232,9 @@ main(int argc, char **argv)
break;
}
+ if (index == ULLONG_MAX)
+ index = (uint64_t)MAX_FLASHNODE_IDX + 1;
+
rc = exec_flashnode_op(op, info_level, host_no,
index, portal_type,
&params);
diff --git a/usr/netlink.c b/usr/netlink.c
index c07fe3c..151b56d 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -1228,6 +1228,30 @@ static int kget_chap(uint64_t transport_handle, uint32_t host_no,
return rc;
}
+static int kset_chap(uint64_t transport_handle, uint32_t host_no,
+ struct iovec *iovs, uint32_t param_count)
+{
+ int rc, ev_len;
+ struct iscsi_uevent ev;
+ struct iovec *iov = iovs + 1;
+
+ log_debug(8, "in %s", __func__);
+
+ ev_len = sizeof(ev);
+ ev.type = ISCSI_UEVENT_SET_CHAP;
+ ev.transport_handle = transport_handle;
+ ev.u.set_path.host_no = host_no;
+
+ iov->iov_base = &ev;
+ iov->iov_len = sizeof(ev);
+
+ rc = __kipc_call(iovs, param_count);
+ if (rc < 0)
+ return rc;
+
+ return 0;
+}
+
static int kdelete_chap(uint64_t transport_handle, uint32_t host_no,
uint16_t chap_tbl_idx)
{
@@ -1705,6 +1729,7 @@ struct iscsi_ipc nl_ipc = {
.recv_conn_state = krecv_conn_state,
.exec_ping = kexec_ping,
.get_chap = kget_chap,
+ .set_chap = kset_chap,
.delete_chap = kdelete_chap,
.set_flash_node_params = kset_flashnode_params,
.new_flash_node = knew_flashnode,
--
1.8.3.1

View File

@ -1,37 +0,0 @@
From 65ce3a27da47cecf71015b16b1d186c49cbb7bcc Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:33 -0400
Subject: [PATCH] iscsi tools: Correctly get username_in and password_in
flashnode params
Fix to correctly read username_in and password_in sysfs params for
flashnode session.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iscsi_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 56cb90c..04c3673 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -601,12 +601,12 @@ int iscsi_sysfs_get_flashnode_info(struct flashnode_rec *fnode,
sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "username",
(fnode->sess).username, sizeof((fnode->sess).username));
sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "username_in",
- (fnode->sess).username,
+ (fnode->sess).username_in,
sizeof((fnode->sess).username_in));
sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "password",
(fnode->sess).password, sizeof((fnode->sess).password));
sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "password_in",
- (fnode->sess).password,
+ (fnode->sess).password_in,
sizeof((fnode->sess).password_in));
sysfs_get_uint(conn_id, ISCSI_FLASHNODE_SUBSYS, "statsn",
&((fnode->conn[0]).stat_sn));
--
1.8.3.1

View File

@ -1,84 +0,0 @@
From f1ed1f7049f42ad12f5e6bf5b02de75290271c56 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 17 Sep 2013 08:07:34 -0400
Subject: [PATCH] README changes for adding support to set CHAP entry
README changes for the support added to set CHAP entry using chap
submode of iscsiadm host mode.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
README | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/README b/README
index dda16c9..813548d 100644
--- a/README
+++ b/README
@@ -393,7 +393,7 @@ Usage: iscsiadm [OPTION]
See below for examples.
-m iface --interface=iscsi_ifacename -C ping --ip=[ipaddr] --packetsize=[size]
--count=[count] --interval=[interval]
- -m host --host=hostno|MAC --print=level -C chap --op=[op] --index=[chap_tbl_idx]
+ -m host --host=hostno|MAC --print=level -C chap --op=[SHOW]
Display information for a specific host. The host
can be passed in by host number or by MAC address.
If a host is not passed in then info
@@ -406,6 +406,14 @@ Usage: iscsiadm [OPTION]
is connected to.
3 = Print iscsi params used.
4 = Print SCSI info like LUNs, device state.
+ -m host --host=hostno|MAC -C chap --op=[DELETE] --index=[chap_tbl_idx]
+ Delete chap entry at the given index from chap table.
+ -m host --host=hostno|MAC -C chap --op=[NEW | UPDATE] --index=[chap_tbl_idx] \
+ --name=[name] --value=[value]
+ Add new or update existing chap entry at the given
+ index with given username and password pair. If index
+ is not passed then entry is added at the first free
+ index in chap table.
-m host --host=hostno|MAC -C flashnode
Display list of all the targets in adapter's
flash (flash node), for the specified host,
@@ -1033,6 +1041,38 @@ To now log into targets it is the same as with sofware iscsi. See section
- Delete a flash node entry
./iscsiadm -m host -H 6 -C flashnode -x 1 -o delete
+ Host mode with chap submode:
+
+ - Display list of chap entries for a host
+
+ ./iscsiadm -m host -H 6 -C chap -o show
+
+ This will list all the chap entries for the given host.
+
+ - Delete a chap entry for a host
+
+ ./iscsiadm -m host -H 6 -C chap -o delete -x 5
+
+ This will delete any chap entry present at given index 5.
+
+ - Add/Update a local chap entry for a host
+
+ ./iscsiadm -m host -H 6 -C chap -o update -x 4 -n username \
+ -v value -n password -v value
+
+ This will update the local chap entry present at index 4. If index 4
+ is free then entry of type local chap will be created at that index
+ with given username and password values.
+
+ - Add/Update a bidi chap entry for a host
+
+ ./iscsiadm -m host -H 6 -C chap -o update -x 5 -n username_in \
+ -v value -n password_in -v value
+
+ This will update the bidi chap entry present at index 5. If index 5
+ is free then entry of type bidi chap will be created at that index
+ with given username_in and password_in values.
+
6. Configuration
================
--
1.8.3.1

View File

@ -1,46 +0,0 @@
From 0a95bc409c6282b95c48ba39a16e17c3e6e26537 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:17 -0400
Subject: [PATCH] iscsi tools: Setup iface conf file with all iface attrs
exported in sysfs
Currently, iface conf file does not get populated with all the iface
attrs that are exported in corresponding sysfs entry.
This patch allows to setup conf file with all iface attrs in sysfs.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index c86892e..8580d1a 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -476,11 +476,8 @@ static int iface_setup_binding_from_kern_iface(void *data,
}
memset(&iface, 0, sizeof(struct iface_rec));
- strcpy(iface.hwaddress, hinfo->iface.hwaddress);
- strcpy(iface.transport_name, hinfo->iface.transport_name);
-
if (kern_iface) {
- iface.iface_num = kern_iface->iface_num;
+ memcpy(&iface, kern_iface, sizeof(iface));
snprintf(iface.name, sizeof(iface.name), "%s.%s.%s.%u",
kern_iface->transport_name,
@@ -492,6 +489,9 @@ static int iface_setup_binding_from_kern_iface(void *data,
hinfo->iface.transport_name, hinfo->iface.hwaddress);
}
+ strcpy(iface.hwaddress, hinfo->iface.hwaddress);
+ strcpy(iface.transport_name, hinfo->iface.transport_name);
+
memset(iface_path, 0, sizeof(iface_path));
snprintf(iface_path, PATH_MAX, "%s/%s", IFACE_CONFIG_DIR,
iface.name);
--
1.8.3.1

View File

@ -1,65 +0,0 @@
From 026c8d771c1df457cd26e7066b503cadfbbc98df Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:18 -0400
Subject: [PATCH] iscsi_if.h: Remove numbers used for network parameter
settings
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
include/iscsi_if.h | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 0284662..e837dd0 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -395,25 +395,25 @@ struct iscsi_path {
/* iSCSI network params */
enum iscsi_net_param {
ISCSI_NET_PARAM_IPV4_ADDR = 1,
- ISCSI_NET_PARAM_IPV4_SUBNET = 2,
- ISCSI_NET_PARAM_IPV4_GW = 3,
- ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
- ISCSI_NET_PARAM_MAC = 5,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
- ISCSI_NET_PARAM_IPV6_ADDR = 7,
- ISCSI_NET_PARAM_IPV6_ROUTER = 8,
- ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
- ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
- ISCSI_NET_PARAM_IFACE_ENABLE = 12,
- ISCSI_NET_PARAM_VLAN_ID = 13,
- ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
- ISCSI_NET_PARAM_VLAN_ENABLED = 15,
- ISCSI_NET_PARAM_VLAN_TAG = 16,
- ISCSI_NET_PARAM_IFACE_TYPE = 17,
- ISCSI_NET_PARAM_IFACE_NAME = 18,
- ISCSI_NET_PARAM_MTU = 19,
- ISCSI_NET_PARAM_PORT = 20,
+ ISCSI_NET_PARAM_IPV4_SUBNET,
+ ISCSI_NET_PARAM_IPV4_GW,
+ ISCSI_NET_PARAM_IPV4_BOOTPROTO,
+ ISCSI_NET_PARAM_MAC,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL,
+ ISCSI_NET_PARAM_IPV6_ADDR,
+ ISCSI_NET_PARAM_IPV6_ROUTER,
+ ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG,
+ ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM_VLAN_ID,
+ ISCSI_NET_PARAM_VLAN_PRIORITY,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM_VLAN_TAG,
+ ISCSI_NET_PARAM_IFACE_TYPE,
+ ISCSI_NET_PARAM_IFACE_NAME,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM_PORT,
};
enum iscsi_conn_state {
--
1.8.3.1

View File

@ -1,122 +0,0 @@
From d1e07af2ed3aa480107213378a54bfc9a6a36c0a Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:19 -0400
Subject: [PATCH] iscsi_if.h: Additional parameters for network param settings
Added support to display and update additional network parameters
through iscsiadm
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
include/iscsi_if.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index e837dd0..e59bcd0 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -320,6 +320,7 @@ enum iscsi_param_type {
ISCSI_NET_PARAM, /* iscsi_net_param */
ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
ISCSI_CHAP_PARAM, /* iscsi_chap_param */
+ ISCSI_IFACE_PARAM, /* iscsi_iface_param */
};
/* structure for minimalist usecase */
@@ -392,6 +393,10 @@ struct iscsi_path {
#define ISCSI_VLAN_DISABLE 0x01
#define ISCSI_VLAN_ENABLE 0x02
+/* iscsi generic enable/disabled setting for various features */
+#define ISCSI_NET_PARAM_DISABLE 0x01
+#define ISCSI_NET_PARAM_ENABLE 0x02
+
/* iSCSI network params */
enum iscsi_net_param {
ISCSI_NET_PARAM_IPV4_ADDR = 1,
@@ -414,6 +419,80 @@ enum iscsi_net_param {
ISCSI_NET_PARAM_IFACE_NAME,
ISCSI_NET_PARAM_MTU,
ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM_IPADDR_STATE,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE,
+ ISCSI_NET_PARAM_IPV6_ROUTER_STATE,
+ ISCSI_NET_PARAM_DELAYED_ACK_EN,
+ ISCSI_NET_PARAM_TCP_NAGLE_DISABLE,
+ ISCSI_NET_PARAM_TCP_WSF_DISABLE,
+ ISCSI_NET_PARAM_TCP_WSF,
+ ISCSI_NET_PARAM_TCP_TIMER_SCALE,
+ ISCSI_NET_PARAM_TCP_TIMESTAMP_EN,
+ ISCSI_NET_PARAM_CACHE_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN,
+ ISCSI_NET_PARAM_IPV4_TOS_EN,
+ ISCSI_NET_PARAM_IPV4_TOS,
+ ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN,
+ ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE,
+ ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN,
+ ISCSI_NET_PARAM_IPV4_TTL,
+ ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN,
+ ISCSI_NET_PARAM_IPV6_MLD_EN,
+ ISCSI_NET_PARAM_IPV6_FLOW_LABEL,
+ ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS,
+ ISCSI_NET_PARAM_IPV6_HOP_LIMIT,
+ ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO,
+ ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME,
+ ISCSI_NET_PARAM_IPV6_ND_STALE_TMO,
+ ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT,
+ ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU,
+ ISCSI_NET_PARAM_REDIRECT_EN,
+};
+
+enum iscsi_ipaddress_state {
+ ISCSI_IPDDRESS_STATE_UNCONFIGURED,
+ ISCSI_IPDDRESS_STATE_ACQUIRING,
+ ISCSI_IPDDRESS_STATE_TENTATIVE,
+ ISCSI_IPDDRESS_STATE_VALID,
+ ISCSI_IPDDRESS_STATE_DISABLING,
+ ISCSI_IPDDRESS_STATE_INVALID,
+ ISCSI_IPDDRESS_STATE_DEPRECATED,
+};
+
+enum iscsi_router_state {
+ ISCSI_ROUTER_STATE_UNKNOWN,
+ ISCSI_ROUTER_STATE_ADVERTISED,
+ ISCSI_ROUTER_STATE_MANUAL,
+ ISCSI_ROUTER_STATE_STALE,
+};
+
+/* iSCSI specific settings params for iface */
+enum iscsi_iface_param {
+ ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO,
+ ISCSI_IFACE_PARAM_HDRDGST_EN,
+ ISCSI_IFACE_PARAM_DATADGST_EN,
+ ISCSI_IFACE_PARAM_IMM_DATA_EN,
+ ISCSI_IFACE_PARAM_INITIAL_R2T_EN,
+ ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN,
+ ISCSI_IFACE_PARAM_PDU_INORDER_EN,
+ ISCSI_IFACE_PARAM_ERL,
+ ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH,
+ ISCSI_IFACE_PARAM_FIRST_BURST,
+ ISCSI_IFACE_PARAM_MAX_R2T,
+ ISCSI_IFACE_PARAM_MAX_BURST,
+ ISCSI_IFACE_PARAM_CHAP_AUTH_EN,
+ ISCSI_IFACE_PARAM_BIDI_CHAP_EN,
+ ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL,
+ ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN,
+ ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN,
+ ISCSI_IFACE_PARAM_INITIATOR_NAME,
};
enum iscsi_conn_state {
--
1.8.3.1

View File

@ -1,243 +0,0 @@
From 466efaad99b0fc0d1181443386b823739a8b483b Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:20 -0400
Subject: [PATCH] iscsi tools: Use macro to set IPv4/IPv6 IP addresses
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iface.c | 154 +++++++++++++++++++++++++++---------------------------------
1 file changed, 69 insertions(+), 85 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 8580d1a..19ad5ab 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1484,8 +1484,8 @@ static int iface_fill_router_autocfg(struct iovec *iov, struct iface_rec *iface)
}
/* IPv4 IPAddress/Subnet Mask/Gateway: 4 bytes */
-static int iface_fill_net_ipv4_addr(struct iovec *iov, struct iface_rec *iface,
- uint32_t param)
+static int iface_fill_net_ipv4_addr(struct iovec *iov, uint32_t iface_num,
+ uint16_t param, char *param_val)
{
int rc = 1;
int len;
@@ -1502,29 +1502,12 @@ static int iface_fill_net_ipv4_addr(struct iovec *iov, struct iface_rec *iface,
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV4;
- net_param->iface_num = iface->iface_num;
+ net_param->iface_num = iface_num;
net_param->len = 4;
net_param->param_type = ISCSI_NET_PARAM;
-
- switch (param) {
- case ISCSI_NET_PARAM_IPV4_ADDR:
- rc = inet_pton(AF_INET, iface->ipaddress, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV4_SUBNET:
- rc = inet_pton(AF_INET, iface->subnet_mask, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV4_GW:
- rc = inet_pton(AF_INET, iface->gateway, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- default:
+ rc = inet_pton(AF_INET, param_val, net_param->value);
+ if (rc <= 0)
goto free;
- }
/* validate */
if (!net_param->value[0] && !net_param->value[1] &&
@@ -1539,9 +1522,19 @@ free:
return 1;
}
+#define IFACE_SET_NET_PARAM_IPV4_ADDR(iov, inum, param, ival, gcnt, \
+ lcnt) { \
+ if (strstr(ival, ".")) { \
+ if (!iface_fill_net_ipv4_addr(iov, inum, param, ival)) {\
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
+ } \
+}
+
/* IPv6 IPAddress/LinkLocal/Router: 16 bytes */
-static int iface_fill_net_ipv6_addr(struct iovec *iov, struct iface_rec *iface,
- uint32_t param)
+static int iface_fill_net_ipv6_addr(struct iovec *iov, uint32_t iface_num,
+ uint16_t param, char *param_val)
{
int rc;
int len;
@@ -1558,30 +1551,12 @@ static int iface_fill_net_ipv6_addr(struct iovec *iov, struct iface_rec *iface,
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
- net_param->iface_num = iface->iface_num;
+ net_param->iface_num = iface_num;
net_param->param_type = ISCSI_NET_PARAM;
net_param->len = 16;
-
- switch (param) {
- case ISCSI_NET_PARAM_IPV6_ADDR:
- rc = inet_pton(AF_INET6, iface->ipaddress, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV6_LINKLOCAL:
- rc = inet_pton(AF_INET6, iface->ipv6_linklocal,
- net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV6_ROUTER:
- rc = inet_pton(AF_INET6, iface->ipv6_router, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- default:
+ rc = inet_pton(AF_INET6, param_val, net_param->value);
+ if (rc <= 0)
goto free;
- }
return 0;
free:
@@ -1591,6 +1566,16 @@ free:
return 1;
}
+#define IFACE_SET_NET_PARAM_IPV6_ADDR(iov, inum, param, ival, gcnt, \
+ lcnt) { \
+ if (strstr(ival, ":")) { \
+ if (!iface_fill_net_ipv6_addr(iov, inum, param, ival)) {\
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
+ } \
+}
+
struct iface_net_config {
struct iface_rec *primary;
struct iovec *iovs;
@@ -1635,28 +1620,27 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
net_config->count++;
count++;
}
- if (!iface_fill_net_ipv4_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV4_ADDR)) {
- net_config->count++;
- count++;
- }
- if (strstr(iface->subnet_mask, ".")) {
- if (!iface_fill_net_ipv4_addr(
- &iov[net_config->count], iface,
- ISCSI_NET_PARAM_IPV4_SUBNET)) {
- net_config->count++;
- count++;
- }
- }
- if (strstr(iface->gateway, ".")) {
- if (!iface_fill_net_ipv4_addr(
- &iov[net_config->count], iface,
- ISCSI_NET_PARAM_IPV4_GW)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_ADDR,
+ iface->ipaddress,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_SUBNET,
+ iface->subnet_mask,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_GW,
+ iface->gateway,
+ &net_config->count,
+ &count);
}
/*
@@ -1727,12 +1711,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided IPv6 Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_ADDR)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_ADDR,
+ iface->ipaddress,
+ &net_config->count,
+ &count);
}
/* For LinkLocal Address */
@@ -1751,12 +1735,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided Link Local Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL,
+ iface->ipv6_linklocal,
+ &net_config->count,
+ &count);
}
/* For Router Address */
@@ -1773,12 +1757,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided Router Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_ROUTER)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_ROUTER,
+ iface->ipv6_router,
+ &net_config->count,
+ &count);
}
/*
--
1.8.3.1

View File

@ -1,220 +0,0 @@
From 2220ee4334637946e93dca5c68889b5e3e807515 Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:21 -0400
Subject: [PATCH] iscsi tools: Use single function to enable/disable network
parameters
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 148 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 74 insertions(+), 74 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 19ad5ab..292c804 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1311,60 +1311,45 @@ static int iface_fill_vlan_id(struct iovec *iov, struct iface_rec *iface,
return 0;
}
-/* IPv4/IPv6 VLAN state: disable/enable */
-static int iface_fill_vlan_state(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
+/* disable/enable parameters */
+static int iface_fill_param_state(struct iovec *iov, uint32_t iface_num,
+ uint8_t iface_type, uint16_t param,
+ uint8_t param_type, char *param_val)
{
int len;
struct iscsi_iface_param_info *net_param;
struct nlattr *attr;
+ if (!param_val[0])
+ return 1;
+
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_VLAN_ENABLED, len);
+ iov->iov_base = iscsi_nla_alloc(param, len);
if (!(iov->iov_base))
return 1;
attr = iov->iov_base;
iov->iov_len = NLA_ALIGN(attr->nla_len);
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_VLAN_ENABLED;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
+ net_param->iface_num = iface_num;
net_param->len = 1;
- if (strcmp(iface->vlan_state, "disable") && iface->vlan_id)
- net_param->value[0] = ISCSI_VLAN_ENABLE;
+ net_param->param = param;
+ net_param->iface_type = iface_type;
+ net_param->param_type = param_type;
+ if (strcmp(param_val, "disable"))
+ net_param->value[0] = ISCSI_NET_PARAM_ENABLE;
else /* Assume disabled */
- net_param->value[0] = ISCSI_VLAN_DISABLE;
+ net_param->value[0] = ISCSI_NET_PARAM_DISABLE;
return 0;
}
-/* IPv4/IPv6 Network state: disable/enable */
-static int iface_fill_net_state(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
-{
- int len;
- struct iscsi_iface_param_info *net_param;
- struct nlattr *attr;
-
- len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IFACE_ENABLE, len);
- if (!(iov->iov_base))
- return 1;
-
- attr = iov->iov_base;
- iov->iov_len = NLA_ALIGN(attr->nla_len);
- net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_IFACE_ENABLE;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 1;
- if (!strcmp(iface->state, "disable"))
- net_param->value[0] = ISCSI_IFACE_DISABLE;
- else /* Assume enabled */
- net_param->value[0] = ISCSI_IFACE_ENABLE;
- return 0;
+#define IFACE_SET_PARAM_STATE(iov, inum, itype, param, ptype, ival, \
+ gcnt, lcnt) { \
+ if (!iface_fill_param_state(iov, inum, itype, param, ptype, \
+ ival)) { \
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
}
/* IPv4 Bootproto: DHCP/static */
@@ -1598,13 +1583,14 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
iptype = iface_get_iptype(iface);
if (iptype == ISCSI_IFACE_TYPE_IPV4) {
if (!strcmp(iface->state, "disable")) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
-
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
return 0;
}
@@ -1648,18 +1634,24 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
* fill state and other parameters (if any)
*/
if (count) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- if (!iface_fill_vlan_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM,
+ iface->vlan_state,
+ &net_config->count,
+ &count);
+
if (strcmp(iface->vlan_state, "disable") &&
iface->vlan_id) {
if (!iface_fill_vlan_id(&iov[net_config->count],
@@ -1687,12 +1679,14 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
}
} else if (iptype == ISCSI_IFACE_TYPE_IPV6) {
if (!strcmp(iface->state, "disable")) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
return 0;
}
@@ -1770,18 +1764,24 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
* fill state and other parameters
*/
if (count) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- if (!iface_fill_vlan_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM,
+ iface->vlan_state,
+ &net_config->count,
+ &count);
+
if (strcmp(iface->vlan_state, "disable") &&
iface->vlan_id) {
if (!iface_fill_vlan_id(&iov[net_config->count],
--
1.8.3.1

View File

@ -1,215 +0,0 @@
From d8991c9e1de373a1c55ad2f8ca07bb3fbda1aa5c Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:22 -0400
Subject: [PATCH] iscsi tools: Use single function to set integer network
parameters
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 162 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 90 insertions(+), 72 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 292c804..6454f75 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1223,58 +1223,68 @@ int iface_get_param_count(struct iface_rec *iface, int iface_all)
return iface_params.count;
}
-/* IPv4/IPv6 Port: 3260 or User defined */
-static int iface_fill_port(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
+/* write integer parameter value */
+static int iface_fill_int_param_val(struct iovec *iov, uint32_t iface_num,
+ uint8_t iface_type, uint16_t param,
+ uint8_t param_type, uint32_t param_len,
+ uint32_t param_val)
{
int len;
struct iscsi_iface_param_info *net_param;
- uint16_t port = 3260;
struct nlattr *attr;
+ uint8_t val8 = 0;
+ uint16_t val16 = 0;
+ uint32_t val32 = 0;
+ char *val = NULL;
- len = sizeof(struct iscsi_iface_param_info) + sizeof(port);
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_PORT, len);
- if (!iov->iov_base)
- return 1;
- attr = iov->iov_base;
- iov->iov_len = NLA_ALIGN(attr->nla_len);
-
- net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_PORT;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 2;
- if (iface->port)
- port = iface->port;
- memcpy(net_param->value, &port, net_param->len);
- return 0;
-}
-
-static int iface_fill_mtu(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
-{
- int len;
- struct iscsi_iface_param_info *net_param;
- uint16_t mtu = 0;
- struct nlattr *attr;
-
- len = sizeof(struct iscsi_iface_param_info) + 2;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_MTU, len);
+ len = sizeof(struct iscsi_iface_param_info) + param_len;
+ iov->iov_base = iscsi_nla_alloc(param, len);
if (!(iov->iov_base))
return 1;
+
attr = iov->iov_base;
iov->iov_len = NLA_ALIGN(attr->nla_len);
-
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_MTU;
+ net_param->iface_num = iface_num;
+ net_param->len = param_len;
+ net_param->param = param;
net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 2;
- mtu = iface->mtu;
- memcpy(net_param->value, &mtu, net_param->len);
+ net_param->param_type = param_type;
+ switch (param_len) {
+ case 1:
+ val8 = (uint8_t)param_val;
+ val = (char *)&val8;
+ break;
+
+ case 2:
+ val16 = (uint16_t)param_val;
+ val = (char *)&val16;
+ break;
+
+ case 4:
+ val32 = (uint32_t)param_val;
+ val = (char *)&val32;
+ break;
+
+ default:
+ goto free;
+ }
+ memcpy(net_param->value, val, param_len);
return 0;
+free:
+ free(iov->iov_base);
+ iov->iov_base = NULL;
+ iov->iov_len = 0;
+ return 1;
+}
+
+#define IFACE_SET_PARAM_INTVAL(iov, inum, itype, param, ptype, plen, \
+ ival, gcnt, lcnt) { \
+ if (ival && !iface_fill_int_param_val(iov, inum, itype, param, \
+ ptype, plen, ival)) { \
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
}
/* IPv4/IPv6 VLAN_ID: decimal value <= 4095 */
@@ -1660,22 +1670,26 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
}
- if (iface->mtu) {
- if (!iface_fill_mtu(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- }
- if (iface->port) {
- if (!iface_fill_port(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->mtu,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->port,
+ &net_config->count,
+ &count);
}
} else if (iptype == ISCSI_IFACE_TYPE_IPV6) {
if (!strcmp(iface->state, "disable")) {
@@ -1791,22 +1805,26 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
}
- if (iface->mtu) {
- if (!iface_fill_mtu(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- }
- if (iface->port) {
- if (!iface_fill_port(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->mtu,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->port,
+ &net_config->count,
+ &count);
}
}
return 0;
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From da404f2137daa4e5cf06d69e4d7b6a0bff8c13b5 Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:23 -0400
Subject: [PATCH] iscsi tools: Ignore network parameter if not enabled/disabled
If iface does not contain network parameter or incorrect value is set,
do not send that network parameter value to driver.
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 6454f75..55b0dd4 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1346,11 +1346,18 @@ static int iface_fill_param_state(struct iovec *iov, uint32_t iface_num,
net_param->param = param;
net_param->iface_type = iface_type;
net_param->param_type = param_type;
- if (strcmp(param_val, "disable"))
- net_param->value[0] = ISCSI_NET_PARAM_ENABLE;
- else /* Assume disabled */
+ if (!strcmp(param_val, "disable"))
net_param->value[0] = ISCSI_NET_PARAM_DISABLE;
+ else if (!strcmp(param_val, "enable"))
+ net_param->value[0] = ISCSI_NET_PARAM_ENABLE;
+ else
+ goto free;
return 0;
+free:
+ free(iov->iov_base);
+ iov->iov_base = NULL;
+ iov->iov_len = 0;
+ return 1;
}
#define IFACE_SET_PARAM_STATE(iov, inum, itype, param, ptype, ival, \
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -1,119 +0,0 @@
From 9260457c1df5f519a63744114cbdf7e50cd75ed7 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:25 -0400
Subject: [PATCH] iscsi tools: iface params should be updated for node_rec as
well.
While updating iface params, the changes should get applied to the
node records as well.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/idbm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index 4428ebe..c6460ad 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -292,6 +292,96 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_uint16(IFACE_MTU, ri, r, iface.mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, iface.port, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, iface.dhcp_alt_client_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, iface.dhcp_alt_client_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, iface.dhcp_learn_iqn,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, iface.dhcp_req_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r, iface.incoming_forwarding,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state, IDBM_SHOW, num,
+ 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, iface.nd_reachable_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, iface.nd_rexmit_time,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DELAYED_ACK, ri, r, iface.delayed_ack, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_TCP_NAGLE, ri, r, iface.nagle, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TCP_WSF_STATE, ri, r, iface.tcp_wsf_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TCP_WSF, ri, r, iface.tcp_wsf, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TCP_TIMER_SCALE, ri, r, iface.tcp_timer_scale,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TCP_TIMESTAMP, ri, r, iface.tcp_timestamp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_REDIRECT, ri, r, iface.redirect, IDBM_SHOW, num, 1);
+ __recinfo_uint16(IFACE_DEF_TMF_TMO, ri, r, iface.def_task_mgmt_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_HDRDGST, ri, r, iface.header_digest, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DATADGST, ri, r, iface.data_digest, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IMM_DATA, ri, r, iface.immediate_data, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_INITIAL_R2T, ri, r, iface.initial_r2t, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DSEQ_INORDER, ri, r, iface.data_seq_inorder,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DPDU_INORDER, ri, r, iface.data_pdu_inorder,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_ERL, ri, r, iface.erl, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_MAX_RECV_DLEN, ri, r, iface.max_recv_dlength,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FIRST_BURST, ri, r, iface.first_burst_len,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint16(IFACE_MAX_R2T, ri, r, iface.max_out_r2t, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint32(IFACE_MAX_BURST, ri, r, iface.max_burst_len, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_CHAP_AUTH, ri, r, iface.chap_auth, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_BIDI_CHAP, ri, r, iface.bidi_chap, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_STRICT_LOGIN_COMP, ri, r, iface.strict_login_comp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DISCOVERY_AUTH, ri, r, iface.discovery_auth,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DISCOVERY_LOGOUT, ri, r, iface.discovery_logout,
+ IDBM_SHOW, num, 1);
+
+
__recinfo_str(NODE_DISC_ADDR, ri, r, disc_address, IDBM_SHOW,
num, 0);
__recinfo_int(NODE_DISC_PORT, ri, r, disc_port, IDBM_SHOW,
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From 75ee9d0af6e200b34e84b1e7b37971213b2fd629 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:26 -0400
Subject: [PATCH] iscsi tools: Let default type of iface be ipv4
While using iface name to determine its type if the name does not
contain iface type then assume it be to of type ipv4 by default.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usr/iface.c b/usr/iface.c
index 87ac875..870dba0 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -450,8 +450,10 @@ int iface_get_iptype(struct iface_rec *iface)
/* try to figure out by name */
if (strstr(iface->name, "ipv4"))
return ISCSI_IFACE_TYPE_IPV4;
- else
+ else if (strstr(iface->name, "ipv6"))
return ISCSI_IFACE_TYPE_IPV6;
+ else /* assume ipv4 by default */
+ return ISCSI_IFACE_TYPE_IPV4;
} else {
if (strcmp(iface->bootproto, "dhcp") &&
!strstr(iface->ipaddress, "."))
--
1.8.3.1

View File

@ -1,310 +0,0 @@
From 4a5e9e29d7516e34e35a15c7342afbc3a1c8c176 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:27 -0400
Subject: [PATCH] iscsi tools: Show iface params based on iface type
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/idbm.c | 250 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 138 insertions(+), 112 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index c6460ad..1ade099 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -237,6 +237,9 @@ void
idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
{
int num = 0, i;
+ int iface_type;
+
+ iface_type = iface_get_iptype(&r->iface);
__recinfo_str(NODE_NAME, ri, r, name, IDBM_SHOW, num, 0);
__recinfo_int(NODE_TPGT, ri, r, tpgt, IDBM_SHOW, num, 0);
@@ -266,21 +269,6 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_str(IFACE_TRANSPORTNAME, ri, r, iface.transport_name,
IDBM_SHOW, num, 1);
__recinfo_str(IFACE_INAME, ri, r, iface.iname, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_BOOT_PROTO, ri, r, iface.bootproto, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_SUBNET_MASK, ri, r, iface.subnet_mask,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GATEWAY, ri, r, iface.gateway, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, iface.ipv6_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, iface.linklocal_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, iface.router_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL, ri, r, iface.ipv6_linklocal,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER, ri, r, iface.ipv6_router, IDBM_SHOW, num,
- 1);
__recinfo_str(IFACE_STATE, ri, r, iface.state, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_VLAN_ID, ri, r, iface.vlan_id, IDBM_SHOW, num,
1);
@@ -292,50 +280,73 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_uint16(IFACE_MTU, ri, r, iface.mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, iface.port, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, iface.dhcp_alt_client_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, iface.dhcp_alt_client_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, iface.dhcp_learn_iqn,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, iface.dhcp_req_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_IN_FORWARD, ri, r, iface.incoming_forwarding,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state, IDBM_SHOW, num,
- 1);
- __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
- iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
- iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, iface.nd_reachable_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, iface.nd_rexmit_time,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
- iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
- IDBM_SHOW, num, 1);
+ if (iface_type == ISCSI_IFACE_TYPE_IPV4) {
+ __recinfo_str(IFACE_BOOT_PROTO, ri, r, iface.bootproto,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_SUBNET_MASK, ri, r, iface.subnet_mask,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GATEWAY, ri, r, iface.gateway, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r,
+ iface.dhcp_alt_client_id_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r,
+ iface.dhcp_alt_client_id, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r,
+ iface.dhcp_learn_iqn, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r,
+ iface.dhcp_req_vendor_id_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r,
+ iface.incoming_forwarding, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
+ } else if (iface_type == ISCSI_IFACE_TYPE_IPV6) {
+ __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, iface.ipv6_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r,
+ iface.linklocal_autocfg, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, iface.router_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL, ri, r, iface.ipv6_linklocal,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER, ri, r, iface.ipv6_router,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r,
+ iface.nd_reachable_tmo, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r,
+ iface.nd_rexmit_time, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
+ IDBM_SHOW, num, 1);
+ }
+
__recinfo_str(IFACE_DELAYED_ACK, ri, r, iface.delayed_ack, IDBM_SHOW,
num, 1);
__recinfo_str(IFACE_TCP_NAGLE, ri, r, iface.nagle, IDBM_SHOW, num, 1);
@@ -515,6 +526,9 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
{
int num = 0;
+ int iface_type;
+
+ iface_type = iface_get_iptype(r);
__recinfo_str(IFACE_ISCSINAME, ri, r, name, IDBM_SHOW, num, 0);
__recinfo_str(IFACE_NETNAME, ri, r, netdev, IDBM_SHOW, num, 1);
@@ -523,19 +537,6 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_str(IFACE_TRANSPORTNAME, ri, r, transport_name,
IDBM_SHOW, num, 1);
__recinfo_str(IFACE_INAME, ri, r, iname, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_BOOT_PROTO, ri, r, bootproto, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_SUBNET_MASK, ri, r, subnet_mask,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GATEWAY, ri, r, gateway, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, ipv6_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, linklocal_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, router_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL, ri, r, ipv6_linklocal,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER, ri, r, ipv6_router, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_STATE, ri, r, state, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_VLAN_ID, ri, r, vlan_id, IDBM_SHOW, num, 1);
__recinfo_uint8(IFACE_VLAN_PRIORITY, ri, r, vlan_priority,
@@ -544,46 +545,71 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_int(IFACE_NUM, ri, r, iface_num, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_MTU, ri, r, mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, port, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, dhcp_alt_client_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, dhcp_alt_client_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_DNS, ri, r, dhcp_dns, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, dhcp_learn_iqn, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, dhcp_req_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID, ri, r, dhcp_vendor_id_state, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_VID_STR, ri, r, dhcp_vendor_id, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, dhcp_slp_da, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_FRAGMENTATION, ri, r, fragmentation, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_ARP, ri, r, gratuitous_arp, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IN_FORWARD, ri, r, incoming_forwarding, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_TOS_STATE, ri, r, tos_state, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TOS, ri, r, tos, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TTL, ri, r, ttl, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r, dup_addr_detect_cnt,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, flow_label, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r, gratuitous_neighbor_adv,
- IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, hop_limit, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_MLD, ri, r, mld, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, nd_reachable_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, nd_rexmit_time, IDBM_SHOW,
- num, 1);
- __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, nd_stale_tmo, IDBM_SHOW,
- num, 1);
- __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r, router_adv_link_mtu,
- IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, traffic_class, IDBM_SHOW,
- num, 1);
+
+ if (iface_type == ISCSI_IFACE_TYPE_IPV4) {
+ __recinfo_str(IFACE_BOOT_PROTO, ri, r, bootproto, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_SUBNET_MASK, ri, r, subnet_mask, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GATEWAY, ri, r, gateway, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r,
+ dhcp_alt_client_id_state, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, dhcp_alt_client_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, dhcp_dns, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, dhcp_learn_iqn,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r,
+ dhcp_req_vendor_id_state, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, dhcp_slp_da, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, gratuitous_arp, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r, incoming_forwarding,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, tos_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, ttl, IDBM_SHOW, num, 1);
+ } else if (iface_type == ISCSI_IFACE_TYPE_IPV6) {
+ __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, ipv6_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, linklocal_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, router_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL, ri, r, ipv6_linklocal, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_ROUTER, ri, r, ipv6_router, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, flow_label, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, hop_limit, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r,
+ nd_reachable_tmo, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, nd_rexmit_time,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, traffic_class,
+ IDBM_SHOW, num, 1);
+ }
+
__recinfo_str(IFACE_DELAYED_ACK, ri, r, delayed_ack, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_TCP_NAGLE, ri, r, nagle, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_TCP_WSF_STATE, ri, r, tcp_wsf_state, IDBM_SHOW,
--
1.8.3.1

View File

@ -1,534 +0,0 @@
From 072d8b931e8e03875e5220546e68d5fb2e80bcda Mon Sep 17 00:00:00 2001
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:12 -0500
Subject: [PATCH] iscsiadm: Added document for description of iface attributes
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
sysfs-documentation | 514 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 514 insertions(+)
create mode 100644 sysfs-documentation
diff --git a/sysfs-documentation b/sysfs-documentation
new file mode 100644
index 0000000..54fc497
--- /dev/null
+++ b/sysfs-documentation
@@ -0,0 +1,514 @@
+Description of iface attributes and their valid values
+======================================================
+
+== IPv4 attributes ==
+
+ipaddress
+---------
+IP address in format XXX.XXX.XXX.XXX
+
+gateway
+-------
+IP address of the network router or gateway device in format XXX.XXX.XXX.XXX
+
+subnet
+------
+Broadcast address in format XXX.XXX.XXX.XXX
+
+bootproto
+---------
+The protocol type used to initialize interface
+
+Valid values: "dhcp" or "static"
+
+dhcp_dns_address_en
+-------------------
+Request DNS Server IP Addresses and Domain Name
+
+If bootproto is set to dhcp and dhcp_dns_address_en is enable,
+requests DNS addresses (option 6) and domain name (option 15) in its
+DHCP parameter request list.
+
+Valid values: "enable" or "disable"
+
+dhcp_slp_da_info_en
+-------------------
+Request SLP DA Information and SLP Scope
+If bootproto is set to dhcp and dhcp_slp_da_info_en is enable,
+requests SLP DA information (option 78) and SLP scope (option 79)
+in its DHCP parameter request list.
+
+Valid values: "enable" or "disable"
+
+tos_en
+------
+Enable IPv4 type of service (ToS)
+
+When tos_en is set to enable, use value set in tos when transmitting IPv4 TCP
+packets on iSCSI connections.
+
+Valid values: "enable" or "disable"
+
+tos
+---
+IPv4 Type of service (ToS)
+
+When tos_en is set to enable, use value set in tos when transmitting IPv4 TCP
+packets on iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+grat_arp_en
+-----------
+Enable Gratuitous ARP Requests
+
+Valid values: "enable" or "disable"
+
+dhcp_alt_client_id_en
+---------------------
+DHCP Use Alternate Client ID
+
+When dhcp_alt_client_id_en is set to enable, use the Client ID configured in
+dhcp_alt_client_id as its Client ID (DHCP option 61) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_alt_client_id
+------------------
+DHCP Alternate Client ID
+
+When dhcp_alt_client_id_en is set to enable, use value set in dhcp_alt_client_id
+for Client ID in DHCP messages.
+
+Valid values: 11-byte Client ID
+
+dhcp_req_vendor_id_en
+---------------------
+DHCP Require Vendor ID
+
+When dhcp_req_vendor_id_en is set to enable, use value set in dhcp_vendor_id as
+its vendor ID (DHCP option 60) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_use_vendor_id_en
+---------------------
+DHCP Use Vendor ID
+
+When dhcp_use_vendor_id_en is set to enable, use value set in dhcp_vendor_id as
+its vendor ID (DHCP option 60) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_vendor_id
+--------------
+DHCP Vendor ID
+
+When dhcp_req_vendor_id_en or dhcp_use_vendor_id_en is set to enable,
+use value set in dhcp_vendor_id for Vendor ID in DHCP messages.
+
+Valid values: 11-byte Client ID
+
+dhcp_learn_iqn_en
+-----------------
+DHCP Learn IQN
+
+When dhcp_learn_iqn_en is set to enable, iSCSI initiator attempts to use DHCP
+to learn its (IQN) iSCSI name.
+
+Valid values: "enable" or "disable"
+
+fragment_disable
+----------------
+Fragmentation Disable.
+
+When fragment_disable is set to disable, iSCSI initiator cannot fragment IP
+datagrams.
+
+Valid values: "enable" or "disable"
+
+incoming_forwarding_en
+----------------------
+When incoming_forwarding_en is set to enable, iSCSI initiator forwards all
+incoming network traffic to the network driver, except for iSCSI TCP packets
+destined to the iSCSI initiator.
+
+Valid values: "enable" or "disable"
+
+ttl
+---
+IPv4 Time to Live (TTL)
+
+This attribute contain TTL value sent in IPv4 TCP packets transmitted on
+iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+== IPv6 attributes ==
+
+ipaddress
+---------
+IP address in IPv6 format.
+
+link_local_addr
+---------------
+Link local address in IPv6 format.
+
+router_addr
+-----------
+Router address in IPv6 format.
+
+ipaddr_autocfg
+--------------
+Autoconfigure IPv6 Address.
+
+Valid values: nd, dhcpv6 or disable
+qla4xxx don't support dhcpv6.
+
+link_local_autocfg
+------------------
+Autoconfigure IPv6 Link Local Address.
+
+IPv6 neighbor discovery protocol to discover Link Local Address.
+
+Valid values: auto or disable
+
+
+router_autocfg
+--------------
+Autoconfigure IPv6 Router address.
+
+IPv6 neighbor discovery protocol to discover a default router address.
+
+Valid values: auto or disable
+
+link_local_state
+----------------
+This Read-only attribute show Link Local IP address state in sysfs.
+
+Valid values: Unconfigured, Acquiring, Tentative, Valid, Disabling, Invalid,
+ Deprecated.
+
+
+router_state
+------------
+This Read-only attribute shows router state.
+
+Valid values: Unknown, Advertised, Manual, Stale.
+
+
+grat_neighbor_adv_en
+--------------------
+Enable Gratuitious Neighbor Advertisement
+
+Valid values: "enable" or "disable"
+
+mld_en
+------
+Enable IPv6 Multicast Listener Discovery
+
+Valid values: "enable" or "disable"
+
+flow_label
+----------
+This attribute specifies the default value of the Flow Label field in the
+IPv6 header of TCP packets transmitted on iSCSI connections
+
+Valid range: 20-bit value. [0-1048575]
+Value zero indicates that the traffic is not assigned to a labelled flow.
+
+traffic_class
+-------------
+This attribute specifies the IPv6 traffic class value to be used in IPv6
+TCP packets transmitted from the firmware on iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+hop_limit
+---------
+This attribute specifies the IPv6 hop limit value to be used in IPv6 TCP
+packets transmitted from the firmware on iSCSI connections
+
+Valid range: 8-bit value. [0-255]
+
+nd_reachable_tmo
+----------------
+This attribute specifies the time (in milliseconds) that a node assumes
+that the neighbor is reachable after confirmation.
+
+Valid range: 4-byte value. [0-4294967295]
+
+nd_rexmit_time
+--------------
+This attribute specifies the time (in milliseconds) between retransmitted
+neighbor solicitation messages.
+
+Valid range: 4-byte value. [0-4294967295]
+
+nd_stale_tmo
+------------
+This attribute specifies the time (in milliseconds) after which a stale
+neighbor or destination cache entry is discarded.
+
+Valid range: 4-byte value. [0-4294967295]
+
+dup_addr_detect_cnt
+-------------------
+This attribute specifies the IPv6 duplicate address detection count
+
+Valid range: 8-bit value. [0-255]
+ 0 - Disable
+ 1 - TryOnce
+ 2 - TryTwice, and so on
+
+router_adv_link_mtu
+-------------------
+IPv6 Router Advertised Link MTU Size.
+
+Valid range: 1280 bytes to 1500 bytes
+
+== Common ==
+enabled
+-------
+This attribute is used to enable or disable IPv4 or IPv6 protocol.
+
+Valid values: "enable" or "disable"
+
+vlan_id
+-------
+This attribute specifies 12-bit VLAN identifier (VID)
+
+Valid range: 12-bit value. [1-4094]
+
+vlan_priority
+-------------
+This attribute specifies Priority to outbound packets containing the
+specified VLAN-ID (VID)
+
+Valid range: 3-bit value. [0-7]
+
+vlan_enabled
+------------
+VLAN Tagging Enable.
+
+When this attribute is set to enable, use value set in vlan_id and
+vlan_priority to transmit IP packets, and discards IP packets that were
+received without a matching VLAN ID
+
+Valid values: "enable" or "disable"
+
+mtu
+---
+Ethernet MTU Size.
+
+This field specifies the maximum payload length in byte of an
+Ethernet frame supported by iSCSI initiator.
+
+Valid values: 576 bytes to 9000 bytes
+
+port
+----
+This attribute shows the initiator iSCSI port number.
+
+ipaddress_state
+---------------
+This Read-only attribute show IP address state.
+
+Valid values: Unconfigured, Acquiring, Tentative, Valid, Disabling, Invalid,
+ Deprecated.
+
+delayed_ack_en
+--------------
+When this attribute is set to enable, TCP delayed ACK is enabled.
+
+Valid values: "enable" or "disable"
+
+tcp_nagle_disable
+-----------------
+When this attribute is set to disable, TCP Nagle algorithm is disabled.
+
+Valid values: "enable" or "disable"
+
+tcp_wsf_disable
+---------------
+When this attribute is set to disable, TCP window scale is disabled.
+
+Valid values: "enable" or "disable"
+
+tcp_wsf
+-------
+This attribute specifies the TCP window scale factor to be negotiated
+on TCP connections.
+
+Valid range: 8-bit value. [0-255]
+
+tcp_timer_scale
+---------------
+The TCP Timer Scale is scale factor that adjusts the time interval between
+timer ticks on a TCP connection. The scale factor allows for faster time-outs
+for connections running on a very small network, versus connections running
+on a very large network.
+
+Valid range: 3-bit value. [0-7]
+
+tcp_timestamp_en
+----------------
+When this attribute is set to enable, iSCSI initiator negotiates to use time
+stamps in TCP headers
+
+Valid values: "enable" or "disable"
+
+cache_id
+--------
+This Read-only attribute is used to find the valid cache entries for the
+interface.
+
+For IPv4, ARP cache entry
+For IPv6, Neighbor cache entry
+
+redirect_en
+-----------
+For IPv4:
+When this attribute is set to enable, an ARP redirect can modify the address
+resolution protocol (ARP) table and any active connections.
+
+For IPv6:
+When this attribute is set to enable and neighbor advertisements are received,
+the connection table is examined and updated if any active connections match
+the IP address on the neighbor advertisement. This action is required for
+failover and redirect.
+
+Valid values: "enable" or "disable"
+
+def_taskmgmt_tmo
+----------------
+This attribute specifies timeout interval in seconds that iSCSI uses for
+timing out task-management commands.
+
+Valid range: 16-bit value [0-65535].
+
+header_digest
+-------------
+When this attribute is set to enable iSCSI initiator negotiates for
+HeaderDigest=CRC32 and when set to disable negotiates HeaderDigest=none.
+
+Valid values: "enable" or "disable"
+
+data_digest
+-----------
+When this attribute is set to enable iSCSI initiator negotiates for
+DataDigest=CRC32 and when set to disable negotiates DataDigest=none.
+
+Valid values: "enable" or "disable"
+
+immediate_data
+--------------
+When this attribute is set to enable iSCSI initiator negotiates for
+ImmediateData=yes and When set to disable negotiates ImmediateData=none
+
+Valid values: "enable" or "disable"
+
+initial_r2t
+-----------
+When this attribute is set to enable iSCSI initiator negotiates for
+InitialR2T=yes. When set to disable negotiates InitialR2T=no.
+
+Valid values: "enable" or "disable"
+
+data_seq_in_order
+-----------------
+When this attribute is set to enable iSCSI initiator set data sequences
+in order
+
+Valid values: "enable" or "disable"
+qla4xxx does not support out-of-order data sequences
+
+data_pdu_in_order
+-----------------
+When this attribute is set to enable iSCSI initiator set Data PDU
+in order
+
+Valid values: "enable" or "disable"
+qla4xxx does not support out-of-order Data PDUs.
+
+erl
+---
+Error Recovery Level
+
+This attribute specifies error recovery level (ERL) supported by the
+connection.
+
+Valid values: 2-bit value [0-2]
+
+max_recv_dlength
+----------------
+iSCSI Maximum Receive Data Segment Length.
+
+This attribute specifies Maximum data segment length in bytes, that receive
+in an iSCSI PDU.
+
+first_burst_len
+---------------
+iSCSI First Burst Length
+
+This attribute Specifies the maximum amount of unsolicited data an iSCSI
+initiator can send to the target during the execution of a single SCSI command,
+in bytes.
+
+max_outstanding_r2t
+-------------------
+iSCSI Maximum Outstanding R2T
+
+This attribute Specifies how many R2T PDUs per command can be outstanding
+during an iSCSI session.
+
+max_burst_len
+-------------
+This attribute Specifies the maximum length for unsolicited or immediate data
+iSCSI session can send or receive.
+
+chap_auth
+---------
+When this attribute is set to enable iSCSI session performs authentication
+during the security state of login phase.
+
+Valid values: "enable" or "disable"
+
+bidi_chap
+---------
+When this attribute is set to enable iSCSI session generates a CHAP challenge
+to any target that has issued a CHAP challenge to the iSCSI session.
+iSCSI session issues the challenge to the target after responding to the
+targets challenge. This attribute is ignored if chap_auth is set to disable.
+
+Valid values: "enable" or "disable"
+
+discovery_auth_optional
+-----------------------
+When this attribute is set to enable and the chap_auth is set to enable,
+iSCSI session does not require authentication on discovery sessions unless
+requested by the peer. When this attribute is set to disable iSCSI session
+requires CHAP authentication for a discovery session.
+
+Valid values: "enable" or "disable"
+
+discovery_logout
+----------------
+When this attribute is set to enable, iSCSI initiator initiates an iSCSI logout
+on a discovery session when discovery is complete (before closing the connection).
+When this attribute is set to disable, iSCSI initiator closes the connection when
+discovery is complete.
+
+Valid values: "enable" or "disable"
+
+strict_login_comp_en
+--------------------
+When this attribute is set to enable, iSCSI initiator enforces the iSCSI login
+negotiation rules. When this attribute is set to disable, iSCSI initiator does
+not enforce iSCSI login negotiation.
+
+Valid values: "enable" or "disable"
+
+initiator_name
+--------------
+This Read-only attribute contains the iSCSI Name string used by the firmware.
--
1.8.3.1

View File

@ -1,524 +0,0 @@
From fe6623803d1135fd382146faa847bcdf5dc6abc3 Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:13 -0500
Subject: [PATCH] iscsi_tool: Add offload host statistics support.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
include/iscsi_if.h | 116 ++++++++++++++++++++++++-
usr/iscsi_ipc.h | 2 +
usr/iscsiadm.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
usr/netlink.c | 47 +++++++++++
4 files changed, 406 insertions(+), 3 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index e59bcd0..9d15811 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -75,8 +75,8 @@ enum iscsi_uevent_e {
ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31,
-
- ISCSI_UEVENT_MAX = ISCSI_UEVENT_SET_CHAP,
+ ISCSI_UEVENT_GET_HOST_STATS = UEVENT_BASE + 32,
+ ISCSI_UEVENT_MAX = ISCSI_UEVENT_GET_HOST_STATS,
/* up events */
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -251,6 +251,10 @@ struct iscsi_uevent {
uint32_t host_no;
uint32_t sid;
} logout_flashnode_sid;
+ struct msg_get_host_stats {
+ uint32_t host_no;
+ } get_host_stats;
+
} u;
union {
/* messages k -> u */
@@ -854,4 +858,112 @@ struct iscsi_chap_rec {
uint8_t password_length;
};
+#define ISCSI_HOST_STATS_CUSTOM_MAX 32
+#define ISCSI_HOST_STATS_CUSTOM_DESC_MAX 64
+struct iscsi_host_stats_custom {
+ char desc[ISCSI_HOST_STATS_CUSTOM_DESC_MAX];
+ uint64_t value;
+};
+
+/* struct iscsi_offload_host_stats: Host statistics,
+ * Include statistics for MAC, IP, TCP & iSCSI.
+ */
+struct iscsi_offload_host_stats {
+ /* MAC */
+ uint64_t mactx_frames;
+ uint64_t mactx_bytes;
+ uint64_t mactx_multicast_frames;
+ uint64_t mactx_broadcast_frames;
+ uint64_t mactx_pause_frames;
+ uint64_t mactx_control_frames;
+ uint64_t mactx_deferral;
+ uint64_t mactx_excess_deferral;
+ uint64_t mactx_late_collision;
+ uint64_t mactx_abort;
+ uint64_t mactx_single_collision;
+ uint64_t mactx_multiple_collision;
+ uint64_t mactx_collision;
+ uint64_t mactx_frames_dropped;
+ uint64_t mactx_jumbo_frames;
+ uint64_t macrx_frames;
+ uint64_t macrx_bytes;
+ uint64_t macrx_unknown_control_frames;
+ uint64_t macrx_pause_frames;
+ uint64_t macrx_control_frames;
+ uint64_t macrx_dribble;
+ uint64_t macrx_frame_length_error;
+ uint64_t macrx_jabber;
+ uint64_t macrx_carrier_sense_error;
+ uint64_t macrx_frame_discarded;
+ uint64_t macrx_frames_dropped;
+ uint64_t mac_crc_error;
+ uint64_t mac_encoding_error;
+ uint64_t macrx_length_error_large;
+ uint64_t macrx_length_error_small;
+ uint64_t macrx_multicast_frames;
+ uint64_t macrx_broadcast_frames;
+ /* IP */
+ uint64_t iptx_packets;
+ uint64_t iptx_bytes;
+ uint64_t iptx_fragments;
+ uint64_t iprx_packets;
+ uint64_t iprx_bytes;
+ uint64_t iprx_fragments;
+ uint64_t ip_datagram_reassembly;
+ uint64_t ip_invalid_address_error;
+ uint64_t ip_error_packets;
+ uint64_t ip_fragrx_overlap;
+ uint64_t ip_fragrx_outoforder;
+ uint64_t ip_datagram_reassembly_timeout;
+ uint64_t ipv6tx_packets;
+ uint64_t ipv6tx_bytes;
+ uint64_t ipv6tx_fragments;
+ uint64_t ipv6rx_packets;
+ uint64_t ipv6rx_bytes;
+ uint64_t ipv6rx_fragments;
+ uint64_t ipv6_datagram_reassembly;
+ uint64_t ipv6_invalid_address_error;
+ uint64_t ipv6_error_packets;
+ uint64_t ipv6_fragrx_overlap;
+ uint64_t ipv6_fragrx_outoforder;
+ uint64_t ipv6_datagram_reassembly_timeout;
+ /* TCP */
+ uint64_t tcptx_segments;
+ uint64_t tcptx_bytes;
+ uint64_t tcprx_segments;
+ uint64_t tcprx_byte;
+ uint64_t tcp_duplicate_ack_retx;
+ uint64_t tcp_retx_timer_expired;
+ uint64_t tcprx_duplicate_ack;
+ uint64_t tcprx_pure_ackr;
+ uint64_t tcptx_delayed_ack;
+ uint64_t tcptx_pure_ack;
+ uint64_t tcprx_segment_error;
+ uint64_t tcprx_segment_outoforder;
+ uint64_t tcprx_window_probe;
+ uint64_t tcprx_window_update;
+ uint64_t tcptx_window_probe_persist;
+ /* ECC */
+ uint64_t ecc_error_correction;
+ /* iSCSI */
+ uint64_t iscsi_pdu_tx;
+ uint64_t iscsi_data_bytes_tx;
+ uint64_t iscsi_pdu_rx;
+ uint64_t iscsi_data_bytes_rx;
+ uint64_t iscsi_io_completed;
+ uint64_t iscsi_unexpected_io_rx;
+ uint64_t iscsi_format_error;
+ uint64_t iscsi_hdr_digest_error;
+ uint64_t iscsi_data_digest_error;
+ uint64_t iscsi_sequence_error;
+ /*
+ * iSCSI Custom Host Statistics support, i.e. Transport could
+ * extend existing host statistics with its own specific statistics
+ * up to ISCSI_HOST_STATS_CUSTOM_MAX
+ */
+ uint32_t custom_length;
+ struct iscsi_host_stats_custom custom[0]
+ __attribute__ ((aligned (sizeof(uint64_t))));
+};
+
#endif
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index a32da1c..9d26d54 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -161,6 +161,8 @@ struct iscsi_ipc {
uint32_t flashnode_idx);
int (*logout_flash_node_sid) (uint64_t transport_handle,
uint32_t host_no, uint32_t sid);
+ int (*get_host_stats) (uint64_t transport_handle, uint32_t host_no,
+ char *host_stats);
};
#endif /* ISCSI_IPC_H */
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 045259b..ed2c0c3 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -69,7 +69,8 @@ enum iscsiadm_mode {
MODE_FW,
MODE_PING,
MODE_CHAP,
- MODE_FLASHNODE
+ MODE_FLASHNODE,
+ MODE_HOST_STATS
};
enum iscsiadm_op {
@@ -137,6 +138,7 @@ iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\
iscsiadm -m fw [ -d debug_level ] [ -l ]\n\
iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
+iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ] | [ -C flashnode [ -o operation ] [ -A portal_type ] [ -x flashnode_idx ] [ -n name ] [ -v value ] ] | [ -C stats ] ]\n\
iscsiadm -k priority\n");
}
exit(status);
@@ -207,6 +209,9 @@ str_to_submode(char *str)
sub_mode = MODE_CHAP;
else if (!strcmp("flashnode", str))
sub_mode = MODE_FLASHNODE;
+ else if (!strcmp("stats", str))
+ sub_mode = MODE_HOST_STATS;
+
else
sub_mode = -1;
@@ -2025,6 +2030,232 @@ exit_flashnode_op:
return rc;
}
+static void print_host_stats(struct iscsi_offload_host_stats *host_stats)
+{
+ /* MAC */
+ printf("Host Statistics:\n"
+ "\tmactx_frames: %lld\n"
+ "\tmactx_bytes: %lld\n"
+ "\tmactx_multicast_frames: %lld\n"
+ "\tmactx_broadcast_frames: %lld\n"
+ "\tmactx_pause_frames: %lld\n"
+ "\tmactx_control_frames: %lld\n"
+ "\tmactx_deferral: %lld\n"
+ "\tmactx_excess_deferral: %lld\n"
+ "\tmactx_late_collision: %lld\n"
+ "\tmactx_abort: %lld\n"
+ "\tmactx_single_collision: %lld\n"
+ "\tmactx_multiple_collision: %lld\n"
+ "\tmactx_collision: %lld\n"
+ "\tmactx_frames_dropped: %lld\n"
+ "\tmactx_jumbo_frames: %lld\n"
+ "\tmacrx_frames: %lld\n"
+ "\tmacrx_bytes: %lld\n"
+ "\tmacrx_unknown_control_frames: %lld\n"
+ "\tmacrx_pause_frames: %lld\n"
+ "\tmacrx_control_frames: %lld\n"
+ "\tmacrx_dribble: %lld\n"
+ "\tmacrx_frame_length_error: %lld\n"
+ "\tmacrx_jabber: %lld\n"
+ "\tmacrx_carrier_sense_error: %lld\n"
+ "\tmacrx_frame_discarded: %lld\n"
+ "\tmacrx_frames_dropped: %lld\n"
+ "\tmac_crc_error: %lld\n"
+ "\tmac_encoding_error: %lld\n"
+ "\tmacrx_length_error_large: %lld\n"
+ "\tmacrx_length_error_small: %lld\n"
+ "\tmacrx_multicast_frames: %lld\n"
+ "\tmacrx_broadcast_frames: %lld\n"
+ /* IP */
+ "\tiptx_packets: %lld\n"
+ "\tiptx_bytes: %lld\n"
+ "\tiptx_fragments: %lld\n"
+ "\tiprx_packets: %lld\n"
+ "\tiprx_bytes: %lld\n"
+ "\tiprx_fragments: %lld\n"
+ "\tip_datagram_reassembly: %lld\n"
+ "\tip_invalid_address_error: %lld\n"
+ "\tip_error_packets: %lld\n"
+ "\tip_fragrx_overlap: %lld\n"
+ "\tip_fragrx_outoforder: %lld\n"
+ "\tip_datagram_reassembly_timeout: %lld\n"
+ "\tipv6tx_packets: %lld\n"
+ "\tipv6tx_bytes: %lld\n"
+ "\tipv6tx_fragments: %lld\n"
+ "\tipv6rx_packets: %lld\n"
+ "\tipv6rx_bytes: %lld\n"
+ "\tipv6rx_fragments: %lld\n"
+ "\tipv6_datagram_reassembly: %lld\n"
+ "\tipv6_invalid_address_error: %lld\n"
+ "\tipv6_error_packets: %lld\n"
+ "\tipv6_fragrx_overlap: %lld\n"
+ "\tipv6_fragrx_outoforder: %lld\n"
+ "\tipv6_datagram_reassembly_timeout: %lld\n"
+ /* TCP */
+ "\ttcptx_segments: %lld\n"
+ "\ttcptx_bytes: %lld\n"
+ "\ttcprx_segments: %lld\n"
+ "\ttcprx_byte: %lld\n"
+ "\ttcp_duplicate_ack_retx: %lld\n"
+ "\ttcp_retx_timer_expired: %lld\n"
+ "\ttcprx_duplicate_ack: %lld\n"
+ "\ttcprx_pure_ackr: %lld\n"
+ "\ttcptx_delayed_ack: %lld\n"
+ "\ttcptx_pure_ack: %lld\n"
+ "\ttcprx_segment_error: %lld\n"
+ "\ttcprx_segment_outoforder: %lld\n"
+ "\ttcprx_window_probe: %lld\n"
+ "\ttcprx_window_update: %lld\n"
+ "\ttcptx_window_probe_persist: %lld\n"
+ /* ECC */
+ "\tecc_error_correction: %lld\n"
+ /* iSCSI */
+ "\tiscsi_pdu_tx: %lld\n"
+ "\tiscsi_data_bytes_tx: %lld\n"
+ "\tiscsi_pdu_rx: %lld\n"
+ "\tiscsi_data_bytes_rx: %lld\n"
+ "\tiscsi_io_completed: %lld\n"
+ "\tiscsi_unexpected_io_rx: %lld\n"
+ "\tiscsi_format_error: %lld\n"
+ "\tiscsi_hdr_digest_error: %lld\n"
+ "\tiscsi_data_digest_error: %lld\n"
+ "\tiscsi_sequence_error: %lld\n",
+ /* MAC */
+ (unsigned long long)host_stats->mactx_frames,
+ (unsigned long long)host_stats->mactx_bytes,
+ (unsigned long long)host_stats->mactx_multicast_frames,
+ (unsigned long long)host_stats->mactx_broadcast_frames,
+ (unsigned long long)host_stats->mactx_pause_frames,
+ (unsigned long long)host_stats->mactx_control_frames,
+ (unsigned long long)host_stats->mactx_deferral,
+ (unsigned long long)host_stats->mactx_excess_deferral,
+ (unsigned long long)host_stats->mactx_late_collision,
+ (unsigned long long)host_stats->mactx_abort,
+ (unsigned long long)host_stats->mactx_single_collision,
+ (unsigned long long)host_stats->mactx_multiple_collision,
+ (unsigned long long)host_stats->mactx_collision,
+ (unsigned long long)host_stats->mactx_frames_dropped,
+ (unsigned long long)host_stats->mactx_jumbo_frames,
+ (unsigned long long)host_stats->macrx_frames,
+ (unsigned long long)host_stats->macrx_bytes,
+ (unsigned long long)host_stats->macrx_unknown_control_frames,
+ (unsigned long long)host_stats->macrx_pause_frames,
+ (unsigned long long)host_stats->macrx_control_frames,
+ (unsigned long long)host_stats->macrx_dribble,
+ (unsigned long long)host_stats->macrx_frame_length_error,
+ (unsigned long long)host_stats->macrx_jabber,
+ (unsigned long long)host_stats->macrx_carrier_sense_error,
+ (unsigned long long)host_stats->macrx_frame_discarded,
+ (unsigned long long)host_stats->macrx_frames_dropped,
+ (unsigned long long)host_stats->mac_crc_error,
+ (unsigned long long)host_stats->mac_encoding_error,
+ (unsigned long long)host_stats->macrx_length_error_large,
+ (unsigned long long)host_stats->macrx_length_error_small,
+ (unsigned long long)host_stats->macrx_multicast_frames,
+ (unsigned long long)host_stats->macrx_broadcast_frames,
+ /* IP */
+ (unsigned long long)host_stats->iptx_packets,
+ (unsigned long long)host_stats->iptx_bytes,
+ (unsigned long long)host_stats->iptx_fragments,
+ (unsigned long long)host_stats->iprx_packets,
+ (unsigned long long)host_stats->iprx_bytes,
+ (unsigned long long)host_stats->iprx_fragments,
+ (unsigned long long)host_stats->ip_datagram_reassembly,
+ (unsigned long long)host_stats->ip_invalid_address_error,
+ (unsigned long long)host_stats->ip_error_packets,
+ (unsigned long long)host_stats->ip_fragrx_overlap,
+ (unsigned long long)host_stats->ip_fragrx_outoforder,
+ (unsigned long long)host_stats->ip_datagram_reassembly_timeout,
+ (unsigned long long)host_stats->ipv6tx_packets,
+ (unsigned long long)host_stats->ipv6tx_bytes,
+ (unsigned long long)host_stats->ipv6tx_fragments,
+ (unsigned long long)host_stats->ipv6rx_packets,
+ (unsigned long long)host_stats->ipv6rx_bytes,
+ (unsigned long long)host_stats->ipv6rx_fragments,
+ (unsigned long long)host_stats->ipv6_datagram_reassembly,
+ (unsigned long long)host_stats->ipv6_invalid_address_error,
+ (unsigned long long)host_stats->ipv6_error_packets,
+ (unsigned long long)host_stats->ipv6_fragrx_overlap,
+ (unsigned long long)host_stats->ipv6_fragrx_outoforder,
+ (unsigned long long)host_stats->ipv6_datagram_reassembly_timeout,
+ /* TCP */
+ (unsigned long long)host_stats->tcptx_segments,
+ (unsigned long long)host_stats->tcptx_bytes,
+ (unsigned long long)host_stats->tcprx_segments,
+ (unsigned long long)host_stats->tcprx_byte,
+ (unsigned long long)host_stats->tcp_duplicate_ack_retx,
+ (unsigned long long)host_stats->tcp_retx_timer_expired,
+ (unsigned long long)host_stats->tcprx_duplicate_ack,
+ (unsigned long long)host_stats->tcprx_pure_ackr,
+ (unsigned long long)host_stats->tcptx_delayed_ack,
+ (unsigned long long)host_stats->tcptx_pure_ack,
+ (unsigned long long)host_stats->tcprx_segment_error,
+ (unsigned long long)host_stats->tcprx_segment_outoforder,
+ (unsigned long long)host_stats->tcprx_window_probe,
+ (unsigned long long)host_stats->tcprx_window_update,
+ (unsigned long long)host_stats->tcptx_window_probe_persist,
+ /* ECC */
+ (unsigned long long)host_stats->ecc_error_correction,
+ /* iSCSI */
+ (unsigned long long)host_stats->iscsi_pdu_tx,
+ (unsigned long long)host_stats->iscsi_data_bytes_tx,
+ (unsigned long long)host_stats->iscsi_pdu_rx,
+ (unsigned long long)host_stats->iscsi_data_bytes_rx,
+ (unsigned long long)host_stats->iscsi_io_completed,
+ (unsigned long long)host_stats->iscsi_unexpected_io_rx,
+ (unsigned long long)host_stats->iscsi_format_error,
+ (unsigned long long)host_stats->iscsi_hdr_digest_error,
+ (unsigned long long)host_stats->iscsi_data_digest_error,
+ (unsigned long long)host_stats->iscsi_sequence_error);
+}
+
+static int exec_host_stats_op(int op, int info_level, uint32_t host_no)
+{
+ struct iscsi_transport *t = NULL;
+ char *req_buf;
+ int rc = ISCSI_SUCCESS;
+ int fd = 0, buf_size = 0;
+
+ t = iscsi_sysfs_get_transport_by_hba(host_no);
+ if (!t) {
+ log_error("Could not match hostno %u to transport.", host_no);
+ rc = ISCSI_ERR_TRANS_NOT_FOUND;
+ goto exit_host_stats;
+ }
+
+ buf_size = sizeof(struct iscsi_offload_host_stats) +
+ sizeof(struct iscsi_uevent);
+ req_buf = calloc(1, buf_size);
+ if (!req_buf) {
+ log_error("Could not allocate memory for host stats request.");
+ rc = ISCSI_ERR_NOMEM;
+ goto exit_host_stats;
+ }
+
+ fd = ipc->ctldev_open();
+ if (fd < 0) {
+ rc = ISCSI_ERR_INTERNAL;
+ log_error("Netlink open failed.");
+ goto exit_host_stats;
+ }
+
+ rc = ipc->get_host_stats(t->handle, host_no, req_buf);
+ if (rc < 0) {
+ log_error("get_host_stats failed. errno=%d", errno);
+ rc = ISCSI_ERR;
+ goto exit_host_stats;
+ }
+
+ print_host_stats(req_buf + sizeof(struct iscsi_uevent));
+
+ ipc->ctldev_close();
+
+exit_host_stats:
+ if (req_buf)
+ free(req_buf);
+ return rc;
+}
+
static int verify_iface_params(struct list_head *params, struct node_rec *rec)
{
struct user_param *param;
@@ -3239,6 +3470,17 @@ main(int argc, char **argv)
index, portal_type,
&params);
break;
+ case MODE_HOST_STATS:
+ if (!host_no) {
+ log_error("STATS mode requires host no");
+ rc = ISCSI_ERR_INVAL;
+ break;
+ }
+
+ rc = exec_host_stats_op(op, info_level,
+ host_no);
+ break;
+
default:
log_error("Invalid Sub Mode");
break;
diff --git a/usr/netlink.c b/usr/netlink.c
index 151b56d..1c4b5cc 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -339,6 +339,10 @@ __kipc_call(struct iovec *iovp, int count)
} else if (ev->type == ISCSI_UEVENT_GET_CHAP) {
/* kget_chap() will read */
return 0;
+ } else if (ev->type == ISCSI_UEVENT_GET_HOST_STATS) {
+ /* kget_host_stats() will read */
+ return 0;
+
} else {
if ((rc = nlpayload_read(ctrl_fd, (void*)ev,
sizeof(*ev), 0)) < 0) {
@@ -1439,6 +1443,48 @@ klogout_flashnode_sid(uint64_t transport_handle, uint32_t host_no,
return 0;
}
+static int kget_host_stats(uint64_t transport_handle, uint32_t host_no,
+ char *host_stats)
+{
+ int rc = 0;
+ int ev_size;
+ struct iscsi_uevent ev;
+ struct iovec iov[2];
+ char nlm_ev[NLMSG_SPACE(sizeof(struct iscsi_uevent))];
+ struct nlmsghdr *nlh;
+
+ memset(&ev, 0, sizeof(struct iscsi_uevent));
+
+ ev.type = ISCSI_UEVENT_GET_HOST_STATS;
+ ev.transport_handle = transport_handle;
+ ev.u.get_host_stats.host_no = host_no;
+
+ iov[1].iov_base = &ev;
+ iov[1].iov_len = sizeof(ev);
+ rc = __kipc_call(iov, 2);
+ if (rc < 0)
+ return rc;
+
+ if ((rc = nl_read(ctrl_fd, nlm_ev,
+ NLMSG_SPACE(sizeof(struct iscsi_uevent)),
+ MSG_PEEK)) < 0) {
+ log_error("can not read nlm_ev, error %d", rc);
+ return rc;
+ }
+
+ nlh = (struct nlmsghdr *)nlm_ev;
+ ev_size = nlh->nlmsg_len - NLMSG_ALIGN(sizeof(struct nlmsghdr));
+
+ if ((rc = nlpayload_read(ctrl_fd, (void *)host_stats,
+ ev_size, 0)) < 0) {
+ log_error("can not read from NL socket, error %d", rc);
+ return rc;
+ }
+
+ return rc;
+}
+
+
static void drop_data(struct nlmsghdr *nlh)
{
int ev_size;
@@ -1737,6 +1783,7 @@ struct iscsi_ipc nl_ipc = {
.login_flash_node = klogin_flashnode,
.logout_flash_node = klogout_flashnode,
.logout_flash_node_sid = klogout_flashnode_sid,
+ .get_host_stats = kget_host_stats,
};
struct iscsi_ipc *ipc = &nl_ipc;
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From d1e8e68f440bbcf5c8b716572ccb3a0904dcd35e Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:14 -0500
Subject: [PATCH] README: Updated for host statistics.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
README | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/README b/README
index 813548d..06d1b6f 100644
--- a/README
+++ b/README
@@ -1073,6 +1073,14 @@ To now log into targets it is the same as with sofware iscsi. See section
is free then entry of type bidi chap will be created at that index
with given username_in and password_in values.
+ Host mode with stats submode:
+
+ - Display host statistics:
+ ./iscsiadm -m host -H 6 -C stats
+
+ This will print the aggregate statistics on the host adapter port.
+ This includes MAC, TCP/IP, ECC & iSCSI statistics.
+
6. Configuration
================
--
1.8.3.1

View File

@ -1,51 +0,0 @@
From 4a3076b56834d444eb9e19fc5fa25fff3a9624ec Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:15 -0500
Subject: [PATCH] iscsiadm.8: Updated man page for host statistics.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index 0e8149c..d59af43 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -18,6 +18,8 @@ iscsiadm \- open-iscsi administration utility
\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
+\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] | [ \-C stats ]]
+
\fBiscsiadm\fR \-k priority
.SH "DESCRIPTION"
@@ -72,12 +74,14 @@ Currently iscsiadm support ping as submode for iface. For example,
iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i interval
-For host, it supports chap and flashnode as submodes. For example,
+For host, it supports chap , flashnode and stats as submodes. For example,
iscsiadm -m host -H hostno -C chap -x chap_tbl_idx -o operation
iscsiadm -m host -H hostno -C flashnode -x flashnode_idx -o operation
+iscsiadm -m host -H hostno -C stats
+
.TP
\fB\-d\fR, \fB\-\-debug=\fIdebug_level\fP
print debugging information. Valid values for debug_level are 0 to 8.
@@ -279,6 +283,7 @@ tuple passed in.
.TP
\fB\-s\fR, \fB\-\-stats\fR
Display session statistics.
+This option when used with host mode, displays host statistics.
.TP
\fB\-S\fR, \fB\-\-show\fR
--
1.8.3.1

View File

@ -1,30 +0,0 @@
From 505ed9d3dbc6f3d746833a2cad7fb62d9ca20c35 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 30 Dec 2013 06:14:40 -0500
Subject: [PATCH] iscsi tools: Fix the iscsiadm help options for host mode
Removing the redundant help message for host mode of iscsiadm.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iscsiadm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index ed2c0c3..3cde8d1 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -137,8 +137,7 @@ iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,au
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\
iscsiadm -m fw [ -d debug_level ] [ -l ]\n\
-iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
-iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ] | [ -C flashnode [ -o operation ] [ -A portal_type ] [ -x flashnode_idx ] [ -n name ] [ -v value ] ] | [ -C stats ] ]\n\
+iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] | [ -C stats ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
iscsiadm -k priority\n");
}
exit(status);
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From bd91b810918df6ac09167aa37c6dc1f32bf907be Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 30 Dec 2013 06:14:41 -0500
Subject: [PATCH] Man page correction for host mode options of iscsiadm
Correct the help options of iscsiadm host mode in its man page.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index d59af43..9a945d1 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -16,9 +16,7 @@ iscsiadm \- open-iscsi administration utility
\fBiscsiadm\fR \-m fw [ \-d debug_level ] [\-l]
-\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
-
-\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] | [ \-C stats ]]
+\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] | [ \-C stats ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
\fBiscsiadm\fR \-k priority
--
1.8.3.1

View File

@ -1,75 +0,0 @@
From 77245b944b7d14a4e139984c3773e994c6ef6703 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:12 -0800
Subject: [PATCH] ISCSIUIO: Added tx doorbell override mechanism
Added a new tx doorbell field in the uio path to work with new
bnx2x/cnic drivers that supports VF_RSS.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/unix/libs/bnx2x.c | 13 ++++++++++---
iscsiuio/src/unix/libs/bnx2x.h | 9 ++++++++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index 36fc48e..748b59d 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -900,8 +900,14 @@ static int bnx2x_open(nic_t *nic)
struct client_init_general_data *data = bp->bufs;
bp->client_id = data->client_id;
- if (data->reserved0)
- bp->cid = data->reserved0;
+ if (data->uid.cid)
+ bp->cid = data->uid.cid;
+ if (bp->version.minor >= 78 && bp->version.sub_minor >= 55 &&
+ data->uid.cid_override_key == UIO_USE_TX_DOORBELL) {
+ bp->tx_doorbell = data->uid.tx_db_off;
+ LOG_INFO(PFX "%s: tx doorbell override offset = 0x%x",
+ nic->log_name, bp->tx_doorbell);
+ }
}
LOG_INFO(PFX "%s: func 0x%x, pfid 0x%x, client_id 0x%x, cid 0x%x",
@@ -928,7 +934,8 @@ static int bnx2x_open(nic_t *nic)
USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) :
USTORM_RX_PRODS_E1X_OFFSET(bp->port, bp->client_id));
- bp->tx_doorbell = bp->cid * 0x80 + 0x40;
+ if (!bp->tx_doorbell)
+ bp->tx_doorbell = bp->cid * 0x80 + 0x40;
bp->get_rx_cons = bnx2x_get_rx_60;
bp->get_tx_cons = bnx2x_get_tx_60;
diff --git a/iscsiuio/src/unix/libs/bnx2x.h b/iscsiuio/src/unix/libs/bnx2x.h
index 0b74e44..ce55cfc 100644
--- a/iscsiuio/src/unix/libs/bnx2x.h
+++ b/iscsiuio/src/unix/libs/bnx2x.h
@@ -382,6 +382,13 @@ union eth_rx_cqe_70 {
struct eth_rx_cqe_next_page_70 next_page_cqe_70;
};
+struct uio_init_data {
+ __u32 cid;
+ __u32 tx_db_off;
+ __u32 cid_override_key;
+#define UIO_USE_TX_DOORBELL 0x017855DB
+};
+
struct client_init_general_data {
__u8 client_id;
__u8 statistics_counter_id;
@@ -394,7 +401,7 @@ struct client_init_general_data {
__u8 func_id;
__u8 cos;
__u8 traffic_type;
- __u32 reserved0;
+ struct uio_init_data uid;
};
/******************************************************************************
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From df68365bef167778fb59059e78090d33a01e4e7f Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:13 -0800
Subject: [PATCH] ISCSIUIO: Added fix for the iface.subnet_mask decoding for
IPv6
Fixed a inet_pton decode error for the iface.subnet_mask for IPv6.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/unix/iscsid_ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index e22de0d..033308d 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -274,7 +274,7 @@ static int decode_iface(struct iface_rec_decode *ird, struct iface_rec *rec)
sizeof(struct in6_addr));
/* Subnet mask priority: CIDR, then rec */
if (!ird->ipv6_subnet_mask.s6_addr)
- inet_pton(AF_INET, rec->subnet_mask,
+ inet_pton(AF_INET6, rec->subnet_mask,
&ird->ipv6_subnet_mask);
/* For LL on, ignore the IPv6 addr in the iface */
--
1.8.3.1

View File

@ -1,41 +0,0 @@
From 817a0831c54f06dda2727fe1118e7a65181eb128 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:14 -0800
Subject: [PATCH] ISCSIUIO: Added fix for the ARP cache flush mechanism
The ARP cache table wasn't being flushed correctly due to a bug
in the time stamp comparison. The same bug can also be observed
to find the oldest entry in the ARP cache table to override.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/uip/uip_arp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/iscsiuio/src/uip/uip_arp.c b/iscsiuio/src/uip/uip_arp.c
index f7a9594..a8de07f 100644
--- a/iscsiuio/src/uip/uip_arp.c
+++ b/iscsiuio/src/uip/uip_arp.c
@@ -112,7 +112,7 @@ void uip_arp_timer(void)
for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
if ((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&
- arptime - tabptr->time >= UIP_ARP_MAXAGE)
+ (u8_t)(arptime - tabptr->time) >= UIP_ARP_MAXAGE)
memset(tabptr->ipaddr, 0, 4);
}
@@ -165,8 +165,8 @@ static void uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)
c = 0;
for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
- if (arptime - tabptr->time > tmpage) {
- tmpage = arptime - tabptr->time;
+ if ((u8_t)(arptime - tabptr->time) > tmpage) {
+ tmpage = (u8_t)(arptime - tabptr->time);
c = i;
}
}
--
1.8.3.1

View File

@ -1,102 +0,0 @@
From eb1d2751f989b8c9031964912ef2e952916735ca Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:15 -0800
Subject: [PATCH] ISCSIUIO: Updated RELEASE note and version
old version: 0.7.8.1b
new version: 0.7.8.2
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/README | 4 ++--
iscsiuio/RELEASE.TXT | 24 ++++++++++++++++++++++--
iscsiuio/configure.ac | 4 ++--
iscsiuio/docs/iscsiuio.8 | 2 +-
4 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/iscsiuio/README b/iscsiuio/README
index e7e5fe4..a283116 100644
--- a/iscsiuio/README
+++ b/iscsiuio/README
@@ -1,6 +1,6 @@
Iscsiuio Userspace Tool
-Version 0.7.8.1b
-May 01, 2013
+Version 0.7.8.2
+Dec 10, 2013
------------------------------------------------------
This tool is to be used in conjunction with the Broadcom NetXtreme II Linux
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index de70667..22628fd 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -1,7 +1,7 @@
Release Notes
Broadcom uIP Linux Driver
- Version 0.7.8.1b
- 05/01/2013
+ Version 0.7.8.2
+ 12/10/2013
Broadcom Corporation
5300 California Avenue,
@@ -10,6 +10,26 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
+uIP v0.7.8.2 (Dec 10, 2013)
+=======================================================
+ Fixes
+ -----
+ 1. Problem: Cont00072053 - Some hardware iSCSI paths fail during test
+ Cause: The test exercised a corner case where the ARP cache flush
+ mechanism didn't work properly
+ Change: Fixed the ARP cache flush mechanism
+ Impact: All
+
+ Enhancements
+ ------------
+ 1. Change: Added a new tx doorbell field in the uio path to work with
+ the new bnx2x/cnic drivers that supports VF_RSS
+ Impact: 10G only
+
+ 2. Change: Fixed the iface.subnet_mask decoding for IPv6
+ Impact: IPv6
+
+
uIP v0.7.8.1b (May 01, 2013)
=======================================================
Enhancements
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index e9a5e32..381b94d 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -11,9 +11,9 @@ dnl Benjamin Li (benli@broadcom.com)
dnl
PACKAGE=iscsiuio
-VERSION=0.7.8.1b
+VERSION=0.7.8.2
-AC_INIT(iscsiuio, 0.7.8.1b, eddie.wai@broadcom.com)
+AC_INIT(iscsiuio, 0.7.8.2, eddie.wai@broadcom.com)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_CONFIG_HEADER(config.h)
diff --git a/iscsiuio/docs/iscsiuio.8 b/iscsiuio/docs/iscsiuio.8
index ea21d78..3b50409 100644
--- a/iscsiuio/docs/iscsiuio.8
+++ b/iscsiuio/docs/iscsiuio.8
@@ -5,7 +5,7 @@
.\"
.\" bnx2.4,v 0.7.8.1b
.\"
-.TH iscsiuio 8 "05/01/2013" "Broadcom Corporation"
+.TH iscsiuio 8 "12/10/2013" "Broadcom Corporation"
.\"
.\" NAME part
.\"
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -1,701 +0,0 @@
From 5f2f3d74b2503e313b7909a3b436071a0757e582 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 9 Aug 2013 18:32:44 -0700
Subject: [PATCH] ISCSIUIO: Removed the auto-generated COPYING file
The automake generated COPYING file in the iscsiuio folder
unintentionally suggested that the iscsiuio source might be
released as GPL licensed instead of the intended 4-clause BSD
license.
The patch is to remove the COPYING file.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/COPYING | 674 -------------------------------------------------------
1 file changed, 674 deletions(-)
delete mode 100644 iscsiuio/COPYING
diff --git a/iscsiuio/COPYING b/iscsiuio/COPYING
deleted file mode 100644
index 94a9ed0..0000000
--- a/iscsiuio/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--
1.8.3.1

View File

@ -1,23 +0,0 @@
From a877c9dc79ef2c759cc96db8ff5de2e5be8087d9 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 31 Jan 2014 23:28:22 -0600
Subject: [PATCH] iscsiuio: fix compilation
Add missing $(AM_CFLAGS) to lib_iscsi_uip_a_CFLAGS.
---
iscsiuio/src/uip/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iscsiuio/src/uip/Makefile.am b/iscsiuio/src/uip/Makefile.am
index 65c1286..16170d7 100644
--- a/iscsiuio/src/uip/Makefile.am
+++ b/iscsiuio/src/uip/Makefile.am
@@ -15,4 +15,4 @@ lib_iscsi_uip_a_SOURCES = uip.c \
ipv6_ndpc.c \
ipv6.c
-lib_iscsi_uip_a_CFLAGS = -DBYTE_ORDER=@ENDIAN@
+lib_iscsi_uip_a_CFLAGS = -DBYTE_ORDER=@ENDIAN@ $(AM_CFLAGS)
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From 9ef01a7d13358e96627ae1d263fea5537c4ed6f7 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 29 Jan 2014 11:21:49 +0100
Subject: [PATCH] Add missing DESTDIR
Several Makefile targets are missing DESTDIR, making it
hard for packagers.
Signed-off-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 88b3529..79bad84 100644
--- a/Makefile
+++ b/Makefile
@@ -124,7 +124,7 @@ install_iface: $(IFACEFILES)
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces
install_etc: $(ETCFILES)
- if [ ! -f /etc/iscsi/iscsid.conf ]; then \
+ if [ ! -f $(DESTDIR)/etc/iscsi/iscsid.conf ]; then \
$(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \
fi
@@ -137,11 +137,11 @@ install_kernel:
$(MAKE) -C kernel install_kernel
install_iname:
- if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then \
+ if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \
echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \
echo "***************************************************" ; \
echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \
- echo "To override edit /etc/iscsi/initiatorname.iscsi" ; \
+ echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \
echo "***************************************************" ; \
fi
--
1.8.3.1

View File

@ -1,236 +0,0 @@
From ea05be3ff043efd44256283d968fa1bb9a371568 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Thu, 13 Feb 2014 12:37:09 -0600
Subject: [PATCH] iscsi tools: set non negotiated params early.
This patch has the iscsi tools pass down the non-negotiated
iscsi settings before doing iscsi login. This allows the
drivers to get info that might be neede to setup the session
early.
This patch also adds the missing discovery_sess param to
the non negotiated params.
---
usr/discovery.c | 15 +++++++++--
usr/initiator.c | 22 +++++++++++-----
usr/initiator.h | 1 +
usr/initiator_common.c | 69 ++++++++++++++++++++++++++++++++++++++++++++------
4 files changed, 91 insertions(+), 16 deletions(-)
diff --git a/usr/discovery.c b/usr/discovery.c
index afce6c0..635ec8d 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1403,6 +1403,17 @@ redirect_reconnect:
iscsi_copy_operational_params(&session->conn[0], &config->session_conf,
&config->conn_conf);
+ if (t->caps & CAP_TEXT_NEGO) {
+ log_debug(2, "%s discovery set params\n", __FUNCTION__);
+ rc = iscsi_session_set_params(conn);
+ if (rc) {
+ log_error("Could not set iscsi params for conn %d:%d "
+ "(err %d)\n", session->id, conn->id, rc);
+ rc = ISCSI_ERR_INTERNAL;
+ goto login_failed;
+ }
+ }
+
if ((session->t->caps & CAP_LOGIN_OFFLOAD))
goto start_conn;
@@ -1509,8 +1520,8 @@ redirect_reconnect:
return 0;
start_conn:
- log_debug(2, "%s discovery set params\n", __FUNCTION__);
- rc = iscsi_session_set_params(conn);
+ log_debug(2, "%s discovery set neg params\n", __FUNCTION__);
+ rc = iscsi_session_set_neg_params(conn);
if (rc) {
log_error("Could not set iscsi params for conn %d:%d (err "
"%d)\n", session->id, conn->id, rc);
diff --git a/usr/initiator.c b/usr/initiator.c
index 79d1779..05a5b19 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1048,12 +1048,7 @@ setup_full_feature_phase(iscsi_conn_t *conn)
actor_delete(&conn->login_timer);
- if (iscsi_session_set_params(conn)) {
- iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
- return;
- }
-
- if (iscsi_host_set_params(session)) {
+ if (iscsi_session_set_neg_params(conn)) {
iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
return;
}
@@ -1507,6 +1502,11 @@ static void setup_offload_login_phase(iscsi_conn_t *conn)
return;
}
+ if (iscsi_session_set_neg_params(conn)) {
+ iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
if (iscsi_host_set_params(session)) {
iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
return;
@@ -1618,6 +1618,16 @@ static void session_conn_poll(void *data)
return;
}
+ if (iscsi_session_set_params(conn)) {
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
+ if (iscsi_host_set_params(session)) {
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
if (iscsi_login_begin(session, c)) {
iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
return;
diff --git a/usr/initiator.h b/usr/initiator.h
index 680640c..c34625b 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -344,6 +344,7 @@ extern void free_initiator(void);
extern void iscsi_initiator_init(void);
/* initiator code common to discovery and normal sessions */
+extern int iscsi_session_set_neg_params(struct iscsi_conn *conn);
extern int iscsi_session_set_params(struct iscsi_conn *conn);
extern int iscsi_host_set_params(struct iscsi_session *session);
extern int iscsi_host_set_net_params(struct iface_rec *iface,
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index e2e87a1..109e8d7 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -345,9 +345,9 @@ void iscsi_session_init_params(struct iscsi_session *session)
}
}
-#define MAX_SESSION_PARAMS 35
+#define MAX_SESSION_NEG_PARAMS 16
-int iscsi_session_set_params(struct iscsi_conn *conn)
+int iscsi_session_set_neg_params(struct iscsi_conn *conn)
{
struct iscsi_session *session = conn->session;
int i, rc;
@@ -357,7 +357,7 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
int type;
void *value;
int conn_only;
- } conntbl[MAX_SESSION_PARAMS] = {
+ } conntbl[MAX_SESSION_NEG_PARAMS] = {
{
.param = ISCSI_PARAM_MAX_RECV_DLENGTH,
.value = &conn->max_recv_dlength,
@@ -434,15 +434,58 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.type = ISCSI_INT,
.conn_only = 1,
}, {
- .param = ISCSI_PARAM_TARGET_NAME,
- .conn_only = 0,
- .type = ISCSI_STRING,
- .value = session->target_name,
- }, {
.param = ISCSI_PARAM_TPGT,
.value = &session->portal_group_tag,
.type = ISCSI_INT,
.conn_only = 0,
+ },
+ };
+
+ iscsi_session_init_params(session);
+
+ /* Entered full-feature phase! */
+ for (i = 0; i < MAX_SESSION_NEG_PARAMS; i++) {
+ if (conn->id != 0 && !conntbl[i].conn_only)
+ continue;
+
+ if (!(session->param_mask & (1ULL << conntbl[i].param)))
+ continue;
+
+ rc = ipc->set_param(session->t->handle, session->id,
+ conn->id, conntbl[i].param, conntbl[i].value,
+ conntbl[i].type);
+ if (rc && rc != -ENOSYS) {
+ log_error("can't set operational parameter %d for "
+ "connection %d:%d, retcode %d (%d)",
+ conntbl[i].param, session->id, conn->id,
+ rc, errno);
+ return EPERM;
+ }
+
+ print_param_value(conntbl[i].param, conntbl[i].value,
+ conntbl[i].type);
+ }
+
+ return 0;
+}
+
+#define MAX_SESSION_PARAMS 20
+
+int iscsi_session_set_params(struct iscsi_conn *conn)
+{
+ struct iscsi_session *session = conn->session;
+ int i, rc;
+ struct connparam {
+ int param;
+ int type;
+ void *value;
+ int conn_only;
+ } conntbl[MAX_SESSION_PARAMS] = {
+ {
+ .param = ISCSI_PARAM_TARGET_NAME,
+ .conn_only = 0,
+ .type = ISCSI_STRING,
+ .value = session->target_name,
}, {
.param = ISCSI_PARAM_PERSISTENT_ADDRESS,
.value = session->nrec.conn[conn->id].address,
@@ -512,22 +555,32 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_IFACE_NAME,
.value = session->nrec.iface.name,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session->initiator_name,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_ROOT,
.value = session->nrec.session.boot_root,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_NIC,
.value = session->nrec.session.boot_nic,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_TARGET,
.value = session->nrec.session.boot_target,
.type = ISCSI_STRING,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_DISCOVERY_SESS,
+ .value = &session->type,
+ .type = ISCSI_INT,
+ .conn_only = 0,
},
};
--
1.8.3.1

View File

@ -1,30 +0,0 @@
From f2ecc22d3cb0473b117a33e048a5a56cd8e9e46d Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 24 Feb 2014 03:14:17 -0500
Subject: [PATCH] iscsiadm: Fix the hostno check for stats submode of host mode
This fixes the condition where hostno value of 0 was being treated
as invalid.
Signed-off-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iscsiadm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 3cde8d1..36617ab 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -3470,7 +3470,7 @@ main(int argc, char **argv)
&params);
break;
case MODE_HOST_STATS:
- if (!host_no) {
+ if (host_no > MAX_HOST_NO) {
log_error("STATS mode requires host no");
rc = ISCSI_ERR_INVAL;
break;
--
1.9.3

View File

@ -1,31 +0,0 @@
From b1526306e413f0874d608637cd2a9f6571ea4d32 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 24 Feb 2014 03:14:18 -0500
Subject: [PATCH] iscsiadm: Fix the compile time warning
This fixes the following compile time warning message:
iscsiadm.c:2248: warning: passing argument 1 of 'print_host_stats' from incompatible pointer type
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iscsiadm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 36617ab..389f4b8 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -2245,7 +2245,8 @@ static int exec_host_stats_op(int op, int info_level, uint32_t host_no)
goto exit_host_stats;
}
- print_host_stats(req_buf + sizeof(struct iscsi_uevent));
+ print_host_stats((struct iscsi_offload_host_stats *)(req_buf +
+ sizeof(struct iscsi_uevent)));
ipc->ctldev_close();
--
1.9.3

View File

@ -1,56 +0,0 @@
From 36a8b41de43749d91dfd52f9c8ad4a454c9a8f15 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 14 Mar 2014 01:41:29 -0500
Subject: [PATCH] iscsid: Fix handling of iscsi async events.
When iscsi targets send 32 or more iscsi async event pdus the
initiator will run out of memory for events and this message:
BUG: iscsid: Can not allocate memory for receive context.
will be logged non stop. iscsid will then not be able to
complate any more requests because it is stuck in a endless loop
printing that message.
This fixes the problem by having iscsid handle an event after it
has read it in from netlink or the mgmt ipc. Previously we would
queue all events then handle them.
---
usr/event_poll.c | 5 ++++-
usr/netlink.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/usr/event_poll.c b/usr/event_poll.c
index f36fec1..939f1a2 100644
--- a/usr/event_poll.c
+++ b/usr/event_poll.c
@@ -165,8 +165,11 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
"exiting", res, errno);
break;
}
- } else
+ }
+
+ if (res >= 0)
actor_poll();
+
reap_proc();
/*
* flush sysfs cache since kernel objs may
diff --git a/usr/netlink.c b/usr/netlink.c
index 1c4b5cc..532d9ef 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -1615,8 +1615,8 @@ static int ctldev_handle(void)
ev_context = ipc_ev_clbk->get_ev_context(conn, ev_size);
if (!ev_context) {
- /* retry later */
log_error("Can not allocate memory for receive context.");
+ drop_data(nlh);
return -ENOMEM;
}
--
1.9.3

View File

@ -1,41 +0,0 @@
From 5f28b8b73fbdb8c1e7fbe4a0e40dd2857b74b685 Mon Sep 17 00:00:00 2001
From: John Soni Jose <sony.john-n@emulex.com>
Date: Fri, 21 Mar 2014 11:51:09 +0530
Subject: [PATCH] be2iscsi: Fix MaxXmitDataLenght of the driver.
Issue :
During login negotiation if the MaxRecvDataSegmenLen given by the
target is 0, then MRDSL default value of 8K should be considered.
Some old targets close the CXN if the PDU received size is greater
than the MaxRecvDataSegmentLen set during negotiation.
Fix :
When target is not sending MaxRecvDataSegmentLen in the negotiated
params the value is 0. be2iscsi was setting max_xmit_dlength to 64k
in this case. This fix sets the MaxRecvDataSegmentLen=8k if during
negotiation the MaxRecvDataSegmentLen=0
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
---
usr/be2iscsi.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/usr/be2iscsi.c b/usr/be2iscsi.c
index ce8b719..ba4c29f 100644
--- a/usr/be2iscsi.c
+++ b/usr/be2iscsi.c
@@ -33,10 +33,6 @@ void be2iscsi_create_conn(struct iscsi_conn *conn)
if (conn->max_xmit_dlength > 65536)
conn->max_xmit_dlength = 65536;
- if (!conn_rec->iscsi.MaxXmitDataSegmentLength ||
- conn_rec->iscsi.MaxXmitDataSegmentLength > 65536)
- conn_rec->iscsi.MaxXmitDataSegmentLength = 65536;
-
session->erl = 0;
session->initial_r2t_en = 1;
}
--
1.9.3

View File

@ -1,61 +0,0 @@
From e696b94743d880c30c6e4e39c753e4d652845e85 Mon Sep 17 00:00:00 2001
From: John Soni Jose <jose0here@gmail.com>
Date: Fri, 21 Mar 2014 11:51:19 +0530
Subject: [PATCH] Fix StatSN in Open-iSCSI Stack.
When LIO target is used, STATSN in login response can be in
the range 0x0 - 0xFFFFFFFF. Open-iSCSI Stack had the type
as ISCSI_INT for StatSN, so StatSN used to get reset to 0.
Adding new type ISCSI_UINT feild to fix this issue.
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
---
usr/initiator_common.c | 2 +-
usr/iscsi_ipc.h | 1 +
usr/netlink.c | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 109e8d7..50f8d41 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -431,7 +431,7 @@ int iscsi_session_set_neg_params(struct iscsi_conn *conn)
}, {
.param = ISCSI_PARAM_EXP_STATSN,
.value = &conn->exp_statsn,
- .type = ISCSI_INT,
+ .type = ISCSI_UINT,
.conn_only = 1,
}, {
.param = ISCSI_PARAM_TPGT,
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index 9d26d54..5087b5c 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -30,6 +30,7 @@
enum {
ISCSI_INT,
+ ISCSI_UINT,
ISCSI_STRING,
};
diff --git a/usr/netlink.c b/usr/netlink.c
index 532d9ef..b0dfb03 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -716,6 +716,9 @@ kset_param(uint64_t transport_handle, uint32_t sid, uint32_t cid,
case ISCSI_INT:
sprintf(param_str, "%d", *((int *)value));
break;
+ case ISCSI_UINT:
+ sprintf(param_str, "%u", *((unsigned int *)value));
+ break;
case ISCSI_STRING:
if (!strlen(value))
return 0;
--
1.9.3

View File

@ -1,207 +0,0 @@
From c0e509e7535372cd5d655bc5a20d3d2bae45df84 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 7 May 2014 14:38:13 -0500
Subject: [PATCH] iscsid: retry login for ISCSI_ERR_HOST_NOT_FOUND
If a driver is being loaded then the scsi_host might not yet
be added. This has iscsid retry login if the host is not yet
in sysfs.
---
usr/initiator.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 100 insertions(+), 11 deletions(-)
diff --git a/usr/initiator.c b/usr/initiator.c
index 05a5b19..b4b8957 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -55,10 +55,19 @@
#define PROC_DIR "/proc"
+struct login_task_retry_info {
+ actor_t retry_actor;
+ queue_task_t *qtask;
+ node_rec_t *rec;
+ int retry_count;
+};
+
static void iscsi_login_timedout(void *data);
static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
struct iscsi_conn *conn, unsigned long tmo,
int event);
+static int queue_session_login_task_retry(struct login_task_retry_info *info,
+ node_rec_t *rec, queue_task_t *qtask);
static int iscsi_ev_context_alloc(iscsi_conn_t *conn)
{
@@ -324,14 +333,17 @@ session_release(iscsi_session_t *session)
}
static iscsi_session_t*
-__session_create(node_rec_t *rec, struct iscsi_transport *t)
+__session_create(node_rec_t *rec, struct iscsi_transport *t, int *rc)
{
iscsi_session_t *session;
- int hostno, rc = 0;
+ int hostno;
+
+ *rc = 0;
session = calloc(1, sizeof (*session));
if (session == NULL) {
log_debug(1, "can not allocate memory for session");
+ *rc = ISCSI_ERR_NOMEM;
return NULL;
}
log_debug(2, "Allocted session %p", session);
@@ -356,8 +368,8 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t)
session->initiator_name = dconfig->initiator_name;
else {
log_error("No initiator name set. Cannot create session.");
- free(session);
- return NULL;
+ *rc = ISCSI_ERR_INVAL;
+ goto free_session;
}
if (strlen(session->nrec.iface.alias))
@@ -386,8 +398,8 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t)
iscsi_session_init_params(session);
- hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, &rc);
- if (!rc) {
+ hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc);
+ if (!*rc) {
/*
* if the netdev or mac was set, then we are going to want
* to want to bind the all the conns/eps to a specific host
@@ -395,10 +407,18 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t)
*/
session->conn[0].bind_ep = 1;
session->hostno = hostno;
+ } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) {
+ goto free_session;
+ } else {
+ *rc = 0;
}
list_add_tail(&session->list, &t->sessions);
return session;
+
+free_session:
+ free(session);
+ return NULL;
}
static void iscsi_flush_context_pool(struct iscsi_session *session)
@@ -1862,8 +1882,7 @@ static int session_is_running(node_rec_t *rec)
return 0;
}
-int
-session_login_task(node_rec_t *rec, queue_task_t *qtask)
+static int __session_login_task(node_rec_t *rec, queue_task_t *qtask)
{
iscsi_session_t *session;
iscsi_conn_t *conn;
@@ -1930,8 +1949,10 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
rec->conn[0].iscsi.OFMarker = 0;
}
- session = __session_create(rec, t);
- if (!session)
+ session = __session_create(rec, t, &rc);
+ if (rc == ISCSI_ERR_HOST_NOT_FOUND)
+ return rc;
+ else if (!session)
return ISCSI_ERR_LOGIN;
/* FIXME: login all connections! marked as "automatic" */
@@ -1979,6 +2000,74 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
return ISCSI_SUCCESS;
}
+int
+session_login_task(node_rec_t *rec, queue_task_t *qtask)
+{
+ int rc;
+
+ rc = __session_login_task(rec, qtask);
+ if (rc == ISCSI_ERR_HOST_NOT_FOUND) {
+ rc = queue_session_login_task_retry(NULL, rec, qtask);
+ if (rc)
+ return rc;
+ /*
+ * we are going to internally retry. Will return final rc
+ * when completed
+ */
+ return ISCSI_SUCCESS;
+ }
+ return rc;
+}
+
+static void session_login_task_retry(void *data)
+{
+ struct login_task_retry_info *info = data;
+ int rc;
+
+ rc = __session_login_task(info->rec, info->qtask);
+ if (rc == ISCSI_ERR_HOST_NOT_FOUND) {
+ if (info->retry_count == 5) {
+ /* give up */
+ goto write_rsp;
+ }
+
+ rc = queue_session_login_task_retry(info, info->rec,
+ info->qtask);
+ if (rc)
+ goto write_rsp;
+ /* we are going to internally retry */
+ return;
+ } else if (rc) {
+ /* hard error - no retry */
+ goto write_rsp;
+ } else
+ /* successfully started login operation */
+ goto free;
+write_rsp:
+ mgmt_ipc_write_rsp(info->qtask, rc);
+free:
+ free(info);
+}
+
+static int queue_session_login_task_retry(struct login_task_retry_info *info,
+ node_rec_t *rec, queue_task_t *qtask)
+{
+ if (!info) {
+ info = malloc(sizeof(*info));
+ if (!info)
+ return ISCSI_ERR_NOMEM;
+ memset(info, 0, sizeof(*info));
+ info->qtask = qtask;
+ info->rec = rec;
+ }
+
+ info->retry_count++;
+ log_debug(4, "queue session setup attempt in %d secs, retries %d\n",
+ 3, info->retry_count);
+ actor_timer(&info->retry_actor, 3000, session_login_task_retry, info);
+ return 0;
+}
+
static int
sync_conn(iscsi_session_t *session, uint32_t cid)
{
@@ -2006,7 +2095,7 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid)
if (!t)
return ISCSI_ERR_TRANS_NOT_FOUND;
- session = __session_create(rec, t);
+ session = __session_create(rec, t, &err);
if (!session)
return ISCSI_ERR_LOGIN;
--
1.9.3

View File

@ -1,28 +0,0 @@
From 134f8dcbcdd76bf2418c64de1b4e3dca6163773d Mon Sep 17 00:00:00 2001
From: Duane Northcutt <jduanen@yahoo.com>
Date: Wed, 14 May 2014 11:23:23 -0700
Subject: [PATCH] iscsid: Fix double close of mgmt ipc fd
Ran into a problem where iscsiadm was closing an already closed fd
(returning EBADF. Seems like the close() in line 466 is redundant as
it is done in mgmt_ipc_destroy_queue_task(). Could also assign
qtask->mgmt_ipc_fd to NULL, but it seems better to do it this way.
---
usr/mgmt_ipc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index a82c063..ee037d9 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -463,7 +463,6 @@ mgmt_ipc_write_rsp(queue_task_t *qtask, int err)
qtask->rsp.err = err;
if (write(qtask->mgmt_ipc_fd, &qtask->rsp, sizeof(qtask->rsp)) < 0)
log_error("IPC qtask write failed: %s", strerror(errno));
- close(qtask->mgmt_ipc_fd);
mgmt_ipc_destroy_queue_task(qtask);
}
--
1.9.3

View File

@ -1,27 +0,0 @@
From 5762ac0a9520d10e727b539403eacb7ab092e45f Mon Sep 17 00:00:00 2001
From: Manish Rangankar <manish.rangankar@qlogic.com>
Date: Thu, 17 Jul 2014 05:27:20 -0400
Subject: [PATCH] iscsiadm: Initialize param_count in set_host_chap_info
Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iscsiadm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 389f4b8..f886d39 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1503,7 +1503,7 @@ static int set_host_chap_info(uint32_t host_no, uint64_t chap_index,
struct iovec *iovs = NULL;
struct iovec *iov = NULL;
int type;
- int param_count;
+ int param_count = 0;
int param_used;
int rc = 0;
int fd, i = 0;
--
1.9.3

View File

@ -1,100 +0,0 @@
From 96eaaacaeac39625508e6ec8022bb5e565c36a7c Mon Sep 17 00:00:00 2001
From: Anish Bhatt <anish@chelsio.com>
Date: Fri, 25 Jul 2014 12:42:27 -0700
Subject: [PATCH] iscsiadm : make iface.ipaddress optional in iface configs for
transports that don't have a hard requirement on it.
v2: cxgb4i changed to NOT_REQ as set ipaddress is not supported
Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
usr/initiator_common.c | 15 ++++++++++++---
usr/transport.c | 8 ++++----
usr/transport.h | 6 ++++++
3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 50f8d41..8ff993d 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -685,9 +685,18 @@ int iscsi_host_set_net_params(struct iface_rec *iface,
/* if we need to set the ip addr then set all the iface net settings */
if (!iface_is_bound_by_ipaddr(iface)) {
- log_warning("Please set the iface.ipaddress for iface %s, "
- "then retry the login command.\n", iface->name);
- return EINVAL;
+ if (t->template->set_host_ip == SET_HOST_IP_REQ) {
+ log_warning("Please set the iface.ipaddress for iface "
+ "%s, then retry the login command.\n",
+ iface->name);
+ return EINVAL;
+ } else if (t->template->set_host_ip == SET_HOST_IP_OPT) {
+ log_info("Optional iface.ipaddress for iface %s "
+ "not set.\n", iface->name);
+ return 0;
+ } else {
+ return EINVAL;
+ }
}
/* these type of drivers need the netdev upd */
diff --git a/usr/transport.c b/usr/transport.c
index 2f38519..630f163 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -58,7 +58,7 @@ struct iscsi_transport_template iscsi_iser = {
struct iscsi_transport_template cxgb3i = {
.name = "cxgb3i",
- .set_host_ip = 1,
+ .set_host_ip = SET_HOST_IP_OPT,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -67,7 +67,7 @@ struct iscsi_transport_template cxgb3i = {
struct iscsi_transport_template cxgb4i = {
.name = "cxgb4i",
- .set_host_ip = 1,
+ .set_host_ip = SET_HOST_IP_NOT_REQ,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
@@ -76,7 +76,7 @@ struct iscsi_transport_template cxgb4i = {
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
- .set_host_ip = 1,
+ .set_host_ip = SET_HOST_IP_REQ,
.use_boot_info = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
@@ -94,7 +94,7 @@ struct iscsi_transport_template be2iscsi = {
struct iscsi_transport_template qla4xxx = {
.name = "qla4xxx",
- .set_host_ip = 0,
+ .set_host_ip = SET_HOST_IP_NOT_REQ,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 388e4b1..73041fa 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -20,6 +20,12 @@
#include "types.h"
#include "config.h"
+enum set_host_ip_opts {
+ SET_HOST_IP_NOT_REQ, /* iface.ipaddress is not supported */
+ SET_HOST_IP_REQ, /* iface.ipaddress must be specified */
+ SET_HOST_IP_OPT, /* iface.ipaddress is not required */
+};
+
struct iscsi_transport;
struct iscsi_conn;
--
1.9.3

View File

@ -1,33 +0,0 @@
From 21a7923de5b2f968643c2ffd96e5c9fb1b201fa3 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 1 Jul 2014 11:14:26 +0200
Subject: [PATCH] Remove unused variable 'path'
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
usr/sysfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/usr/sysfs.c b/usr/sysfs.c
index 7f31c1a..d00c925 100644
--- a/usr/sysfs.c
+++ b/usr/sysfs.c
@@ -671,7 +671,6 @@ int sysfs_set_param(char *id, char *subsys, char *attr_name,
char devpath[PATH_SIZE];
size_t sysfs_len;
char path_full[PATH_SIZE];
- const char *path;
int rc = 0, fd;
if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath),
@@ -684,7 +683,6 @@ int sysfs_set_param(char *id, char *subsys, char *attr_name,
sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
if(sysfs_len >= sizeof(path_full))
sysfs_len = sizeof(path_full) - 1;
- path = &path_full[sysfs_len];
strlcat(path_full, devpath, sizeof(path_full));
strlcat(path_full, "/", sizeof(path_full));
strlcat(path_full, attr_name, sizeof(path_full));
--
1.9.3

View File

@ -1,81 +0,0 @@
From 78e24f50ab754f35f4aa208ade7c9fd794d82036 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 1 Jul 2014 11:14:57 +0200
Subject: [PATCH] Parse 'origin' value from iBFT
iBFT has an 'origin' field which indicates the origin of the
network address. If that is set to '3' it indicates that
DHCP has been used; there is no need to evaluate the 'dhcp'
field here.
In fact. latest iPXE sets the 'origin' field, but not the
'dhcp' field.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
include/fw_context.h | 1 +
utils/fwparam_ibft/fw_entry.c | 8 +++++---
utils/fwparam_ibft/fwparam_ibft_sysfs.c | 2 ++
utils/fwparam_ibft/fwparam_sysfs.c | 2 ++
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/fw_context.h b/include/fw_context.h
index 6563d68..295b54d 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -48,6 +48,7 @@ struct boot_context {
char initiatorname[TARGET_NAME_MAXLEN + 1];
/* network settings */
+ char origin[2];
char dhcp[NI_MAXHOST];
char iface[IF_NAMESIZE];
char mac[18];
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index b6f05c1..295e905 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -192,10 +192,12 @@ static void dump_network(struct boot_context *context)
if (strlen(context->mac))
printf("%s = %s\n", IFACE_HWADDR, context->mac);
/*
- * If this has a valid address then DHCP was used (broadcom sends
- * 0.0.0.0).
+ * If the 'origin' field is '3' then DHCP is used.
+ * Otherwise evaluate the 'dhcp' field, if this has a valid
+ * address then DHCP was used (broadcom sends 0.0.0.0).
*/
- if (strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0"))
+ if ((strlen(context->origin) && !strcmp(context->origin, "3")) ||
+ (strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0")))
printf("%s = DHCP\n", IFACE_BOOT_PROTO);
else
printf("%s = STATIC\n", IFACE_BOOT_PROTO);
diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
index 9185c85..2dc6f6d 100644
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
@@ -201,6 +201,8 @@ static int fill_nic_context(char *id, struct boot_context *context)
sizeof(context->secondary_dns));
sysfs_get_str(id, IBFT_SUBSYS, "dhcp", context->dhcp,
sizeof(context->dhcp));
+ sysfs_get_str(id, IBFT_SUBSYS, "origin", context->origin,
+ sizeof(context->origin));
return 0;
}
diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c
index 2f37b59..09dd9fd 100644
--- a/utils/fwparam_ibft/fwparam_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_sysfs.c
@@ -217,6 +217,8 @@ static int fill_nic_context(char *subsys, char *id,
sizeof(context->secondary_dns));
sysfs_get_str(id, subsys, "dhcp", context->dhcp,
sizeof(context->dhcp));
+ sysfs_get_str(id, subsys, "origin", context->origin,
+ sizeof(context->origin));
return 0;
}
--
1.9.3

Some files were not shown because too many files have changed in this diff Show More