diff options
Diffstat (limited to 'net/tipc/link.h')
| -rw-r--r-- | net/tipc/link.h | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h index b567a3427fda..55812e87ca1e 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #ifndef _TIPC_LINK_H | 37 | #ifndef _TIPC_LINK_H |
| 38 | #define _TIPC_LINK_H | 38 | #define _TIPC_LINK_H |
| 39 | 39 | ||
| 40 | #include <net/genetlink.h> | ||
| 40 | #include "msg.h" | 41 | #include "msg.h" |
| 41 | #include "node.h" | 42 | #include "node.h" |
| 42 | 43 | ||
| @@ -118,20 +119,13 @@ struct tipc_stats { | |||
| 118 | * @max_pkt: current maximum packet size for this link | 119 | * @max_pkt: current maximum packet size for this link |
| 119 | * @max_pkt_target: desired maximum packet size for this link | 120 | * @max_pkt_target: desired maximum packet size for this link |
| 120 | * @max_pkt_probes: # of probes based on current (max_pkt, max_pkt_target) | 121 | * @max_pkt_probes: # of probes based on current (max_pkt, max_pkt_target) |
| 121 | * @out_queue_size: # of messages in outbound message queue | 122 | * @outqueue: outbound message queue |
| 122 | * @first_out: ptr to first outbound message in queue | ||
| 123 | * @last_out: ptr to last outbound message in queue | ||
| 124 | * @next_out_no: next sequence number to use for outbound messages | 123 | * @next_out_no: next sequence number to use for outbound messages |
| 125 | * @last_retransmitted: sequence number of most recently retransmitted message | 124 | * @last_retransmitted: sequence number of most recently retransmitted message |
| 126 | * @stale_count: # of identical retransmit requests made by peer | 125 | * @stale_count: # of identical retransmit requests made by peer |
| 127 | * @next_in_no: next sequence number to expect for inbound messages | 126 | * @next_in_no: next sequence number to expect for inbound messages |
| 128 | * @deferred_inqueue_sz: # of messages in inbound message queue | 127 | * @deferred_queue: deferred queue saved OOS b'cast message received from node |
| 129 | * @oldest_deferred_in: ptr to first inbound message in queue | ||
| 130 | * @newest_deferred_in: ptr to last inbound message in queue | ||
| 131 | * @unacked_window: # of inbound messages rx'd without ack'ing back to peer | 128 | * @unacked_window: # of inbound messages rx'd without ack'ing back to peer |
| 132 | * @proto_msg_queue: ptr to (single) outbound control message | ||
| 133 | * @retransm_queue_size: number of messages to retransmit | ||
| 134 | * @retransm_queue_head: sequence number of first message to retransmit | ||
| 135 | * @next_out: ptr to first unsent outbound message in queue | 129 | * @next_out: ptr to first unsent outbound message in queue |
| 136 | * @waiting_sks: linked list of sockets waiting for link congestion to abate | 130 | * @waiting_sks: linked list of sockets waiting for link congestion to abate |
| 137 | * @long_msg_seq_no: next identifier to use for outbound fragmented messages | 131 | * @long_msg_seq_no: next identifier to use for outbound fragmented messages |
| @@ -175,24 +169,17 @@ struct tipc_link { | |||
| 175 | u32 max_pkt_probes; | 169 | u32 max_pkt_probes; |
| 176 | 170 | ||
| 177 | /* Sending */ | 171 | /* Sending */ |
| 178 | u32 out_queue_size; | 172 | struct sk_buff_head outqueue; |
| 179 | struct sk_buff *first_out; | ||
| 180 | struct sk_buff *last_out; | ||
| 181 | u32 next_out_no; | 173 | u32 next_out_no; |
| 182 | u32 last_retransmitted; | 174 | u32 last_retransmitted; |
| 183 | u32 stale_count; | 175 | u32 stale_count; |
| 184 | 176 | ||
| 185 | /* Reception */ | 177 | /* Reception */ |
| 186 | u32 next_in_no; | 178 | u32 next_in_no; |
| 187 | u32 deferred_inqueue_sz; | 179 | struct sk_buff_head deferred_queue; |
| 188 | struct sk_buff *oldest_deferred_in; | ||
| 189 | struct sk_buff *newest_deferred_in; | ||
| 190 | u32 unacked_window; | 180 | u32 unacked_window; |
| 191 | 181 | ||
| 192 | /* Congestion handling */ | 182 | /* Congestion handling */ |
| 193 | struct sk_buff *proto_msg_queue; | ||
| 194 | u32 retransm_queue_size; | ||
| 195 | u32 retransm_queue_head; | ||
| 196 | struct sk_buff *next_out; | 183 | struct sk_buff *next_out; |
| 197 | struct sk_buff_head waiting_sks; | 184 | struct sk_buff_head waiting_sks; |
| 198 | 185 | ||
| @@ -226,18 +213,26 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, | |||
| 226 | void tipc_link_reset_all(struct tipc_node *node); | 213 | void tipc_link_reset_all(struct tipc_node *node); |
| 227 | void tipc_link_reset(struct tipc_link *l_ptr); | 214 | void tipc_link_reset(struct tipc_link *l_ptr); |
| 228 | void tipc_link_reset_list(unsigned int bearer_id); | 215 | void tipc_link_reset_list(unsigned int bearer_id); |
| 229 | int tipc_link_xmit(struct sk_buff *buf, u32 dest, u32 selector); | 216 | int tipc_link_xmit_skb(struct sk_buff *skb, u32 dest, u32 selector); |
| 230 | int __tipc_link_xmit(struct tipc_link *link, struct sk_buff *buf); | 217 | int tipc_link_xmit(struct sk_buff_head *list, u32 dest, u32 selector); |
| 218 | int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list); | ||
| 231 | u32 tipc_link_get_max_pkt(u32 dest, u32 selector); | 219 | u32 tipc_link_get_max_pkt(u32 dest, u32 selector); |
| 232 | void tipc_link_bundle_rcv(struct sk_buff *buf); | 220 | void tipc_link_bundle_rcv(struct sk_buff *buf); |
| 233 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, | 221 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, |
| 234 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); | 222 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); |
| 235 | void tipc_link_push_queue(struct tipc_link *l_ptr); | 223 | void tipc_link_push_packets(struct tipc_link *l_ptr); |
| 236 | u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, | 224 | u32 tipc_link_defer_pkt(struct sk_buff_head *list, struct sk_buff *buf); |
| 237 | struct sk_buff *buf); | ||
| 238 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); | 225 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); |
| 239 | void tipc_link_retransmit(struct tipc_link *l_ptr, | 226 | void tipc_link_retransmit(struct tipc_link *l_ptr, |
| 240 | struct sk_buff *start, u32 retransmits); | 227 | struct sk_buff *start, u32 retransmits); |
| 228 | struct sk_buff *tipc_skb_queue_next(const struct sk_buff_head *list, | ||
| 229 | const struct sk_buff *skb); | ||
| 230 | |||
| 231 | int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb); | ||
| 232 | 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); | ||
| 234 | 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 | 236 | ||
| 242 | /* | 237 | /* |
| 243 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) | 238 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) |
| @@ -252,18 +247,14 @@ static inline u32 mod(u32 x) | |||
| 252 | return x & 0xffffu; | 247 | return x & 0xffffu; |
| 253 | } | 248 | } |
| 254 | 249 | ||
| 255 | static inline int between(u32 lower, u32 upper, u32 n) | 250 | static inline int less_eq(u32 left, u32 right) |
| 256 | { | 251 | { |
| 257 | if ((lower < n) && (n < upper)) | 252 | return mod(right - left) < 32768u; |
| 258 | return 1; | ||
| 259 | if ((upper < lower) && ((n > lower) || (n < upper))) | ||
| 260 | return 1; | ||
| 261 | return 0; | ||
| 262 | } | 253 | } |
| 263 | 254 | ||
| 264 | static inline int less_eq(u32 left, u32 right) | 255 | static inline int more(u32 left, u32 right) |
| 265 | { | 256 | { |
| 266 | return mod(right - left) < 32768u; | 257 | return !less_eq(left, right); |
| 267 | } | 258 | } |
| 268 | 259 | ||
| 269 | static inline int less(u32 left, u32 right) | 260 | static inline int less(u32 left, u32 right) |
| @@ -302,7 +293,7 @@ static inline int link_reset_reset(struct tipc_link *l_ptr) | |||
| 302 | 293 | ||
| 303 | static inline int link_congested(struct tipc_link *l_ptr) | 294 | static inline int link_congested(struct tipc_link *l_ptr) |
| 304 | { | 295 | { |
| 305 | return l_ptr->out_queue_size >= l_ptr->queue_limit[0]; | 296 | return skb_queue_len(&l_ptr->outqueue) >= l_ptr->queue_limit[0]; |
| 306 | } | 297 | } |
| 307 | 298 | ||
| 308 | #endif | 299 | #endif |
