From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:42
Another mixed bag of misc TIPC fixes and enhancements. Some commits
here from Ying, who Al is working with to impart/share his TIPC
experience with -- we'll definitely be seeing more commits from Ying
on TIPC in the future. Active TIPC users may have already met Ying
on the TIPC users [sourceforge] mailing list. Thanks Ying!
The merge-base of these is roughly net-next of around when kernel.org
went down -- so I had to temporarily revert 0856a304091 (the use
after free scm pid thing) during validation since my 64bit test box
would simply die at boot. But I see that same revert is now in. Just
thought I'd mention it in case someone wondered how I tested when
0856a was preventing booting. The self test was run between 32bit and
64bit boxes, each alternating between client and server respectively.
Thanks,
Paul.
---
The following changes since commit ab7e11d9d0293ef1802d6ae8aab39ce58472b167:
greth: convert to SKB paged frag API. (2011-08-30 17:58:03 -0400)
are available in the git repository at:
git://openlinux.windriver.com/people/paulg/net-next tipc-Sep17-2011
Allan Stephens (23):
tipc: Remove obsolete manipulation of message re-route count field
tipc: Eliminate obsolete filter for unexpected unicast messages
tipc: Display meaningful peer interface name during link creation
tipc: Initialize peer session field of newly created link endpoint
tipc: Enhance filtering of out-dated link reset messages
tipc: Update obsolete references to multicast link
tipc: Cosmetic changes to broadcast bearer send routine
tipc: Remove non-executable code to handle broadcast bearer congestion
tipc: Enhance cleanup of broadcast link when contact with node is lost
tipc: Prevent broadcast link stalling when another node fails
tipc: Fix node lock problems during broadcast message reception
tipc: Remove deferred queue head caching during broadcast message reception
tipc: Discard incoming broadcast messages that are unexpected
tipc: Remove obsolete congestion handling when sending a broadcast NACK
tipc: Eliminate redundant check when sending messages
tipc: Prevent rounding issues when saving connect timeout option
tipc: Ensure congested links receive bearer status updates
tipc: Ensure both nodes recognize loss of contact between them
tipc: Fix unsafe device list search when enabling bearer
tipc: Remove redundant search when enabling bearer
tipc: Lower limits for number of bearers and media types
tipc: Prevent fragmented messages during initial name table exchange
tipc: Enhance sending of bulk name table messages
Paul Gortmaker (1):
tipc: relocate/coalesce node cast in tipc_named_node_up
Ying Xue (4):
tipc: Add support for SO_SNDTIMEO socket option
tipc: Simplify prohibition of listen and accept for connectionless sockets
tipc: Remove callback field from subscription structure
tipc: Remove unused link event tracking code
net/tipc/bcast.c | 111 +++++++++++++++++++++++--------------------------
net/tipc/bcast.h | 1 -
net/tipc/bearer.c | 8 +--
net/tipc/bearer.h | 4 +-
net/tipc/config.h | 1 -
net/tipc/discover.c | 6 ---
net/tipc/eth_media.c | 32 ++++++--------
net/tipc/link.c | 111 +++++++++++++++++++++++++++++++++++--------------
net/tipc/link.h | 1 +
net/tipc/name_distr.c | 35 +++++++++++++---
net/tipc/net.c | 11 -----
net/tipc/node.c | 45 +++++++++++---------
net/tipc/node.h | 10 ++++-
net/tipc/socket.c | 51 +++++++++++------------
net/tipc/subscr.c | 3 +-
net/tipc/subscr.h | 6 ---
16 files changed, 239 insertions(+), 197 deletions(-)
--
1.7.4.4
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:42
From: Allan Stephens <redacted>
Sets the peer interface portion of the name of a newly created link
endpoint to "unknown". This ensures that state and statistics information
can be properly displayed during the time between the link endpoint's
creation and the time handshaking with its peer is completed.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -332,12 +332,12 @@ struct link *tipc_link_create(struct tipc_node *n_ptr,l_ptr->addr=peer;if_name=strchr(b_ptr->name,':')+1;-sprintf(l_ptr->name,"%u.%u.%u:%s-%u.%u.%u:",+sprintf(l_ptr->name,"%u.%u.%u:%s-%u.%u.%u:unknown",tipc_zone(tipc_own_addr),tipc_cluster(tipc_own_addr),tipc_node(tipc_own_addr),if_name,tipc_zone(peer),tipc_cluster(peer),tipc_node(peer));-/* note: peer i/f is appended to link name by reset/activate */+/* note: peer i/f name is updated by reset/activate message */memcpy(&l_ptr->media_addr,media_addr,sizeof(*media_addr));l_ptr->owner=n_ptr;l_ptr->checkpoint=1;
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:42
From: Allan Stephens <redacted>
Removes a test that ensures unicast link endpoints discard an incoming
message if it will not be consumed by the node itself and cannot be
forwarded to another node, since the preceding test already ensures that
the message is destined for this node and single-cluster TIPC no longer
performs message forwarding.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
@@ -1658,19 +1658,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)continue;}+/* Discard unicast link messages destined for another node */+if(unlikely(!msg_short(msg)&&(msg_destnode(msg)!=tipc_own_addr)))gotocont;-/* Discard non-routeable messages destined for another node */--if(unlikely(!msg_isdata(msg)&&-(msg_destnode(msg)!=tipc_own_addr))){-if((msg_user(msg)!=CONN_MANAGER)&&-(msg_user(msg)!=MSG_FRAGMENTER))-gotocont;-}-/* Locate neighboring node that sent message */n_ptr=tipc_node_find(msg_prevnode(msg));
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:42
From: Allan Stephens <redacted>
Eliminates code that increments and validates the re-route count field
of payload messages, since the elimination of multi-cluster support
means that it is no longer necessary for TIPC to forward incoming messages
to another node. (The obsolete code was incorrect anyway, since it
incorrectly incremented the re-route count field of messages that
originated on the node that forwarded the message.)
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/net.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:43
From: Allan Stephens <redacted>
Ensure TIPC ignores an out-dated link reset message whose session
number predates the current session number. (Previously, TIPC only
ignored an out-date reset message whose session number was equal
to the current link session number.)
Out-dated link reset messages should not occur under normal circumstances;
however, they can be generated if a link endpoint is unable to send a
link reset message right away and queues it for later delivery, but the
queued message is not sent until after the link is established.
Thanks to Laser [gotolaser@gmail.com] for diagnosing the problem and
contributing a prototype patch.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:43
From: Allan Stephens <redacted>
Initializes the peer session number field of a newly created link
endpoint to an invalid value. This eliminates the remote possibility
that it will accidentally match the session number used by the peer
the first time the link is activated, and cause the link to ignore
a valid RESET message.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:44
From: Allan Stephens <redacted>
Updates TIPC's broadcast link in a couple of places that were missed
during the transition from its former name ("multicast-link") to its
current name ("broadcast-link"). These changes are essentially cosmetic
and do not affect the overall operation of TIPC.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -764,7 +764,7 @@ int tipc_bclink_init(void)bcbearer=kzalloc(sizeof(*bcbearer),GFP_ATOMIC);bclink=kzalloc(sizeof(*bclink),GFP_ATOMIC);if(!bcbearer||!bclink){-warn("Multicast link creation failed, no memory\n");+warn("Broadcast link creation failed, no memory\n");kfree(bcbearer);bcbearer=NULL;kfree(bclink);
@@ -775,7 +775,7 @@ int tipc_bclink_init(void)INIT_LIST_HEAD(&bcbearer->bearer.cong_links);bcbearer->bearer.media=&bcbearer->media;bcbearer->media.send_msg=tipc_bcbearer_send;-sprintf(bcbearer->media.name,"tipc-multicast");+sprintf(bcbearer->media.name,"tipc-broadcast");bcl=&bclink->link;INIT_LIST_HEAD(&bcl->waiting_ports);
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:45
From: Allan Stephens <redacted>
Updates the comments in the broadcast bearer send routine to more
accurately describe the processing done by the routine. Also replaces
the improper use of a TIPC payload message error status symbol (in a place
that has nothing to do with such errors) with its numeric equivalent.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
@@ -547,7 +548,12 @@ static int tipc_bcbearer_send(struct sk_buff *buf,{intbp_index;-/* Prepare buffer for broadcasting (if first time trying to send it) */+/*+*Preparebroadcastlinkmessageforreliabletransmission,+*iffirsttimetryingtosendit;+*preparationisskippedforbroadcastlinkprotocolmessages+*sincetheyaresentinanunreliablemanneranddon'tneedit+*/if(likely(!msg_non_seq(buf_msg(buf)))){structtipc_msg*msg;
@@ -596,18 +602,12 @@ static int tipc_bcbearer_send(struct sk_buff *buf,}if(bcbearer->remains_new.count==0)-return0;+break;/* all targets reached */bcbearer->remains=bcbearer->remains_new;}-/*-*Unabletoreachalltargets(indicatesuccess,sincecurrently-*thereisn'tcodeinplacetoproperlyblock&unblockthe-*pseudo-bearerusedbythebroadcastlink)-*/--returnTIPC_OK;+return0;}/**
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:47
From: Allan Stephens <redacted>
Enhances cleanup of broadcast link-related information when contact
with a node is lost.
1) All broadcast link-related cleanup now occurs only if the lost node
was capable of communicating over the broadcast link.
2) Following cleanup, the lost node is marked as no longer supporting
the broadcast link, ensuring that any remaining broadcast messages
received from that node prior to the re-establishment of a normal
communication link are ignored.
Thanks to Surya [Suryanarayana.Garlapati@emerson.com] for contributing
a prototype version of this patch.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/node.c | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
@@ -331,28 +331,32 @@ static void node_lost_contact(struct tipc_node *n_ptr)charaddr_string[16];u32i;-/* Clean up broadcast reception remains */-n_ptr->bclink.gap_after=n_ptr->bclink.gap_to=0;-while(n_ptr->bclink.deferred_head){-structsk_buff*buf=n_ptr->bclink.deferred_head;-n_ptr->bclink.deferred_head=buf->next;-buf_discard(buf);-}-if(n_ptr->bclink.defragm){-buf_discard(n_ptr->bclink.defragm);-n_ptr->bclink.defragm=NULL;-}+info("Lost contact with %s\n",+tipc_addr_string_fill(addr_string,n_ptr->addr));++/* Flush broadcast link info associated with lost node */if(n_ptr->bclink.supported){+n_ptr->bclink.gap_after=n_ptr->bclink.gap_to=0;+while(n_ptr->bclink.deferred_head){+structsk_buff*buf=n_ptr->bclink.deferred_head;+n_ptr->bclink.deferred_head=buf->next;+buf_discard(buf);+}++if(n_ptr->bclink.defragm){+buf_discard(n_ptr->bclink.defragm);+n_ptr->bclink.defragm=NULL;+}+tipc_bclink_acknowledge(n_ptr,mod(n_ptr->bclink.acked+10000));tipc_nmap_remove(&tipc_bcast_nmap,n_ptr->addr);if(n_ptr->addr<tipc_own_addr)tipc_own_tag--;-}-info("Lost contact with %s\n",-tipc_addr_string_fill(addr_string,n_ptr->addr));+n_ptr->bclink.supported=0;+}/* Abort link changeover */for(i=0;i<MAX_BEARERS;i++){
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:47
From: Allan Stephens <redacted>
Eliminates code associated with the sending of unsent broadcast link
traffic when the broadcast pseudo-bearer becomes unblocked following a
temporary congestion situation. This code is non-executable because the
broadcast pseudo-bearer never becomes blocked [see tipc_bcbearer_send()].
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 21 ---------------------
net/tipc/bcast.h | 1 -
net/tipc/bearer.c | 6 +-----
3 files changed, 1 insertions(+), 27 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:48
From: Allan Stephens <redacted>
Ensure that broadcast link messages that have not been acknowledged
by a newly failed node do not get an implied acknowledgement until the
failed node is removed from the broadcast link's map of reachable nodes.
Previously, a race condition allowed a new broadcast link message to be
sent after the implicit acknowledgement processing was completed, but
before the map of reachable nodes was updated, resulting in the message
having an expected acknowledgement count that required the failed node
to explicitly acknowledge the message. Since this would never occur
the new message would remain in the broadcast link's transmit queue
forever, eventually causing the link to become congested and "stall".
Delaying the implicit acknowledgement processing until after the update
of the map of reachable nodes eliminates this race condition and prevents
stalling.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/node.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:49
From: Allan Stephens <redacted>
Modifies TIPC's incoming broadcast packet handler to ensure that the
node lock associated with the sender of the packet is held whenever
node-related data structure fields are accessed. The routine is also
restructured with a single exit point, making it easier to ensure
the node lock is properly released and the incoming packet is properly
disposed of.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:50
From: Allan Stephens <redacted>
Modifies TIPC's incoming broadcast packet handler so that it no longer
pre-reads information about the deferred packet queue, since the cached
value is unreliable once the associated node lock has been released.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:51
From: Allan Stephens <redacted>
Modifies TIPC's incoming broadcast packet handler to discard messages
that cannot legally be sent over the broadcast link, including:
- broadcast protocol messages that do no contain state information
- payload messages that are not named multicast messages
- any other form of message except for bundled messages, fragmented
messages, and name distribution messages.
These checks are needed to prevent TIPC from handing an unexpected
message to a routine that isn't prepared to handle it, which could
lead to incorrect processing (up to and including invalid memory
references caused by attempts to access message fields that aren't
present in the message).
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:52
From: Allan Stephens <redacted>
Eliminates obsolete code that handles broadcast bearer congestion when
the broadast link sends a NACK message, since the broadcast pseudo-bearer
never becomes blocked.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bcast.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:52
From: Allan Stephens <redacted>
Eliminates code in tipc_send_buf_fast() that handles messages
sent to a destination on the current node, since the only caller
of the routine only passes in messages destined for other nodes.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:54
From: Allan Stephens <redacted>
Modifies code that disables a bearer to ensure that all of its links
are deleted, not just its uncongested links. Similarly, modifies code
that blocks a bearer to ensure that all of its links are reset, not
just its uncongested links.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bearer.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:54
From: Allan Stephens <redacted>
Saves a socket's TIPC_CONN_TIMEOUT socket option value in its original
form (milliseconds), rather than jiffies. This ensures that the exact
value set using setsockopt() is always returned by getsockopt(), without
being subject to rounding issues introduced by a ms->jiffies->ms
conversion sequence.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/socket.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
@@ -231,7 +231,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,sock_init_data(sock,sk);sk->sk_backlog_rcv=backlog_rcv;tipc_sk(sk)->p=tp_ptr;-tipc_sk(sk)->conn_timeout=msecs_to_jiffies(CONN_TIMEOUT_DEFAULT);+tipc_sk(sk)->conn_timeout=CONN_TIMEOUT_DEFAULT;spin_unlock_bh(tp_ptr->lock);
@@ -1369,7 +1369,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,structmsghdrm={NULL,};structsk_buff*buf;structtipc_msg*msg;-longtimeout;+unsignedinttimeout;intres;lock_sock(sk);
@@ -1434,7 +1434,8 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,res=wait_event_interruptible_timeout(*sk_sleep(sk),(!skb_queue_empty(&sk->sk_receive_queue)||(sock->state!=SS_CONNECTING)),-timeout?timeout:MAX_SCHEDULE_TIMEOUT);+timeout?(long)msecs_to_jiffies(timeout)+:MAX_SCHEDULE_TIMEOUT);lock_sock(sk);if(res>0){
@@ -1696,7 +1697,7 @@ static int setsockopt(struct socket *sock,res=tipc_set_portunreturnable(tport->ref,value);break;caseTIPC_CONN_TIMEOUT:-tipc_sk(sk)->conn_timeout=msecs_to_jiffies(value);+tipc_sk(sk)->conn_timeout=value;/* no need to set "res", since already 0 at this point */break;default:
@@ -1752,7 +1753,7 @@ static int getsockopt(struct socket *sock,res=tipc_portunreturnable(tport->ref,&value);break;caseTIPC_CONN_TIMEOUT:-value=jiffies_to_msecs(tipc_sk(sk)->conn_timeout);+value=tipc_sk(sk)->conn_timeout;/* no need to set "res", since already 0 at this point */break;caseTIPC_NODE_RECVQ_DEPTH:
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:55
From: Allan Stephens <redacted>
Enhances TIPC to ensure that a node that loses contact with a
neighboring node does not allow contact to be re-established until
it sees that its peer has also recognized the loss of contact.
Previously, nodes that were connected by two or more links could
encounter a situation in which node A would lose contact with node B
on all of its links, purge its name table of names published by B,
and then fail to repopulate those names once contact with B was restored.
This would happen because B was able to re-establish one or more links
so quickly that it never reached a point where it had no links to A --
meaning that B never saw a loss of contact with A, and consequently
didn't re-publish its names to A.
This problem is now prevented by enhancing the cleanup done by TIPC
following a loss of contact with a neighboring node to ensure that
node A ignores all messages sent by B until it receives a LINK_PROTOCOL
message that indicates B has lost contact with A, thereby preventing
the (re)establishment of links between the nodes. The loss of contact
is recognized when a RESET or ACTIVATE message is received that has
a "redundant link exists" field of 0, indicating that B's sending link
endpoint is in a reset state and that B has no other working links.
Additionally, TIPC now suppresses the sending of (most) link protocol
messages to a neighboring node while it is cleaning up after an earlier
loss of contact with that node. This stops the peer node from prematurely
activating its link endpoint, which would prevent TIPC from later
activating its own end. TIPC still allows outgoing RESET messages to
occur during cleanup, to avoid problems if its own node recognizes
the loss of contact first and tries to notify the peer of the situation.
Finally, TIPC now recognizes an impending loss of contact with a peer node
as soon as it receives a RESET message on a working link that is the
peer's only link to the node, and ensures that the link protocol
suppression mentioned above goes into effect right away -- that is,
even before its own link endpoints have failed. This is necessary to
ensure correct operation when there are redundant links between the nodes,
since otherwise TIPC would send an ACTIVATE message upon receiving a RESET
on its first link and only begin suppressing when a RESET on its second
link was received, instead of initiating suppression with the first RESET
message as it needs to.
Note: The reworked cleanup code also eliminates a check that prevented
a link endpoint's discovery object from responding to incoming messages
while stale name table entries are being purged. This check is now
unnecessary and would have slowed down re-establishment of communication
between the nodes in some situations.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/discover.c | 6 ------
net/tipc/link.c | 33 ++++++++++++++++++++++++++++-----
net/tipc/node.c | 11 ++++++-----
net/tipc/node.h | 10 ++++++++--
4 files changed, 42 insertions(+), 18 deletions(-)
@@ -159,12 +159,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)}tipc_node_lock(n_ptr);-/* Don't talk to neighbor during cleanup after last session */-if(n_ptr->cleanup_required){-tipc_node_unlock(n_ptr);-return;-}-link=n_ptr->links[b_ptr->identity];/* Create a link endpoint for this bearer, if necessary */
@@ -1669,17 +1669,24 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)gotocont;tipc_node_lock(n_ptr);-/* Don't talk to neighbor during cleanup after last session */+/* Locate unicast link endpoint that should handle message */-if(n_ptr->cleanup_required){+l_ptr=n_ptr->links[b_ptr->identity];+if(unlikely(!l_ptr)){tipc_node_unlock(n_ptr);gotocont;}-/* Locate unicast link endpoint that should handle message */+/* Verify that communication with node is currently allowed */-l_ptr=n_ptr->links[b_ptr->identity];-if(unlikely(!l_ptr)){+if((n_ptr->block_setup&WAIT_PEER_DOWN)&&+msg_user(msg)==LINK_PROTOCOL&&+(msg_type(msg)==RESET_MSG||+msg_type(msg)==ACTIVATE_MSG)&&+!msg_redundant_link(msg))+n_ptr->block_setup&=~WAIT_PEER_DOWN;++if(n_ptr->block_setup){tipc_node_unlock(n_ptr);gotocont;}
@@ -1914,6 +1921,12 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,if(link_blocked(l_ptr))return;++/* Abort non-RESET send if communication with node is prohibited */++if((l_ptr->owner->block_setup)&&(msg_typ!=RESET_MSG))+return;+msg_set_type(msg,msg_typ);msg_set_net_plane(msg,l_ptr->b_ptr->net_plane);msg_set_bcast_ack(msg,mod(l_ptr->owner->bclink.last_in));
@@ -2045,6 +2058,16 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)if(less_eq(msg_session(msg),l_ptr->peer_session))break;/* duplicate or old reset: ignore */}++if(!msg_redundant_link(msg)&&(link_working_working(l_ptr)||+link_working_unknown(l_ptr))){+/*+*peerhaslostcontact--don'tallowpeer'slinks+*toreactivatebeforewerecognizeloss&cleanup+*/+l_ptr->owner->block_setup=WAIT_NODE_DOWN;+}+/* fall thru' */caseACTIVATE_MSG:/* Update link settings according other endpoint's values */
@@ -320,7 +321,7 @@ static void node_cleanup_finished(unsigned long node_addr)n_ptr=tipc_node_find(node_addr);if(n_ptr){tipc_node_lock(n_ptr);-n_ptr->cleanup_required=0;+n_ptr->block_setup&=~WAIT_NAMES_GONE;tipc_node_unlock(n_ptr);}read_unlock_bh(&tipc_net_lock);
@@ -371,10 +372,10 @@ static void node_lost_contact(struct tipc_node *n_ptr)/* Notify subscribers */tipc_nodesub_notify(n_ptr);-/* Prevent re-contact with node until all cleanup is done */+/* Prevent re-contact with node until cleanup is done */-n_ptr->cleanup_required=1;-tipc_k_signal((Handler)node_cleanup_finished,n_ptr->addr);+n_ptr->block_setup=WAIT_PEER_DOWN|WAIT_NAMES_GONE;+tipc_k_signal((Handler)node_name_purge_complete,n_ptr->addr);}structsk_buff*tipc_node_get_nodes(constvoid*req_tlv_area,intreq_tlv_space)
@@ -42,6 +42,12 @@#include"net.h"#include"bearer.h"+/* Flags used to block (re)establishment of contact with a neighboring node */++#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */+#define WAIT_NAMES_GONE 0x0002 /* wait for peer's publications to be purged */+#define WAIT_NODE_DOWN 0x0004 /* wait until peer node is declared down */+/***structtipc_node-TIPCnodestructure*@addr:networkaddressofnode
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:56
From: Allan Stephens <redacted>
Ensures that the device list lock is held while trying to locate
the Ethernet device used by a newly enabled bearer, so that the
addition or removal of a device does not cause problems.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/eth_media.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
@@ -144,12 +144,15 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)/* Find device with specified name */+read_lock(&dev_base_lock);for_each_netdev(&init_net,pdev){if(!strncmp(pdev->name,driver_name,IFNAMSIZ)){dev=pdev;+dev_hold(dev);break;}}+read_unlock(&dev_base_lock);if(!dev)return-ENODEV;
@@ -166,7 +169,6 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)eb_ptr->tipc_packet_type.func=recv_msg;eb_ptr->tipc_packet_type.af_packet_priv=eb_ptr;INIT_LIST_HEAD(&(eb_ptr->tipc_packet_type.list));-dev_hold(dev);dev_add_pack(&eb_ptr->tipc_packet_type);}
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:57
From: Allan Stephens <redacted>
Removes obsolete code that searches for an Ethernet bearer structure entry
to use for a newly enabled bearer, since this search is now performed
at the start of the enabling algorithm.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/eth_media.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:58
From: Allan Stephens <redacted>
Reduces the number of bearers a node can support to 2, which can use
identical or non-identical media. This change won't impact users,
since they are currently limited to a maximum of 2 Ethernet bearers,
and will save memory by eliminating a number of unused entries in
TIPC's media and bearer arrays.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/bearer.h | 4 ++--
net/tipc/eth_media.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:32:59
From: Allan Stephens <redacted>
Reduces the maximum size of messages sent during the initial exchange
of name table information between two nodes to be no larger than the
MTU of the first link established between the nodes. This ensures that
messages will never need to be fragmented, which would add unnecessary
overhead to the name table synchronization mechanism.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/name_distr.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
@@ -175,16 +175,32 @@ void tipc_named_withdraw(struct publication *publ)voidtipc_named_node_up(unsignedlongnode){+structtipc_node*n_ptr;+structlink*l_ptr;structpublication*publ;structdistr_item*item=NULL;structsk_buff*buf=NULL;u32left=0;u32rest;-u32max_item_buf;+u32max_item_buf=0;++/* compute maximum amount of publication data to send per message */++read_lock_bh(&tipc_net_lock);+n_ptr=tipc_node_find((u32)node);+if(n_ptr){+tipc_node_lock(n_ptr);+l_ptr=n_ptr->active_links[0];+if(l_ptr)+max_item_buf=((l_ptr->max_pkt-INT_H_SIZE)/+ITEM_SIZE)*ITEM_SIZE;+tipc_node_unlock(n_ptr);+}+read_unlock_bh(&tipc_net_lock);+if(!max_item_buf)+return;read_lock_bh(&tipc_nametbl_lock);-max_item_buf=TIPC_MAX_USER_MSG_SIZE/ITEM_SIZE;-max_item_buf*=ITEM_SIZE;rest=publ_cnt*ITEM_SIZE;list_for_each_entry(publ,&publ_root,local_list){
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:00
Functions like this are called using unsigned longs from
function pointers. In this case, the function is passed in
a node which is normally internally treated as a u32 by TIPC.
Rather than add more casts into this function in the future
for each added use of node within, move the cast to a single
place on a local.
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/name_distr.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
@@ -187,7 +188,7 @@ void tipc_named_node_up(unsigned long node)/* compute maximum amount of publication data to send per message */read_lock_bh(&tipc_net_lock);-n_ptr=tipc_node_find((u32)node);+n_ptr=tipc_node_find(node);if(n_ptr){tipc_node_lock(n_ptr);l_ptr=n_ptr->active_links[0];
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:01
From: Ying Xue <redacted>
Adds support for the SO_SNDTIMEO socket option. (This complements the
existing support for SO_RCVTIMEO that is already present.)
Signed-off-by: Ying Xue <redacted>
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/socket.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:01
From: Allan Stephens <redacted>
Modifies the initial transfer of name table entries to a new neighboring
node so that the messages are enqueued as a unit, rather than individually.
The revised algorithm now locates the link carrying the message only once,
and eliminates unnecessary checks for link congestion, message fragmentation,
and message bundling that are not required when sending these messages.
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/link.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
net/tipc/link.h | 1 +
net/tipc/name_distr.c | 10 ++++++++--
3 files changed, 54 insertions(+), 2 deletions(-)
@@ -986,6 +986,51 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)}/*+*tipc_link_send_names-sendnametableentriestonewneighbor+*+*Sendroutineforbulkdeliveryofnametablemessageswhencontact+*withanewneighboroccurs.Nolinkcongestioncheckingisperformed+*becausenametablemessages*must*bedelivered.Themessagesmustbe+*smallenoughnottorequirefragmentation.+*Calledwithoutanylocksheld.+*/++voidtipc_link_send_names(structlist_head*message_list,u32dest)+{+structtipc_node*n_ptr;+structlink*l_ptr;+structsk_buff*buf;+structsk_buff*temp_buf;++if(list_empty(message_list))+return;++read_lock_bh(&tipc_net_lock);+n_ptr=tipc_node_find(dest);+if(n_ptr){+tipc_node_lock(n_ptr);+l_ptr=n_ptr->active_links[0];+if(l_ptr){+/* convert circular list to linear list */+((structsk_buff*)message_list->prev)->next=NULL;+link_add_chain_to_outqueue(l_ptr,+(structsk_buff*)message_list->next,0);+tipc_link_push_queue(l_ptr);+INIT_LIST_HEAD(message_list);+}+tipc_node_unlock(n_ptr);+}+read_unlock_bh(&tipc_net_lock);++/* discard the messages if they couldn't be sent */++list_for_each_safe(buf,temp_buf,((structsk_buff*)message_list)){+list_del((structlist_head*)buf);+buf_discard(buf);+}+}++/**link_send_buf_fast:Entryfordatamessageswherethe*destinationlinkisknownandtheheaderiscomplete,*inclusivetotalmessagelength.Verytimecritical.
@@ -180,6 +180,7 @@ void tipc_named_node_up(unsigned long nodearg)structpublication*publ;structdistr_item*item=NULL;structsk_buff*buf=NULL;+structlist_headmessage_list;u32node=(u32)nodearg;u32left=0;u32rest;
@@ -201,6 +202,10 @@ void tipc_named_node_up(unsigned long nodearg)if(!max_item_buf)return;+/* create list of publication messages, then send them as a unit */++INIT_LIST_HEAD(&message_list);+read_lock_bh(&tipc_nametbl_lock);rest=publ_cnt*ITEM_SIZE;
@@ -219,13 +224,14 @@ void tipc_named_node_up(unsigned long nodearg)item++;left-=ITEM_SIZE;if(!left){-msg_set_link_selector(buf_msg(buf),node);-tipc_link_send(buf,node,node);+list_add_tail((structlist_head*)buf,&message_list);buf=NULL;}}exit:read_unlock_bh(&tipc_nametbl_lock);++tipc_link_send_names(&message_list,(u32)node);}/**
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:02
From: Ying Xue <redacted>
Modifies the proto_ops structure used by TIPC DGRAM and RDM sockets
so that calls to listen() and accept() are handled by existing kernel
"unsupported operation" routines, and eliminates the related checks
in the listen and accept routines used by SEQPACKET and STREAM sockets
that are no longer needed.
Signed-off-by: Ying Xue <redacted>
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/socket.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:03
From: Ying Xue <redacted>
Eliminate the "event_cb" member from TIPC's "subscription" structure
since the function pointer it holds always points to subscr_send_event().
Signed-off-by: Ying Xue <redacted>
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/subscr.c | 3 +--
net/tipc/subscr.h | 6 ------
2 files changed, 1 insertions(+), 8 deletions(-)
From: Paul Gortmaker <hidden> Date: 2011-09-18 03:33:04
From: Ying Xue <redacted>
Elimintes prototype link event tracking functionality that has never
been fleshed out and doesn't do anything useful at the current time.
Signed-off-by: Ying Xue <redacted>
Signed-off-by: Allan Stephens <redacted>
Signed-off-by: Paul Gortmaker <redacted>
---
net/tipc/config.h | 1 -
net/tipc/link.c | 10 ----------
2 files changed, 0 insertions(+), 11 deletions(-)
@@ -537,9 +537,6 @@ void tipc_link_stop(struct link *l_ptr)l_ptr->proto_msg_queue=NULL;}-/* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */-#define link_send_event(fcn, l_ptr, up) do { } while (0)-voidtipc_link_reset(structlink*l_ptr){structsk_buff*buf;
@@ -597,10 +594,6 @@ void tipc_link_reset(struct link *l_ptr)l_ptr->fsm_msg_cnt=0;l_ptr->stale_count=0;link_reset_statistics(l_ptr);--link_send_event(tipc_cfg_link_event,l_ptr,0);-if(!in_own_cluster(l_ptr->addr))-link_send_event(tipc_disc_link_event,l_ptr,0);}
@@ -609,9 +602,6 @@ static void link_activate(struct link *l_ptr)l_ptr->next_in_no=l_ptr->stats.recv_info=1;tipc_node_link_up(l_ptr->owner,l_ptr);tipc_bearer_add_dest(l_ptr->b_ptr,l_ptr->addr);-link_send_event(tipc_cfg_link_event,l_ptr,1);-if(!in_own_cluster(l_ptr->addr))-link_send_event(tipc_disc_link_event,l_ptr,1);}/**
The following changes since commit ab7e11d9d0293ef1802d6ae8aab39ce58472b167:
greth: convert to SKB paged frag API. (2011-08-30 17:58:03 -0400)
are available in the git repository at:
git://openlinux.windriver.com/people/paulg/net-next tipc-Sep17-2011