]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Disambiguate the expected target errors in the login response
authorMichael Brown <mcb30@ipxe.org>
Wed, 23 Feb 2011 09:52:02 +0000 (09:52 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 23 Feb 2011 09:52:02 +0000 (09:52 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/iscsi.h
src/net/tcp/iscsi.c

index 4890bcc6ddeb20b2b164ba167e08d21451702fc1..f336c7cc0e3e9dfa9c5577f9f8ae010cb995794b 100644 (file)
@@ -237,6 +237,8 @@ struct iscsi_bhs_login_response {
 #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND         0x03
 #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED           0x04
 #define ISCSI_STATUS_TARGET_ERROR              0x03
+#define ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE          0x01
+#define ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES         0x02
 
 /**
  * iSCSI SCSI command basic header segment
index dc272fdb1635912b3ac0c3c3a3c3b288d6fb9ed5..17cdaba24aa90e3215f24fab0d5bc402a57e5f7c 100644 (file)
@@ -75,6 +75,14 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
        __einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
 #define EINFO_EINVAL_NO_TARGET_IQN \
        __einfo_uniqify ( EINFO_EINVAL, 0x04, "No target IQN" )
+#define EIO_TARGET_UNAVAILABLE \
+       __einfo_error ( EINFO_EIO_TARGET_UNAVAILABLE )
+#define EINFO_EIO_TARGET_UNAVAILABLE \
+       __einfo_uniqify ( EINFO_EIO, 0x01, "Target not currently operational" )
+#define EIO_TARGET_NO_RESOURCES \
+       __einfo_error ( EINFO_EIO_TARGET_NO_RESOURCES )
+#define EINFO_EIO_TARGET_NO_RESOURCES \
+       __einfo_uniqify ( EINFO_EIO, 0x02, "Target out of resources" )
 #define ENOTSUP_INITIATOR_STATUS \
        __einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
@@ -87,6 +95,10 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
        __einfo_error ( EINFO_ENOTSUP_DISCOVERY )
 #define EINFO_ENOTSUP_DISCOVERY \
        __einfo_uniqify ( EINFO_ENOTSUP, 0x03, "Discovery not supported" )
+#define ENOTSUP_TARGET_STATUS \
+       __einfo_error ( EINFO_ENOTSUP_TARGET_STATUS )
+#define EINFO_ENOTSUP_TARGET_STATUS \
+       __einfo_uniqify ( EINFO_ENOTSUP, 0x04, "Unsupported target status" )
 #define EPERM_INITIATOR_AUTHENTICATION \
        __einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
@@ -1157,7 +1169,14 @@ static int iscsi_status_to_rc ( unsigned int status_class,
                        return -ENOTSUP_INITIATOR_STATUS;
                }
        case ISCSI_STATUS_TARGET_ERROR :
-               return -EIO;
+               switch ( status_detail ) {
+               case ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE:
+                       return -EIO_TARGET_UNAVAILABLE;
+               case ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES:
+                       return -EIO_TARGET_NO_RESOURCES;
+               default:
+                       return -ENOTSUP_TARGET_STATUS;
+               }
        default :
                return -EINVAL;
        }