Add support for enum to string conversion of wr_type. Fix bug in
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 14 Sep 2005 18:17:10 +0000 (18:17 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 14 Sep 2005 18:17:10 +0000 (18:17 +0000)
async_event enum to string function and type in docs.
Submitted by Yossi Leybovich <sleybo@mellanox.co.il>

Changed other string arrays to match declaration and naming syntax
of wr_type string.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@65 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/ib_statustext.c
inc/iba/ib_types.h

index a5a7bfb..456054c 100644 (file)
@@ -44,7 +44,7 @@
 \r
 \r
 /* ib_api_status_t values above converted to text for easier printing. */\r
-const char* ib_error_str[] =\r
+static const char* const __ib_error_str[] =\r
 {\r
        "IB_SUCCESS",\r
        "IB_INSUFFICIENT_RESOURCES",\r
@@ -97,7 +97,6 @@ const char* ib_error_str[] =
        "IB_NO_MATCH",\r
        "IB_PENDING",\r
        "IB_UNKNOWN_ERROR"\r
-\r
 };\r
 \r
 \r
@@ -107,13 +106,14 @@ ib_get_err_str(
 {\r
        if( status > IB_UNKNOWN_ERROR )\r
                status = IB_UNKNOWN_ERROR;\r
-       return( ib_error_str[status] );\r
+       return( __ib_error_str[status] );\r
 }\r
 \r
 \r
 /* ib_async_event_t values above converted to text for easier printing. */\r
-const char* ib_async_event_str[] =\r
+static const char* const __ib_async_event_str[] =\r
 {\r
+       "IB_AE_DUMMY",          /*place holder*/\r
        "IB_AE_SQ_ERROR",\r
        "IB_AE_SQ_DRAINED",\r
        "IB_AE_RQ_ERROR",\r
@@ -137,7 +137,6 @@ const char* ib_async_event_str[] =
        "IB_AE_PORT_ACTIVE",            /* ACTIVE STATE */\r
        "IB_AE_PORT_DOWN",                      /* INIT", ARMED", DOWN */\r
        "IB_AE_UNKNOWN"\r
-\r
 };\r
 \r
 \r
@@ -147,11 +146,11 @@ ib_get_async_event_str(
 {\r
        if( event > IB_AE_UNKNOWN )\r
                event = IB_AE_UNKNOWN;\r
-       return( ib_async_event_str[event] );\r
+       return( __ib_async_event_str[event] );\r
 }\r
 \r
 \r
-const char* ib_wc_status_str[] =\r
+static const char* const __ib_wc_status_str[] =\r
 {\r
        "IB_WCS_SUCCESS",\r
        "IB_WCS_LOCAL_LEN_ERR",\r
@@ -167,7 +166,6 @@ const char* ib_wc_status_str[] =
        "IB_WCS_UNMATCHED_RESPONSE",                    /* InfiniBand Access Layer */\r
        "IB_WCS_CANCELED",                                              /* InfiniBand Access Layer */\r
        "IB_WCS_UNKNOWN"\r
-\r
 };\r
 \r
 \r
@@ -177,11 +175,12 @@ ib_get_wc_status_str(
 {\r
        if( wc_status > IB_WCS_UNKNOWN )\r
                wc_status = IB_WCS_UNKNOWN;\r
-       return( ib_wc_status_str[wc_status] );\r
+       return( __ib_wc_status_str[wc_status] );\r
 }\r
 \r
 \r
-const char *ib_wc_type_str[] = {\r
+static const char* const __ib_wc_type_str[] =\r
+{\r
        "IB_WC_SEND",\r
        "IB_WC_RDMA_WRITE",\r
        "IB_WC_RECV",\r
@@ -200,5 +199,27 @@ ib_get_wc_type_str(
 {\r
        if( wc_type > IB_WC_UNKNOWN )\r
                wc_type = IB_WC_UNKNOWN;\r
-       return( ib_wc_type_str[wc_type] );\r
+       return( __ib_wc_type_str[wc_type] );\r
 }\r
+\r
+\r
+static const char* const __ib_wr_type_str[] =\r
+{\r
+       "WR_SEND",\r
+       "WR_RDMA_WRITE",\r
+       "WR_RDMA_READ",\r
+       "WR_COMPARE_SWAP",\r
+       "WR_FETCH_ADD",\r
+       "WR_UNKNOWN"\r
+};\r
+\r
+\r
+const char* \r
+ib_get_wr_type_str(\r
+       IN                              uint8_t                                         wr_type )\r
+{\r
+       if( wr_type > WR_UNKNOWN )\r
+               wr_type = WR_UNKNOWN;\r
+       return( __ib_wr_type_str[wr_type] );\r
+}\r
+\r
index 81af5bb..4a5827d 100644 (file)
@@ -1665,7 +1665,7 @@ ib_get_port_state_str(
 }\r
 /*\r
 * PARAMETERS\r
-*      node_type\r
+*      port_state\r
 *              [in] Encoded port state as returned in the PortInfo attribute.\r
 \r
 * RETURN VALUES\r
@@ -8292,12 +8292,42 @@ typedef enum _ib_wr_type_t
        WR_RDMA_WRITE,\r
        WR_RDMA_READ,\r
        WR_COMPARE_SWAP,\r
-       WR_FETCH_ADD\r
+       WR_FETCH_ADD,\r
+       WR_UNKNOWN\r
 \r
 }      ib_wr_type_t;\r
 /*****/\r
 \r
 \r
+/****f* IBA Base: Types/ib_get_wr_type_str\r
+* NAME\r
+*      ib_get_wr_type_str\r
+*\r
+* DESCRIPTION\r
+*      Returns a string for the specified work request type\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_wr_type_str(\r
+       IN                              uint8_t                                         wr_type );\r
+\r
+/*\r
+* PARAMETERS\r
+*      wr_type\r
+*              [in] Encoded work request type as defined in the\r
+work request attribute.\r
+\r
+* RETURN VALUES\r
+*      Pointer to the work request type string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_wr_type_t\r
+*********/\r
+\r
+\r
 /****s* Access Layer/ib_local_ds_t\r
 * NAME\r
 *      ib_local_ds_t\r