diff options
Diffstat (limited to 'net/tipc/link.h')
-rw-r--r-- | net/tipc/link.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h index 55812e87ca1e..7aeb52092bf3 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -41,6 +41,10 @@ | |||
41 | #include "msg.h" | 41 | #include "msg.h" |
42 | #include "node.h" | 42 | #include "node.h" |
43 | 43 | ||
44 | /* TIPC-specific error codes | ||
45 | */ | ||
46 | #define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ | ||
47 | |||
44 | /* Out-of-range value for link sequence numbers | 48 | /* Out-of-range value for link sequence numbers |
45 | */ | 49 | */ |
46 | #define INVALID_LINK_SEQ 0x10000 | 50 | #define INVALID_LINK_SEQ 0x10000 |
@@ -99,13 +103,14 @@ struct tipc_stats { | |||
99 | * @media_addr: media address to use when sending messages over link | 103 | * @media_addr: media address to use when sending messages over link |
100 | * @timer: link timer | 104 | * @timer: link timer |
101 | * @owner: pointer to peer node | 105 | * @owner: pointer to peer node |
106 | * @refcnt: reference counter for permanent references (owner node & timer) | ||
102 | * @flags: execution state flags for link endpoint instance | 107 | * @flags: execution state flags for link endpoint instance |
103 | * @checkpoint: reference point for triggering link continuity checking | 108 | * @checkpoint: reference point for triggering link continuity checking |
104 | * @peer_session: link session # being used by peer end of link | 109 | * @peer_session: link session # being used by peer end of link |
105 | * @peer_bearer_id: bearer id used by link's peer endpoint | 110 | * @peer_bearer_id: bearer id used by link's peer endpoint |
106 | * @bearer_id: local bearer id used by link | 111 | * @bearer_id: local bearer id used by link |
107 | * @tolerance: minimum link continuity loss needed to reset link [in ms] | 112 | * @tolerance: minimum link continuity loss needed to reset link [in ms] |
108 | * @continuity_interval: link continuity testing interval [in ms] | 113 | * @cont_intv: link continuity testing interval |
109 | * @abort_limit: # of unacknowledged continuity probes needed to reset link | 114 | * @abort_limit: # of unacknowledged continuity probes needed to reset link |
110 | * @state: current state of link FSM | 115 | * @state: current state of link FSM |
111 | * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state | 116 | * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state |
@@ -126,8 +131,10 @@ struct tipc_stats { | |||
126 | * @next_in_no: next sequence number to expect for inbound messages | 131 | * @next_in_no: next sequence number to expect for inbound messages |
127 | * @deferred_queue: deferred queue saved OOS b'cast message received from node | 132 | * @deferred_queue: deferred queue saved OOS b'cast message received from node |
128 | * @unacked_window: # of inbound messages rx'd without ack'ing back to peer | 133 | * @unacked_window: # of inbound messages rx'd without ack'ing back to peer |
134 | * @inputq: buffer queue for messages to be delivered upwards | ||
135 | * @namedq: buffer queue for name table messages to be delivered upwards | ||
129 | * @next_out: ptr to first unsent outbound message in queue | 136 | * @next_out: ptr to first unsent outbound message in queue |
130 | * @waiting_sks: linked list of sockets waiting for link congestion to abate | 137 | * @wakeupq: linked list of wakeup msgs waiting for link congestion to abate |
131 | * @long_msg_seq_no: next identifier to use for outbound fragmented messages | 138 | * @long_msg_seq_no: next identifier to use for outbound fragmented messages |
132 | * @reasm_buf: head of partially reassembled inbound message fragments | 139 | * @reasm_buf: head of partially reassembled inbound message fragments |
133 | * @stats: collects statistics regarding link activity | 140 | * @stats: collects statistics regarding link activity |
@@ -138,6 +145,7 @@ struct tipc_link { | |||
138 | struct tipc_media_addr media_addr; | 145 | struct tipc_media_addr media_addr; |
139 | struct timer_list timer; | 146 | struct timer_list timer; |
140 | struct tipc_node *owner; | 147 | struct tipc_node *owner; |
148 | struct kref ref; | ||
141 | 149 | ||
142 | /* Management and link supervision data */ | 150 | /* Management and link supervision data */ |
143 | unsigned int flags; | 151 | unsigned int flags; |
@@ -146,7 +154,7 @@ struct tipc_link { | |||
146 | u32 peer_bearer_id; | 154 | u32 peer_bearer_id; |
147 | u32 bearer_id; | 155 | u32 bearer_id; |
148 | u32 tolerance; | 156 | u32 tolerance; |
149 | u32 continuity_interval; | 157 | unsigned long cont_intv; |
150 | u32 abort_limit; | 158 | u32 abort_limit; |
151 | int state; | 159 | int state; |
152 | u32 fsm_msg_cnt; | 160 | u32 fsm_msg_cnt; |
@@ -178,10 +186,12 @@ struct tipc_link { | |||
178 | u32 next_in_no; | 186 | u32 next_in_no; |
179 | struct sk_buff_head deferred_queue; | 187 | struct sk_buff_head deferred_queue; |
180 | u32 unacked_window; | 188 | u32 unacked_window; |
189 | struct sk_buff_head inputq; | ||
190 | struct sk_buff_head namedq; | ||
181 | 191 | ||
182 | /* Congestion handling */ | 192 | /* Congestion handling */ |
183 | struct sk_buff *next_out; | 193 | struct sk_buff *next_out; |
184 | struct sk_buff_head waiting_sks; | 194 | struct sk_buff_head wakeupq; |
185 | 195 | ||
186 | /* Fragmentation/reassembly */ | 196 | /* Fragmentation/reassembly */ |
187 | u32 long_msg_seq_no; | 197 | u32 long_msg_seq_no; |
@@ -196,28 +206,24 @@ struct tipc_port; | |||
196 | struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | 206 | struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, |
197 | struct tipc_bearer *b_ptr, | 207 | struct tipc_bearer *b_ptr, |
198 | const struct tipc_media_addr *media_addr); | 208 | const struct tipc_media_addr *media_addr); |
199 | void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down); | 209 | void tipc_link_delete(struct tipc_link *link); |
210 | void tipc_link_delete_list(struct net *net, unsigned int bearer_id, | ||
211 | bool shutting_down); | ||
200 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr); | 212 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr); |
201 | void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest); | 213 | void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest); |
202 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); | 214 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); |
203 | int tipc_link_is_up(struct tipc_link *l_ptr); | 215 | int tipc_link_is_up(struct tipc_link *l_ptr); |
204 | int tipc_link_is_active(struct tipc_link *l_ptr); | 216 | int tipc_link_is_active(struct tipc_link *l_ptr); |
205 | void tipc_link_purge_queues(struct tipc_link *l_ptr); | 217 | void tipc_link_purge_queues(struct tipc_link *l_ptr); |
206 | struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, | ||
207 | int req_tlv_space, | ||
208 | u16 cmd); | ||
209 | struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, | ||
210 | int req_tlv_space); | ||
211 | struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, | ||
212 | int req_tlv_space); | ||
213 | void tipc_link_reset_all(struct tipc_node *node); | 218 | void tipc_link_reset_all(struct tipc_node *node); |
214 | void tipc_link_reset(struct tipc_link *l_ptr); | 219 | void tipc_link_reset(struct tipc_link *l_ptr); |
215 | void tipc_link_reset_list(unsigned int bearer_id); | 220 | void tipc_link_reset_list(struct net *net, unsigned int bearer_id); |
216 | int tipc_link_xmit_skb(struct sk_buff *skb, u32 dest, u32 selector); | 221 | int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, |
217 | int tipc_link_xmit(struct sk_buff_head *list, u32 dest, u32 selector); | 222 | u32 selector); |
218 | int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list); | 223 | int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, |
219 | u32 tipc_link_get_max_pkt(u32 dest, u32 selector); | 224 | u32 selector); |
220 | void tipc_link_bundle_rcv(struct sk_buff *buf); | 225 | int __tipc_link_xmit(struct net *net, struct tipc_link *link, |
226 | struct sk_buff_head *list); | ||
221 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, | 227 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, |
222 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); | 228 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); |
223 | void tipc_link_push_packets(struct tipc_link *l_ptr); | 229 | void tipc_link_push_packets(struct tipc_link *l_ptr); |
@@ -233,6 +239,7 @@ int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info); | |||
233 | int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info); | 239 | int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info); |
234 | int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info); | 240 | int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info); |
235 | int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]); | 241 | int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]); |
242 | void link_prepare_wakeup(struct tipc_link *l); | ||
236 | 243 | ||
237 | /* | 244 | /* |
238 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) | 245 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) |
@@ -267,6 +274,10 @@ static inline u32 lesser(u32 left, u32 right) | |||
267 | return less_eq(left, right) ? left : right; | 274 | return less_eq(left, right) ? left : right; |
268 | } | 275 | } |
269 | 276 | ||
277 | static inline u32 link_own_addr(struct tipc_link *l) | ||
278 | { | ||
279 | return msg_prevnode(l->pmsg); | ||
280 | } | ||
270 | 281 | ||
271 | /* | 282 | /* |
272 | * Link status checking routines | 283 | * Link status checking routines |