Blame view
include/rdma/rdma_netlink.h
3.27 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
b2cbae2c2 RDMA: Add netlink... |
2 3 |
#ifndef _RDMA_NETLINK_H #define _RDMA_NETLINK_H |
b2cbae2c2 RDMA: Add netlink... |
4 5 |
#include <linux/netlink.h> |
7235aa79f UAPI: (Scripted) ... |
6 |
#include <uapi/rdma/rdma_netlink.h> |
b2cbae2c2 RDMA: Add netlink... |
7 |
|
3250b4dbd RDMA/netlink: Ren... |
8 |
struct rdma_nl_cbs { |
1830ba21b RDMA/netlink: Add... |
9 10 |
int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack); |
b2cbae2c2 RDMA: Add netlink... |
11 |
int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); |
e3a2b93dd RDMA/netlink: Add... |
12 13 14 15 16 17 |
u8 flags; }; enum rdma_nl_flags { /* Require CAP_NET_ADMIN */ RDMA_NL_ADMIN_PERM = 1 << 0, |
b2cbae2c2 RDMA: Add netlink... |
18 |
}; |
e3bf14bdc rdma: Autoload ne... |
19 20 21 22 23 24 25 26 27 28 29 |
/* Define this module as providing netlink services for NETLINK_RDMA, with * index _index. Since the client indexes were setup in a uapi header as an * enum and we do no want to change that, the user must supply the expanded * constant as well and the compiler checks they are the same. */ #define MODULE_ALIAS_RDMA_NETLINK(_index, _val) \ static inline void __chk_##_index(void) \ { \ BUILD_BUG_ON(_index != _val); \ } \ MODULE_ALIAS("rdma-netlink-subsys-" __stringify(_val)) |
b2cbae2c2 RDMA: Add netlink... |
30 |
/** |
c9901724a RDMA/netlink: Rem... |
31 |
* Register client in RDMA netlink. |
b2cbae2c2 RDMA: Add netlink... |
32 |
* @index: Index of the added client |
b2cbae2c2 RDMA: Add netlink... |
33 |
* @cb_table: A table for op->callback |
b2cbae2c2 RDMA: Add netlink... |
34 |
*/ |
c9901724a RDMA/netlink: Rem... |
35 |
void rdma_nl_register(unsigned int index, |
3250b4dbd RDMA/netlink: Ren... |
36 |
const struct rdma_nl_cbs cb_table[]); |
b2cbae2c2 RDMA: Add netlink... |
37 38 39 40 |
/** * Remove a client from IB netlink. * @index: Index of the removed IB client. |
b2cbae2c2 RDMA: Add netlink... |
41 |
*/ |
c9901724a RDMA/netlink: Rem... |
42 |
void rdma_nl_unregister(unsigned int index); |
b2cbae2c2 RDMA: Add netlink... |
43 44 45 46 47 48 49 50 51 52 53 54 |
/** * Put a new message in a supplied skb. * @skb: The netlink skb. * @nlh: Pointer to put the header of the new netlink message. * @seq: The message sequence number. * @len: The requested message length to allocate. * @client: Calling IB netlink client. * @op: message content op. * Returns the allocated buffer on success and NULL on failure. */ void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, |
30dc5e63d RDMA/core: Add su... |
55 |
int len, int client, int op, int flags); |
b2cbae2c2 RDMA: Add netlink... |
56 57 58 59 60 61 62 63 64 65 66 |
/** * Put a new attribute in a supplied skb. * @skb: The netlink skb. * @nlh: Header of the netlink message to append the attribute to. * @len: The length of the attribute data. * @data: The attribute data to put. * @type: The attribute type. * Returns the 0 and a negative error code on failure. */ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, int len, void *data, int type); |
30dc5e63d RDMA/core: Add su... |
67 68 69 |
/** * Send the supplied skb to a specific userspace PID. * @skb: The netlink skb |
30dc5e63d RDMA/core: Add su... |
70 71 72 |
* @pid: Userspace netlink process ID * Returns 0 on success or a negative error code. */ |
f00e64637 RDMA/netlink: Ren... |
73 |
int rdma_nl_unicast(struct sk_buff *skb, u32 pid); |
30dc5e63d RDMA/core: Add su... |
74 75 |
/** |
9047811b7 RDMA/core: Add wa... |
76 77 |
* Send, with wait/1 retry, the supplied skb to a specific userspace PID. * @skb: The netlink skb |
9047811b7 RDMA/core: Add wa... |
78 79 80 |
* @pid: Userspace netlink process ID * Returns 0 on success or a negative error code. */ |
f00e64637 RDMA/netlink: Ren... |
81 |
int rdma_nl_unicast_wait(struct sk_buff *skb, __u32 pid); |
9047811b7 RDMA/core: Add wa... |
82 83 |
/** |
30dc5e63d RDMA/core: Add su... |
84 85 |
* Send the supplied skb to a netlink group. * @skb: The netlink skb |
30dc5e63d RDMA/core: Add su... |
86 87 88 89 |
* @group: Netlink group ID * @flags: allocation flags * Returns 0 on success or a negative error code. */ |
4d7f693af RDMA/netlink: Ren... |
90 |
int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags); |
30dc5e63d RDMA/core: Add su... |
91 |
|
ff61c425c RDMA/netlink: Sim... |
92 93 94 95 96 97 |
/** * Check if there are any listeners to the netlink group * @group: the netlink group ID * Returns 0 on success or a negative for no listeners. */ int rdma_nl_chk_listeners(unsigned int group); |
b2cbae2c2 RDMA: Add netlink... |
98 |
#endif /* _RDMA_NETLINK_H */ |