2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-22 17:41:55 +00:00

[infiniband] Include the SRP login rejection reason in the error number

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2010-09-22 20:05:39 +01:00
parent 2a92697bda
commit 29ad8a922b
2 changed files with 54 additions and 5 deletions

View File

@ -54,6 +54,50 @@ FEATURE ( FEATURE_PROTOCOL, "SRP", DHCP_EB_FEATURE_SRP, 1 );
*/
#define SRP_MAX_I_T_IU_LEN 80
/* Error numbers generated by SRP login rejection */
#define EINFO_SRP_LOGIN_REJ( reason, desc ) \
__einfo_uniqify ( EINFO_EPERM, ( (reason) & 0x0f ), desc )
#define EPERM_UNKNOWN \
__einfo_error ( EINFO_EPERM_UNKNOWN )
#define EINFO_EPERM_UNKNOWN EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_UNKNOWN, \
"Unable to establish RDMA channel, no reason specified" )
#define EPERM_INSUFFICIENT_RESOURCES \
__einfo_error ( EINFO_EPERM_INSUFFICIENT_RESOURCES )
#define EINFO_EPERM_INSUFFICIENT_RESOURCES EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_INSUFFICIENT_RESOURCES, \
"Insufficient RDMA channel resources" )
#define EPERM_BAD_MAX_I_T_IU_LEN \
__einfo_error ( EINFO_EPERM_BAD_MAX_I_T_IU_LEN )
#define EINFO_EPERM_BAD_MAX_I_T_IU_LEN EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_BAD_MAX_I_T_IU_LEN, \
"Requested maximum initiator to target IU length value too large" )
#define EPERM_CANNOT_ASSOCIATE \
__einfo_error ( EINFO_EPERM_CANNOT_ASSOCIATE )
#define EINFO_EPERM_CANNOT_ASSOCIATE EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_CANNOT_ASSOCIATE, \
"Unable to associate RDMA channel with specified I_T nexus" )
#define EPERM_UNSUPPORTED_BUFFER_FORMAT \
__einfo_error ( EINFO_EPERM_UNSUPPORTED_BUFFER_FORMAT )
#define EINFO_EPERM_UNSUPPORTED_BUFFER_FORMAT EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_UNSUPPORTED_BUFFER_FORMAT, \
"One or more requested data buffer descriptor formats not supported" )
#define EPERM_NO_MULTIPLE_CHANNELS \
__einfo_error ( EINFO_EPERM_NO_MULTIPLE_CHANNELS )
#define EINFO_EPERM_NO_MULTIPLE_CHANNELS EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_NO_MULTIPLE_CHANNELS, \
"SRP target does not support multiple RDMA channels per I_T nexus" )
#define EPERM_NO_MORE_CHANNELS \
__einfo_error ( EINFO_EPERM_NO_MORE_CHANNELS )
#define EINFO_EPERM_NO_MORE_CHANNELS EINFO_SRP_LOGIN_REJ ( \
SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS, \
"RDMA channel limit reached for this initiator" )
#define EPERM_LOGIN_REJ( reason_nibble ) \
EUNIQ ( EPERM, (reason_nibble), EPERM_UNKNOWN, \
EPERM_INSUFFICIENT_RESOURCES, EPERM_BAD_MAX_I_T_IU_LEN, \
EPERM_CANNOT_ASSOCIATE, EPERM_UNSUPPORTED_BUFFER_FORMAT, \
EPERM_NO_MULTIPLE_CHANNELS, EPERM_NO_MORE_CHANNELS )
/** An SRP device */
struct srp_device {
/** Reference count */
@ -330,6 +374,7 @@ static int srp_login_rsp ( struct srp_device *srpdev,
static int srp_login_rej ( struct srp_device *srpdev,
const void *data, size_t len ) {
const struct srp_login_rej *login_rej = data;
uint32_t reason;
/* Sanity check */
if ( len < sizeof ( *login_rej ) ) {
@ -337,14 +382,14 @@ static int srp_login_rej ( struct srp_device *srpdev,
srpdev, len );
return -EINVAL;
}
DBGC ( srpdev, "SRP %p tag %08x LOGIN_REJ:\n",
srpdev, ntohl ( login_rej->tag.dwords[1] ) );
reason = ntohl ( login_rej->reason );
DBGC ( srpdev, "SRP %p tag %08x LOGIN_REJ reason %08x:\n",
srpdev, ntohl ( login_rej->tag.dwords[1] ), reason );
DBGC_HDA ( srpdev, 0, data, len );
/* Login rejection always indicates an error */
DBGC ( srpdev, "SRP %p login rejected (reason %08x)\n",
srpdev, ntohl ( login_rej->reason ) );
return -EPERM;
return ( SRP_LOGIN_REJ_REASON_DEFINED ( reason ) ?
-EPERM_LOGIN_REJ ( reason ) : -EACCES );
}
/**

View File

@ -242,6 +242,10 @@ struct srp_login_rej {
/** RDMA channel limit reached for this initiator */
#define SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS 0x00010006UL
/** SRP login rejection reason is defined */
#define SRP_LOGIN_REJ_REASON_DEFINED( reason ) \
( ( (reason) & 0xfffffff0UL ) == 0x00010000UL )
/** Indirect data buffer descriptor format supported */
#define SRP_LOGIN_REJ_FMT_IDBD 0x04