Blame IbAccess/Common/Inc/ib_status.h

Packit 5ea288
/* BEGIN_ICS_COPYRIGHT3 ****************************************
Packit 5ea288
Packit 5ea288
Copyright (c) 2015, Intel Corporation
Packit 5ea288
Packit 5ea288
Redistribution and use in source and binary forms, with or without
Packit 5ea288
modification, are permitted provided that the following conditions are met:
Packit 5ea288
Packit 5ea288
    * Redistributions of source code must retain the above copyright notice,
Packit 5ea288
      this list of conditions and the following disclaimer.
Packit 5ea288
    * Redistributions in binary form must reproduce the above copyright
Packit 5ea288
      notice, this list of conditions and the following disclaimer in the
Packit 5ea288
     documentation and/or other materials provided with the distribution.
Packit 5ea288
    * Neither the name of Intel Corporation nor the names of its contributors
Packit 5ea288
      may be used to endorse or promote products derived from this software
Packit 5ea288
      without specific prior written permission.
Packit 5ea288
Packit 5ea288
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 5ea288
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 5ea288
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 5ea288
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 5ea288
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 5ea288
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 5ea288
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 5ea288
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 5ea288
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 5ea288
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 5ea288
Packit 5ea288
** END_ICS_COPYRIGHT3   ****************************************/
Packit 5ea288
Packit 5ea288
/* [ICS VERSION STRING: unknown] */
Packit 5ea288
Packit 5ea288
#ifndef _IBA_IB_STATUS_H_
Packit 5ea288
#define _IBA_IB_STATUS_H_
Packit 5ea288
Packit 5ea288
#include "iba/public/datatypes.h"
Packit 5ea288
Packit 5ea288
/*
Packit 5ea288
 * The following values defines different IB software stack modules.
Packit 5ea288
 * These are the values that would be found in bits 16 - 23
Packit 5ea288
 */
Packit 5ea288
Packit 5ea288
#define IB_MOD_VPI		0x01	/* Verbs provider Interface */
Packit 5ea288
#define IB_MOD_VCA		0x02	/* Verbs Consumer Agent */
Packit 5ea288
#define IB_MOD_VKA		0x03	/* Verbs Kernel Agent */
Packit 5ea288
#define IB_MOD_GSA		0x04	/* General Services Agent */
Packit 5ea288
#define IB_MOD_SMA		0x05	/* Subnet Management Agent */
Packit 5ea288
#define IB_MOD_TSL		0x06	/* IB Transport Services */
Packit 5ea288
#define IB_MOD_SM		0x07	/* Subnet Manager */
Packit 5ea288
#define IB_MOD_CM		0x08	/* Connection Manager */
Packit 5ea288
Packit 5ea288
/*
Packit 5ea288
 * The low 8 bits define generic codes defined in the datatypes.h
Packit 5ea288
 * file. The top 24bits are application specific. For IB error and status 
Packit 5ea288
 * types we use the low 8 bits of this 24 bits for module identification. we
Packit 5ea288
 * use the values defined above. The low 16 bits are module specific 
Packit 5ea288
 * error codes that the module can choose to implement in their own way 
Packit 5ea288
 * as applicable.
Packit 5ea288
 *
Packit 5ea288
 *   31               16        8        0
Packit 5ea288
 *     +--------+--------+--------+--------+
Packit 5ea288
 *     | module err code | mod #  | fstatus|
Packit 5ea288
 *     +--------+--------+--------+--------+
Packit 5ea288
 */
Packit 5ea288
Packit 5ea288
#define SET_FSTATUS(fstatus, mod, mstatus)		\
Packit 5ea288
		((fstatus) & 0x000000FF) |				\
Packit 5ea288
		(((mod) << 8) & 0x0000FF00)	|			\
Packit 5ea288
		(((mstatus) << 16) & 0xFFFF0000)  		
Packit 5ea288
Packit 5ea288
#define GET_STATUS(fstatus)						\
Packit 5ea288
		(fstatus & 0x000000FF)
Packit 5ea288
Packit 5ea288
#define GET_MODULE(fstatus)						\
Packit 5ea288
		((fstatus & 0x0000FF00) >> 8)
Packit 5ea288
Packit 5ea288
#define GET_MODERR(fstatus)						\
Packit 5ea288
		((fstatus & 0xFFFF0000) >> 16)
Packit 5ea288
	
Packit 5ea288
#endif /* _IBA_IB_STATUS_H_ */