Commit c448b5e7 authored by David S. Miller's avatar David S. Miller

Merge branch 'tipc-next'

Jon Maloy says:

====================
tipc: remove some unnecessary complexity

The TIPC code is unnecessarily complex in some places, often because
the conditions or assumptions that were the cause for the complexity
are not valid anymore.

In these three commits, we eliminate some cases of such redundant
complexity.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c5531ca2 ed193ece
...@@ -413,7 +413,7 @@ static void bclink_accept_pkt(struct tipc_node *node, u32 seqno) ...@@ -413,7 +413,7 @@ static void bclink_accept_pkt(struct tipc_node *node, u32 seqno)
*/ */
if (((seqno - tn->own_addr) % TIPC_MIN_LINK_WIN) == 0) { if (((seqno - tn->own_addr) % TIPC_MIN_LINK_WIN) == 0) {
tipc_link_proto_xmit(node->active_links[node->addr & 1], tipc_link_proto_xmit(node->active_links[node->addr & 1],
STATE_MSG, 0, 0, 0, 0, 0); STATE_MSG, 0, 0, 0, 0);
tn->bcl->stats.sent_acks++; tn->bcl->stats.sent_acks++;
} }
} }
...@@ -899,7 +899,7 @@ int tipc_bclink_init(struct net *net) ...@@ -899,7 +899,7 @@ int tipc_bclink_init(struct net *net)
skb_queue_head_init(&bclink->inputq); skb_queue_head_init(&bclink->inputq);
bcl->owner = &bclink->node; bcl->owner = &bclink->node;
bcl->owner->net = net; bcl->owner->net = net;
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; bcl->mtu = MAX_PKT_DEFAULT_MCAST;
tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
bcl->bearer_id = MAX_BEARERS; bcl->bearer_id = MAX_BEARERS;
rcu_assign_pointer(tn->bearer_list[MAX_BEARERS], &bcbearer->bearer); rcu_assign_pointer(tn->bearer_list[MAX_BEARERS], &bcbearer->bearer);
......
This diff is collapsed.
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#define LINK_STARTED 0x0001 #define LINK_STARTED 0x0001
#define LINK_STOPPED 0x0002 #define LINK_STOPPED 0x0002
#define LINK_SYNCHING 0x0004 #define LINK_SYNCHING 0x0004
#define LINK_FAILINGOVER 0x0008
/* Starting value for maximum packet size negotiation on unicast links /* Starting value for maximum packet size negotiation on unicast links
* (unless bearer MTU is less) * (unless bearer MTU is less)
...@@ -122,9 +123,8 @@ struct tipc_stats { ...@@ -122,9 +123,8 @@ struct tipc_stats {
* @backlog_limit: backlog queue congestion thresholds (indexed by importance) * @backlog_limit: backlog queue congestion thresholds (indexed by importance)
* @exp_msg_count: # of tunnelled messages expected during link changeover * @exp_msg_count: # of tunnelled messages expected during link changeover
* @reset_checkpoint: seq # of last acknowledged message at time of link reset * @reset_checkpoint: seq # of last acknowledged message at time of link reset
* @max_pkt: current maximum packet size for this link * @mtu: current maximum packet size for this link
* @max_pkt_target: desired maximum packet size for this link * @advertised_mtu: advertised own mtu when link is being established
* @max_pkt_probes: # of probes based on current (max_pkt, max_pkt_target)
* @transmitq: queue for sent, non-acked messages * @transmitq: queue for sent, non-acked messages
* @backlogq: queue for messages waiting to be sent * @backlogq: queue for messages waiting to be sent
* @next_out_no: next sequence number to use for outbound messages * @next_out_no: next sequence number to use for outbound messages
...@@ -167,16 +167,16 @@ struct tipc_link { ...@@ -167,16 +167,16 @@ struct tipc_link {
struct tipc_msg *pmsg; struct tipc_msg *pmsg;
u32 priority; u32 priority;
char net_plane; char net_plane;
u16 synch_point;
/* Changeover */ /* Failover */
u32 exp_msg_count; u16 failover_pkts;
u32 reset_checkpoint; u16 failover_checkpt;
u32 synch_point; struct sk_buff *failover_skb;
/* Max packet negotiation */ /* Max packet negotiation */
u32 max_pkt; u16 mtu;
u32 max_pkt_target; u16 advertised_mtu;
u32 max_pkt_probes;
/* Sending */ /* Sending */
struct sk_buff_head transmq; struct sk_buff_head transmq;
...@@ -201,7 +201,6 @@ struct tipc_link { ...@@ -201,7 +201,6 @@ struct tipc_link {
struct sk_buff_head wakeupq; struct sk_buff_head wakeupq;
/* Fragmentation/reassembly */ /* Fragmentation/reassembly */
u32 long_msg_seq_no;
struct sk_buff *reasm_buf; struct sk_buff *reasm_buf;
/* Statistics */ /* Statistics */
...@@ -232,7 +231,7 @@ int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, ...@@ -232,7 +231,7 @@ int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest,
int __tipc_link_xmit(struct net *net, struct tipc_link *link, int __tipc_link_xmit(struct net *net, struct tipc_link *link,
struct sk_buff_head *list); struct sk_buff_head *list);
void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob,
u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); u32 gap, u32 tolerance, u32 priority);
void tipc_link_push_packets(struct tipc_link *l_ptr); void tipc_link_push_packets(struct tipc_link *l_ptr);
u32 tipc_link_defer_pkt(struct sk_buff_head *list, struct sk_buff *buf); u32 tipc_link_defer_pkt(struct sk_buff_head *list, struct sk_buff *buf);
void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window);
......
...@@ -355,7 +355,7 @@ bool tipc_msg_bundle(struct sk_buff *bskb, struct sk_buff *skb, u32 mtu) ...@@ -355,7 +355,7 @@ bool tipc_msg_bundle(struct sk_buff *bskb, struct sk_buff *skb, u32 mtu)
start = align(bsz); start = align(bsz);
pad = start - bsz; pad = start - bsz;
if (unlikely(msg_user(msg) == CHANGEOVER_PROTOCOL)) if (unlikely(msg_user(msg) == TUNNEL_PROTOCOL))
return false; return false;
if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) if (unlikely(msg_user(msg) == BCAST_PROTOCOL))
return false; return false;
...@@ -433,7 +433,7 @@ bool tipc_msg_make_bundle(struct sk_buff **skb, u32 mtu, u32 dnode) ...@@ -433,7 +433,7 @@ bool tipc_msg_make_bundle(struct sk_buff **skb, u32 mtu, u32 dnode)
if (msg_user(msg) == MSG_FRAGMENTER) if (msg_user(msg) == MSG_FRAGMENTER)
return false; return false;
if (msg_user(msg) == CHANGEOVER_PROTOCOL) if (msg_user(msg) == TUNNEL_PROTOCOL)
return false; return false;
if (msg_user(msg) == BCAST_PROTOCOL) if (msg_user(msg) == BCAST_PROTOCOL)
return false; return false;
......
...@@ -72,7 +72,7 @@ struct plist; ...@@ -72,7 +72,7 @@ struct plist;
#define MSG_BUNDLER 6 #define MSG_BUNDLER 6
#define LINK_PROTOCOL 7 #define LINK_PROTOCOL 7
#define CONN_MANAGER 8 #define CONN_MANAGER 8
#define CHANGEOVER_PROTOCOL 10 #define TUNNEL_PROTOCOL 10
#define NAME_DISTRIBUTOR 11 #define NAME_DISTRIBUTOR 11
#define MSG_FRAGMENTER 12 #define MSG_FRAGMENTER 12
#define LINK_CONFIG 13 #define LINK_CONFIG 13
...@@ -512,8 +512,8 @@ static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) ...@@ -512,8 +512,8 @@ static inline void msg_set_nameupper(struct tipc_msg *m, u32 n)
/* /*
* Changeover tunnel message types * Changeover tunnel message types
*/ */
#define DUPLICATE_MSG 0 #define SYNCH_MSG 0
#define ORIGINAL_MSG 1 #define FAILOVER_MSG 1
/* /*
* Config protocol message types * Config protocol message types
...@@ -556,9 +556,9 @@ static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n) ...@@ -556,9 +556,9 @@ static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n)
static inline bool msg_dup(struct tipc_msg *m) static inline bool msg_dup(struct tipc_msg *m)
{ {
if (likely(msg_user(m) != CHANGEOVER_PROTOCOL)) if (likely(msg_user(m) != TUNNEL_PROTOCOL))
return false; return false;
if (msg_type(m) != DUPLICATE_MSG) if (msg_type(m) != SYNCH_MSG)
return false; return false;
return true; return true;
} }
......
...@@ -254,8 +254,8 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) ...@@ -254,8 +254,8 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
active[0] = active[1] = l_ptr; active[0] = active[1] = l_ptr;
exit: exit:
/* Leave room for changeover header when returning 'mtu' to users: */ /* Leave room for changeover header when returning 'mtu' to users: */
n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE; n_ptr->act_mtus[0] = active[0]->mtu - INT_H_SIZE;
n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE; n_ptr->act_mtus[1] = active[1]->mtu - INT_H_SIZE;
} }
/** /**
...@@ -319,11 +319,10 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) ...@@ -319,11 +319,10 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
/* Leave room for changeover header when returning 'mtu' to users: */ /* Leave room for changeover header when returning 'mtu' to users: */
if (active[0]) { if (active[0]) {
n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE; n_ptr->act_mtus[0] = active[0]->mtu - INT_H_SIZE;
n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE; n_ptr->act_mtus[1] = active[1]->mtu - INT_H_SIZE;
return; return;
} }
/* Loopback link went down? No fragmentation needed from now on. */ /* Loopback link went down? No fragmentation needed from now on. */
if (n_ptr->addr == tn->own_addr) { if (n_ptr->addr == tn->own_addr) {
n_ptr->act_mtus[0] = MAX_MSG_SIZE; n_ptr->act_mtus[0] = MAX_MSG_SIZE;
...@@ -394,18 +393,17 @@ static void node_lost_contact(struct tipc_node *n_ptr) ...@@ -394,18 +393,17 @@ static void node_lost_contact(struct tipc_node *n_ptr)
n_ptr->bclink.recv_permitted = false; n_ptr->bclink.recv_permitted = false;
} }
/* Abort link changeover */ /* Abort any ongoing link failover */
for (i = 0; i < MAX_BEARERS; i++) { for (i = 0; i < MAX_BEARERS; i++) {
struct tipc_link *l_ptr = n_ptr->links[i]; struct tipc_link *l_ptr = n_ptr->links[i];
if (!l_ptr) if (!l_ptr)
continue; continue;
l_ptr->reset_checkpoint = l_ptr->next_in_no; l_ptr->flags &= ~LINK_FAILINGOVER;
l_ptr->exp_msg_count = 0; l_ptr->failover_checkpt = 0;
l_ptr->failover_pkts = 0;
kfree_skb(l_ptr->failover_skb);
l_ptr->failover_skb = NULL;
tipc_link_reset_fragments(l_ptr); tipc_link_reset_fragments(l_ptr);
/* Link marked for deletion after failover? => do it now */
if (l_ptr->flags & LINK_STOPPED)
tipc_link_delete(l_ptr);
} }
n_ptr->action_flags &= ~TIPC_WAIT_OWN_LINKS_DOWN; n_ptr->action_flags &= ~TIPC_WAIT_OWN_LINKS_DOWN;
......
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