Commit 6e498158 authored by Jon Paul Maloy's avatar Jon Paul Maloy Committed by David S. Miller

tipc: move link synch and failover to link aggregation level

Link failover and synchronization have until now been handled by the
links themselves, forcing them to have knowledge about and to access
parallel links in order to make the two algorithms work correctly.

In this commit, we move the control part of this functionality to the
link aggregation level in node.c, which is the right location for this.
As a result, the two algorithms become easier to follow, and the link
implementation becomes simpler.
Tested-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66996b6c
This diff is collapsed.
...@@ -164,13 +164,11 @@ struct tipc_link { ...@@ -164,13 +164,11 @@ struct tipc_link {
struct tipc_msg *pmsg; struct tipc_msg *pmsg;
u32 priority; u32 priority;
char net_plane; char net_plane;
u8 exec_mode;
u16 synch_point;
/* Failover */ /* Failover/synch */
u16 failover_pkts; u8 exec_mode;
u16 failover_checkpt; u16 drop_point;
struct sk_buff *failover_skb; struct sk_buff *failover_reasm_skb;
/* Max packet negotiation */ /* Max packet negotiation */
u16 mtu; u16 mtu;
...@@ -212,8 +210,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n, ...@@ -212,8 +210,8 @@ struct tipc_link *tipc_link_create(struct tipc_node *n,
const struct tipc_media_addr *maddr, const struct tipc_media_addr *maddr,
struct sk_buff_head *inputq, struct sk_buff_head *inputq,
struct sk_buff_head *namedq); struct sk_buff_head *namedq);
void tipc_link_failover_send_queue(struct tipc_link *l_ptr); void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
void tipc_link_dup_queue_xmit(struct tipc_link *l_ptr, struct tipc_link *dest); int mtyp, struct sk_buff_head *xmitq);
void tipc_link_reset_fragments(struct tipc_link *l_ptr); void tipc_link_reset_fragments(struct tipc_link *l_ptr);
int tipc_link_is_up(struct tipc_link *l_ptr); int tipc_link_is_up(struct tipc_link *l_ptr);
int tipc_link_is_active(struct tipc_link *l_ptr); int tipc_link_is_active(struct tipc_link *l_ptr);
......
...@@ -110,7 +110,6 @@ struct tipc_skb_cb { ...@@ -110,7 +110,6 @@ struct tipc_skb_cb {
struct sk_buff *tail; struct sk_buff *tail;
bool validated; bool validated;
bool wakeup_pending; bool wakeup_pending;
bool bundling;
u16 chain_sz; u16 chain_sz;
u16 chain_imp; u16 chain_imp;
}; };
...@@ -559,15 +558,6 @@ static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n) ...@@ -559,15 +558,6 @@ static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n)
msg_set_bits(m, 1, 15, 0x1fff, n); msg_set_bits(m, 1, 15, 0x1fff, n);
} }
static inline bool msg_dup(struct tipc_msg *m)
{
if (likely(msg_user(m) != TUNNEL_PROTOCOL))
return false;
if (msg_type(m) != SYNCH_MSG)
return false;
return true;
}
/* /*
* Word 2 * Word 2
*/ */
...@@ -621,12 +611,12 @@ static inline void msg_set_fragm_no(struct tipc_msg *m, u32 n) ...@@ -621,12 +611,12 @@ static inline void msg_set_fragm_no(struct tipc_msg *m, u32 n)
} }
static inline u32 msg_next_sent(struct tipc_msg *m) static inline u16 msg_next_sent(struct tipc_msg *m)
{ {
return msg_bits(m, 4, 0, 0xffff); return msg_bits(m, 4, 0, 0xffff);
} }
static inline void msg_set_next_sent(struct tipc_msg *m, u32 n) static inline void msg_set_next_sent(struct tipc_msg *m, u16 n)
{ {
msg_set_bits(m, 4, 0, 0xffff, n); msg_set_bits(m, 4, 0, 0xffff, n);
} }
...@@ -727,12 +717,12 @@ static inline char *msg_media_addr(struct tipc_msg *m) ...@@ -727,12 +717,12 @@ static inline char *msg_media_addr(struct tipc_msg *m)
/* /*
* Word 9 * Word 9
*/ */
static inline u32 msg_msgcnt(struct tipc_msg *m) static inline u16 msg_msgcnt(struct tipc_msg *m)
{ {
return msg_bits(m, 9, 16, 0xffff); return msg_bits(m, 9, 16, 0xffff);
} }
static inline void msg_set_msgcnt(struct tipc_msg *m, u32 n) static inline void msg_set_msgcnt(struct tipc_msg *m, u16 n)
{ {
msg_set_bits(m, 9, 16, 0xffff, n); msg_set_bits(m, 9, 16, 0xffff, n);
} }
...@@ -767,19 +757,19 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) ...@@ -767,19 +757,19 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
msg_set_bits(m, 9, 0, 0xffff, n); msg_set_bits(m, 9, 0, 0xffff, n);
} }
static inline bool msg_is_traffic(struct tipc_msg *m) static inline bool msg_peer_link_is_up(struct tipc_msg *m)
{ {
if (likely(msg_user(m) != LINK_PROTOCOL)) if (likely(msg_user(m) != LINK_PROTOCOL))
return true; return true;
if ((msg_type(m) == RESET_MSG) || (msg_type(m) == ACTIVATE_MSG)) if (msg_type(m) == STATE_MSG)
return false; return true;
return true; return false;
} }
static inline bool msg_peer_is_up(struct tipc_msg *m) static inline bool msg_peer_node_is_up(struct tipc_msg *m)
{ {
if (likely(msg_is_traffic(m))) if (msg_peer_link_is_up(m))
return false; return true;
return msg_redundant_link(m); return msg_redundant_link(m);
} }
......
This diff is collapsed.
...@@ -47,33 +47,7 @@ ...@@ -47,33 +47,7 @@
#define INVALID_BEARER_ID -1 #define INVALID_BEARER_ID -1
/* Node FSM states and events:
*/
enum {
SELF_DOWN_PEER_DOWN = 0xdd,
SELF_UP_PEER_UP = 0xaa,
SELF_DOWN_PEER_LEAVING = 0xd1,
SELF_UP_PEER_COMING = 0xac,
SELF_COMING_PEER_UP = 0xca,
SELF_LEAVING_PEER_DOWN = 0x1d,
NODE_FAILINGOVER = 0xf0,
NODE_SYNCHING = 0xcc
};
enum {
SELF_ESTABL_CONTACT_EVT = 0xece,
SELF_LOST_CONTACT_EVT = 0x1ce,
PEER_ESTABL_CONTACT_EVT = 0xfece,
PEER_LOST_CONTACT_EVT = 0xf1ce,
NODE_FAILOVER_BEGIN_EVT = 0xfbe,
NODE_FAILOVER_END_EVT = 0xfee,
NODE_SYNCH_BEGIN_EVT = 0xcbe,
NODE_SYNCH_END_EVT = 0xcee
};
/* Flags used to take different actions according to flag type /* Flags used to take different actions according to flag type
* TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down
* TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down
* TIPC_NOTIFY_NODE_DOWN: notify node is down * TIPC_NOTIFY_NODE_DOWN: notify node is down
* TIPC_NOTIFY_NODE_UP: notify node is up * TIPC_NOTIFY_NODE_UP: notify node is up
* TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type
...@@ -133,6 +107,8 @@ struct tipc_link_entry { ...@@ -133,6 +107,8 @@ struct tipc_link_entry {
* @links: array containing references to all links to node * @links: array containing references to all links to node
* @action_flags: bit mask of different types of node actions * @action_flags: bit mask of different types of node actions
* @bclink: broadcast-related info * @bclink: broadcast-related info
* @state: connectivity state vs peer node
* @sync_point: sequence number where synch/failover is finished
* @list: links to adjacent nodes in sorted list of cluster's nodes * @list: links to adjacent nodes in sorted list of cluster's nodes
* @working_links: number of working links to node (both active and standby) * @working_links: number of working links to node (both active and standby)
* @link_cnt: number of links to node * @link_cnt: number of links to node
...@@ -156,6 +132,7 @@ struct tipc_node { ...@@ -156,6 +132,7 @@ struct tipc_node {
struct tipc_node_bclink bclink; struct tipc_node_bclink bclink;
struct list_head list; struct list_head list;
int state; int state;
u16 sync_point;
int link_cnt; int link_cnt;
u16 working_links; u16 working_links;
u16 capabilities; u16 capabilities;
...@@ -180,8 +157,6 @@ bool tipc_node_update_dest(struct tipc_node *n, struct tipc_bearer *bearer, ...@@ -180,8 +157,6 @@ bool tipc_node_update_dest(struct tipc_node *n, struct tipc_bearer *bearer,
void tipc_node_delete_links(struct net *net, int bearer_id); void tipc_node_delete_links(struct net *net, int bearer_id);
void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
void tipc_node_link_down(struct tipc_node *n_ptr, int bearer_id);
void tipc_node_link_up(struct tipc_node *n_ptr, int bearer_id);
bool tipc_node_is_up(struct tipc_node *n); bool tipc_node_is_up(struct tipc_node *n);
int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
char *linkname, size_t len); char *linkname, size_t len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment