<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/net/tipc/node.c, branch v3.15-rc8</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>tipc: use node list lock to protect tipc_num_links variable</title>
<updated>2014-03-27T17:08:38+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-03-27T04:54:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dde2026608fbf24e1687a2b62c4752022f429252'/>
<id>dde2026608fbf24e1687a2b62c4752022f429252</id>
<content type='text'>
Without properly implicit or explicit read memory barrier, it's
unsafe to read an atomic variable with atomic_read() from another
thread which is different with the thread of changing the atomic
variable with atomic_inc() or atomic_dec(). So a stale tipc_num_links
may be got with atomic_read() in tipc_node_get_links(). If the
tipc_num_links variable type is converted from atomic to unsigned
integer and node list lock is used to protect it, the issue would
be avoided.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without properly implicit or explicit read memory barrier, it's
unsafe to read an atomic variable with atomic_read() from another
thread which is different with the thread of changing the atomic
variable with atomic_inc() or atomic_dec(). So a stale tipc_num_links
may be got with atomic_read() in tipc_node_get_links(). If the
tipc_num_links variable type is converted from atomic to unsigned
integer and node list lock is used to protect it, the issue would
be avoided.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: use node_list_lock to protect tipc_num_nodes variable</title>
<updated>2014-03-27T17:08:37+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-03-27T04:54:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2220646a53aa588798653232e26172ec36ab06cd'/>
<id>2220646a53aa588798653232e26172ec36ab06cd</id>
<content type='text'>
As tipc_node_list is protected by rcu read lock on read side, it's
unnecessary to hold node_list_lock to protect tipc_node_list in
tipc_node_get_links(). Instead, node_list_lock should just protects
tipc_num_nodes in the function.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As tipc_node_list is protected by rcu read lock on read side, it's
unnecessary to hold node_list_lock to protect tipc_node_list in
tipc_node_get_links(). Instead, node_list_lock should just protects
tipc_num_nodes in the function.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: tipc: convert node list and node hlist to RCU lists</title>
<updated>2014-03-27T17:08:37+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-03-27T04:54:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6c7a762e70637a256229f9dc9ca793908e8bd01b'/>
<id>6c7a762e70637a256229f9dc9ca793908e8bd01b</id>
<content type='text'>
Convert tipc_node_list list and node_htable hash list to RCU lists.
On read side, the two lists are protected with RCU read lock, and
on update side, node_list_lock is applied to them.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert tipc_node_list list and node_htable hash list to RCU lists.
On read side, the two lists are protected with RCU read lock, and
on update side, node_list_lock is applied to them.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: rename node create lock to protect node list and hlist</title>
<updated>2014-03-27T17:08:37+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-03-27T04:54:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=46651c59c483f14fd35cf7df2104feac0e54e258'/>
<id>46651c59c483f14fd35cf7df2104feac0e54e258</id>
<content type='text'>
When a node is created, tipc_net_lock read lock is first held and
then node_create_lock is grabbed in order to prevent the same node
from being created and inserted into both node list and hlist twice.
But when we query node from the two node lists, we only hold
tipc_net_lock read lock without grabbing node_create_lock. Obviously
this locking policy is unable to guarantee that the two node lists
are always synchronized especially when the operation of changing
and accessing them occurs in different contexts like currently doing.

Therefore, rename node_create_lock to node_list_lock to protect the
two node lists, that is, whenever node is inserted into them or node
is queried from them, the node_list_lock should be always held. As a
result, tipc_net_lock read lock becomes redundant and then can be
removed from the node query functions.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a node is created, tipc_net_lock read lock is first held and
then node_create_lock is grabbed in order to prevent the same node
from being created and inserted into both node list and hlist twice.
But when we query node from the two node lists, we only hold
tipc_net_lock read lock without grabbing node_create_lock. Obviously
this locking policy is unable to guarantee that the two node lists
are always synchronized especially when the operation of changing
and accessing them occurs in different contexts like currently doing.

Therefore, rename node_create_lock to node_list_lock to protect the
two node lists, that is, whenever node is inserted into them or node
is queried from them, the node_list_lock should be always held. As a
result, tipc_net_lock read lock becomes redundant and then can be
removed from the node query functions.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: remove unnecessary checking for node object</title>
<updated>2014-03-27T17:08:36+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-03-27T04:54:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=76d7882420d94075c806c074de241602a06e47e6'/>
<id>76d7882420d94075c806c074de241602a06e47e6</id>
<content type='text'>
tipc_node_create routine doesn't need to check whether a node
object specified with a node address exists or not because its
caller(ie, tipc_disc_recv_msg routine) has checked this before
calling it.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
tipc_node_create routine doesn't need to check whether a node
object specified with a node address exists or not because its
caller(ie, tipc_disc_recv_msg routine) has checked this before
calling it.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Erik Hugne &lt;erik.hugne@ericsson.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: align tipc function names with common naming practice in the network</title>
<updated>2014-02-18T22:31:59+00:00</updated>
<author>
<name>Ying Xue</name>
<email>ying.xue@windriver.com</email>
</author>
<published>2014-02-18T08:06:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=247f0f3c3176c55b46cb9a20011d3d6757634815'/>
<id>247f0f3c3176c55b46cb9a20011d3d6757634815</id>
<content type='text'>
Rename the following functions, which are shorter and more in line
with common naming practice in the network subsystem.

tipc_bclink_send_msg-&gt;tipc_bclink_xmit
tipc_bclink_recv_pkt-&gt;tipc_bclink_rcv
tipc_disc_recv_msg-&gt;tipc_disc_rcv
tipc_link_send_proto_msg-&gt;tipc_link_proto_xmit
link_recv_proto_msg-&gt;tipc_link_proto_rcv
link_send_sections_long-&gt;tipc_link_iovec_long_xmit
tipc_link_send_sections_fast-&gt;tipc_link_iovec_xmit_fast
tipc_link_send_sync-&gt;tipc_link_sync_xmit
tipc_link_recv_sync-&gt;tipc_link_sync_rcv
tipc_link_send_buf-&gt;__tipc_link_xmit
tipc_link_send-&gt;tipc_link_xmit
tipc_link_send_names-&gt;tipc_link_names_xmit
tipc_named_recv-&gt;tipc_named_rcv
tipc_link_recv_bundle-&gt;tipc_link_bundle_rcv
tipc_link_dup_send_queue-&gt;tipc_link_dup_queue_xmit
link_send_long_buf-&gt;tipc_link_frag_xmit

tipc_multicast-&gt;tipc_port_mcast_xmit
tipc_port_recv_mcast-&gt;tipc_port_mcast_rcv
tipc_port_reject_sections-&gt;tipc_port_iovec_reject
tipc_port_recv_proto_msg-&gt;tipc_port_proto_rcv
tipc_connect-&gt;tipc_port_connect
__tipc_connect-&gt;__tipc_port_connect
__tipc_disconnect-&gt;__tipc_port_disconnect
tipc_disconnect-&gt;tipc_port_disconnect
tipc_shutdown-&gt;tipc_port_shutdown
tipc_port_recv_msg-&gt;tipc_port_rcv
tipc_port_recv_sections-&gt;tipc_port_iovec_rcv

release-&gt;tipc_release
accept-&gt;tipc_accept
bind-&gt;tipc_bind
get_name-&gt;tipc_getname
poll-&gt;tipc_poll
send_msg-&gt;tipc_sendmsg
send_packet-&gt;tipc_send_packet
send_stream-&gt;tipc_send_stream
recv_msg-&gt;tipc_recvmsg
recv_stream-&gt;tipc_recv_stream
connect-&gt;tipc_connect
listen-&gt;tipc_listen
shutdown-&gt;tipc_shutdown
setsockopt-&gt;tipc_setsockopt
getsockopt-&gt;tipc_getsockopt

Above changes have no impact on current users of the functions.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename the following functions, which are shorter and more in line
with common naming practice in the network subsystem.

tipc_bclink_send_msg-&gt;tipc_bclink_xmit
tipc_bclink_recv_pkt-&gt;tipc_bclink_rcv
tipc_disc_recv_msg-&gt;tipc_disc_rcv
tipc_link_send_proto_msg-&gt;tipc_link_proto_xmit
link_recv_proto_msg-&gt;tipc_link_proto_rcv
link_send_sections_long-&gt;tipc_link_iovec_long_xmit
tipc_link_send_sections_fast-&gt;tipc_link_iovec_xmit_fast
tipc_link_send_sync-&gt;tipc_link_sync_xmit
tipc_link_recv_sync-&gt;tipc_link_sync_rcv
tipc_link_send_buf-&gt;__tipc_link_xmit
tipc_link_send-&gt;tipc_link_xmit
tipc_link_send_names-&gt;tipc_link_names_xmit
tipc_named_recv-&gt;tipc_named_rcv
tipc_link_recv_bundle-&gt;tipc_link_bundle_rcv
tipc_link_dup_send_queue-&gt;tipc_link_dup_queue_xmit
link_send_long_buf-&gt;tipc_link_frag_xmit

tipc_multicast-&gt;tipc_port_mcast_xmit
tipc_port_recv_mcast-&gt;tipc_port_mcast_rcv
tipc_port_reject_sections-&gt;tipc_port_iovec_reject
tipc_port_recv_proto_msg-&gt;tipc_port_proto_rcv
tipc_connect-&gt;tipc_port_connect
__tipc_connect-&gt;__tipc_port_connect
__tipc_disconnect-&gt;__tipc_port_disconnect
tipc_disconnect-&gt;tipc_port_disconnect
tipc_shutdown-&gt;tipc_port_shutdown
tipc_port_recv_msg-&gt;tipc_port_rcv
tipc_port_recv_sections-&gt;tipc_port_iovec_rcv

release-&gt;tipc_release
accept-&gt;tipc_accept
bind-&gt;tipc_bind
get_name-&gt;tipc_getname
poll-&gt;tipc_poll
send_msg-&gt;tipc_sendmsg
send_packet-&gt;tipc_send_packet
send_stream-&gt;tipc_send_stream
recv_msg-&gt;tipc_recvmsg
recv_stream-&gt;tipc_recv_stream
connect-&gt;tipc_connect
listen-&gt;tipc_listen
shutdown-&gt;tipc_shutdown
setsockopt-&gt;tipc_setsockopt
getsockopt-&gt;tipc_getsockopt

Above changes have no impact on current users of the functions.

Signed-off-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: fix a loop style problem</title>
<updated>2014-02-17T05:26:26+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2014-02-14T21:40:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=074bb43e9e594bec647ec45cc5bbc8c1ac2306aa'/>
<id>074bb43e9e594bec647ec45cc5bbc8c1ac2306aa</id>
<content type='text'>
In commit 7d33939f475d403e79124e3143d7951dcfe8629f
("tipc: delay delete of link when failover is needed") we
introduced a loop for finding and removing a link pointer
in an array. The removal is done after we have left the loop,
giving the impression that one may remove the wrong pointer
if no matching element is found.

This is not really a bug, since we know that there will always
be a matching element, but it looks wrong, and causes a smatch
warning.

We fix this loop with this commit.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In commit 7d33939f475d403e79124e3143d7951dcfe8629f
("tipc: delay delete of link when failover is needed") we
introduced a loop for finding and removing a link pointer
in an array. The removal is done after we have left the loop,
giving the impression that one may remove the wrong pointer
if no matching element is found.

This is not really a bug, since we know that there will always
be a matching element, but it looks wrong, and causes a smatch
warning.

We fix this loop with this commit.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: delay delete of link when failover is needed</title>
<updated>2014-02-13T22:57:07+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2014-02-13T22:29:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7d33939f475d403e79124e3143d7951dcfe8629f'/>
<id>7d33939f475d403e79124e3143d7951dcfe8629f</id>
<content type='text'>
When a bearer is disabled, all its attached links are deleted.
Ideally, we should do link failover to redundant links on other bearers,
if there are any, in such cases. This would be consistent with current
behavior when a link is reset, but not deleted. However, due to the
complexity involved, and the (wrongly) perceived low demand for this
feature, it was never implemented until now.

We mark the doomed link for deletion with a new flag, but wait until the
failover process is finished before we actually delete it. With the
improved link tunnelling/failover code introduced earlier in this commit
series, it is now easy to identify a spot in the code where the failover
is finished and it is safe to delete the marked link. Moreover, the test
for the flag and the deletion can be done synchronously, and outside the
most time critical data path.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a bearer is disabled, all its attached links are deleted.
Ideally, we should do link failover to redundant links on other bearers,
if there are any, in such cases. This would be consistent with current
behavior when a link is reset, but not deleted. However, due to the
complexity involved, and the (wrongly) perceived low demand for this
feature, it was never implemented until now.

We mark the doomed link for deletion with a new flag, but wait until the
failover process is finished before we actually delete it. With the
improved link tunnelling/failover code introduced earlier in this commit
series, it is now easy to identify a spot in the code where the failover
is finished and it is safe to delete the marked link. Moreover, the test
for the flag and the deletion can be done synchronously, and outside the
most time critical data path.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: rename functions related to link failover and improve comments</title>
<updated>2014-01-07T23:44:25+00:00</updated>
<author>
<name>Jon Paul Maloy</name>
<email>jon.maloy@ericsson.com</email>
</author>
<published>2014-01-07T22:02:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=170b3927b4c4f6e105964f81ae985fc9772b1f9b'/>
<id>170b3927b4c4f6e105964f81ae985fc9772b1f9b</id>
<content type='text'>
The functionality related to link addition and failover is unnecessarily
hard to understand and maintain. We try to improve this by renaming
some of the functions, at the same time adding or improving the
explanatory comments around them. Names such as "tipc_rcv()" etc. also
align better with what is used in other networking components.

The changes in this commit are purely cosmetic, no functional changes
are made.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The functionality related to link addition and failover is unnecessarily
hard to understand and maintain. We try to improve this by renaming
some of the functions, at the same time adding or improving the
explanatory comments around them. Names such as "tipc_rcv()" etc. also
align better with what is used in other networking components.

The changes in this commit are purely cosmetic, no functional changes
are made.

Signed-off-by: Jon Maloy &lt;jon.maloy@ericsson.com&gt;
Reviewed-by: Ying Xue &lt;ying.xue@windriver.com&gt;
Reviewed-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tipc: remove unused code</title>
<updated>2014-01-05T01:18:50+00:00</updated>
<author>
<name>stephen hemminger</name>
<email>stephen@networkplumber.org</email>
</author>
<published>2014-01-04T21:49:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=eec73f1c968d6d6cafa5ca19d53b6618bbd20e1e'/>
<id>eec73f1c968d6d6cafa5ca19d53b6618bbd20e1e</id>
<content type='text'>
Remove dead code;
       tipc_bearer_find_interface
       tipc_node_redundant_links

This may break out of tree version of TIPC if there still is one.
But that maybe a good thing :-)

Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove dead code;
       tipc_bearer_find_interface
       tipc_node_redundant_links

This may break out of tree version of TIPC if there still is one.
But that maybe a good thing :-)

Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
