fixes for iscsiadm to support qla4xxx

Resolves: #1007388

refresh boot session info patches to final version from upstream,
fixes context issues with later patches

Signed-off-by: Chris Leech <cleech@redhat.com>
This commit is contained in:
Chris Leech 2014-02-17 14:00:46 -08:00
parent 40630bc648
commit 2c4537b393
7 changed files with 703 additions and 56 deletions

View File

@ -0,0 +1,213 @@
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

@ -0,0 +1,74 @@
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

@ -0,0 +1,369 @@
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,26 +1,29 @@
From 68ef07c23f7c0d1ea6b502c28be1152e77ff1bde Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:15 -0700
Subject: ISCSISTART: Saved ibft boot info to the session sysfs
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
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_if.h | 4 ++++
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 ++++++++
7 files changed, 38 insertions(+), 1 deletion(-)
6 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
@ -36,21 +39,6 @@ index 1640859..6563d68 100644
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 20f2bc2..b47dde7 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -495,6 +495,10 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+ ISCSI_PARAM_BOOT_ROOT,
+ ISCSI_PARAM_BOOT_NIC,
+ ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
};
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
@ -95,11 +83,11 @@ index bc06058..1e4f8c8 100644
iface_setup_from_boot_context(&rec->iface, context);
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index eb72795..544d637 100644
index 0fb7edc..e2e87a1 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
@@ -345,7 +345,7 @@ void iscsi_session_init_params(struct iscsi_session *session)
}
}
-#define MAX_SESSION_PARAMS 32
@ -107,7 +95,7 @@ index eb72795..544d637 100644
int iscsi_session_set_params(struct iscsi_conn *conn)
{
@@ -496,6 +496,18 @@ 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,
@ -160,5 +148,5 @@ index 3997363..2f37b59 100644
* 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.1.4
1.8.3.1

View File

@ -1,7 +1,7 @@
From d86ca42685620ad3263da098923308a3a00ac55a Mon Sep 17 00:00:00 2001
From 487c312c96379e45648c782cee5b0d469cba80d0 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:16 -0700
Subject: ISCSID: Added the extraction of the session boot info
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
@ -13,12 +13,12 @@ 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 | 2 ++
usr/transport.c | 1 +
usr/transport.h | 1 +
3 files changed, 43 insertions(+)
3 files changed, 42 insertions(+)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index aed10a3..79ec79d 100644
index aed10a3..56cb90c 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -674,6 +674,43 @@ free_fnode:
@ -69,25 +69,17 @@ index aed10a3..79ec79d 100644
}
}
+ if (t->template->use_boot_info && session)
+ 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..4d030a8 100644
index 52b7674..2f38519 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -42,6 +42,7 @@
struct iscsi_transport_template iscsi_tcp = {
.name = "tcp",
+ .use_boot_info = 1,
.ep_connect = iscsi_io_tcp_connect,
.ep_poll = iscsi_io_tcp_poll,
.ep_disconnect = iscsi_io_tcp_disconnect,
@@ -77,6 +78,7 @@ struct iscsi_transport_template cxgb4i = {
@@ -77,6 +77,7 @@ struct iscsi_transport_template cxgb4i = {
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.set_host_ip = 1,
@ -108,5 +100,5 @@ index 5dcf872..388e4b1 100644
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
--
1.8.1.4
1.8.3.1

View File

@ -1,7 +1,7 @@
From ec7d79ed691619b6ffa8c25f162ce62e1e25e6c1 Mon Sep 17 00:00:00 2001
From 3b4b45001b6d8412aad76a55347de42d30d694f7 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:17 -0700
Subject: ISCSID: Added iface content override fix
Date: Fri, 23 Aug 2013 14:04:12 -0700
Subject: [PATCH] ISCSID: Added iface content override fix
Patch provided by Mike Christie.
@ -53,5 +53,5 @@ index 8f19220..d1756ef 100644
/* multiple drivers could be connected to the same portal */
--
1.8.1.4
1.8.3.1

View File

@ -4,7 +4,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 18%{?dist}
Release: 19%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -41,10 +41,13 @@ Patch24: 0024-Fix-discovery-error-return-without-return-value.patch
Patch25: 0025-iscsid-Fix-strlen-parameter.patch
Patch26: 0026-iscsiuio-Change-socket-bind-to-use-the-same-struct-s.patch
Patch27: 0027-Make-rescan-run-in-parallel.patch
Patch28: 0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch
Patch29: 0029-iscsi-tools-Print-additional-session-info-for-flashn.patch
Patch30: 0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch
Patch31: 0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch
Patch32: 0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
Patch33: 0033-ISCSID-Added-iface-content-override-fix.patch
# not (yet) upstream merged
Patch40: 0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch
Patch41: 0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
Patch42: 0042-ISCSID-Added-iface-content-override-fix.patch
Patch43: 0043-idmb_rec_write-check-for-tpgt-first.patch
Patch45: 0045-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch46: 0046-idbw_rec_write-pick-tpgt-from-existing-record.patch
@ -123,10 +126,13 @@ developing applications that use %{name}.
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
# pending upstream merge
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch45 -p1
%patch46 -p1
@ -297,6 +303,11 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Mon Feb 17 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-19
- 1007388 fixes for iscsiadm to support qla4xxx
- refresh boot session info patches to final version from upstream,
fixes context issues with later patches
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 6.2.0.873-18
- Mass rebuild 2014-01-24