Blame IbAccess/Common/Ibt/Bma/bmamain.h

Packit 857059
/* BEGIN_ICS_COPYRIGHT4 ****************************************
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_COPYRIGHT4   ****************************************/
Packit 857059
/* [ICS VERSION STRING: unknown] */
Packit 857059
Packit 857059
#ifndef _IBA_IB_BMA_MAIN_H_
Packit 857059
#define _IBA_IB_BMA_MAIN_H_
Packit 857059
Packit 857059
Packit 857059
#include "datatypes.h"
Packit 857059
#include "ib_types.h"
Packit 857059
#include "ib_debug_osd.h"
Packit 857059
#include "vpi_export.h"
Packit 857059
#include "ib_gsi.h"
Packit 857059
#include "ib_ibt.h"
Packit 857059
#include "ib_mad.h"
Packit 857059
#include "ib_generalServices.h"
Packit 857059
#include "vca_export.h"
Packit 857059
#include "statustext.h"
Packit 857059
#include "ispinlock.h"
Packit 857059
#include "ilist.h"
Packit 857059
#include "icmdthread.h"
Packit 857059
#include "ibyteswap.h"
Packit 857059
#include "ib_bm.h"
Packit 857059
#include "imemory.h"
Packit 857059
#include "gsadebug.h"
Packit 857059
#if defined(_DBG_LVL_PKTDUMP)
Packit 857059
/* We want to use the _DBG_LVL_PKTDUMP for sma and not gsa */
Packit 857059
#undef _DBG_LVL_PKTDUMP
Packit 857059
#endif
Packit 857059
#include "smadebug.h"
Packit 857059
#include "gsamain.h"
Packit 857059
#include "smamain.h"
Packit 857059
Packit 857059
#ifdef __cplusplus
Packit 857059
extern "C" {
Packit 857059
#endif
Packit 857059
Packit 857059
//
Packit 857059
// Definitions
Packit 857059
//
Packit 857059
Packit 857059
#define BMA_TAG	MAKE_MEM_TAG(B,m,a,M)
Packit 857059
Packit 857059
#define BMA_MAX_NDGRM 128
Packit 857059
Packit 857059
//
Packit 857059
// Performance management data structures and definitions.
Packit 857059
//
Packit 857059
Packit 857059
typedef void 
Packit 857059
(*BMA_SEND_CALLBACK)(
Packit 857059
	IN	void					*ServiceContext,
Packit 857059
	IN	IBT_DGRM_ELEMENT		*DgrmList
Packit 857059
	);
Packit 857059
Packit 857059
typedef FSTATUS 
Packit 857059
(*BMA_RECEIVE_CALLBACK)(
Packit 857059
	IN	void					*ServiceContext,
Packit 857059
	IN	IBT_DGRM_ELEMENT		*DgrmList
Packit 857059
	);
Packit 857059
Packit 857059
//
Packit 857059
//   GSA_GLOBAL_INFO
Packit 857059
//
Packit 857059
//	This structure is used to keep track of global information and tie the 
Packit 857059
//	various lists maintained into meaningful related entities. There is only 
Packit 857059
//	one instance of this structure per the whole of GSA activeCAlist is used 
Packit 857059
//	to link the list of all CA's in the system. Every time a CA is added, a 
Packit 857059
//	new CA structure is created and linked to the end of this field in a 
Packit 857059
//	LIFO fashion.
Packit 857059
//
Packit 857059
//	calock is used to guard access to the above list ( activeCAlist ).
Packit 857059
//
Packit 857059
//	activeserviceclasslist is used to link the list of all registered service 
Packit 857059
//	classes. Every time a unique service class is registered, a service class 
Packit 857059
//	registration record ( GSA_SERVICE_CLASS_INFO ) is created and linked to
Packit 857059
//	this list in a LIFO fashion.
Packit 857059
//
Packit 857059
//	activeserviceclasslistlock is used to guard access to the list of service 
Packit 857059
//	classes ( activeserviceclasslist ).
Packit 857059
//
Packit 857059
//	uinumberofcas is the number of cas in the list ActiveCAList.
Packit 857059
//	if binitsuccess is set to TRUE, it means that GSA was successful in 
Packit 857059
//	initializing properly ( one-time initialization ). 
Packit 857059
//	The interfaces of GSA MUST check this state before providing any 
Packit 857059
//	useful functionality.
Packit 857059
//	if FALSE, GSA services are not available.
Packit 857059
//
Packit 857059
//	ConfigParam contains the list of configuration parameters used to configure 
Packit 857059
//	GSA. These values might be read from registry or from local configuration 
Packit 857059
//	file(s) , depending on the platform we are running on.
Packit 857059
//
Packit 857059
//
Packit 857059
typedef struct _BMA_GLOBAL_INFO
Packit 857059
{
Packit 857059
Packit 857059
	void*							GsaHandle;		// Handle for Device Management Class service with GSA
Packit 857059
Packit 857059
    boolean							binitsuccess;
Packit 857059
Packit 857059
	IB_HANDLE						DgrmPoolHandle;
Packit 857059
Packit 857059
	CMD_THREAD						RecvThread;
Packit 857059
Packit 857059
	struct _BMA_DEV_INFO *			DevList;
Packit 857059
Packit 857059
	unsigned						NumCA;
Packit 857059
Packit 857059
	SPIN_LOCK						DevListLock;
Packit 857059
Packit 857059
} BMA_GLOBAL_INFO;
Packit 857059
Packit 857059
//
Packit 857059
// Per-device info
Packit 857059
//
Packit 857059
typedef struct _BMA_DEV_INFO
Packit 857059
{
Packit 857059
	struct _BMA_DEV_INFO *			Next;
Packit 857059
Packit 857059
	struct _BMA_PORT_INFO *			Port;
Packit 857059
Packit 857059
	unsigned						NumPorts;
Packit 857059
Packit 857059
	EUI64							CaGuid;
Packit 857059
Packit 857059
} BMA_DEV_INFO;
Packit 857059
Packit 857059
Packit 857059
//
Packit 857059
// Per-port info
Packit 857059
//
Packit 857059
typedef struct _BMA_PORT_INFO
Packit 857059
{
Packit 857059
	EUI64							Guid;
Packit 857059
	// trap settings
Packit 857059
	struct {
Packit 857059
		IB_GID		GID;
Packit 857059
		uint32		TClass		:  8;
Packit 857059
		uint32		SL			:  4;
Packit 857059
		uint32		FlowLabel	: 20;
Packit 857059
		uint16		LID;
Packit 857059
		uint16		P_Key;
Packit 857059
		uint32		HopLimit	:  8;
Packit 857059
		uint32		QP			: 24;
Packit 857059
		uint32		Q_Key;
Packit 857059
	} Trap;
Packit 857059
	uint64	BKey;
Packit 857059
	boolean	BKeyProtect;
Packit 857059
	uint16	BKeyViolations;
Packit 857059
	uint16	BKeyLease;
Packit 857059
} BMA_PORT_INFO;
Packit 857059
Packit 857059
//
Packit 857059
// extern declaration for our global information structure
Packit 857059
//
Packit 857059
#ifndef g_BmaGlobalInfo
Packit 857059
extern BMA_GLOBAL_INFO *g_BmaGlobalInfo;
Packit 857059
#endif
Packit 857059
Packit 857059
typedef struct _BMA_GLOBAL_CONFIG_PARAMETERS
Packit 857059
{
Packit 857059
	uint32 MaxNDgrm;
Packit 857059
} BMA_GLOBAL_CONFIG_PARAMETERS;
Packit 857059
Packit 857059
#define BMA_DEFAULT_SETTINGS { BMA_MAX_NDGRM }
Packit 857059
Packit 857059
#ifndef g_BmaSettings
Packit 857059
extern BMA_GLOBAL_CONFIG_PARAMETERS g_BmaSettings;
Packit 857059
#endif
Packit 857059
Packit 857059
Packit 857059
//
Packit 857059
// Function declarations
Packit 857059
//
Packit 857059
// bmamain.c
Packit 857059
FSTATUS
Packit 857059
BmaLoad(
Packit 857059
	IN IBT_COMPONENT_INFO		*ComponentInfo
Packit 857059
	);
Packit 857059
Packit 857059
void
Packit 857059
BmaUnload(void);
Packit 857059
Packit 857059
FSTATUS
Packit 857059
BmaAddDevice(
Packit 857059
	IN	EUI64					CaGuid,
Packit 857059
	OUT void					**Context
Packit 857059
	);
Packit 857059
Packit 857059
FSTATUS
Packit 857059
BmaRemoveDevice(
Packit 857059
	IN EUI64					CaGuid,
Packit 857059
	IN void						*Context
Packit 857059
	);
Packit 857059
Packit 857059
// bmacallb.c
Packit 857059
Packit 857059
void
Packit 857059
BmaSendCallback(
Packit 857059
	void				*ServiceContext,
Packit 857059
	IBT_DGRM_ELEMENT	*pDgrmList
Packit 857059
	);
Packit 857059
Packit 857059
void
Packit 857059
BmaFreeCallback(
Packit 857059
	IN void* Context,
Packit 857059
	IN void* Cmd
Packit 857059
	);
Packit 857059
Packit 857059
void
Packit 857059
BmaThreadCallback(
Packit 857059
	IN void* Context,
Packit 857059
	IN void* Cmd
Packit 857059
	);
Packit 857059
Packit 857059
FSTATUS
Packit 857059
BmaRecvCallback(
Packit 857059
	void				*ServiceContext,
Packit 857059
	IBT_DGRM_ELEMENT	*pDgrmList
Packit 857059
	);
Packit 857059
Packit 857059
FSTATUS
Packit 857059
BmaProcessDevMgmtGet(
Packit 857059
	PDM_MAD				pMad,
Packit 857059
	IBT_DGRM_ELEMENT	*pRecvDgrm,
Packit 857059
	IBT_DGRM_ELEMENT	*pSendDgrm
Packit 857059
	);
Packit 857059
Packit 857059
#ifdef __cplusplus
Packit 857059
}
Packit 857059
#endif
Packit 857059
Packit 857059
#endif	// _IBA_IB_BMA_MAIN_H_