Skip to content

Commit

Permalink
[iscsi] Disambiguate the expected target errors in the login response
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Feb 23, 2011
1 parent 623469d commit 7ef3145
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/include/ipxe/iscsi.h
Expand Up @@ -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
Expand Down
21 changes: 20 additions & 1 deletion src/net/tcp/iscsi.c
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 7ef3145

Please sign in to comment.