diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netlink.h | 1 | ||||
-rw-r--r-- | include/rdma/rdma_netlink.h | 64 |
2 files changed, 65 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 4c4ac3f3ce5a..a9dd89552f9c 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -24,6 +24,7 @@ | |||
24 | /* leave room for NETLINK_DM (DM Events) */ | 24 | /* leave room for NETLINK_DM (DM Events) */ |
25 | #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ | 25 | #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ |
26 | #define NETLINK_ECRYPTFS 19 | 26 | #define NETLINK_ECRYPTFS 19 |
27 | #define NETLINK_RDMA 20 | ||
27 | 28 | ||
28 | #define MAX_LINKS 32 | 29 | #define MAX_LINKS 32 |
29 | 30 | ||
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h new file mode 100644 index 000000000000..c983a193cecf --- /dev/null +++ b/include/rdma/rdma_netlink.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _RDMA_NETLINK_H | ||
2 | #define _RDMA_NETLINK_H | ||
3 | |||
4 | #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) | ||
5 | #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) | ||
6 | #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | #include <linux/netlink.h> | ||
11 | |||
12 | struct ibnl_client_cbs { | ||
13 | int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); | ||
14 | }; | ||
15 | |||
16 | int ibnl_init(void); | ||
17 | void ibnl_cleanup(void); | ||
18 | |||
19 | /** | ||
20 | * Add a a client to the list of IB netlink exporters. | ||
21 | * @index: Index of the added client | ||
22 | * @nops: Number of supported ops by the added client. | ||
23 | * @cb_table: A table for op->callback | ||
24 | * | ||
25 | * Returns 0 on success or a negative error code. | ||
26 | */ | ||
27 | int ibnl_add_client(int index, int nops, | ||
28 | const struct ibnl_client_cbs cb_table[]); | ||
29 | |||
30 | /** | ||
31 | * Remove a client from IB netlink. | ||
32 | * @index: Index of the removed IB client. | ||
33 | * | ||
34 | * Returns 0 on success or a negative error code. | ||
35 | */ | ||
36 | int ibnl_remove_client(int index); | ||
37 | |||
38 | /** | ||
39 | * Put a new message in a supplied skb. | ||
40 | * @skb: The netlink skb. | ||
41 | * @nlh: Pointer to put the header of the new netlink message. | ||
42 | * @seq: The message sequence number. | ||
43 | * @len: The requested message length to allocate. | ||
44 | * @client: Calling IB netlink client. | ||
45 | * @op: message content op. | ||
46 | * Returns the allocated buffer on success and NULL on failure. | ||
47 | */ | ||
48 | void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, | ||
49 | int len, int client, int op); | ||
50 | /** | ||
51 | * Put a new attribute in a supplied skb. | ||
52 | * @skb: The netlink skb. | ||
53 | * @nlh: Header of the netlink message to append the attribute to. | ||
54 | * @len: The length of the attribute data. | ||
55 | * @data: The attribute data to put. | ||
56 | * @type: The attribute type. | ||
57 | * Returns the 0 and a negative error code on failure. | ||
58 | */ | ||
59 | int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, | ||
60 | int len, void *data, int type); | ||
61 | |||
62 | #endif /* __KERNEL__ */ | ||
63 | |||
64 | #endif /* _RDMA_NETLINK_H */ | ||