hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/rdma/rdma_netlink.h
....@@ -1,10 +1,16 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2
+
23 #ifndef _RDMA_NETLINK_H
34 #define _RDMA_NETLINK_H
45
5
-
66 #include <linux/netlink.h>
77 #include <uapi/rdma/rdma_netlink.h>
8
+
9
+enum {
10
+ RDMA_NLDEV_ATTR_EMPTY_STRING = 1,
11
+ RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
12
+ RDMA_NLDEV_ATTR_CHARDEV_TYPE_SIZE = 32,
13
+};
814
915 struct rdma_nl_cbs {
1016 int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh,
....@@ -70,33 +76,50 @@
7076
7177 /**
7278 * Send the supplied skb to a specific userspace PID.
79
+ * @net: Net namespace in which to send the skb
7380 * @skb: The netlink skb
7481 * @pid: Userspace netlink process ID
7582 * Returns 0 on success or a negative error code.
7683 */
77
-int rdma_nl_unicast(struct sk_buff *skb, u32 pid);
84
+int rdma_nl_unicast(struct net *net, struct sk_buff *skb, u32 pid);
7885
7986 /**
8087 * Send, with wait/1 retry, the supplied skb to a specific userspace PID.
88
+ * @net: Net namespace in which to send the skb
8189 * @skb: The netlink skb
8290 * @pid: Userspace netlink process ID
8391 * Returns 0 on success or a negative error code.
8492 */
85
-int rdma_nl_unicast_wait(struct sk_buff *skb, __u32 pid);
93
+int rdma_nl_unicast_wait(struct net *net, struct sk_buff *skb, __u32 pid);
8694
8795 /**
8896 * Send the supplied skb to a netlink group.
97
+ * @net: Net namespace in which to send the skb
8998 * @skb: The netlink skb
9099 * @group: Netlink group ID
91100 * @flags: allocation flags
92101 * Returns 0 on success or a negative error code.
93102 */
94
-int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags);
103
+int rdma_nl_multicast(struct net *net, struct sk_buff *skb,
104
+ unsigned int group, gfp_t flags);
95105
96106 /**
97107 * Check if there are any listeners to the netlink group
98108 * @group: the netlink group ID
99
- * Returns 0 on success or a negative for no listeners.
109
+ * Returns true on success or false if no listeners.
100110 */
101
-int rdma_nl_chk_listeners(unsigned int group);
111
+bool rdma_nl_chk_listeners(unsigned int group);
112
+
113
+struct rdma_link_ops {
114
+ struct list_head list;
115
+ const char *type;
116
+ int (*newlink)(const char *ibdev_name, struct net_device *ndev);
117
+};
118
+
119
+void rdma_link_register(struct rdma_link_ops *ops);
120
+void rdma_link_unregister(struct rdma_link_ops *ops);
121
+
122
+#define MODULE_ALIAS_RDMA_LINK(type) MODULE_ALIAS("rdma-link-" type)
123
+#define MODULE_ALIAS_RDMA_CLIENT(type) MODULE_ALIAS("rdma-client-" type)
124
+
102125 #endif /* _RDMA_NETLINK_H */