1 #ifndef _RDMA_NETLINK_H
2 #define _RDMA_NETLINK_H
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)
10 #include <linux/netlink.h>
12 struct ibnl_client_cbs {
13 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
17 void ibnl_cleanup(void);
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
25 * Returns 0 on success or a negative error code.
27 int ibnl_add_client(int index, int nops,
28 const struct ibnl_client_cbs cb_table[]);
31 * Remove a client from IB netlink.
32 * @index: Index of the removed IB client.
34 * Returns 0 on success or a negative error code.
36 int ibnl_remove_client(int index);
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.
48 void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
49 int len, int client, int op);
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.
59 int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
60 int len, void *data, int type);
62 #endif /* __KERNEL__ */
64 #endif /* _RDMA_NETLINK_H */