| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | + |
|---|
| 2 | 3 | #ifndef _RDMA_NETLINK_H |
|---|
| 3 | 4 | #define _RDMA_NETLINK_H |
|---|
| 4 | 5 | |
|---|
| 5 | | - |
|---|
| 6 | 6 | #include <linux/netlink.h> |
|---|
| 7 | 7 | #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 | +}; |
|---|
| 8 | 14 | |
|---|
| 9 | 15 | struct rdma_nl_cbs { |
|---|
| 10 | 16 | int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh, |
|---|
| .. | .. |
|---|
| 70 | 76 | |
|---|
| 71 | 77 | /** |
|---|
| 72 | 78 | * Send the supplied skb to a specific userspace PID. |
|---|
| 79 | + * @net: Net namespace in which to send the skb |
|---|
| 73 | 80 | * @skb: The netlink skb |
|---|
| 74 | 81 | * @pid: Userspace netlink process ID |
|---|
| 75 | 82 | * Returns 0 on success or a negative error code. |
|---|
| 76 | 83 | */ |
|---|
| 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); |
|---|
| 78 | 85 | |
|---|
| 79 | 86 | /** |
|---|
| 80 | 87 | * Send, with wait/1 retry, the supplied skb to a specific userspace PID. |
|---|
| 88 | + * @net: Net namespace in which to send the skb |
|---|
| 81 | 89 | * @skb: The netlink skb |
|---|
| 82 | 90 | * @pid: Userspace netlink process ID |
|---|
| 83 | 91 | * Returns 0 on success or a negative error code. |
|---|
| 84 | 92 | */ |
|---|
| 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); |
|---|
| 86 | 94 | |
|---|
| 87 | 95 | /** |
|---|
| 88 | 96 | * Send the supplied skb to a netlink group. |
|---|
| 97 | + * @net: Net namespace in which to send the skb |
|---|
| 89 | 98 | * @skb: The netlink skb |
|---|
| 90 | 99 | * @group: Netlink group ID |
|---|
| 91 | 100 | * @flags: allocation flags |
|---|
| 92 | 101 | * Returns 0 on success or a negative error code. |
|---|
| 93 | 102 | */ |
|---|
| 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); |
|---|
| 95 | 105 | |
|---|
| 96 | 106 | /** |
|---|
| 97 | 107 | * Check if there are any listeners to the netlink group |
|---|
| 98 | 108 | * @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. |
|---|
| 100 | 110 | */ |
|---|
| 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 | + |
|---|
| 102 | 125 | #endif /* _RDMA_NETLINK_H */ |
|---|