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