From: Jon Maloy <jon.maloy@ericsson.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org,
Paul Gortmaker <paul.gortmaker@windriver.com>,
erik.hugne@ericsson.com, ying.xue@windriver.com,
maloy@donjonn.com, tipc-discussion@lists.sourceforge.net,
Jon Maloy <jon.maloy@ericsson.com>
Subject: [PATCH net-next v2 02/14] tipc: move code for resetting links from bearer.c to link.c
Date: Thu, 13 Feb 2014 17:29:06 -0500 [thread overview]
Message-ID: <1392330558-19048-3-git-send-email-jon.maloy@ericsson.com> (raw)
In-Reply-To: <1392330558-19048-1-git-send-email-jon.maloy@ericsson.com>
From: Ying Xue <ying.xue@windriver.com>
We break out the code for resetting attached links in the
function tipc_reset_bearer(), and define a new function named
tipc_link_reset_list() to do this job.
This commit incurs no functional changes, but makes the code
of function tipc_reset_bearer() cleaner. It is also a preparation
for a more important change to the bearer code, in a subsequent
commit in this series.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/bearer.c | 11 +----------
net/tipc/link.c | 12 ++++++++++++
net/tipc/link.h | 1 +
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index a38c899..a3bdf5c 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -350,19 +350,10 @@ exit:
*/
static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
{
- struct tipc_link *l_ptr;
- struct tipc_link *temp_l_ptr;
-
read_lock_bh(&tipc_net_lock);
pr_info("Resetting bearer <%s>\n", b_ptr->name);
spin_lock_bh(&b_ptr->lock);
- list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
- struct tipc_node *n_ptr = l_ptr->owner;
-
- spin_lock_bh(&n_ptr->lock);
- tipc_link_reset(l_ptr);
- spin_unlock_bh(&n_ptr->lock);
- }
+ tipc_link_reset_list(b_ptr);
spin_unlock_bh(&b_ptr->lock);
read_unlock_bh(&tipc_net_lock);
return 0;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 17fbd15..3ff34e8 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -461,6 +461,18 @@ void tipc_link_reset(struct tipc_link *l_ptr)
link_reset_statistics(l_ptr);
}
+void tipc_link_reset_list(struct tipc_bearer *b_ptr)
+{
+ struct tipc_link *l_ptr;
+
+ list_for_each_entry(l_ptr, &b_ptr->links, link_list) {
+ struct tipc_node *n_ptr = l_ptr->owner;
+
+ spin_lock_bh(&n_ptr->lock);
+ tipc_link_reset(l_ptr);
+ spin_unlock_bh(&n_ptr->lock);
+ }
+}
static void link_activate(struct tipc_link *l_ptr)
{
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 8addc5e..73beecb 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -231,6 +231,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area,
struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area,
int req_tlv_space);
void tipc_link_reset(struct tipc_link *l_ptr);
+void tipc_link_reset_list(struct tipc_bearer *b_ptr);
int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
void tipc_link_send_names(struct list_head *message_list, u32 dest);
int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf);
--
1.7.9.5
next prev parent reply other threads:[~2014-02-13 22:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 22:29 [PATCH net-next v2 00/14] tipc: clean up media and bearer layer Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 01/14] tipc: stricter behavior of message reassembly function Jon Maloy
2014-02-13 22:29 ` Jon Maloy [this message]
2014-02-13 22:29 ` [PATCH net-next v2 03/14] tipc: move code for deleting links from bearer.c to link.c Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 04/14] tipc: redefine 'started' flag in struct link to bitmap Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 05/14] tipc: remove 'links' list from tipc_bearer struct Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 06/14] tipc: change reception of tunnelled duplicate packets Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 07/14] tipc: change reception of tunnelled failover packets Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 08/14] tipc: change signature of tunnelling reception function Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 09/14] tipc: more cleanup " Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 10/14] tipc: rename stack variables in function tipc_link_tunnel_rcv Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 11/14] tipc: changes to general packet reception algorithm Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 12/14] tipc: delay delete of link when failover is needed Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 13/14] tipc: remove bearer_lock from tipc_bearer struct Jon Maloy
2014-02-13 22:29 ` [PATCH net-next v2 14/14] tipc: add node_lock protection to link lookup function Jon Maloy
2014-02-13 22:57 ` [PATCH net-next v2 00/14] tipc: clean up media and bearer layer David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392330558-19048-3-git-send-email-jon.maloy@ericsson.com \
--to=jon.maloy@ericsson.com \
--cc=davem@davemloft.net \
--cc=erik.hugne@ericsson.com \
--cc=maloy@donjonn.com \
--cc=netdev@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox