[SRP] Use I/O class constants when formatting login request
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Oct 2006 17:36:39 +0000 (17:36 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Oct 2006 17:36:39 +0000 (17:36 +0000)
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/trunk@513 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/srp/kernel/srp.h
ulp/srp/kernel/srp_connection.c
ulp/srp/kernel/srp_hba.c

index 44317ea..c508fbb 100644 (file)
 /*\r
   SRP Service Definitions\r
  */\r
-#define SRP_IO_CLASS                    0x0100  /* T10 changed */\r
-#define SRP_IO_CLASS_R10                0xff00  /* FF + high 8 bits of NCITS OUI */\r
-#define SRP_IO_SUBCLASS                 0x609e  /* Low 16 bits of NCITS OUI */\r
-#define SRP_PROTOCOL                    0x0108  /* T10 administered identifier */\r
-#define SRP_PROTOCOL_VER                0x0001  /* Approved standard version */\r
-#define SRP_SERVICE_NAME_PREFIX         "SRP.T10:"\r
-#define SRP_EXTENSION_ID_LENGTH         16      /* Service name extension ID length */\r
+#define SRP_IO_CLASS                   CL_HTON16(0x0100)  /* T10 changed */\r
+#define SRP_IO_CLASS_R10               CL_HTON16(0xff00)  /* FF + high 8 bits of NCITS OUI */\r
+#define SRP_IO_SUBCLASS                        CL_HTON16(0x609e)  /* Low 16 bits of NCITS OUI */\r
+#define SRP_PROTOCOL                   0x0108  /* T10 administered identifier */\r
+#define SRP_PROTOCOL_VER               0x0001  /* Approved standard version */\r
+#define SRP_SERVICE_NAME_PREFIX        "SRP.T10:"\r
+#define SRP_EXTENSION_ID_LENGTH        16      /* Service name extension ID length */\r
 \r
 #define SRP_MIN_IU_SIZE     64\r
 #define SRP_MAX_IU_SIZE     340\r
index 4541297..cefa953 100644 (file)
@@ -779,14 +779,14 @@ srp_init_connection(
        p_connection->p_path_rec = p_path_rec;\r
        switch( p_profile->io_class )\r
        {\r
-       case 0xFF:\r
+       case SRP_IO_CLASS_R10:\r
                p_connection->init_port_id.field1 = ca_guid;\r
                p_connection->init_port_id.field2 = ext_id;\r
                p_connection->targ_port_id.field1 = p_profile->ioc_guid;\r
                p_connection->targ_port_id.field2 = ext_id;\r
                break;\r
 \r
-       case 0x0100:\r
+       case SRP_IO_CLASS:\r
                p_connection->init_port_id.field1 = ext_id;\r
                p_connection->init_port_id.field2 = ca_guid;\r
                p_connection->targ_port_id.field1 = ext_id;\r
index 7a8f73a..31597e2 100644 (file)
@@ -394,9 +394,9 @@ __srp_validate_ioc(
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        // Is this really an SRP device?\r
-       if ( ( cl_ntoh16( p_ioc_rec->info.profile.io_class )  != SRP_IO_CLASS &&\r
-                  cl_ntoh16( p_ioc_rec->info.profile.io_class )  != SRP_IO_CLASS_R10 ) ||\r
-                cl_ntoh16( p_ioc_rec->info.profile.io_subclass ) != SRP_IO_SUBCLASS )\r
+       if ( ( p_ioc_rec->info.profile.io_class != SRP_IO_CLASS &&\r
+                  p_ioc_rec->info.profile.io_class != SRP_IO_CLASS_R10 ) ||\r
+                p_ioc_rec->info.profile.io_subclass != SRP_IO_SUBCLASS )\r
        {\r
                SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                                ("Not an SRP CLASS(0x%x)/SUBCLASS(0x%x).\n",\r