rdma_netlink.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef _RDMA_NETLINK_H
  2. #define _RDMA_NETLINK_H
  3. #include <linux/netlink.h>
  4. #include <uapi/rdma/rdma_netlink.h>
  5. struct ibnl_client_cbs {
  6. int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
  7. struct module *module;
  8. };
  9. /**
  10. * Add a a client to the list of IB netlink exporters.
  11. * @index: Index of the added client
  12. * @nops: Number of supported ops by the added client.
  13. * @cb_table: A table for op->callback
  14. *
  15. * Returns 0 on success or a negative error code.
  16. */
  17. int ibnl_add_client(int index, int nops,
  18. const struct ibnl_client_cbs cb_table[]);
  19. /**
  20. * Remove a client from IB netlink.
  21. * @index: Index of the removed IB client.
  22. *
  23. * Returns 0 on success or a negative error code.
  24. */
  25. int ibnl_remove_client(int index);
  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,
  37. int len, int client, int op, int flags);
  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. /**
  50. * Send the supplied skb to a specific userspace PID.
  51. * @skb: The netlink skb
  52. * @nlh: Header of the netlink message to send
  53. * @pid: Userspace netlink process ID
  54. * Returns 0 on success or a negative error code.
  55. */
  56. int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
  57. __u32 pid);
  58. /**
  59. * Send the supplied skb to a netlink group.
  60. * @skb: The netlink skb
  61. * @nlh: Header of the netlink message to send
  62. * @group: Netlink group ID
  63. * @flags: allocation flags
  64. * Returns 0 on success or a negative error code.
  65. */
  66. int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
  67. unsigned int group, gfp_t flags);
  68. #endif /* _RDMA_NETLINK_H */