Browse Source

[iscsi] Disambiguate the expected target errors in the login response

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
7ef314514c
2 changed files with 22 additions and 1 deletions
  1. 2
    0
      src/include/ipxe/iscsi.h
  2. 20
    1
      src/net/tcp/iscsi.c

+ 2
- 0
src/include/ipxe/iscsi.h View File

@@ -237,6 +237,8 @@ struct iscsi_bhs_login_response {
237 237
 #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND		0x03
238 238
 #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED		0x04
239 239
 #define ISCSI_STATUS_TARGET_ERROR		0x03
240
+#define ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE		0x01
241
+#define ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES		0x02
240 242
 
241 243
 /**
242 244
  * iSCSI SCSI command basic header segment

+ 20
- 1
src/net/tcp/iscsi.c View File

@@ -75,6 +75,14 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
75 75
 	__einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
76 76
 #define EINFO_EINVAL_NO_TARGET_IQN \
77 77
 	__einfo_uniqify ( EINFO_EINVAL, 0x04, "No target IQN" )
78
+#define EIO_TARGET_UNAVAILABLE \
79
+	__einfo_error ( EINFO_EIO_TARGET_UNAVAILABLE )
80
+#define EINFO_EIO_TARGET_UNAVAILABLE \
81
+	__einfo_uniqify ( EINFO_EIO, 0x01, "Target not currently operational" )
82
+#define EIO_TARGET_NO_RESOURCES \
83
+	__einfo_error ( EINFO_EIO_TARGET_NO_RESOURCES )
84
+#define EINFO_EIO_TARGET_NO_RESOURCES \
85
+	__einfo_uniqify ( EINFO_EIO, 0x02, "Target out of resources" )
78 86
 #define ENOTSUP_INITIATOR_STATUS \
79 87
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
80 88
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
@@ -87,6 +95,10 @@ FEATURE ( FEATURE_PROTOCOL, "iSCSI", DHCP_EB_FEATURE_ISCSI, 1 );
87 95
 	__einfo_error ( EINFO_ENOTSUP_DISCOVERY )
88 96
 #define EINFO_ENOTSUP_DISCOVERY \
89 97
 	__einfo_uniqify ( EINFO_ENOTSUP, 0x03, "Discovery not supported" )
98
+#define ENOTSUP_TARGET_STATUS \
99
+	__einfo_error ( EINFO_ENOTSUP_TARGET_STATUS )
100
+#define EINFO_ENOTSUP_TARGET_STATUS \
101
+	__einfo_uniqify ( EINFO_ENOTSUP, 0x04, "Unsupported target status" )
90 102
 #define EPERM_INITIATOR_AUTHENTICATION \
91 103
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
92 104
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
@@ -1157,7 +1169,14 @@ static int iscsi_status_to_rc ( unsigned int status_class,
1157 1169
 			return -ENOTSUP_INITIATOR_STATUS;
1158 1170
 		}
1159 1171
 	case ISCSI_STATUS_TARGET_ERROR :
1160
-		return -EIO;
1172
+		switch ( status_detail ) {
1173
+		case ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE:
1174
+			return -EIO_TARGET_UNAVAILABLE;
1175
+		case ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES:
1176
+			return -EIO_TARGET_NO_RESOURCES;
1177
+		default:
1178
+			return -ENOTSUP_TARGET_STATUS;
1179
+		}
1161 1180
 	default :
1162 1181
 		return -EINVAL;
1163 1182
 	}

Loading…
Cancel
Save