From db3562256f0ba19fc9b92a2f63fa74863b786215 Mon Sep 17 00:00:00 2001 From: ftillier Date: Tue, 3 Oct 2006 17:36:39 +0000 Subject: [PATCH] [SRP] Use I/O class constants when formatting login request initiator and target port identifiers. Define I/O class and subclass constants in network order to eliminate run-time byte swaps when checking these fields. git-svn-id: svn://openib.tc.cornell.edu/gen1@513 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/ulp/srp/kernel/srp.h | 14 +++++++------- trunk/ulp/srp/kernel/srp_connection.c | 4 ++-- trunk/ulp/srp/kernel/srp_hba.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/trunk/ulp/srp/kernel/srp.h b/trunk/ulp/srp/kernel/srp.h index 44317ea2..c508fbb6 100644 --- a/trunk/ulp/srp/kernel/srp.h +++ b/trunk/ulp/srp/kernel/srp.h @@ -40,13 +40,13 @@ /* SRP Service Definitions */ -#define SRP_IO_CLASS 0x0100 /* T10 changed */ -#define SRP_IO_CLASS_R10 0xff00 /* FF + high 8 bits of NCITS OUI */ -#define SRP_IO_SUBCLASS 0x609e /* Low 16 bits of NCITS OUI */ -#define SRP_PROTOCOL 0x0108 /* T10 administered identifier */ -#define SRP_PROTOCOL_VER 0x0001 /* Approved standard version */ -#define SRP_SERVICE_NAME_PREFIX "SRP.T10:" -#define SRP_EXTENSION_ID_LENGTH 16 /* Service name extension ID length */ +#define SRP_IO_CLASS CL_HTON16(0x0100) /* T10 changed */ +#define SRP_IO_CLASS_R10 CL_HTON16(0xff00) /* FF + high 8 bits of NCITS OUI */ +#define SRP_IO_SUBCLASS CL_HTON16(0x609e) /* Low 16 bits of NCITS OUI */ +#define SRP_PROTOCOL 0x0108 /* T10 administered identifier */ +#define SRP_PROTOCOL_VER 0x0001 /* Approved standard version */ +#define SRP_SERVICE_NAME_PREFIX "SRP.T10:" +#define SRP_EXTENSION_ID_LENGTH 16 /* Service name extension ID length */ #define SRP_MIN_IU_SIZE 64 #define SRP_MAX_IU_SIZE 340 diff --git a/trunk/ulp/srp/kernel/srp_connection.c b/trunk/ulp/srp/kernel/srp_connection.c index 4541297f..cefa9533 100644 --- a/trunk/ulp/srp/kernel/srp_connection.c +++ b/trunk/ulp/srp/kernel/srp_connection.c @@ -779,14 +779,14 @@ srp_init_connection( p_connection->p_path_rec = p_path_rec; switch( p_profile->io_class ) { - case 0xFF: + case SRP_IO_CLASS_R10: p_connection->init_port_id.field1 = ca_guid; p_connection->init_port_id.field2 = ext_id; p_connection->targ_port_id.field1 = p_profile->ioc_guid; p_connection->targ_port_id.field2 = ext_id; break; - case 0x0100: + case SRP_IO_CLASS: p_connection->init_port_id.field1 = ext_id; p_connection->init_port_id.field2 = ca_guid; p_connection->targ_port_id.field1 = ext_id; diff --git a/trunk/ulp/srp/kernel/srp_hba.c b/trunk/ulp/srp/kernel/srp_hba.c index 7a8f73a7..31597e2b 100644 --- a/trunk/ulp/srp/kernel/srp_hba.c +++ b/trunk/ulp/srp/kernel/srp_hba.c @@ -394,9 +394,9 @@ __srp_validate_ioc( SRP_ENTER( SRP_DBG_PNP ); // Is this really an SRP device? - if ( ( cl_ntoh16( p_ioc_rec->info.profile.io_class ) != SRP_IO_CLASS && - cl_ntoh16( p_ioc_rec->info.profile.io_class ) != SRP_IO_CLASS_R10 ) || - cl_ntoh16( p_ioc_rec->info.profile.io_subclass ) != SRP_IO_SUBCLASS ) + if ( ( p_ioc_rec->info.profile.io_class != SRP_IO_CLASS && + p_ioc_rec->info.profile.io_class != SRP_IO_CLASS_R10 ) || + p_ioc_rec->info.profile.io_subclass != SRP_IO_SUBCLASS ) { SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, ("Not an SRP CLASS(0x%x)/SUBCLASS(0x%x).\n", -- 2.41.0