Linux 3.12.5
[linux/fpc-iii.git] / include / rdma / rdma_netlink.h
blobe38de79eeb48f9070a65d806a38eff84a3f92914
1 #ifndef _RDMA_NETLINK_H
2 #define _RDMA_NETLINK_H
5 #include <linux/netlink.h>
6 #include <uapi/rdma/rdma_netlink.h>
8 struct ibnl_client_cbs {
9 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
10 struct module *module;
13 int ibnl_init(void);
14 void ibnl_cleanup(void);
16 /**
17 * Add a a client to the list of IB netlink exporters.
18 * @index: Index of the added client
19 * @nops: Number of supported ops by the added client.
20 * @cb_table: A table for op->callback
22 * Returns 0 on success or a negative error code.
24 int ibnl_add_client(int index, int nops,
25 const struct ibnl_client_cbs cb_table[]);
27 /**
28 * Remove a client from IB netlink.
29 * @index: Index of the removed IB client.
31 * Returns 0 on success or a negative error code.
33 int ibnl_remove_client(int index);
35 /**
36 * Put a new message in a supplied skb.
37 * @skb: The netlink skb.
38 * @nlh: Pointer to put the header of the new netlink message.
39 * @seq: The message sequence number.
40 * @len: The requested message length to allocate.
41 * @client: Calling IB netlink client.
42 * @op: message content op.
43 * Returns the allocated buffer on success and NULL on failure.
45 void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
46 int len, int client, int op);
47 /**
48 * Put a new attribute in a supplied skb.
49 * @skb: The netlink skb.
50 * @nlh: Header of the netlink message to append the attribute to.
51 * @len: The length of the attribute data.
52 * @data: The attribute data to put.
53 * @type: The attribute type.
54 * Returns the 0 and a negative error code on failure.
56 int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
57 int len, void *data, int type);
59 #endif /* _RDMA_NETLINK_H */