1 #ifndef _RDMA_NETLINK_H
2 #define _RDMA_NETLINK_H
4 #include <linux/types.h>
10 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
11 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
12 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
15 RDMA_NL_RDMA_CM_ID_STATS
= 0,
16 RDMA_NL_RDMA_CM_NUM_OPS
20 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR
= 1,
21 RDMA_NL_RDMA_CM_ATTR_DST_ADDR
,
22 RDMA_NL_RDMA_CM_NUM_ATTR
,
25 struct rdma_cm_id_stats
{
38 #include <linux/netlink.h>
40 struct ibnl_client_cbs
{
41 int (*dump
)(struct sk_buff
*skb
, struct netlink_callback
*nlcb
);
45 void ibnl_cleanup(void);
48 * Add a a client to the list of IB netlink exporters.
49 * @index: Index of the added client
50 * @nops: Number of supported ops by the added client.
51 * @cb_table: A table for op->callback
53 * Returns 0 on success or a negative error code.
55 int ibnl_add_client(int index
, int nops
,
56 const struct ibnl_client_cbs cb_table
[]);
59 * Remove a client from IB netlink.
60 * @index: Index of the removed IB client.
62 * Returns 0 on success or a negative error code.
64 int ibnl_remove_client(int index
);
67 * Put a new message in a supplied skb.
68 * @skb: The netlink skb.
69 * @nlh: Pointer to put the header of the new netlink message.
70 * @seq: The message sequence number.
71 * @len: The requested message length to allocate.
72 * @client: Calling IB netlink client.
73 * @op: message content op.
74 * Returns the allocated buffer on success and NULL on failure.
76 void *ibnl_put_msg(struct sk_buff
*skb
, struct nlmsghdr
**nlh
, int seq
,
77 int len
, int client
, int op
);
79 * Put a new attribute in a supplied skb.
80 * @skb: The netlink skb.
81 * @nlh: Header of the netlink message to append the attribute to.
82 * @len: The length of the attribute data.
83 * @data: The attribute data to put.
84 * @type: The attribute type.
85 * Returns the 0 and a negative error code on failure.
87 int ibnl_put_attr(struct sk_buff
*skb
, struct nlmsghdr
*nlh
,
88 int len
, void *data
, int type
);
90 #endif /* __KERNEL__ */
92 #endif /* _RDMA_NETLINK_H */