summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/ib/clients/rdsv3/info.h
blob: 584486087ab60dd222c8b55c8575610b88282138 (plain)
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
/*
 * This file contains definitions imported from the OFED rds header info.h.
 * Oracle elects to have and use the contents of info.h under and
 * governed by the OpenIB.org BSD license.
 */

/*
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */

#ifndef _RDSV3_INFO_H
#define	_RDSV3_INFO_H

struct rdsv3_info_iterator {
	char *addr;
	unsigned long offset;
};

struct rdsv3_info_lengths {
	unsigned int	nr;
	unsigned int	each;
};

struct rdsv3_sock;

/*
 * These functions must fill in the fields of @lens to reflect the size
 * of the available info source.  If the snapshot fits in @len then it
 * should be copied using @iter.  The caller will deduce if it was copied
 * or not by comparing the lengths.
 */
typedef void (*rdsv3_info_func)(struct rsock *sock, unsigned int len,
    struct rdsv3_info_iterator *iter,
    struct rdsv3_info_lengths *lens);

#define	rdsv3_info_copy(iter, data, bytes)			\
	(void) ddi_copyout(data, iter->addr + iter->offset, bytes, 0);	\
	iter->offset += bytes

void rdsv3_info_register_func(int optname, rdsv3_info_func func);
void rdsv3_info_deregister_func(int optname, rdsv3_info_func func);
int rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval,
    int32_t *rvalp);

#endif /* _RDSV3_INFO_H */