Blame src/components/infiniband_umad/linux-infiniband_umad.h

Packit 577717
/****************************/
Packit 577717
/* THIS IS OPEN SOURCE CODE */
Packit 577717
/****************************/
Packit 577717
Packit 577717
/** 
Packit 577717
 * @file    linux-infiniband_umad.h
Packit 577717
 * @author  Heike Jagode (in collaboration with Michael Kluge, TU Dresden)
Packit 577717
 *          jagode@eecs.utk.edu
Packit 577717
 *
Packit 577717
 * @ingroup papi_components 		
Packit 577717
 * 
Packit 577717
 * InfiniBand component 
Packit 577717
 * 
Packit 577717
 * Tested version of OFED: 1.4
Packit 577717
 *
Packit 577717
 * @brief
Packit 577717
 *  This file has the source code for a component that enables PAPI-C to 
Packit 577717
 *  access hardware monitoring counters for InfiniBand devices through the  
Packit 577717
 *  OFED library. Since a new interface was introduced with OFED version 1.4 
Packit 577717
 *  (released Dec 2008), the current InfiniBand component does not support 
Packit 577717
 *  OFED versions < 1.4.
Packit 577717
 */
Packit 577717
Packit 577717
#ifndef _PAPI_INFINIBAND_H
Packit 577717
#define _PAPI_INFINIBAND_H
Packit 577717
Packit 577717
#define __BUILD_VERSION_TAG__ 1.2
Packit 577717
Packit 577717
#include <infiniband/umad.h>
Packit 577717
#include <infiniband/mad.h>
Packit 577717
Packit 577717
/* describes a single counter with its properties */
Packit 577717
typedef struct counter_info_struct
Packit 577717
{
Packit 577717
	int idx;
Packit 577717
	char *name;
Packit 577717
	char *description;
Packit 577717
	char *unit;
Packit 577717
	uint64_t value;
Packit 577717
	struct counter_info_struct *next;
Packit 577717
} counter_info;
Packit 577717
Packit 577717
typedef struct
Packit 577717
{
Packit 577717
	int count;
Packit 577717
	char **data;
Packit 577717
} string_list;
Packit 577717
Packit 577717
/* infos collected of a single IB port */
Packit 577717
typedef struct ib_port_struct
Packit 577717
{
Packit 577717
	char *name;
Packit 577717
	counter_info *send_cntr;
Packit 577717
	counter_info *recv_cntr;
Packit 577717
	int port_rate;
Packit 577717
	int port_number;
Packit 577717
	int is_initialized;
Packit 577717
	uint64_t sum_send_val;
Packit 577717
	uint64_t sum_recv_val;
Packit 577717
	uint32_t last_send_val;
Packit 577717
	uint32_t last_recv_val;
Packit 577717
	struct ib_port_struct *next;
Packit 577717
} ib_port;
Packit 577717
Packit 577717
Packit 577717
static void init_ib_counter(  );
Packit 577717
static int read_ib_counter(  );
Packit 577717
static int init_ib_port( ib_port * portdata );
Packit 577717
static void addIBPort( const char *ca_name, umad_port_t * port );
Packit 577717
Packit 577717
Packit 577717
/*************************  DEFINES SECTION  *******************************
Packit 577717
 ***************************************************************************/
Packit 577717
/* this number assumes that there will never be more events than indicated */
Packit 577717
#define INFINIBAND_MAX_COUNTERS 100
Packit 577717
#define INFINIBAND_MAX_COUNTER_TERMS  INFINIBAND_MAX_COUNTERS
Packit 577717
Packit 577717
typedef counter_info INFINIBAND_register_t;
Packit 577717
typedef counter_info INFINIBAND_native_event_entry_t;
Packit 577717
typedef counter_info INFINIBAND_reg_alloc_t;
Packit 577717
Packit 577717
Packit 577717
typedef struct INFINIBAND_control_state
Packit 577717
{
Packit 577717
	long long counts[INFINIBAND_MAX_COUNTERS];
Packit 577717
	int ncounter;
Packit 577717
} INFINIBAND_control_state_t;
Packit 577717
Packit 577717
Packit 577717
typedef struct INFINIBAND_context
Packit 577717
{
Packit 577717
	INFINIBAND_control_state_t state;
Packit 577717
} INFINIBAND_context_t;
Packit 577717
Packit 577717
#endif /* _PAPI_INFINIBAND_H */