[iscsi-initiator-utils: 66/109] Resolves: #696267

Chris Leech cleech at fedoraproject.org
Tue Dec 10 21:24:56 UTC 2013


commit a094452bde92557d722c050f62288bdf51b99d3f
Author: mchristi <mchristi at redhat.com>
Date:   Mon Apr 18 18:06:37 2011 +0000

    Resolves: #696267

 iscsi-initiator-utils-fix-bnx2i-mac-match.patch |  114 +++++++++++++++++++++++
 iscsi-initiator-utils.spec                      |    9 ++-
 2 files changed, 122 insertions(+), 1 deletions(-)
---
diff --git a/iscsi-initiator-utils-fix-bnx2i-mac-match.patch b/iscsi-initiator-utils-fix-bnx2i-mac-match.patch
new file mode 100644
index 0000000..09fafbc
--- /dev/null
+++ b/iscsi-initiator-utils-fix-bnx2i-mac-match.patch
@@ -0,0 +1,114 @@
+diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iface.c
+--- open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c	2011-04-18 12:50:45.000000000 -0500
++++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iface.c	2011-04-18 12:51:50.000000000 -0500
+@@ -788,42 +788,50 @@ void iface_link_ifaces(struct list_head 
+ int iface_setup_from_boot_context(struct iface_rec *iface,
+ 				   struct boot_context *context)
+ {
++	struct iscsi_transport *t;
++	uint32_t hostno;
++	int rc;
++
+ 	if (strlen(context->initiatorname))
+ 		strlcpy(iface->iname, context->initiatorname,
+ 			sizeof(iface->iname));
+ 
+ 	if (strlen(context->scsi_host_name)) {
+-		struct iscsi_transport *t;
+-		uint32_t hostno;
+-
+ 		if (sscanf(context->scsi_host_name, "iscsi_boot%u", &hostno) != 		    1) {
+ 			log_error("Could not parse %s's host no.",
+ 				  context->scsi_host_name);
+ 			return 0;
+ 		}
+-		t = iscsi_sysfs_get_transport_by_hba(hostno);
+-		if (!t) {
+-			log_error("Could not get transport for %s. "
+-				  "Make sure the iSCSI driver is loaded.",
+-				  context->scsi_host_name);
++	} else if (strlen(context->iface)) {
++		hostno = iscsi_sysfs_get_host_no_from_hwaddress(context->mac,
++								&rc);
++		if (rc) {
++			/*
++			 * If the MAC in the boot info does not match a iscsi
++			 * host then the MAC must be for network card, so boot
++			 * is not going to be offloaded.
++			 */
++			log_debug(3, "Could not match %s to host\n",
++				  context->mac);
+ 			return 0;
+ 		}
+ 
+-		log_debug(3, "boot context has %s transport %s",
+-			  context->scsi_host_name, t->name);
+-		strcpy(iface->transport_name, t->name);
+-	} else if (strlen(context->iface) &&
+-		 (!net_get_transport_name_from_netdev(context->iface,
+-						iface->transport_name))) {
+-		log_debug(3, "boot context has netdev %s",
+-			  context->iface);
+-		strlcpy(iface->netdev, context->iface,
+-			sizeof(iface->netdev));
++		strlcpy(iface->netdev, context->iface, sizeof(iface->netdev));
+ 	} else
+ 		return 0;
++
+ 	/*
+ 	 * set up for access through a offload card.
+ 	 */
++	t = iscsi_sysfs_get_transport_by_hba(hostno);
++	if (!t) {
++		log_error("Could not get transport for host%u. "
++			  "Make sure the iSCSI driver is loaded.",
++			  hostno);
++		return 0;
++	}
++	strcpy(iface->transport_name, t->name);
++
+ 	memset(iface->name, 0, sizeof(iface->name));
+ 	snprintf(iface->name, sizeof(iface->name), "%s.%s",
+ 		 iface->transport_name, context->mac);
+diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c
+--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c	2011-04-18 12:50:45.000000000 -0500
++++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c	2011-04-18 12:51:30.000000000 -0500
+@@ -332,7 +332,7 @@ static int __get_host_no_from_hwaddress(
+ 	return 0;
+ }
+ 
+-static uint32_t get_host_no_from_hwaddress(char *address, int *rc)
++uint32_t iscsi_sysfs_get_host_no_from_hwaddress(char *hwaddress, int *rc)
+ {
+ 	uint32_t host_no = -1;
+ 	struct host_info *info;
+@@ -345,7 +345,7 @@ static uint32_t get_host_no_from_hwaddre
+ 		*rc = ISCSI_ERR_NOMEM;
+ 		return -1;
+ 	}
+-	strcpy(info->iface.hwaddress, address);
++	strcpy(info->iface.hwaddress, hwaddress);
+ 
+ 	local_rc = iscsi_sysfs_for_each_host(info, &nr_found,
+ 					__get_host_no_from_hwaddress);
+@@ -401,7 +401,8 @@ uint32_t iscsi_sysfs_get_host_no_from_hw
+ 
+ 	if (strlen(iface->hwaddress) &&
+ 	    strcasecmp(iface->hwaddress, DEFAULT_HWADDRESS))
+-		host_no = get_host_no_from_hwaddress(iface->hwaddress, &tmp_rc);
++		host_no = iscsi_sysfs_get_host_no_from_hwaddress(
++						iface->hwaddress, &tmp_rc);
+ 	else if (strlen(iface->netdev) &&
+ 		strcasecmp(iface->netdev, DEFAULT_NETDEV))
+ 		host_no = get_host_no_from_netdev(iface->netdev, &tmp_rc);
+diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.h open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.h
+--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.h	2011-04-18 12:50:45.000000000 -0500
++++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.h	2011-04-18 12:51:30.000000000 -0500
+@@ -51,6 +51,7 @@ extern int iscsi_sysfs_for_each_host(voi
+ extern uint32_t iscsi_sysfs_get_host_no_from_sid(uint32_t sid, int *err);
+ extern uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct iface_rec *iface,
+ 						    int *rc);
++extern uint32_t iscsi_sysfs_get_host_no_from_hwaddress(char *hwaddress, int *rc);
+ extern int iscsi_sysfs_get_hostinfo_by_host_no(struct host_info *hinfo);
+ extern int iscsi_sysfs_get_sid_from_path(char *session);
+ extern char *iscsi_sysfs_get_blockdev_from_lun(int hostno, int target, int sid);
diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec
index 234cfbd..2ce83a7 100644
--- a/iscsi-initiator-utils.spec
+++ b/iscsi-initiator-utils.spec
@@ -3,7 +3,7 @@
 Summary: iSCSI daemon and utility programs
 Name: iscsi-initiator-utils
 Version: 6.2.0.872
-Release: 19%{?dist}
+Release: 20%{?dist}
 Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc4-bnx2i.tar.gz
 Source1: iscsid.init
 Source2: iscsidevs.init
@@ -45,6 +45,8 @@ Patch14: iscsi-initiator-utils-libiscsi-nodes-remember-the-interface.patch
 Patch15: iscsi-initiator-utils-fixes.patch
 # node mode hostname support
 Patch16: iscsi-initiator-utils-node-hostname.patch
+# created offload boot session if ibft and iscsi_host mac match
+Patch17: iscsi-initiator-utils-fix-bnx2i-mac-match.patch
 
 Group: System Environment/Daemons
 License: GPLv2+
@@ -89,6 +91,7 @@ developing applications that use %{name}.
 %patch14 -p1 -b .libiscsi-remember-the-interface
 %patch15 -p1 -b .fixes
 %patch16 -p1 -b .node-hostname
+%patch17 -p1 -b .fix-bnx2i-mac-match
 
 %build
 cd utils/open-isns
@@ -207,6 +210,10 @@ fi
 %{_includedir}/libiscsi.h
 
 %changelog
+* Mon Apr 18 2011 Mike Christie <mcrhsit at redhat.com> 6.2.0.872.20
+- 696267 Create a offloaded session if the iscsi_host MAC and ibft
+MAC match. This enables support for Broadcoms hba boot mode.
+
 * Tue Apr 5 2011 Mike Christie <mcrhsit at redhat.com> 6.2.0.872.19
 - 624437 support hostnames in node mode. [patch merged in .14 got
  dropped by accident]


More information about the scm-commits mailing list