diff options
-rw-r--r-- | net/tipc/bearer.c | 2 | ||||
-rw-r--r-- | net/tipc/bearer.h | 3 | ||||
-rw-r--r-- | net/tipc/link.c | 70 | ||||
-rw-r--r-- | net/tipc/link.h | 15 | ||||
-rw-r--r-- | net/tipc/node.c | 4 |
5 files changed, 56 insertions, 38 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 07ed5cc8235d..2d456ab0e843 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -541,7 +541,7 @@ static int tipc_l2_rcv_msg(struct sk_buff *buf, struct net_device *dev, | |||
541 | if (likely(b_ptr)) { | 541 | if (likely(b_ptr)) { |
542 | if (likely(buf->pkt_type <= PACKET_BROADCAST)) { | 542 | if (likely(buf->pkt_type <= PACKET_BROADCAST)) { |
543 | buf->next = NULL; | 543 | buf->next = NULL; |
544 | tipc_recv_msg(buf, b_ptr); | 544 | tipc_rcv(buf, b_ptr); |
545 | rcu_read_unlock(); | 545 | rcu_read_unlock(); |
546 | return NET_RX_SUCCESS; | 546 | return NET_RX_SUCCESS; |
547 | } | 547 | } |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 410efb1e930b..4f5db9ad5bf6 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -161,8 +161,7 @@ extern struct tipc_bearer tipc_bearers[]; | |||
161 | * TIPC routines available to supported media types | 161 | * TIPC routines available to supported media types |
162 | */ | 162 | */ |
163 | 163 | ||
164 | void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr); | 164 | void tipc_rcv(struct sk_buff *buf, struct tipc_bearer *tb_ptr); |
165 | |||
166 | int tipc_enable_bearer(const char *bearer_name, u32 disc_domain, u32 priority); | 165 | int tipc_enable_bearer(const char *bearer_name, u32 disc_domain, u32 priority); |
167 | int tipc_disable_bearer(const char *name); | 166 | int tipc_disable_bearer(const char *name); |
168 | 167 | ||
diff --git a/net/tipc/link.c b/net/tipc/link.c index 131a32a7b174..bb48b9685020 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/link.c: TIPC link code | 2 | * net/tipc/link.c: TIPC link code |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2007, 2012, Ericsson AB | 4 | * Copyright (c) 1996-2007, 2012-2014, Ericsson AB |
5 | * Copyright (c) 2004-2007, 2010-2013, Wind River Systems | 5 | * Copyright (c) 2004-2007, 2010-2013, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -78,8 +78,8 @@ static const char *link_unk_evt = "Unknown link event "; | |||
78 | static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, | 78 | static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, |
79 | struct sk_buff *buf); | 79 | struct sk_buff *buf); |
80 | static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf); | 80 | static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf); |
81 | static int link_recv_changeover_msg(struct tipc_link **l_ptr, | 81 | static int tipc_link_tunnel_rcv(struct tipc_link **l_ptr, |
82 | struct sk_buff **buf); | 82 | struct sk_buff **buf); |
83 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance); | 83 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance); |
84 | static int link_send_sections_long(struct tipc_port *sender, | 84 | static int link_send_sections_long(struct tipc_port *sender, |
85 | struct iovec const *msg_sect, | 85 | struct iovec const *msg_sect, |
@@ -278,7 +278,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | |||
278 | 278 | ||
279 | tipc_node_attach_link(n_ptr, l_ptr); | 279 | tipc_node_attach_link(n_ptr, l_ptr); |
280 | 280 | ||
281 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); | 281 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, |
282 | (unsigned long)l_ptr); | ||
282 | list_add_tail(&l_ptr->link_list, &b_ptr->links); | 283 | list_add_tail(&l_ptr->link_list, &b_ptr->links); |
283 | tipc_k_signal((Handler)link_start, (unsigned long)l_ptr); | 284 | tipc_k_signal((Handler)link_start, (unsigned long)l_ptr); |
284 | 285 | ||
@@ -1422,14 +1423,14 @@ static int link_recv_buf_validate(struct sk_buff *buf) | |||
1422 | } | 1423 | } |
1423 | 1424 | ||
1424 | /** | 1425 | /** |
1425 | * tipc_recv_msg - process TIPC messages arriving from off-node | 1426 | * tipc_rcv - process TIPC packets/messages arriving from off-node |
1426 | * @head: pointer to message buffer chain | 1427 | * @head: pointer to message buffer chain |
1427 | * @tb_ptr: pointer to bearer message arrived on | 1428 | * @tb_ptr: pointer to bearer message arrived on |
1428 | * | 1429 | * |
1429 | * Invoked with no locks held. Bearer pointer must point to a valid bearer | 1430 | * Invoked with no locks held. Bearer pointer must point to a valid bearer |
1430 | * structure (i.e. cannot be NULL), but bearer can be inactive. | 1431 | * structure (i.e. cannot be NULL), but bearer can be inactive. |
1431 | */ | 1432 | */ |
1432 | void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) | 1433 | void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr) |
1433 | { | 1434 | { |
1434 | read_lock_bh(&tipc_net_lock); | 1435 | read_lock_bh(&tipc_net_lock); |
1435 | while (head) { | 1436 | while (head) { |
@@ -1603,7 +1604,7 @@ deliver: | |||
1603 | continue; | 1604 | continue; |
1604 | case CHANGEOVER_PROTOCOL: | 1605 | case CHANGEOVER_PROTOCOL: |
1605 | type = msg_type(msg); | 1606 | type = msg_type(msg); |
1606 | if (link_recv_changeover_msg(&l_ptr, &buf)) { | 1607 | if (tipc_link_tunnel_rcv(&l_ptr, &buf)) { |
1607 | msg = buf_msg(buf); | 1608 | msg = buf_msg(buf); |
1608 | seq_no = msg_seqno(msg); | 1609 | seq_no = msg_seqno(msg); |
1609 | if (type == ORIGINAL_MSG) | 1610 | if (type == ORIGINAL_MSG) |
@@ -1954,13 +1955,13 @@ exit: | |||
1954 | } | 1955 | } |
1955 | 1956 | ||
1956 | 1957 | ||
1957 | /* | 1958 | /* tipc_link_tunnel_xmit(): Tunnel one packet via a link belonging to |
1958 | * tipc_link_tunnel(): Send one message via a link belonging to | 1959 | * a different bearer. Owner node is locked. |
1959 | * another bearer. Owner node is locked. | ||
1960 | */ | 1960 | */ |
1961 | static void tipc_link_tunnel(struct tipc_link *l_ptr, | 1961 | static void tipc_link_tunnel_xmit(struct tipc_link *l_ptr, |
1962 | struct tipc_msg *tunnel_hdr, struct tipc_msg *msg, | 1962 | struct tipc_msg *tunnel_hdr, |
1963 | u32 selector) | 1963 | struct tipc_msg *msg, |
1964 | u32 selector) | ||
1964 | { | 1965 | { |
1965 | struct tipc_link *tunnel; | 1966 | struct tipc_link *tunnel; |
1966 | struct sk_buff *buf; | 1967 | struct sk_buff *buf; |
@@ -1983,12 +1984,13 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr, | |||
1983 | } | 1984 | } |
1984 | 1985 | ||
1985 | 1986 | ||
1986 | 1987 | /* tipc_link_failover_send_queue(): A link has gone down, but a second | |
1987 | /* | 1988 | * link is still active. We can do failover. Tunnel the failing link's |
1988 | * changeover(): Send whole message queue via the remaining link | 1989 | * whole send queue via the remaining link. This way, we don't lose |
1989 | * Owner node is locked. | 1990 | * any packets, and sequence order is preserved for subsequent traffic |
1991 | * sent over the remaining link. Owner node is locked. | ||
1990 | */ | 1992 | */ |
1991 | void tipc_link_changeover(struct tipc_link *l_ptr) | 1993 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr) |
1992 | { | 1994 | { |
1993 | u32 msgcount = l_ptr->out_queue_size; | 1995 | u32 msgcount = l_ptr->out_queue_size; |
1994 | struct sk_buff *crs = l_ptr->first_out; | 1996 | struct sk_buff *crs = l_ptr->first_out; |
@@ -2037,20 +2039,30 @@ void tipc_link_changeover(struct tipc_link *l_ptr) | |||
2037 | msgcount = msg_msgcnt(msg); | 2039 | msgcount = msg_msgcnt(msg); |
2038 | while (msgcount--) { | 2040 | while (msgcount--) { |
2039 | msg_set_seqno(m, msg_seqno(msg)); | 2041 | msg_set_seqno(m, msg_seqno(msg)); |
2040 | tipc_link_tunnel(l_ptr, &tunnel_hdr, m, | 2042 | tipc_link_tunnel_xmit(l_ptr, &tunnel_hdr, m, |
2041 | msg_link_selector(m)); | 2043 | msg_link_selector(m)); |
2042 | pos += align(msg_size(m)); | 2044 | pos += align(msg_size(m)); |
2043 | m = (struct tipc_msg *)pos; | 2045 | m = (struct tipc_msg *)pos; |
2044 | } | 2046 | } |
2045 | } else { | 2047 | } else { |
2046 | tipc_link_tunnel(l_ptr, &tunnel_hdr, msg, | 2048 | tipc_link_tunnel_xmit(l_ptr, &tunnel_hdr, msg, |
2047 | msg_link_selector(msg)); | 2049 | msg_link_selector(msg)); |
2048 | } | 2050 | } |
2049 | crs = crs->next; | 2051 | crs = crs->next; |
2050 | } | 2052 | } |
2051 | } | 2053 | } |
2052 | 2054 | ||
2053 | void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel) | 2055 | /* tipc_link_dup_send_queue(): A second link has become active. Tunnel a |
2056 | * duplicate of the first link's send queue via the new link. This way, we | ||
2057 | * are guaranteed that currently queued packets from a socket are delivered | ||
2058 | * before future traffic from the same socket, even if this is using the | ||
2059 | * new link. The last arriving copy of each duplicate packet is dropped at | ||
2060 | * the receiving end by the regular protocol check, so packet cardinality | ||
2061 | * and sequence order is preserved per sender/receiver socket pair. | ||
2062 | * Owner node is locked. | ||
2063 | */ | ||
2064 | void tipc_link_dup_send_queue(struct tipc_link *l_ptr, | ||
2065 | struct tipc_link *tunnel) | ||
2054 | { | 2066 | { |
2055 | struct sk_buff *iter; | 2067 | struct sk_buff *iter; |
2056 | struct tipc_msg tunnel_hdr; | 2068 | struct tipc_msg tunnel_hdr; |
@@ -2106,12 +2118,14 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) | |||
2106 | return eb; | 2118 | return eb; |
2107 | } | 2119 | } |
2108 | 2120 | ||
2109 | /* | 2121 | /* tipc_link_tunnel_rcv(): Receive a tunneled packet, sent |
2110 | * link_recv_changeover_msg(): Receive tunneled packet sent | 2122 | * via other link as result of a failover (ORIGINAL_MSG) or |
2111 | * via other link. Node is locked. Return extracted buffer. | 2123 | * a new active link (DUPLICATE_MSG). Failover packets are |
2124 | * returned to the active link for delivery upwards. | ||
2125 | * Owner node is locked. | ||
2112 | */ | 2126 | */ |
2113 | static int link_recv_changeover_msg(struct tipc_link **l_ptr, | 2127 | static int tipc_link_tunnel_rcv(struct tipc_link **l_ptr, |
2114 | struct sk_buff **buf) | 2128 | struct sk_buff **buf) |
2115 | { | 2129 | { |
2116 | struct sk_buff *tunnel_buf = *buf; | 2130 | struct sk_buff *tunnel_buf = *buf; |
2117 | struct tipc_link *dest_link; | 2131 | struct tipc_link *dest_link; |
diff --git a/net/tipc/link.h b/net/tipc/link.h index 0636ca95be36..89ab89be848d 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -216,15 +216,20 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | |||
216 | struct tipc_bearer *b_ptr, | 216 | struct tipc_bearer *b_ptr, |
217 | const struct tipc_media_addr *media_addr); | 217 | const struct tipc_media_addr *media_addr); |
218 | void tipc_link_delete(struct tipc_link *l_ptr); | 218 | void tipc_link_delete(struct tipc_link *l_ptr); |
219 | void tipc_link_changeover(struct tipc_link *l_ptr); | 219 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr); |
220 | void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *dest); | 220 | void tipc_link_dup_send_queue(struct tipc_link *l_ptr, |
221 | struct tipc_link *dest); | ||
221 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); | 222 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); |
222 | int tipc_link_is_up(struct tipc_link *l_ptr); | 223 | int tipc_link_is_up(struct tipc_link *l_ptr); |
223 | int tipc_link_is_active(struct tipc_link *l_ptr); | 224 | int tipc_link_is_active(struct tipc_link *l_ptr); |
224 | void tipc_link_stop(struct tipc_link *l_ptr); | 225 | void tipc_link_stop(struct tipc_link *l_ptr); |
225 | struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); | 226 | struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, |
226 | struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); | 227 | int req_tlv_space, |
227 | struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); | 228 | u16 cmd); |
229 | struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, | ||
230 | int req_tlv_space); | ||
231 | struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, | ||
232 | int req_tlv_space); | ||
228 | void tipc_link_reset(struct tipc_link *l_ptr); | 233 | void tipc_link_reset(struct tipc_link *l_ptr); |
229 | int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); | 234 | int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); |
230 | void tipc_link_send_names(struct list_head *message_list, u32 dest); | 235 | void tipc_link_send_names(struct list_head *message_list, u32 dest); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index e167d2615569..efe4d41bf11b 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -162,7 +162,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
162 | pr_info("New link <%s> becomes standby\n", l_ptr->name); | 162 | pr_info("New link <%s> becomes standby\n", l_ptr->name); |
163 | return; | 163 | return; |
164 | } | 164 | } |
165 | tipc_link_send_duplicate(active[0], l_ptr); | 165 | tipc_link_dup_send_queue(active[0], l_ptr); |
166 | if (l_ptr->priority == active[0]->priority) { | 166 | if (l_ptr->priority == active[0]->priority) { |
167 | active[0] = l_ptr; | 167 | active[0] = l_ptr; |
168 | return; | 168 | return; |
@@ -225,7 +225,7 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
225 | if (active[0] == l_ptr) | 225 | if (active[0] == l_ptr) |
226 | node_select_active_links(n_ptr); | 226 | node_select_active_links(n_ptr); |
227 | if (tipc_node_is_up(n_ptr)) | 227 | if (tipc_node_is_up(n_ptr)) |
228 | tipc_link_changeover(l_ptr); | 228 | tipc_link_failover_send_queue(l_ptr); |
229 | else | 229 | else |
230 | node_lost_contact(n_ptr); | 230 | node_lost_contact(n_ptr); |
231 | } | 231 | } |