xref: /titanic_51/usr/src/uts/common/sys/ib/clients/rdsv3/info.h (revision 16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347)
1 /*
2  * This file contains definitions imported from the OFED rds header info.h.
3  * Oracle elects to have and use the contents of info.h under and
4  * governed by the OpenIB.org BSD license.
5  */
6 
7 /*
8  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
9  */
10 
11 #ifndef _RDSV3_INFO_H
12 #define	_RDSV3_INFO_H
13 
14 struct rdsv3_info_iterator {
15 	char *addr;
16 	unsigned long offset;
17 };
18 
19 struct rdsv3_info_lengths {
20 	unsigned int	nr;
21 	unsigned int	each;
22 };
23 
24 struct rdsv3_sock;
25 
26 /*
27  * These functions must fill in the fields of @lens to reflect the size
28  * of the available info source.  If the snapshot fits in @len then it
29  * should be copied using @iter.  The caller will deduce if it was copied
30  * or not by comparing the lengths.
31  */
32 typedef void (*rdsv3_info_func)(struct rsock *sock, unsigned int len,
33     struct rdsv3_info_iterator *iter,
34     struct rdsv3_info_lengths *lens);
35 
36 #define	rdsv3_info_copy(iter, data, bytes)			\
37 	(void) ddi_copyout(data, iter->addr + iter->offset, bytes, 0);	\
38 	iter->offset += bytes
39 
40 void rdsv3_info_register_func(int optname, rdsv3_info_func func);
41 void rdsv3_info_deregister_func(int optname, rdsv3_info_func func);
42 int rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval,
43     int32_t *rvalp);
44 
45 #endif /* _RDSV3_INFO_H */
46