aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink/af_netlink.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-04-17 02:47:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-19 14:57:57 -0400
commitccdfcc398594ddf3f77348c5a10938dbe9efefbe (patch)
tree5458e0eca52d0488e8c24c8587028b5bd29b60de /net/netlink/af_netlink.h
parentcf0a018ac669955c10e4fca24fa55dde58434e9a (diff)
netlink: mmaped netlink: ring setup
Add support for mmap'ed RX and TX ring setup and teardown based on the af_packet.c code. The following patches will use this to add the real mmap'ed receive and transmit functionality. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/af_netlink.h')
-rw-r--r--net/netlink/af_netlink.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index d9acb2a1d855..ed8522265f4e 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -6,6 +6,20 @@
6#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) 6#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
7#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long)) 7#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
8 8
9struct netlink_ring {
10 void **pg_vec;
11 unsigned int head;
12 unsigned int frames_per_block;
13 unsigned int frame_size;
14 unsigned int frame_max;
15
16 unsigned int pg_vec_order;
17 unsigned int pg_vec_pages;
18 unsigned int pg_vec_len;
19
20 atomic_t pending;
21};
22
9struct netlink_sock { 23struct netlink_sock {
10 /* struct sock has to be the first member of netlink_sock */ 24 /* struct sock has to be the first member of netlink_sock */
11 struct sock sk; 25 struct sock sk;
@@ -24,6 +38,12 @@ struct netlink_sock {
24 void (*netlink_rcv)(struct sk_buff *skb); 38 void (*netlink_rcv)(struct sk_buff *skb);
25 void (*netlink_bind)(int group); 39 void (*netlink_bind)(int group);
26 struct module *module; 40 struct module *module;
41#ifdef CONFIG_NETLINK_MMAP
42 struct mutex pg_vec_lock;
43 struct netlink_ring rx_ring;
44 struct netlink_ring tx_ring;
45 atomic_t mapped;
46#endif /* CONFIG_NETLINK_MMAP */
27}; 47};
28 48
29static inline struct netlink_sock *nlk_sk(struct sock *sk) 49static inline struct netlink_sock *nlk_sk(struct sock *sk)