Blame IbAccess/Common/Inc/ib_sm_priv.h

Packit 857059
/* BEGIN_ICS_COPYRIGHT3 ****************************************
Packit 857059
Packit 857059
Copyright (c) 2015-2017, 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_SM_PRIV_H__
Packit 857059
#define __IBA_IB_SM_PRIV_H__
Packit 857059
Packit 857059
#include "iba/ib_sm_types.h"
Packit 857059
Packit 857059
#if defined (__cplusplus)
Packit 857059
extern "C" {
Packit 857059
#endif
Packit 857059
Packit 857059
#define OUI_TRUESCALE 0x00066a
Packit 857059
Packit 857059
#include "iba/public/ipackon.h"
Packit 857059
Packit 857059
/* *************************************************************************
Packit 857059
 * SMPs
Packit 857059
 */
Packit 857059
Packit 857059
/* SMP Fields (LID Routed/Directed Route) */
Packit 857059
typedef struct _SMP {
Packit 857059
Packit 857059
	MAD_COMMON	common;
Packit 857059
	uint64	M_Key;						/* A 64 bit key,  */
Packit 857059
										/* employed for SM authentication */
Packit 857059
	union {
Packit 857059
		struct _LIDRouted
Packit 857059
	{
Packit 857059
			uint8	Reserved3[32];		/* For aligning the SMP data field with */
Packit 857059
										/* the directed route SMP data field */
Packit 857059
			uint8	SMPData[64];		/* 64 byte field of SMP data used to */
Packit 857059
										/* contain the methods attribute */
Packit 857059
			uint8	Reserved4[128];		/* Reserved. Shall be set to 0 */
Packit 857059
		} LIDRouted;
Packit 857059
Packit 857059
		struct _DirectedRoute
Packit 857059
		{
Packit 857059
			uint16	DrSLID;				/* Directed route source LID */
Packit 857059
			uint16	DrDLID;				/* Directed route destination LID */
Packit 857059
			uint8	Reserved2[28];		/* For the purpose of aligning the Data */
Packit 857059
										/* field on a 64 byte boundary */
Packit 857059
Packit 857059
			uint8	SMPData[64];		/* 64-byte field of SMP data used to  */
Packit 857059
										/* contain the methods attribute */
Packit 857059
			uint8	InitPath[64];		/* 64-byte field containing the initial */
Packit 857059
										/* directed path */
Packit 857059
			uint8	RetPath[64];		/* 64-byte field containing the  */
Packit 857059
										/* returning directed path */
Packit 857059
		} DirectedRoute;
Packit 857059
	}SmpExt;
Packit 857059
Packit 857059
} PACK_SUFFIX SMP;
Packit 857059
Packit 857059
#if 0
Packit 857059
#define SMP_SET_VERSION_INFO(smp, basever, mgmtcl, clver) {\
Packit 857059
	MAD_SET_VERSION_INFO(smp, basever, mgmtcl, clver); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_VERSION_INFO(smp, basever, mgmtcl, clver) {\
Packit 857059
	MAD_GET_VERSION_INFO(smp, basever, mgmtcl, clver); \
Packit 857059
}
Packit 857059
#endif
Packit 857059
Packit 857059
#define SMP_GET_STATUS(smp, status) {\
Packit 857059
	MAD_GET_STATUS(smp, status); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_DR_STATUS(smp, status, d) { \
Packit 857059
	(*status) = (smp)->common.u.DR.s.Status; \
Packit 857059
	if( NULL != d){\
Packit 857059
		(*d) = (smp)->common.u.DR.s.D; \
Packit 857059
	}\
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_SET_HOP_POINTER(smp, hop_ptr) { \
Packit 857059
	(smp)->common.u.DR.HopPointer = hop_ptr; \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_HOP_POINTER(smp, hop_ptr) { \
Packit 857059
	(*hop_ptr) = (smp)->common.u.DR.HopPointer; \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_SET_HOP_COUNT(smp, hop_count) { \
Packit 857059
	(smp)->common.u.DR.HopCount = hop_count; \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_HOP_COUNT(smp, hop_count) { \
Packit 857059
	(*hop_count) = (x)->common.u.DR.HopCount; \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_SET_TRANSACTION_ID(smp, id) {\
Packit 857059
	MAD_SET_TRANSACTION_ID(smp, id); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_TRANSACTION_ID(smp, id) {\
Packit 857059
	MAD_GET_TRANSACTION_ID(smp, id); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_SET_ATTRIB_ID(smp, id) {\
Packit 857059
	MAD_SET_ATTRIB_ID(smp, id); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_ATTRIB_ID(smp, id) {\
Packit 857059
	MAD_GET_ATTRIB_ID(smp, id); \
Packit 857059
}
Packit 857059
	
Packit 857059
#define SMP_SET_ATTRIB_MOD(smp, amod) {\
Packit 857059
	MAD_SET_ATTRIB_MOD(smp, amod); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_GET_ATTRIB_MOD(smp, amod) {\
Packit 857059
	MAD_GET_ATTRIB_MOD(smp, amod); \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_SET_M_KEY(smp, mkey) {\
Packit 857059
	(smp)->M_Key = mkey; \
Packit 857059
}
Packit 857059
	
Packit 857059
#define SMP_GET_M_KEY(smp, mkey) {\
Packit 857059
	(mkey) = (smp)->M_Key; \
Packit 857059
}
Packit 857059
Packit 857059
#define SMP_LR_DATA		SmpExt.LIDRouted.SMPData
Packit 857059
Packit 857059
#define SMP_DR_DLID		SmpExt.DirectedRoute.DrDLID
Packit 857059
#define SMP_DR_SLID		SmpExt.DirectedRoute.DrSLID
Packit 857059
#define SMP_DR_DATA		SmpExt.DirectedRoute.SMPData
Packit 857059
#define SMP_DR_IPath	SmpExt.DirectedRoute.InitPath
Packit 857059
#define SMP_DR_RPath	SmpExt.DirectedRoute.RetPath
Packit 857059
Packit 857059
Packit 857059
/* **************************************************************************
Packit 857059
 * Attribute specific SMP Packet Formats
Packit 857059
 */
Packit 857059
Packit 857059
/*
Packit 857059
 * SMA Notices/Traps (Data field for IB_NOTICE, see ib_mad.h)
Packit 857059
 */
Packit 857059
Packit 857059
	/* Trap Numbers */
Packit 857059
#define SMA_TRAP_GID_NOW_IN_SERVICE		64		/* <GIDADDR> is now in service */
Packit 857059
#define SMA_TRAP_GID_OUT_OF_SERVICE		65		/* <GIDADDR> is out of service */
Packit 857059
#define SMA_TRAP_ADD_MULTICAST_GROUP	66		/* New multicast group with multicast address <GIDADDR> is now created */
Packit 857059
#define SMA_TRAP_DEL_MULTICAST_GROUP	67		/* New multicast group with multicast address <GIDADDR> is now deleted */
Packit 857059
#define SMA_TRAP_LINK_STATE 			128		/* Switch port link state has changed */
Packit 857059
#define SMA_TRAP_LINK_INTEGRITY 		129		/* Any link integrity threshold reached */
Packit 857059
#define SMA_TRAP_BUFFER_OVERRUN 		130		/* Any buffer overrun threshold reached */
Packit 857059
#define SMA_TRAP_FLOW_WATCHDOG			131		/* Switch flow control update watchdog */
Packit 857059
#define SMA_TRAP_CHG_CAPABILITY			144		/* capability mask changed */
Packit 857059
#define SMA_TRAP_CHG_PLATGUID			145		/* platform (system) guid changed */
Packit 857059
#define SMA_TRAP_BAD_MKEY				256		/* Any bad M_key */
Packit 857059
#define SMA_TRAP_BAD_PKEY				257		/* Any bad P_key */
Packit 857059
#define SMA_TRAP_BAD_QKEY				258		/* Any bad Q_key */
Packit 857059
#define SMA_TRAP_SWITCH_BAD_PKEY		259		/* Switch bad P_key */
Packit 857059
Packit 857059
/*
Packit 857059
 * SwitchInfo
Packit 857059
 */
Packit 857059
typedef struct _SWITCH_INFO {
Packit 857059
	uint16	LinearFDBCap;		/* Number of entries supported in the  */
Packit 857059
								/* Linear Unicast Forwarding Database  */
Packit 857059
	uint16	RandomFDBCap;		/* Number of entries supported in the  */
Packit 857059
								/* Random Unicast Forwarding Database.  */
Packit 857059
	uint16	MulticastFDBCap;	/* Number of entries supported in the  */
Packit 857059
								/* Multicast Forwarding Database  */
Packit 857059
	uint16	LinearFDBTop;		/* Indicates the top of the linear  */
Packit 857059
								/* forwarding table. */
Packit 857059
	uint8	DefaultPort;		/* forward to this port all unicast  */
Packit 857059
								/* packets from other ports  */
Packit 857059
								/* whose DLID does not exist in the random  */
Packit 857059
								/* fwd table */
Packit 857059
	uint8	DefaultMulticastPrimaryPort;	
Packit 857059
	uint8	DefaultMulticastNotPrimaryPort;
Packit 857059
	union {
Packit 857059
		uint8	AsReg8;
Packit 857059
		struct {
Packit 857059
#if CPU_BE
Packit 857059
			uint8	LifeTimeValue:	      5;
Packit 857059
			uint8	PortStateChange:      1;
Packit 857059
			uint8	OptimizedSLVL:	      2;
Packit 857059
#else
Packit 857059
			uint8	OptimizedSLVL:	2;	
Packit 857059
			uint8	PortStateChange:1;	/* This bit is set to zero by a  */
Packit 857059
										/* management write.  */
Packit 857059
			uint8	LifeTimeValue:	5;	/* Sets the time a packet can live in  */
Packit 857059
										/* the switch. See section XXX */
Packit 857059
#endif
Packit 857059
		} s;
Packit 857059
	} u1;
Packit 857059
	uint16	LIDsPerPort;			/* specifies no. of LID/LMC combinations  */
Packit 857059
									/* that may be assigned  */
Packit 857059
									/* to a given link port for switches that  */
Packit 857059
									/* support the Random Forwarding database  */
Packit 857059
									/* model */
Packit 857059
	uint16	PartitionEnforcementCap;/* Specifies the number of entries in the  */
Packit 857059
									/* partition enforcement table. */
Packit 857059
	union {
Packit 857059
		uint8	AsReg8;
Packit 857059
		struct {
Packit 857059
#if CPU_BE
Packit 857059
			uint8	InboundEnforcementCapable:	1;
Packit 857059
			uint8	OutboundEnforcementCapable:	1;
Packit 857059
			uint8	FilterRawPacketInboundCapable:	1;
Packit 857059
			uint8	FilterRawPacketOutboundCapable:	1;
Packit 857059
			uint8	EnhancedPort0:	1;
Packit 857059
			uint8	reserved:			3;
Packit 857059
#else
Packit 857059
			uint8	reserved:			3;
Packit 857059
			uint8	EnhancedPort0:	1;
Packit 857059
			uint8	FilterRawPacketOutboundCapable:	1;
Packit 857059
			uint8	FilterRawPacketInboundCapable:	1;
Packit 857059
			uint8	OutboundEnforcementCapable:		1;
Packit 857059
			uint8	InboundEnforcementCapable:		1;
Packit 857059
#endif /*CPU_BE */
Packit 857059
		} s;
Packit 857059
	} u2;
Packit 857059
Packit 857059
	uint8	Reserved2;
Packit 857059
Packit 857059
	uint16	MulticastFDBTop;	/* Indicates the top of the multicast  */
Packit 857059
								/* forwarding table. */
Packit 857059
} PACK_SUFFIX SWITCH_INFO;
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * GuidInfo
Packit 857059
 */
Packit 857059
Packit 857059
/* The GuidInfo Attribute allows the setting of GUIDs to an end port. */
Packit 857059
#define GUID_INFO_BLOCK_SIZE 8
Packit 857059
#define GUID_INFO_MAX_BLOCK_NUM 31
Packit 857059
Packit 857059
typedef struct _GUID_INFO {
Packit 857059
	/* Gid 0 in block 0 is Read only invariant value of the BASE GUID */
Packit 857059
	uint64 Gid[GUID_INFO_BLOCK_SIZE];
Packit 857059
} PACK_SUFFIX GUID_INFO;
Packit 857059
Packit 857059
/*
Packit 857059
 * PartitionTable
Packit 857059
 */
Packit 857059
Packit 857059
#define PARTITION_TABLE_BLOCK_SIZE 32
Packit 857059
#define PARTITION_TABLE_MAX_BLOCK_NUM 2047
Packit 857059
Packit 857059
typedef union _P_KeyBlock {
Packit 857059
	uint16	AsInt16;
Packit 857059
Packit 857059
	struct {
Packit 857059
		uint16	P_KeyBase:		15;			/* Base value of the P_Key that  */
Packit 857059
											/* the endnode will use to check  */
Packit 857059
											/* against incoming packets */
Packit 857059
		uint16	MembershipType:	1;			/* 0 = Limited type */
Packit 857059
											/* 1 = Full type */
Packit 857059
	} p;
Packit 857059
Packit 857059
} PACK_SUFFIX P_KEY_BLOCK;
Packit 857059
Packit 857059
typedef struct _PARTITION_TABLE {
Packit 857059
Packit 857059
	P_KEY_BLOCK	PartitionTableBlock[PARTITION_TABLE_BLOCK_SIZE];	/* List of P_Key Block elements */
Packit 857059
Packit 857059
} PACK_SUFFIX PARTITION_TABLE;
Packit 857059
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * ForwardingTable
Packit 857059
 */
Packit 857059
Packit 857059
typedef struct _LID_Port_Block {
Packit 857059
	uint16	LID;				/* base LID */
Packit 857059
	struct {
Packit 857059
#if CPU_BE
Packit 857059
		uint8	Valid:		1;	/* valid bit */
Packit 857059
		uint8	LMC:		3;	/* the LMC of this LID */
Packit 857059
		uint8	reserved:	4;	/* for alignment */
Packit 857059
#else
Packit 857059
		uint8	reserved:	4;	/* for alignment */
Packit 857059
		uint8	LMC:		3;	/* the LMC of this LID */
Packit 857059
		uint8	Valid:		1;	/* valid bit */
Packit 857059
#endif
Packit 857059
	} s;
Packit 857059
	PORT	Port;				
Packit 857059
} PACK_SUFFIX LID_PORT_BLOCK;
Packit 857059
Packit 857059
typedef uint16	PORTMASK;		/* port mask block element */
Packit 857059
Packit 857059
#define LFT_BLOCK_SIZE 64
Packit 857059
#define RFT_BLOCK_SIZE 16
Packit 857059
#define RFT_MAX_BLOCK_NUM 3071
Packit 857059
#define MFT_BLOCK_SIZE 32
Packit 857059
#define MFT_BLOCK_WIDTH 16	// width of portmask in bits
Packit 857059
typedef struct _FORWARDING_TABLE {
Packit 857059
Packit 857059
	union {
Packit 857059
	
Packit 857059
		struct _Linear {
Packit 857059
			PORT			LftBlock[64];
Packit 857059
		} Linear;
Packit 857059
Packit 857059
		struct _Random {
Packit 857059
			LID_PORT_BLOCK	RftBlock[16];
Packit 857059
		} Random;
Packit 857059
Packit 857059
		struct _Multicast {
Packit 857059
			PORTMASK		MftBlock[32];
Packit 857059
		} Multicast;
Packit 857059
	} u;
Packit 857059
Packit 857059
} PACK_SUFFIX FORWARDING_TABLE;
Packit 857059
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * SMInfo
Packit 857059
 */
Packit 857059
Packit 857059
typedef enum _SM_STATE {
Packit 857059
	SM_INACTIVE = 0,
Packit 857059
	SM_DISCOVERING,
Packit 857059
	SM_STANDBY,
Packit 857059
	SM_MASTER,
Packit 857059
	/* 4-255 - Reserved */
Packit 857059
} SM_STATE ;
Packit 857059
Packit 857059
typedef struct _SM_INFO {
Packit 857059
	uint64	GUID;				/* This SM's perception of the GUID  */
Packit 857059
								/* of the master SM. */
Packit 857059
	uint64	SM_Key;				/* Key of this SM. This is shown as 0 unless  */
Packit 857059
								/* the requesting SM is proven to be the  */
Packit 857059
								/* master, or the requester is otherwise */
Packit 857059
								/* authenticated */
Packit 857059
	uint32	ActCount;			/* Counter that increments each time the SM  */
Packit 857059
								/* issues a SMP or performs other management  */
Packit 857059
								/* activities. Used as a 'heartbeat' indicator  */
Packit 857059
								/* by standby SMs. */
Packit 857059
	struct {
Packit 857059
#if CPU_BE
Packit 857059
		uint8	Priority:	4;
Packit 857059
		uint8	SMState:	4;
Packit 857059
#else
Packit 857059
		uint8	SMState:	4;	/* Enumerated value indicating this SM's state. */
Packit 857059
								/* Enumerated as SM_STATE. */
Packit 857059
		uint8	Priority:	4;	/* Administratively assigned priority for this  */
Packit 857059
								/* SM. Can be reset by master SM. */
Packit 857059
#endif
Packit 857059
	} s;
Packit 857059
		
Packit 857059
} PACK_SUFFIX SM_INFO;
Packit 857059
Packit 857059
// SM Service Record
Packit 857059
#define SM_SERVICE_ID           (0x1100d03c34822222ull)
Packit 857059
#define SM_CAPABILITY_NONE		0x00000000
Packit 857059
#define SM_CAPABILITY_VSWINFO	0x00000001
Packit 857059
Packit 857059
/* convert SM State to text */
Packit 857059
static __inline const char*
Packit 857059
IbSMStateToText(SM_STATE state)
Packit 857059
{
Packit 857059
	return (state == SM_INACTIVE? "Inactive":
Packit 857059
			state == SM_DISCOVERING? "Discovering":
Packit 857059
			state == SM_STANDBY? "Standby":
Packit 857059
			state == SM_MASTER? "Master": "???");
Packit 857059
}
Packit 857059
Packit 857059
/*
Packit 857059
 * VendorDiag
Packit 857059
 */
Packit 857059
Packit 857059
typedef enum {
Packit 857059
	DIAG_NODE_READY = 0,
Packit 857059
	DIAG_SELF_TEST,
Packit 857059
	DIAG_INIT,
Packit 857059
	DIAG_SOFT_ERROR,
Packit 857059
	DIAG_HARD_ERROR,
Packit 857059
	DIAG_RESERVED
Packit 857059
} IB_DIAG_CODE;
Packit 857059
Packit 857059
typedef struct _VendorDiag {
Packit 857059
Packit 857059
	union {
Packit 857059
		uint16	NextIndex;		/* Next attribute Modifier to get to Diag Info. */
Packit 857059
								/* Set to zero if this s last or only  */
Packit 857059
								/* diag data. */
Packit 857059
		struct {
Packit 857059
#if CPU_BE
Packit 857059
			uint16	UniversalDiagCode:		4;	
Packit 857059
			uint16	VendorDiagCode:	11;
Packit 857059
			uint16	Chain:	1;
Packit 857059
#else /* CPU_LE */
Packit 857059
			uint16	Chain:	1;
Packit 857059
			uint16	VendorDiagCode:	11;
Packit 857059
			uint16	UniversalDiagCode:		4;	
Packit 857059
#endif
Packit 857059
		} s;
Packit 857059
	} u;
Packit 857059
Packit 857059
	uint8	DiagData[62];		/* Vendor specific diag info. Format undefined. */
Packit 857059
Packit 857059
} PACK_SUFFIX VendorDiag, VENDOR_DIAG;
Packit 857059
Packit 857059
Packit 857059
/*
Packit 857059
 * Define VL Arbitration table.
Packit 857059
 */
Packit 857059
#define IB_VLARBTABLE_SIZE 32
Packit 857059
Packit 857059
typedef struct _VLArbBlock{
Packit 857059
	struct {
Packit 857059
#if CPU_BE
Packit 857059
		uint8			Reserved:	4;
Packit 857059
		uint8			VL:			4;
Packit 857059
#else
Packit 857059
		uint8			VL:			4;
Packit 857059
		uint8			Reserved:	4;
Packit 857059
#endif /*CPU_BE */
Packit 857059
	} s;
Packit 857059
Packit 857059
	uint8		Weight;
Packit 857059
} PACK_SUFFIX VLArbBlock;
Packit 857059
Packit 857059
typedef struct _VLARBTABLE {
Packit 857059
	VLArbBlock	ArbTable[IB_VLARBTABLE_SIZE];
Packit 857059
} PACK_SUFFIX VLARBTABLE;
Packit 857059
Packit 857059
#define PGTABLE_LIST_COUNT 64
Packit 857059
Packit 857059
typedef struct _PORT_GROUP_TABLE {
Packit 857059
	uint8		PortGroup[PGTABLE_LIST_COUNT];		/* List of PortGroups indexed by port */
Packit 857059
} PACK_SUFFIX PORT_GROUP_TABLE;
Packit 857059
Packit 857059
#define LIDMASK_LEN 64
Packit 857059
Packit 857059
typedef struct _ADAPTIVE_ROUTING_LIDMASK {
Packit 857059
	uint8		lidmask[LIDMASK_LEN];           // lidmask block of 512 lids
Packit 857059
} PACK_SUFFIX ADAPTIVE_ROUTING_LIDMASK;
Packit 857059
Packit 857059
#include "iba/public/ipackoff.h"
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_SMP_HEADER(
Packit 857059
	SMP			*Dest
Packit 857059
	 )
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	BSWAP_MAD_HEADER((MAD *)Dest);
Packit 857059
Packit 857059
	Dest->M_Key = ntoh64(Dest->M_Key);
Packit 857059
	Dest->SmpExt.DirectedRoute.DrSLID = \
Packit 857059
		ntoh16(Dest->SmpExt.DirectedRoute.DrSLID);
Packit 857059
	Dest->SmpExt.DirectedRoute.DrDLID = \
Packit 857059
		ntoh16(Dest->SmpExt.DirectedRoute.DrDLID);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_NODE_DESCRIPTION(
Packit 857059
	NODE_DESCRIPTION			*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
	/* pure text field, nothing to swap */
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_NODE_INFO(
Packit 857059
	NODE_INFO	*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	Dest->SystemImageGUID = ntoh64(Dest->SystemImageGUID );
Packit 857059
	Dest->NodeGUID = ntoh64(Dest->NodeGUID);
Packit 857059
	Dest->PortGUID = ntoh64(Dest->PortGUID);
Packit 857059
	Dest->PartitionCap = ntoh16(Dest->PartitionCap);
Packit 857059
	Dest->DeviceID = ntoh16(Dest->DeviceID);
Packit 857059
	Dest->Revision = ntoh32(Dest->Revision);
Packit 857059
	Dest->u1.AsReg32 = ntoh32(Dest->u1.AsReg32);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
/* The extended flag should only be used when the PORT_INFO structure
Packit 857059
 * used contains the full set of fields.  This is generally true for SMA
Packit 857059
 * operations, but when operating against SA PortInfoRecords the
Packit 857059
 * extra data may not be present
Packit 857059
 */
Packit 857059
static __inline void
Packit 857059
BSWAP_PORT_INFO(
Packit 857059
	PORT_INFO			*Dest, int extended
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	Dest->M_Key = ntoh64(Dest->M_Key);
Packit 857059
	Dest->SubnetPrefix = ntoh64(Dest->SubnetPrefix);
Packit 857059
	Dest->LID = ntoh16(Dest->LID);
Packit 857059
	Dest->MasterSMLID = ntoh16(Dest->MasterSMLID);
Packit 857059
	Dest->CapabilityMask.AsReg32 = ntoh32(Dest->CapabilityMask.AsReg32);
Packit 857059
	Dest->DiagCode = ntoh16(Dest->DiagCode);
Packit 857059
	Dest->M_KeyLeasePeriod = ntoh16(Dest->M_KeyLeasePeriod);
Packit 857059
	Dest->Violations.M_Key = ntoh16(Dest->Violations.M_Key);
Packit 857059
	Dest->Violations.P_Key = ntoh16(Dest->Violations.P_Key);
Packit 857059
	Dest->Violations.Q_Key = ntoh16(Dest->Violations.Q_Key);
Packit 857059
	Dest->MaxCreditHint = ntoh16(Dest->MaxCreditHint);
Packit 857059
	Dest->Latency.LinkRoundTrip =
Packit 857059
		((Dest->Latency.LinkRoundTrip & 0x0000FF) << 16) |
Packit 857059
		(Dest->Latency.LinkRoundTrip & 0x00FF00) |
Packit 857059
		((Dest->Latency.LinkRoundTrip & 0xFF0000) >> 16);
Packit 857059
	if (extended)
Packit 857059
		Dest->CapabilityMask2 = ntoh16(Dest->CapabilityMask2);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_PART_TABLE(
Packit 857059
	PARTITION_TABLE		*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	uint32			i;
Packit 857059
Packit 857059
Packit 857059
	for (i=0; i<32; i++)
Packit 857059
	{
Packit 857059
		Dest->PartitionTableBlock[i].AsInt16 = \
Packit 857059
			ntoh16(Dest->PartitionTableBlock[i].AsInt16);
Packit 857059
	}
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_SWITCH_INFO(
Packit 857059
	SWITCH_INFO		*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	Dest->LinearFDBCap = ntoh16(Dest->LinearFDBCap);
Packit 857059
	Dest->RandomFDBCap = ntoh16(Dest->RandomFDBCap);
Packit 857059
	Dest->MulticastFDBCap = ntoh16(Dest->MulticastFDBCap);
Packit 857059
	Dest->LinearFDBTop = ntoh16(Dest->LinearFDBTop);
Packit 857059
	Dest->LIDsPerPort = ntoh16(Dest->LIDsPerPort);
Packit 857059
	Dest->PartitionEnforcementCap = ntoh16(Dest->PartitionEnforcementCap);
Packit 857059
	Dest->MulticastFDBTop = ntoh16(Dest->MulticastFDBTop);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_GUID_INFO(
Packit 857059
	GUID_INFO			*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	int i;
Packit 857059
Packit 857059
	for (i=0; i
Packit 857059
	{
Packit 857059
		Dest->Gid[i] = ntoh64(Dest->Gid[i]);
Packit 857059
	}
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_VLARBTABLE(
Packit 857059
	VLARBTABLE			*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
	/* we laid this out in network byte order for intel compilers */
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_LINEAR_FWD_TABLE(
Packit 857059
    FORWARDING_TABLE            *Dest
Packit 857059
    )
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	/* nothing to do, PORT is only 1 byte */
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_RANDOM_FWD_TABLE(
Packit 857059
    FORWARDING_TABLE            *Dest
Packit 857059
    )
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
#if defined(VXWORKS)
Packit 857059
	uint32 i;
Packit 857059
#else
Packit 857059
	uint i;
Packit 857059
#endif
Packit 857059
Packit 857059
	for (i=0; i< 16; ++i)
Packit 857059
	{
Packit 857059
		Dest->u.Random.RftBlock[i].LID = ntoh16(Dest->u.Random.RftBlock[i].LID);
Packit 857059
	}
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_MCAST_FWD_TABLE(
Packit 857059
    FORWARDING_TABLE		*Dest
Packit 857059
    )
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
#if defined(VXWORKS)
Packit 857059
	uint32 i;
Packit 857059
#else
Packit 857059
	uint i;
Packit 857059
#endif
Packit 857059
Packit 857059
	for (i=0; i< 32; ++i)
Packit 857059
	{
Packit 857059
		Dest->u.Multicast.MftBlock[i] = ntoh16(Dest->u.Multicast.MftBlock[i]);
Packit 857059
	}
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_SM_INFO(
Packit 857059
    SM_INFO            *Dest
Packit 857059
    )
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
    Dest->GUID =                 ntoh64(Dest->GUID);
Packit 857059
    Dest->SM_Key =               ntoh64(Dest->SM_Key);
Packit 857059
    Dest->ActCount =             ntoh32(Dest->ActCount);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_VENDOR_DIAG(
Packit 857059
	VENDOR_DIAG			*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
#if CPU_LE
Packit 857059
	Dest->u.NextIndex = ntoh32(Dest->u.NextIndex);
Packit 857059
#endif
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_PORT_GROUP_TABLE(
Packit 857059
	PORT_GROUP_TABLE	*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
}
Packit 857059
Packit 857059
static __inline void
Packit 857059
BSWAP_ADAPTIVE_ROUTING_LIDMASK(
Packit 857059
	ADAPTIVE_ROUTING_LIDMASK	*Dest
Packit 857059
	)
Packit 857059
{
Packit 857059
}
Packit 857059
Packit 857059
#if defined (__cplusplus)
Packit 857059
};
Packit 857059
#endif
Packit 857059
Packit 857059
#endif /* __IBA_IB_SM_PRIV_H__ */