rdma_netlink.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. int ibnl_init(void);
  10. void ibnl_cleanup(void);
  11. /**
  12. * Add a a client to the list of IB netlink exporters.
  13. * @index: Index of the added client
  14. * @nops: Number of supported ops by the added client.
  15. * @cb_table: A table for op->callback
  16. *
  17. * Returns 0 on success or a negative error code.
  18. */
  19. int ibnl_add_client(int index, int nops,
  20. const struct ibnl_client_cbs cb_table[]);
  21. /**
  22. * Remove a client from IB netlink.
  23. * @index: Index of the removed IB client.
  24. *
  25. * Returns 0 on success or a negative error code.
  26. */
  27. int ibnl_remove_client(int index);
  28. /**
  29. * Put a new message in a supplied skb.
  30. * @skb: The netlink skb.
  31. * @nlh: Pointer to put the header of the new netlink message.
  32. * @seq: The message sequence number.
  33. * @len: The requested message length to allocate.
  34. * @client: Calling IB netlink client.
  35. * @op: message content op.
  36. * Returns the allocated buffer on success and NULL on failure.
  37. */
  38. void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
  39. int len, int client, int op);
  40. /**
  41. * Put a new attribute in a supplied skb.
  42. * @skb: The netlink skb.
  43. * @nlh: Header of the netlink message to append the attribute to.
  44. * @len: The length of the attribute data.
  45. * @data: The attribute data to put.
  46. * @type: The attribute type.
  47. * Returns the 0 and a negative error code on failure.
  48. */
  49. int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
  50. int len, void *data, int type);
  51. #endif /* _RDMA_NETLINK_H */