summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/ib_gma.h
blob: 1b33514ba476c44142ba6f51488a322f69a0afe1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef _GPXE_IB_GMA_H
#define _GPXE_IB_GMA_H

/** @file
 *
 * Infiniband General Management Agent
 *
 */

FILE_LICENCE ( GPL2_OR_LATER );

#include <gpxe/list.h>
#include <gpxe/retry.h>
#include <gpxe/tables.h>
#include <gpxe/infiniband.h>

struct ib_gma;

/** A GMA attribute handler */
struct ib_gma_handler {
	/** Management class */
	uint8_t mgmt_class;
	/** Management class don't-care bits */
	uint8_t mgmt_class_ignore;
	/** Class version */
	uint8_t class_version;
	/** Method */
	uint8_t method;
	/** Attribute (in network byte order) */
	uint16_t attr_id;
	/** Handle attribute
	 *
	 * @v gma		General management agent
	 * @v mad		MAD
	 * @ret response	MAD response, or NULL to send no response
	 */
	union ib_mad * ( * handle ) ( struct ib_gma *gma, union ib_mad *mad );
};

/** GMA attribute handlers */
#define IB_GMA_HANDLERS __table ( struct ib_gma_handler, "ib_gma_handlers" )

/** Declare a GMA attribute handler */
#define __ib_gma_handler __table_entry ( IB_GMA_HANDLERS, 01 )

/** An Infiniband General Management Agent */
struct ib_gma {
	/** Infiniband device */
	struct ib_device *ibdev;
	/** Completion queue */
	struct ib_completion_queue *cq;
	/** Queue pair */
	struct ib_queue_pair *qp;

	/** List of outstanding MAD requests */
	struct list_head requests;
};

extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
			    struct ib_address_vector *av, int retry );
extern struct ib_gma * ib_create_gma ( struct ib_device *ibdev,
				       enum ib_queue_pair_type type );
extern void ib_destroy_gma ( struct ib_gma *gma );

#endif /* _GPXE_IB_GMA_H */