Blame IbAccess/Common/Inc/ib_status.h

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