]>
Commit | Line | Data |
---|---|---|
b2cbae2c RD |
1 | #ifndef _RDMA_NETLINK_H |
2 | #define _RDMA_NETLINK_H | |
3 | ||
b2cbae2c RD |
4 | |
5 | #include <linux/netlink.h> | |
7235aa79 | 6 | #include <uapi/rdma/rdma_netlink.h> |
b2cbae2c RD |
7 | |
8 | struct ibnl_client_cbs { | |
9 | int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); | |
10 | }; | |
11 | ||
b2cbae2c | 12 | /** |
c9901724 | 13 | * Register client in RDMA netlink. |
b2cbae2c | 14 | * @index: Index of the added client |
b2cbae2c | 15 | * @cb_table: A table for op->callback |
b2cbae2c | 16 | */ |
c9901724 LR |
17 | void rdma_nl_register(unsigned int index, |
18 | const struct ibnl_client_cbs cb_table[]); | |
b2cbae2c RD |
19 | |
20 | /** | |
21 | * Remove a client from IB netlink. | |
22 | * @index: Index of the removed IB client. | |
b2cbae2c | 23 | */ |
c9901724 | 24 | void rdma_nl_unregister(unsigned int index); |
b2cbae2c RD |
25 | |
26 | /** | |
27 | * Put a new message in a supplied skb. | |
28 | * @skb: The netlink skb. | |
29 | * @nlh: Pointer to put the header of the new netlink message. | |
30 | * @seq: The message sequence number. | |
31 | * @len: The requested message length to allocate. | |
32 | * @client: Calling IB netlink client. | |
33 | * @op: message content op. | |
34 | * Returns the allocated buffer on success and NULL on failure. | |
35 | */ | |
36 | void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, | |
30dc5e63 | 37 | int len, int client, int op, int flags); |
b2cbae2c RD |
38 | /** |
39 | * Put a new attribute in a supplied skb. | |
40 | * @skb: The netlink skb. | |
41 | * @nlh: Header of the netlink message to append the attribute to. | |
42 | * @len: The length of the attribute data. | |
43 | * @data: The attribute data to put. | |
44 | * @type: The attribute type. | |
45 | * Returns the 0 and a negative error code on failure. | |
46 | */ | |
47 | int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, | |
48 | int len, void *data, int type); | |
49 | ||
30dc5e63 TN |
50 | /** |
51 | * Send the supplied skb to a specific userspace PID. | |
52 | * @skb: The netlink skb | |
53 | * @nlh: Header of the netlink message to send | |
54 | * @pid: Userspace netlink process ID | |
55 | * Returns 0 on success or a negative error code. | |
56 | */ | |
57 | int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, | |
58 | __u32 pid); | |
59 | ||
9047811b IM |
60 | /** |
61 | * Send, with wait/1 retry, the supplied skb to a specific userspace PID. | |
62 | * @skb: The netlink skb | |
63 | * @nlh: Header of the netlink message to send | |
64 | * @pid: Userspace netlink process ID | |
65 | * Returns 0 on success or a negative error code. | |
66 | */ | |
67 | int ibnl_unicast_wait(struct sk_buff *skb, struct nlmsghdr *nlh, | |
68 | __u32 pid); | |
69 | ||
30dc5e63 TN |
70 | /** |
71 | * Send the supplied skb to a netlink group. | |
72 | * @skb: The netlink skb | |
73 | * @nlh: Header of the netlink message to send | |
74 | * @group: Netlink group ID | |
75 | * @flags: allocation flags | |
76 | * Returns 0 on success or a negative error code. | |
77 | */ | |
78 | int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh, | |
79 | unsigned int group, gfp_t flags); | |
80 | ||
b2cbae2c | 81 | #endif /* _RDMA_NETLINK_H */ |