OpenNSL API Guide and Reference Manual
Error Handling APIs

With few exceptions, all OpenNSL API routines return an integer indicating the success or error status of the call. All error codes (except OPENNSL_E_NONE) are negative and are one of the values given in table error_codes . Success is usually indicated by the return value of OPENNSL_E_NONE, which is defined to be zero. Some routines may also return other success indications as positive numbers. Any such deviations from the table 'error_codes' will be described in the individual API routine descriptions.

In the API descriptions, an arbitrary error return code is specified by writing OPENNSL_E_XXX. This means that the routine will return some error code listed in table 'error_codes'.

Routines may also propagate error indications from lower-level driver and utility routines. The error codes thus propagated are compatible with these OpenNSL error codes, and can be treated identically.

Access to the error definitions is through the include file <opennsl/error.h>.

Checking for the failure of an API call can be done by testing if its return value is negative or by using OPENNSL_FAILURE macro:

int rv;
rv = opennsl_port_speed_set(unit, port, 1000);
if (rv < 0) {
/* failure */
}
if (OPENNSL_FAILURE(rv)) {
/* failure */
}

TABLE: Error Codes :: ERROR CODE [String Value] DESCRIPTION