115 lines
4.4 KiB
Diff
115 lines
4.4 KiB
Diff
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);
|