File libhbalinux-fix-issue-preventi of Package libhbalinux2

libhbalinux: fix issue preventing luns display for luns higher than 1023

From: Vasu Dev <vasu.dev@intel.com>

Removes check blocking lun value higher than 1023 as fcoeadm needs to
display them as well.

Currently lun value is retrieved from their scsi int value representation
in /sysfs and stored in double long after 48 bit left shift, and later
stored value used in comparing against same /sysfs int value after 48 bit
right shift to stored value, this is issue for higher luns value as second
48 bits right shift won't give same value as it was originally from /sysfs
and in turn compare always fails for such cases and in turn their lun info
is never displayed with fcoeadm -l or -t options.

So instead of doing these bits shifts for their only use to compare /sysfs
int value, just store int value as is to keep their value intact for higher
luns value also.

Also maxframe_size is not supported by all HBAs, thus ignore rc
for reading maxframe_size to avoid following error print.
        fprintf(stderr, "%s: errors (%x) from /sys reads in %s\n",
                __func__, rc, dp->d_name);

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---

 bind.c  |    9 ++-------
 rport.c |    2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)


diff --git a/bind.c b/bind.c
index b6cc103..5590636 100644
--- a/bind.c
+++ b/bind.c
@@ -251,7 +251,7 @@ get_binding_target_mapping(struct dirent *dp, void *ctxt_arg)
 			fcp->FcId = pp->ap_attr.PortFcId;
 			fcp->NodeWWN = pp->ap_attr.NodeWWN;
 			fcp->PortWWN = pp->ap_attr.PortWWN;
-			fcp->FcpLun = (HBA_UINT64) lun << 48;
+			fcp->FcpLun = (HBA_UINT64) lun;
 		}
 
 		/*
@@ -364,11 +364,6 @@ get_binding_sg_name(struct port_info *lp, HBA_WWN disc_wwpn,
 	if (rp == NULL)
 		return HBA_STATUS_ERROR_ILLEGAL_WWN;
 
-	/*
-	 * Check for LUN more than 1023 or multi-level.
-	 */
-	if (fc_lun & ((0xfc01ULL << 48) - 1))
-		return HBA_STATUS_ERROR;
 	memset(&ctxt, 0, sizeof(ctxt));
 	memset(&entry, 0, sizeof(entry));
 	ctxt.oc_rport = rp;
@@ -377,7 +372,7 @@ get_binding_sg_name(struct port_info *lp, HBA_WWN disc_wwpn,
 	ctxt.oc_target = rp->ap_scsi_target;
 	if (ctxt.oc_target == -1)
 		return ENOENT;
-	ctxt.oc_lun = fc_lun >> 48;
+	ctxt.oc_lun = (int) fc_lun;
 	ctxt.oc_limit = 1;
 	ctxt.oc_ver = 1;
 	ctxt.oc_entries = &entry;
diff --git a/rport.c b/rport.c
index 7b72872..1460c2e 100644
--- a/rport.c
+++ b/rport.c
@@ -80,7 +80,7 @@ sysfs_get_rport(struct dirent *dp, void *arg)
 	rc |= sys_read_wwn(rport_dir, "port_name", &rpa->PortWWN);
 	rc |= sa_sys_read_u32(rport_dir, "port_id", &rpa->PortFcId);
 	rc |= sa_sys_read_u32(rport_dir, "scsi_target_id", &rp->ap_scsi_target);
-	rc |= sa_sys_read_line(rport_dir, "maxframe_size", buf, sizeof(buf));
+	sa_sys_read_line(rport_dir, "maxframe_size", buf, sizeof(buf));
 	sscanf(buf, "%d", &rpa->PortMaxFrameSize);
 	rc |= sys_read_port_state(rport_dir, "port_state", &rpa->PortState);
 	rc |= sys_read_classes(rport_dir, "supported_classes",
openSUSE Build Service is sponsored by