diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-03-23 12:18:27 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-03-23 12:18:27 -0400 |
| commit | 188933ac139a6f8ab06cad369bd0200af947b00d (patch) | |
| tree | c4c107528fcf6b82e32a93b0596e13eea7aa9385 /net/tipc/node.h | |
| parent | 4ed0e032c3cf27c6fabc154164d003c4e0ac4654 (diff) | |
| parent | bc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff) | |
Merge tag 'v4.0-rc5' into next
Merge with the latest upstream to synchronize Synaptics changes
and bring in new infrastructure pieces.
Conflicts:
drivers/input/mouse/synaptics.c
Diffstat (limited to 'net/tipc/node.h')
| -rw-r--r-- | net/tipc/node.h | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h index cbe0e950f1cc..3d18c66b7f78 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * net/tipc/node.h: Include file for TIPC node management routines | 2 | * net/tipc/node.h: Include file for TIPC node management routines |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2000-2006, 2014, Ericsson AB | 4 | * Copyright (c) 2000-2006, 2014-2015, Ericsson AB |
| 5 | * Copyright (c) 2005, 2010-2014, Wind River Systems | 5 | * Copyright (c) 2005, 2010-2014, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| @@ -42,10 +42,10 @@ | |||
| 42 | #include "bearer.h" | 42 | #include "bearer.h" |
| 43 | #include "msg.h" | 43 | #include "msg.h" |
| 44 | 44 | ||
| 45 | /* | 45 | /* Out-of-range value for node signature */ |
| 46 | * Out-of-range value for node signature | 46 | #define INVALID_NODE_SIG 0x10000 |
| 47 | */ | 47 | |
| 48 | #define INVALID_NODE_SIG 0x10000 | 48 | #define NODE_HTABLE_SIZE 512 |
| 49 | 49 | ||
| 50 | /* Flags used to take different actions according to flag type | 50 | /* Flags used to take different actions according to flag type |
| 51 | * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down | 51 | * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down |
| @@ -55,14 +55,16 @@ | |||
| 55 | * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type | 55 | * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type |
| 56 | */ | 56 | */ |
| 57 | enum { | 57 | enum { |
| 58 | TIPC_MSG_EVT = 1, | ||
| 58 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), | 59 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), |
| 59 | TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2), | 60 | TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2), |
| 60 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), | 61 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), |
| 61 | TIPC_NOTIFY_NODE_UP = (1 << 4), | 62 | TIPC_NOTIFY_NODE_UP = (1 << 4), |
| 62 | TIPC_WAKEUP_USERS = (1 << 5), | 63 | TIPC_WAKEUP_BCAST_USERS = (1 << 5), |
| 63 | TIPC_WAKEUP_BCAST_USERS = (1 << 6), | 64 | TIPC_NOTIFY_LINK_UP = (1 << 6), |
| 64 | TIPC_NOTIFY_LINK_UP = (1 << 7), | 65 | TIPC_NOTIFY_LINK_DOWN = (1 << 7), |
| 65 | TIPC_NOTIFY_LINK_DOWN = (1 << 8) | 66 | TIPC_NAMED_MSG_EVT = (1 << 8), |
| 67 | TIPC_BCAST_MSG_EVT = (1 << 9) | ||
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | /** | 70 | /** |
| @@ -73,6 +75,7 @@ enum { | |||
| 73 | * @oos_state: state tracker for handling OOS b'cast messages | 75 | * @oos_state: state tracker for handling OOS b'cast messages |
| 74 | * @deferred_queue: deferred queue saved OOS b'cast message received from node | 76 | * @deferred_queue: deferred queue saved OOS b'cast message received from node |
| 75 | * @reasm_buf: broadcast reassembly queue head from node | 77 | * @reasm_buf: broadcast reassembly queue head from node |
| 78 | * @inputq_map: bitmap indicating which inqueues should be kicked | ||
| 76 | * @recv_permitted: true if node is allowed to receive b'cast messages | 79 | * @recv_permitted: true if node is allowed to receive b'cast messages |
| 77 | */ | 80 | */ |
| 78 | struct tipc_node_bclink { | 81 | struct tipc_node_bclink { |
| @@ -83,6 +86,7 @@ struct tipc_node_bclink { | |||
| 83 | u32 deferred_size; | 86 | u32 deferred_size; |
| 84 | struct sk_buff_head deferred_queue; | 87 | struct sk_buff_head deferred_queue; |
| 85 | struct sk_buff *reasm_buf; | 88 | struct sk_buff *reasm_buf; |
| 89 | int inputq_map; | ||
| 86 | bool recv_permitted; | 90 | bool recv_permitted; |
| 87 | }; | 91 | }; |
| 88 | 92 | ||
| @@ -90,7 +94,11 @@ struct tipc_node_bclink { | |||
| 90 | * struct tipc_node - TIPC node structure | 94 | * struct tipc_node - TIPC node structure |
| 91 | * @addr: network address of node | 95 | * @addr: network address of node |
| 92 | * @lock: spinlock governing access to structure | 96 | * @lock: spinlock governing access to structure |
| 97 | * @net: the applicable net namespace | ||
| 93 | * @hash: links to adjacent nodes in unsorted hash chain | 98 | * @hash: links to adjacent nodes in unsorted hash chain |
| 99 | * @inputq: pointer to input queue containing messages for msg event | ||
| 100 | * @namedq: pointer to name table input queue with name table messages | ||
| 101 | * @curr_link: the link holding the node lock, if any | ||
| 94 | * @active_links: pointers to active links to node | 102 | * @active_links: pointers to active links to node |
| 95 | * @links: pointers to all links to node | 103 | * @links: pointers to all links to node |
| 96 | * @action_flags: bit mask of different types of node actions | 104 | * @action_flags: bit mask of different types of node actions |
| @@ -106,11 +114,14 @@ struct tipc_node_bclink { | |||
| 106 | struct tipc_node { | 114 | struct tipc_node { |
| 107 | u32 addr; | 115 | u32 addr; |
| 108 | spinlock_t lock; | 116 | spinlock_t lock; |
| 117 | struct net *net; | ||
| 109 | struct hlist_node hash; | 118 | struct hlist_node hash; |
| 119 | struct sk_buff_head *inputq; | ||
| 120 | struct sk_buff_head *namedq; | ||
| 110 | struct tipc_link *active_links[2]; | 121 | struct tipc_link *active_links[2]; |
| 111 | u32 act_mtus[2]; | 122 | u32 act_mtus[2]; |
| 112 | struct tipc_link *links[MAX_BEARERS]; | 123 | struct tipc_link *links[MAX_BEARERS]; |
| 113 | unsigned int action_flags; | 124 | int action_flags; |
| 114 | struct tipc_node_bclink bclink; | 125 | struct tipc_node_bclink bclink; |
| 115 | struct list_head list; | 126 | struct list_head list; |
| 116 | int link_cnt; | 127 | int link_cnt; |
| @@ -118,28 +129,24 @@ struct tipc_node { | |||
| 118 | u32 signature; | 129 | u32 signature; |
| 119 | u32 link_id; | 130 | u32 link_id; |
| 120 | struct list_head publ_list; | 131 | struct list_head publ_list; |
| 121 | struct sk_buff_head waiting_sks; | ||
| 122 | struct list_head conn_sks; | 132 | struct list_head conn_sks; |
| 123 | struct rcu_head rcu; | 133 | struct rcu_head rcu; |
| 124 | }; | 134 | }; |
| 125 | 135 | ||
| 126 | extern struct list_head tipc_node_list; | 136 | struct tipc_node *tipc_node_find(struct net *net, u32 addr); |
| 127 | 137 | struct tipc_node *tipc_node_create(struct net *net, u32 addr); | |
| 128 | struct tipc_node *tipc_node_find(u32 addr); | 138 | void tipc_node_stop(struct net *net); |
| 129 | struct tipc_node *tipc_node_create(u32 addr); | ||
| 130 | void tipc_node_stop(void); | ||
| 131 | void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); | 139 | void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); |
| 132 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); | 140 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); |
| 133 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr); | 141 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr); |
| 134 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr); | 142 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr); |
| 135 | int tipc_node_active_links(struct tipc_node *n_ptr); | 143 | int tipc_node_active_links(struct tipc_node *n_ptr); |
| 136 | int tipc_node_is_up(struct tipc_node *n_ptr); | 144 | int tipc_node_is_up(struct tipc_node *n_ptr); |
| 137 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); | 145 | int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, |
| 138 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); | 146 | char *linkname, size_t len); |
| 139 | int tipc_node_get_linkname(u32 bearer_id, u32 node, char *linkname, size_t len); | ||
| 140 | void tipc_node_unlock(struct tipc_node *node); | 147 | void tipc_node_unlock(struct tipc_node *node); |
| 141 | int tipc_node_add_conn(u32 dnode, u32 port, u32 peer_port); | 148 | int tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port); |
| 142 | void tipc_node_remove_conn(u32 dnode, u32 port); | 149 | void tipc_node_remove_conn(struct net *net, u32 dnode, u32 port); |
| 143 | 150 | ||
| 144 | int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); | 151 | int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); |
| 145 | 152 | ||
| @@ -154,12 +161,12 @@ static inline bool tipc_node_blocked(struct tipc_node *node) | |||
| 154 | TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN)); | 161 | TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN)); |
| 155 | } | 162 | } |
| 156 | 163 | ||
| 157 | static inline uint tipc_node_get_mtu(u32 addr, u32 selector) | 164 | static inline uint tipc_node_get_mtu(struct net *net, u32 addr, u32 selector) |
| 158 | { | 165 | { |
| 159 | struct tipc_node *node; | 166 | struct tipc_node *node; |
| 160 | u32 mtu; | 167 | u32 mtu; |
| 161 | 168 | ||
| 162 | node = tipc_node_find(addr); | 169 | node = tipc_node_find(net, addr); |
| 163 | 170 | ||
| 164 | if (likely(node)) | 171 | if (likely(node)) |
| 165 | mtu = node->act_mtus[selector & 1]; | 172 | mtu = node->act_mtus[selector & 1]; |
