|
@@ -45,13 +45,11 @@
|
|
|
/*
|
|
|
* Out-of-range value for link session numbers
|
|
|
*/
|
|
|
-
|
|
|
#define INVALID_SESSION 0x10000
|
|
|
|
|
|
/*
|
|
|
* Link state events:
|
|
|
*/
|
|
|
-
|
|
|
#define STARTING_EVT 856384768 /* link processing trigger */
|
|
|
#define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */
|
|
|
#define TIMEOUT_EVT 560817u /* link timer expired */
|
|
@@ -67,7 +65,6 @@
|
|
|
/*
|
|
|
* State value stored in 'exp_msg_count'
|
|
|
*/
|
|
|
-
|
|
|
#define START_CHANGEOVER 100000u
|
|
|
|
|
|
/**
|
|
@@ -77,7 +74,6 @@
|
|
|
* @addr_peer: network address of node at far end
|
|
|
* @if_peer: name of interface at far end
|
|
|
*/
|
|
|
-
|
|
|
struct tipc_link_name {
|
|
|
u32 addr_local;
|
|
|
char if_local[TIPC_MAX_IF_NAME];
|
|
@@ -105,7 +101,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
|
|
|
/*
|
|
|
* Simple link routines
|
|
|
*/
|
|
|
-
|
|
|
static unsigned int align(unsigned int i)
|
|
|
{
|
|
|
return (i + 3) & ~3u;
|
|
@@ -143,7 +138,6 @@ static u32 link_last_sent(struct tipc_link *l_ptr)
|
|
|
/*
|
|
|
* Simple non-static link routines (i.e. referenced outside this file)
|
|
|
*/
|
|
|
-
|
|
|
int tipc_link_is_up(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
if (!l_ptr)
|
|
@@ -164,7 +158,6 @@ int tipc_link_is_active(struct tipc_link *l_ptr)
|
|
|
*
|
|
|
* Returns 1 if link name is valid, otherwise 0.
|
|
|
*/
|
|
|
-
|
|
|
static int link_name_validate(const char *name,
|
|
|
struct tipc_link_name *name_parts)
|
|
|
{
|
|
@@ -180,7 +173,6 @@ static int link_name_validate(const char *name,
|
|
|
u32 if_peer_len;
|
|
|
|
|
|
/* copy link name & ensure length is OK */
|
|
|
-
|
|
|
name_copy[TIPC_MAX_LINK_NAME - 1] = 0;
|
|
|
/* need above in case non-Posix strncpy() doesn't pad with nulls */
|
|
|
strncpy(name_copy, name, TIPC_MAX_LINK_NAME);
|
|
@@ -188,7 +180,6 @@ static int link_name_validate(const char *name,
|
|
|
return 0;
|
|
|
|
|
|
/* ensure all component parts of link name are present */
|
|
|
-
|
|
|
addr_local = name_copy;
|
|
|
if_local = strchr(addr_local, ':');
|
|
|
if (if_local == NULL)
|
|
@@ -206,7 +197,6 @@ static int link_name_validate(const char *name,
|
|
|
if_peer_len = strlen(if_peer) + 1;
|
|
|
|
|
|
/* validate component parts of link name */
|
|
|
-
|
|
|
if ((sscanf(addr_local, "%u.%u.%u%c",
|
|
|
&z_local, &c_local, &n_local, &dummy) != 3) ||
|
|
|
(sscanf(addr_peer, "%u.%u.%u%c",
|
|
@@ -220,7 +210,6 @@ static int link_name_validate(const char *name,
|
|
|
return 0;
|
|
|
|
|
|
/* return link name components, if necessary */
|
|
|
-
|
|
|
if (name_parts) {
|
|
|
name_parts->addr_local = tipc_addr(z_local, c_local, n_local);
|
|
|
strcpy(name_parts->if_local, if_local);
|
|
@@ -239,13 +228,11 @@ static int link_name_validate(const char *name,
|
|
|
* another thread because tipc_link_delete() always cancels the link timer before
|
|
|
* tipc_node_delete() is called.)
|
|
|
*/
|
|
|
-
|
|
|
static void link_timeout(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
tipc_node_lock(l_ptr->owner);
|
|
|
|
|
|
/* update counters used in statistical profiling of send traffic */
|
|
|
-
|
|
|
l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size;
|
|
|
l_ptr->stats.queue_sz_counts++;
|
|
|
|
|
@@ -278,7 +265,6 @@ static void link_timeout(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
|
|
|
/* do all other link processing performed on a periodic basis */
|
|
|
-
|
|
|
link_check_defragm_bufs(l_ptr);
|
|
|
|
|
|
link_state_event(l_ptr, TIMEOUT_EVT);
|
|
@@ -302,7 +288,6 @@ static void link_set_timer(struct tipc_link *l_ptr, u32 time)
|
|
|
*
|
|
|
* Returns pointer to link.
|
|
|
*/
|
|
|
-
|
|
|
struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
|
|
|
struct tipc_bearer *b_ptr,
|
|
|
const struct tipc_media_addr *media_addr)
|
|
@@ -383,7 +368,6 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
|
|
|
* This routine must not grab the node lock until after link timer cancellation
|
|
|
* to avoid a potential deadlock situation.
|
|
|
*/
|
|
|
-
|
|
|
void tipc_link_delete(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
if (!l_ptr) {
|
|
@@ -419,7 +403,6 @@ static void link_start(struct tipc_link *l_ptr)
|
|
|
* Schedules port for renewed sending of messages after link congestion
|
|
|
* has abated.
|
|
|
*/
|
|
|
-
|
|
|
static int link_schedule_port(struct tipc_link *l_ptr, u32 origport, u32 sz)
|
|
|
{
|
|
|
struct tipc_port *p_ptr;
|
|
@@ -476,7 +459,6 @@ exit:
|
|
|
* link_release_outqueue - purge link's outbound message queue
|
|
|
* @l_ptr: pointer to link
|
|
|
*/
|
|
|
-
|
|
|
static void link_release_outqueue(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
struct sk_buff *buf = l_ptr->first_out;
|
|
@@ -495,7 +477,6 @@ static void link_release_outqueue(struct tipc_link *l_ptr)
|
|
|
* tipc_link_reset_fragments - purge link's inbound message fragments queue
|
|
|
* @l_ptr: pointer to link
|
|
|
*/
|
|
|
-
|
|
|
void tipc_link_reset_fragments(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
struct sk_buff *buf = l_ptr->defragm_buf;
|
|
@@ -513,7 +494,6 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
|
|
|
* tipc_link_stop - purge all inbound and outbound messages associated with link
|
|
|
* @l_ptr: pointer to link
|
|
|
*/
|
|
|
-
|
|
|
void tipc_link_stop(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
struct sk_buff *buf;
|
|
@@ -569,7 +549,6 @@ void tipc_link_reset(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
|
|
|
/* Clean up all queues: */
|
|
|
-
|
|
|
link_release_outqueue(l_ptr);
|
|
|
kfree_skb(l_ptr->proto_msg_queue);
|
|
|
l_ptr->proto_msg_queue = NULL;
|
|
@@ -611,7 +590,6 @@ static void link_activate(struct tipc_link *l_ptr)
|
|
|
* @l_ptr: pointer to link
|
|
|
* @event: state machine event to process
|
|
|
*/
|
|
|
-
|
|
|
static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
|
|
|
{
|
|
|
struct tipc_link *other;
|
|
@@ -785,7 +763,6 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
|
|
|
* link_bundle_buf(): Append contents of a buffer to
|
|
|
* the tail of an existing one.
|
|
|
*/
|
|
|
-
|
|
|
static int link_bundle_buf(struct tipc_link *l_ptr,
|
|
|
struct sk_buff *bundler,
|
|
|
struct sk_buff *buf)
|
|
@@ -860,7 +837,6 @@ static void link_add_chain_to_outqueue(struct tipc_link *l_ptr,
|
|
|
* inside TIPC when the 'fast path' in tipc_send_buf
|
|
|
* has failed, and from link_send()
|
|
|
*/
|
|
|
-
|
|
|
int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
{
|
|
|
struct tipc_msg *msg = buf_msg(buf);
|
|
@@ -872,7 +848,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
u32 max_packet = l_ptr->max_pkt;
|
|
|
|
|
|
/* Match msg importance against queue limits: */
|
|
|
-
|
|
|
if (unlikely(queue_size >= queue_limit)) {
|
|
|
if (imp <= TIPC_CRITICAL_IMPORTANCE) {
|
|
|
link_schedule_port(l_ptr, msg_origport(msg), size);
|
|
@@ -888,12 +863,10 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
}
|
|
|
|
|
|
/* Fragmentation needed ? */
|
|
|
-
|
|
|
if (size > max_packet)
|
|
|
return link_send_long_buf(l_ptr, buf);
|
|
|
|
|
|
- /* Packet can be queued or sent: */
|
|
|
-
|
|
|
+ /* Packet can be queued or sent. */
|
|
|
if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
|
|
|
!link_congested(l_ptr))) {
|
|
|
link_add_to_outqueue(l_ptr, buf, msg);
|
|
@@ -907,13 +880,11 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
}
|
|
|
return dsz;
|
|
|
}
|
|
|
- /* Congestion: can message be bundled ?: */
|
|
|
-
|
|
|
+ /* Congestion: can message be bundled ? */
|
|
|
if ((msg_user(msg) != CHANGEOVER_PROTOCOL) &&
|
|
|
(msg_user(msg) != MSG_FRAGMENTER)) {
|
|
|
|
|
|
/* Try adding message to an existing bundle */
|
|
|
-
|
|
|
if (l_ptr->next_out &&
|
|
|
link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
|
|
|
tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
|
|
@@ -921,7 +892,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
}
|
|
|
|
|
|
/* Try creating a new bundle */
|
|
|
-
|
|
|
if (size <= max_packet * 2 / 3) {
|
|
|
struct sk_buff *bundler = tipc_buf_acquire(max_packet);
|
|
|
struct tipc_msg bundler_hdr;
|
|
@@ -951,7 +921,6 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
* not been selected yet, and the the owner node is not locked
|
|
|
* Called by TIPC internal users, e.g. the name distributor
|
|
|
*/
|
|
|
-
|
|
|
int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
|
|
|
{
|
|
|
struct tipc_link *l_ptr;
|
|
@@ -984,7 +953,6 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
|
|
|
* small enough not to require fragmentation.
|
|
|
* Called without any locks held.
|
|
|
*/
|
|
|
-
|
|
|
void tipc_link_send_names(struct list_head *message_list, u32 dest)
|
|
|
{
|
|
|
struct tipc_node *n_ptr;
|
|
@@ -1013,7 +981,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
|
|
|
read_unlock_bh(&tipc_net_lock);
|
|
|
|
|
|
/* discard the messages if they couldn't be sent */
|
|
|
-
|
|
|
list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) {
|
|
|
list_del((struct list_head *)buf);
|
|
|
kfree_skb(buf);
|
|
@@ -1026,7 +993,6 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
|
|
|
* inclusive total message length. Very time critical.
|
|
|
* Link is locked. Returns user data length.
|
|
|
*/
|
|
|
-
|
|
|
static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
|
|
|
u32 *used_max_pkt)
|
|
|
{
|
|
@@ -1111,7 +1077,6 @@ again:
|
|
|
* Try building message using port's max_pkt hint.
|
|
|
* (Must not hold any locks while building message.)
|
|
|
*/
|
|
|
-
|
|
|
res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
|
|
|
sender->max_pkt, !sender->user_port, &buf);
|
|
|
|
|
@@ -1131,12 +1096,10 @@ exit:
|
|
|
}
|
|
|
|
|
|
/* Exit if build request was invalid */
|
|
|
-
|
|
|
if (unlikely(res < 0))
|
|
|
goto exit;
|
|
|
|
|
|
/* Exit if link (or bearer) is congested */
|
|
|
-
|
|
|
if (link_congested(l_ptr) ||
|
|
|
!list_empty(&l_ptr->b_ptr->cong_links)) {
|
|
|
res = link_schedule_port(l_ptr,
|
|
@@ -1148,7 +1111,6 @@ exit:
|
|
|
* Message size exceeds max_pkt hint; update hint,
|
|
|
* then re-try fast path or fragment the message
|
|
|
*/
|
|
|
-
|
|
|
sender->max_pkt = l_ptr->max_pkt;
|
|
|
tipc_node_unlock(node);
|
|
|
read_unlock_bh(&tipc_net_lock);
|
|
@@ -1166,7 +1128,6 @@ exit:
|
|
|
read_unlock_bh(&tipc_net_lock);
|
|
|
|
|
|
/* Couldn't find a link to the destination node */
|
|
|
-
|
|
|
if (buf)
|
|
|
return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
|
|
|
if (res >= 0)
|
|
@@ -1220,15 +1181,13 @@ again:
|
|
|
sect_crs = NULL;
|
|
|
curr_sect = -1;
|
|
|
|
|
|
- /* Prepare reusable fragment header: */
|
|
|
-
|
|
|
+ /* Prepare reusable fragment header */
|
|
|
tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
|
|
|
INT_H_SIZE, msg_destnode(hdr));
|
|
|
msg_set_size(&fragm_hdr, max_pkt);
|
|
|
msg_set_fragm_no(&fragm_hdr, 1);
|
|
|
|
|
|
- /* Prepare header of first fragment: */
|
|
|
-
|
|
|
+ /* Prepare header of first fragment */
|
|
|
buf_chain = buf = tipc_buf_acquire(max_pkt);
|
|
|
if (!buf)
|
|
|
return -ENOMEM;
|
|
@@ -1237,8 +1196,7 @@ again:
|
|
|
hsz = msg_hdr_sz(hdr);
|
|
|
skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz);
|
|
|
|
|
|
- /* Chop up message: */
|
|
|
-
|
|
|
+ /* Chop up message */
|
|
|
fragm_crs = INT_H_SIZE + hsz;
|
|
|
fragm_rest = fragm_sz - hsz;
|
|
|
|
|
@@ -1329,7 +1287,6 @@ reject:
|
|
|
}
|
|
|
|
|
|
/* Append chain of fragments to send queue & send them */
|
|
|
-
|
|
|
l_ptr->long_msg_seq_no++;
|
|
|
link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
|
|
|
l_ptr->stats.sent_fragments += fragm_no;
|
|
@@ -1350,7 +1307,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
|
|
|
|
|
|
/* Step to position where retransmission failed, if any, */
|
|
|
/* consider that buffers may have been released in meantime */
|
|
|
-
|
|
|
if (r_q_size && buf) {
|
|
|
u32 last = lesser(mod(r_q_head + r_q_size),
|
|
|
link_last_sent(l_ptr));
|
|
@@ -1365,7 +1321,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
|
|
|
/* Continue retransmission now, if there is anything: */
|
|
|
-
|
|
|
if (r_q_size && buf) {
|
|
|
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
|
|
|
msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
|
|
@@ -1381,7 +1336,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
|
|
|
/* Send deferred protocol message, if any: */
|
|
|
-
|
|
|
buf = l_ptr->proto_msg_queue;
|
|
|
if (buf) {
|
|
|
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
|
|
@@ -1398,7 +1352,6 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
|
|
|
/* Send one deferred data message, if send window not full: */
|
|
|
-
|
|
|
buf = l_ptr->next_out;
|
|
|
if (buf) {
|
|
|
struct tipc_msg *msg = buf_msg(buf);
|
|
@@ -1478,16 +1431,12 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
|
|
|
warn("Retransmission failure on link <%s>\n", l_ptr->name);
|
|
|
|
|
|
if (l_ptr->addr) {
|
|
|
-
|
|
|
/* Handle failure on standard link */
|
|
|
-
|
|
|
link_print(l_ptr, "Resetting link\n");
|
|
|
tipc_link_reset(l_ptr);
|
|
|
|
|
|
} else {
|
|
|
-
|
|
|
/* Handle failure on broadcast link */
|
|
|
-
|
|
|
struct tipc_node *n_ptr;
|
|
|
char addr_string[16];
|
|
|
|
|
@@ -1536,7 +1485,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
|
|
|
return;
|
|
|
} else {
|
|
|
/* Detect repeated retransmit failures on uncongested bearer */
|
|
|
-
|
|
|
if (l_ptr->last_retransmitted == msg_seqno(msg)) {
|
|
|
if (++l_ptr->stale_count > 100) {
|
|
|
link_retransmit_failure(l_ptr, buf);
|
|
@@ -1571,7 +1519,6 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
|
|
|
/**
|
|
|
* link_insert_deferred_queue - insert deferred messages back into receive chain
|
|
|
*/
|
|
|
-
|
|
|
static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
|
|
|
struct sk_buff *buf)
|
|
|
{
|
|
@@ -1602,7 +1549,6 @@ static struct sk_buff *link_insert_deferred_queue(struct tipc_link *l_ptr,
|
|
|
* TIPC will ignore the excess, under the assumption that it is optional info
|
|
|
* introduced by a later release of the protocol.
|
|
|
*/
|
|
|
-
|
|
|
static int link_recv_buf_validate(struct sk_buff *buf)
|
|
|
{
|
|
|
static u32 min_data_hdr_size[8] = {
|
|
@@ -1648,7 +1594,6 @@ static int link_recv_buf_validate(struct sk_buff *buf)
|
|
|
* Invoked with no locks held. Bearer pointer must point to a valid bearer
|
|
|
* structure (i.e. cannot be NULL), but bearer can be inactive.
|
|
|
*/
|
|
|
-
|
|
|
void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
{
|
|
|
read_lock_bh(&tipc_net_lock);
|
|
@@ -1666,22 +1611,18 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
head = head->next;
|
|
|
|
|
|
/* Ensure bearer is still enabled */
|
|
|
-
|
|
|
if (unlikely(!b_ptr->active))
|
|
|
goto cont;
|
|
|
|
|
|
/* Ensure message is well-formed */
|
|
|
-
|
|
|
if (unlikely(!link_recv_buf_validate(buf)))
|
|
|
goto cont;
|
|
|
|
|
|
/* Ensure message data is a single contiguous unit */
|
|
|
-
|
|
|
if (unlikely(skb_linearize(buf)))
|
|
|
goto cont;
|
|
|
|
|
|
/* Handle arrival of a non-unicast link message */
|
|
|
-
|
|
|
msg = buf_msg(buf);
|
|
|
|
|
|
if (unlikely(msg_non_seq(msg))) {
|
|
@@ -1693,20 +1634,17 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
}
|
|
|
|
|
|
/* Discard unicast link messages destined for another node */
|
|
|
-
|
|
|
if (unlikely(!msg_short(msg) &&
|
|
|
(msg_destnode(msg) != tipc_own_addr)))
|
|
|
goto cont;
|
|
|
|
|
|
/* Locate neighboring node that sent message */
|
|
|
-
|
|
|
n_ptr = tipc_node_find(msg_prevnode(msg));
|
|
|
if (unlikely(!n_ptr))
|
|
|
goto cont;
|
|
|
tipc_node_lock(n_ptr);
|
|
|
|
|
|
/* Locate unicast link endpoint that should handle message */
|
|
|
-
|
|
|
l_ptr = n_ptr->links[b_ptr->identity];
|
|
|
if (unlikely(!l_ptr)) {
|
|
|
tipc_node_unlock(n_ptr);
|
|
@@ -1714,7 +1652,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
}
|
|
|
|
|
|
/* Verify that communication with node is currently allowed */
|
|
|
-
|
|
|
if ((n_ptr->block_setup & WAIT_PEER_DOWN) &&
|
|
|
msg_user(msg) == LINK_PROTOCOL &&
|
|
|
(msg_type(msg) == RESET_MSG ||
|
|
@@ -1728,12 +1665,10 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
}
|
|
|
|
|
|
/* Validate message sequence number info */
|
|
|
-
|
|
|
seq_no = msg_seqno(msg);
|
|
|
ackd = msg_ack(msg);
|
|
|
|
|
|
/* Release acked messages */
|
|
|
-
|
|
|
if (n_ptr->bclink.supported)
|
|
|
tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
|
|
|
|
|
@@ -1752,7 +1687,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
}
|
|
|
|
|
|
/* Try sending any messages link endpoint has pending */
|
|
|
-
|
|
|
if (unlikely(l_ptr->next_out))
|
|
|
tipc_link_push_queue(l_ptr);
|
|
|
if (unlikely(!list_empty(&l_ptr->waiting_ports)))
|
|
@@ -1763,7 +1697,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
|
|
|
}
|
|
|
|
|
|
/* Now (finally!) process the incoming message */
|
|
|
-
|
|
|
protocol_check:
|
|
|
if (likely(link_working_working(l_ptr))) {
|
|
|
if (likely(seq_no == mod(l_ptr->next_in_no))) {
|
|
@@ -1859,7 +1792,6 @@ cont:
|
|
|
*
|
|
|
* Returns increase in queue length (i.e. 0 or 1)
|
|
|
*/
|
|
|
-
|
|
|
u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
|
|
|
struct sk_buff *buf)
|
|
|
{
|
|
@@ -1908,7 +1840,6 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
|
|
|
/*
|
|
|
* link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet
|
|
|
*/
|
|
|
-
|
|
|
static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
|
|
|
struct sk_buff *buf)
|
|
|
{
|
|
@@ -1920,14 +1851,12 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
|
|
|
}
|
|
|
|
|
|
/* Record OOS packet arrival (force mismatch on next timeout) */
|
|
|
-
|
|
|
l_ptr->checkpoint--;
|
|
|
|
|
|
/*
|
|
|
* Discard packet if a duplicate; otherwise add it to deferred queue
|
|
|
* and notify peer of gap as per protocol specification
|
|
|
*/
|
|
|
-
|
|
|
if (less(seq_no, mod(l_ptr->next_in_no))) {
|
|
|
l_ptr->stats.duplicates++;
|
|
|
kfree_skb(buf);
|
|
@@ -1957,7 +1886,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
|
|
|
int r_flag;
|
|
|
|
|
|
/* Discard any previous message that was deferred due to congestion */
|
|
|
-
|
|
|
if (l_ptr->proto_msg_queue) {
|
|
|
kfree_skb(l_ptr->proto_msg_queue);
|
|
|
l_ptr->proto_msg_queue = NULL;
|
|
@@ -1967,12 +1895,10 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
|
|
|
return;
|
|
|
|
|
|
/* Abort non-RESET send if communication with node is prohibited */
|
|
|
-
|
|
|
if ((l_ptr->owner->block_setup) && (msg_typ != RESET_MSG))
|
|
|
return;
|
|
|
|
|
|
/* Create protocol message with "out-of-sequence" sequence number */
|
|
|
-
|
|
|
msg_set_type(msg, msg_typ);
|
|
|
msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
|
|
|
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
|
|
@@ -2040,14 +1966,12 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
|
|
|
skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg));
|
|
|
|
|
|
/* Defer message if bearer is already congested */
|
|
|
-
|
|
|
if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
|
|
|
l_ptr->proto_msg_queue = buf;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/* Defer message if attempting to send results in bearer congestion */
|
|
|
-
|
|
|
if (!tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
|
|
|
tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
|
|
|
l_ptr->proto_msg_queue = buf;
|
|
@@ -2056,7 +1980,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
|
|
|
}
|
|
|
|
|
|
/* Discard message if it was sent successfully */
|
|
|
-
|
|
|
l_ptr->unacked_window = 0;
|
|
|
kfree_skb(buf);
|
|
|
}
|
|
@@ -2066,7 +1989,6 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
|
|
|
* Note that network plane id propagates through the network, and may
|
|
|
* change at any time. The node with lowest address rules
|
|
|
*/
|
|
|
-
|
|
|
static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
{
|
|
|
u32 rec_gap = 0;
|
|
@@ -2079,7 +2001,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
goto exit;
|
|
|
|
|
|
/* record unnumbered packet arrival (force mismatch on next timeout) */
|
|
|
-
|
|
|
l_ptr->checkpoint--;
|
|
|
|
|
|
if (l_ptr->b_ptr->net_plane != msg_net_plane(msg))
|
|
@@ -2111,7 +2032,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
/* fall thru' */
|
|
|
case ACTIVATE_MSG:
|
|
|
/* Update link settings according other endpoint's values */
|
|
|
-
|
|
|
strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg));
|
|
|
|
|
|
msg_tol = msg_link_tolerance(msg);
|
|
@@ -2133,7 +2053,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
l_ptr->owner->bclink.supportable = (max_pkt_info != 0);
|
|
|
|
|
|
/* Synchronize broadcast link info, if not done previously */
|
|
|
-
|
|
|
if (!tipc_node_is_up(l_ptr->owner)) {
|
|
|
l_ptr->owner->bclink.last_sent =
|
|
|
l_ptr->owner->bclink.last_in =
|
|
@@ -2185,7 +2104,6 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
}
|
|
|
|
|
|
/* Protocol message before retransmits, reduce loss risk */
|
|
|
-
|
|
|
if (l_ptr->owner->bclink.supported)
|
|
|
tipc_bclink_update_link_state(l_ptr->owner,
|
|
|
msg_last_bcast(msg));
|
|
@@ -2243,7 +2161,6 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr,
|
|
|
* changeover(): Send whole message queue via the remaining link
|
|
|
* Owner node is locked.
|
|
|
*/
|
|
|
-
|
|
|
void tipc_link_changeover(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
u32 msgcount = l_ptr->out_queue_size;
|
|
@@ -2343,8 +2260,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* buf_extract - extracts embedded TIPC message from another message
|
|
|
* @skb: encapsulating message buffer
|
|
@@ -2353,7 +2268,6 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
|
|
|
* Returns a new message buffer containing an embedded message. The
|
|
|
* encapsulating message itself is left unchanged.
|
|
|
*/
|
|
|
-
|
|
|
static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
|
|
|
{
|
|
|
struct tipc_msg *msg = (struct tipc_msg *)(skb->data + from_pos);
|
|
@@ -2370,7 +2284,6 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
|
|
|
* link_recv_changeover_msg(): Receive tunneled packet sent
|
|
|
* via other link. Node is locked. Return extracted buffer.
|
|
|
*/
|
|
|
-
|
|
|
static int link_recv_changeover_msg(struct tipc_link **l_ptr,
|
|
|
struct sk_buff **buf)
|
|
|
{
|
|
@@ -2405,7 +2318,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
|
|
|
}
|
|
|
|
|
|
/* First original message ?: */
|
|
|
-
|
|
|
if (tipc_link_is_up(dest_link)) {
|
|
|
info("Resetting link <%s>, changeover initiated by peer\n",
|
|
|
dest_link->name);
|
|
@@ -2420,7 +2332,6 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
|
|
|
}
|
|
|
|
|
|
/* Receive original message */
|
|
|
-
|
|
|
if (dest_link->exp_msg_count == 0) {
|
|
|
warn("Link switchover error, "
|
|
|
"got too many tunnelled messages\n");
|
|
@@ -2469,7 +2380,6 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
|
|
|
* Fragmentation/defragmentation:
|
|
|
*/
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
* link_send_long_buf: Entry for buffers needing fragmentation.
|
|
|
* The buffer is complete, inclusive total message length.
|
|
@@ -2496,12 +2406,10 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
destaddr = msg_destnode(inmsg);
|
|
|
|
|
|
/* Prepare reusable fragment header: */
|
|
|
-
|
|
|
tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
|
|
|
INT_H_SIZE, destaddr);
|
|
|
|
|
|
/* Chop up message: */
|
|
|
-
|
|
|
while (rest > 0) {
|
|
|
struct sk_buff *fragm;
|
|
|
|
|
@@ -2535,7 +2443,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
kfree_skb(buf);
|
|
|
|
|
|
/* Append chain of fragments to send queue & send them */
|
|
|
-
|
|
|
l_ptr->long_msg_seq_no++;
|
|
|
link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
|
|
|
l_ptr->stats.sent_fragments += fragm_no;
|
|
@@ -2551,7 +2458,6 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
|
|
|
* help storing these values in unused, available fields in the
|
|
|
* pending message. This makes dynamic memory allocation unnecessary.
|
|
|
*/
|
|
|
-
|
|
|
static void set_long_msg_seqno(struct sk_buff *buf, u32 seqno)
|
|
|
{
|
|
|
msg_set_seqno(buf_msg(buf), seqno);
|
|
@@ -2603,7 +2509,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
|
|
|
*fb = NULL;
|
|
|
|
|
|
/* Is there an incomplete message waiting for this fragment? */
|
|
|
-
|
|
|
while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) ||
|
|
|
(msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) {
|
|
|
prev = pbuf;
|
|
@@ -2629,7 +2534,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
|
|
|
skb_copy_to_linear_data(pbuf, imsg,
|
|
|
msg_data_sz(fragm));
|
|
|
/* Prepare buffer for subsequent fragments. */
|
|
|
-
|
|
|
set_long_msg_seqno(pbuf, long_msg_seq_no);
|
|
|
set_fragm_size(pbuf, fragm_sz);
|
|
|
set_expected_frags(pbuf, exp_fragm_cnt - 1);
|
|
@@ -2650,7 +2554,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
|
|
|
kfree_skb(fbuf);
|
|
|
|
|
|
/* Is message complete? */
|
|
|
-
|
|
|
if (exp_frags == 0) {
|
|
|
if (prev)
|
|
|
prev->next = pbuf->next;
|
|
@@ -2672,7 +2575,6 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
|
|
|
* link_check_defragm_bufs - flush stale incoming message fragments
|
|
|
* @l_ptr: pointer to link
|
|
|
*/
|
|
|
-
|
|
|
static void link_check_defragm_bufs(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
struct sk_buff *prev = NULL;
|
|
@@ -2701,8 +2603,6 @@ static void link_check_defragm_bufs(struct tipc_link *l_ptr)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
|
|
|
{
|
|
|
if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL))
|
|
@@ -2714,7 +2614,6 @@ static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance)
|
|
|
l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
|
|
|
{
|
|
|
/* Data messages from this node, inclusive FIRST_FRAGM */
|
|
@@ -2744,7 +2643,6 @@ void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
|
|
|
*
|
|
|
* Returns pointer to link (or 0 if invalid link name).
|
|
|
*/
|
|
|
-
|
|
|
static struct tipc_link *link_find_link(const char *name,
|
|
|
struct tipc_node **node)
|
|
|
{
|
|
@@ -2778,7 +2676,6 @@ static struct tipc_link *link_find_link(const char *name,
|
|
|
*
|
|
|
* Returns 1 if value is within range, 0 if not.
|
|
|
*/
|
|
|
-
|
|
|
static int link_value_is_valid(u16 cmd, u32 new_value)
|
|
|
{
|
|
|
switch (cmd) {
|
|
@@ -2794,7 +2691,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* link_cmd_set_value - change priority/tolerance/window for link/bearer/media
|
|
|
* @name - ptr to link, bearer, or media name
|
|
@@ -2805,7 +2701,6 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
|
|
|
*
|
|
|
* Returns 0 if value updated and negative value on error.
|
|
|
*/
|
|
|
-
|
|
|
static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
|
|
|
{
|
|
|
struct tipc_node *node;
|
|
@@ -2910,7 +2805,6 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
|
|
|
* link_reset_statistics - reset link statistics
|
|
|
* @l_ptr: pointer to link
|
|
|
*/
|
|
|
-
|
|
|
static void link_reset_statistics(struct tipc_link *l_ptr)
|
|
|
{
|
|
|
memset(&l_ptr->stats, 0, sizeof(l_ptr->stats));
|
|
@@ -2951,7 +2845,6 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
|
|
|
/**
|
|
|
* percent - convert count to a percentage of total (rounding up or down)
|
|
|
*/
|
|
|
-
|
|
|
static u32 percent(u32 count, u32 total)
|
|
|
{
|
|
|
return (count * 100 + (total / 2)) / total;
|
|
@@ -2965,7 +2858,6 @@ static u32 percent(u32 count, u32 total)
|
|
|
*
|
|
|
* Returns length of print buffer data string (or 0 if error)
|
|
|
*/
|
|
|
-
|
|
|
static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
|
|
|
{
|
|
|
struct print_buf pb;
|
|
@@ -3087,7 +2979,6 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
|
|
|
*
|
|
|
* If no active link can be found, uses default maximum packet size.
|
|
|
*/
|
|
|
-
|
|
|
u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
|
|
|
{
|
|
|
struct tipc_node *n_ptr;
|
|
@@ -3171,4 +3062,3 @@ print_state:
|
|
|
tipc_printbuf_validate(buf);
|
|
|
info("%s", print_area);
|
|
|
}
|
|
|
-
|