0001
0002
0003 #ifndef _RDMA_NETLINK_H
0004 #define _RDMA_NETLINK_H
0005
0006 #include <linux/netlink.h>
0007 #include <uapi/rdma/rdma_netlink.h>
0008
0009 enum {
0010 RDMA_NLDEV_ATTR_EMPTY_STRING = 1,
0011 RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
0012 RDMA_NLDEV_ATTR_CHARDEV_TYPE_SIZE = 32,
0013 };
0014
0015 struct rdma_nl_cbs {
0016 int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh,
0017 struct netlink_ext_ack *extack);
0018 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
0019 u8 flags;
0020 };
0021
0022 enum rdma_nl_flags {
0023
0024 RDMA_NL_ADMIN_PERM = 1 << 0,
0025 };
0026
0027
0028
0029
0030
0031
0032 #define MODULE_ALIAS_RDMA_NETLINK(_index, _val) \
0033 static inline void __maybe_unused __chk_##_index(void) \
0034 { \
0035 BUILD_BUG_ON(_index != _val); \
0036 } \
0037 MODULE_ALIAS("rdma-netlink-subsys-" __stringify(_val))
0038
0039
0040
0041
0042
0043
0044 void rdma_nl_register(unsigned int index,
0045 const struct rdma_nl_cbs cb_table[]);
0046
0047
0048
0049
0050
0051 void rdma_nl_unregister(unsigned int index);
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
0064 int len, int client, int op, int flags);
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
0075 int len, void *data, int type);
0076
0077
0078
0079
0080
0081
0082
0083
0084 int rdma_nl_unicast(struct net *net, struct sk_buff *skb, u32 pid);
0085
0086
0087
0088
0089
0090
0091
0092
0093 int rdma_nl_unicast_wait(struct net *net, struct sk_buff *skb, __u32 pid);
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 int rdma_nl_multicast(struct net *net, struct sk_buff *skb,
0104 unsigned int group, gfp_t flags);
0105
0106
0107
0108
0109
0110
0111 bool rdma_nl_chk_listeners(unsigned int group);
0112
0113 struct rdma_link_ops {
0114 struct list_head list;
0115 const char *type;
0116 int (*newlink)(const char *ibdev_name, struct net_device *ndev);
0117 };
0118
0119 void rdma_link_register(struct rdma_link_ops *ops);
0120 void rdma_link_unregister(struct rdma_link_ops *ops);
0121
0122 #define MODULE_ALIAS_RDMA_LINK(type) MODULE_ALIAS("rdma-link-" type)
0123 #define MODULE_ALIAS_RDMA_CLIENT(type) MODULE_ALIAS("rdma-client-" type)
0124
0125 #endif