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
 #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND		0x03
237
 #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND		0x03
238
 #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED		0x04
238
 #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED		0x04
239
 #define ISCSI_STATUS_TARGET_ERROR		0x03
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
  * iSCSI SCSI command basic header segment
244
  * iSCSI SCSI command basic header segment

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

75
 	__einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
75
 	__einfo_error ( EINFO_EINVAL_NO_TARGET_IQN )
76
 #define EINFO_EINVAL_NO_TARGET_IQN \
76
 #define EINFO_EINVAL_NO_TARGET_IQN \
77
 	__einfo_uniqify ( EINFO_EINVAL, 0x04, "No target IQN" )
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
 #define ENOTSUP_INITIATOR_STATUS \
86
 #define ENOTSUP_INITIATOR_STATUS \
79
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
87
 	__einfo_error ( EINFO_ENOTSUP_INITIATOR_STATUS )
80
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
88
 #define EINFO_ENOTSUP_INITIATOR_STATUS \
87
 	__einfo_error ( EINFO_ENOTSUP_DISCOVERY )
95
 	__einfo_error ( EINFO_ENOTSUP_DISCOVERY )
88
 #define EINFO_ENOTSUP_DISCOVERY \
96
 #define EINFO_ENOTSUP_DISCOVERY \
89
 	__einfo_uniqify ( EINFO_ENOTSUP, 0x03, "Discovery not supported" )
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
 #define EPERM_INITIATOR_AUTHENTICATION \
102
 #define EPERM_INITIATOR_AUTHENTICATION \
91
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
103
 	__einfo_error ( EINFO_EPERM_INITIATOR_AUTHENTICATION )
92
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
104
 #define EINFO_EPERM_INITIATOR_AUTHENTICATION \
1157
 			return -ENOTSUP_INITIATOR_STATUS;
1169
 			return -ENOTSUP_INITIATOR_STATUS;
1158
 		}
1170
 		}
1159
 	case ISCSI_STATUS_TARGET_ERROR :
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
 	default :
1180
 	default :
1162
 		return -EINVAL;
1181
 		return -EINVAL;
1163
 	}
1182
 	}

Loading…
Cancel
Save