From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net
Subject: [patch net-next 1/3] team: use function team_port_txable() for determing enabled and up port
Date: Wed, 11 Jul 2012 17:34:02 +0200 [thread overview]
Message-ID: <1342020844-3547-2-git-send-email-jpirko@redhat.com> (raw)
In-Reply-To: <1342020844-3547-1-git-send-email-jpirko@redhat.com>
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/team/team.c | 6 ++++++
drivers/net/team/team_mode_roundrobin.c | 6 +++---
include/linux/if_team.h | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 9b94f53..bc7afa5 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -677,6 +677,12 @@ bool team_port_enabled(struct team_port *port)
}
EXPORT_SYMBOL(team_port_enabled);
+bool team_port_txable(struct team_port *port)
+{
+ return port->linkup && team_port_enabled(port);
+}
+EXPORT_SYMBOL(team_port_txable);
+
/*
* Enable/disable port by adding to enabled port hashlist and setting
* port->index (Might be racy so reader could see incorrect ifindex when
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c
index 52dd0ec..0cf38e9 100644
--- a/drivers/net/team/team_mode_roundrobin.c
+++ b/drivers/net/team/team_mode_roundrobin.c
@@ -30,16 +30,16 @@ static struct team_port *__get_first_port_up(struct team *team,
{
struct team_port *cur;
- if (port->linkup)
+ if (team_port_txable(port))
return port;
cur = port;
list_for_each_entry_continue_rcu(cur, &team->port_list, list)
- if (cur->linkup)
+ if (team_port_txable(port))
return cur;
list_for_each_entry_rcu(cur, &team->port_list, list) {
if (cur == port)
break;
- if (cur->linkup)
+ if (team_port_txable(port))
return cur;
}
return NULL;
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 99efd60..dca426c 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -64,6 +64,7 @@ struct team_port {
};
extern bool team_port_enabled(struct team_port *port);
+extern bool team_port_txable(struct team_port *port);
struct team_mode_ops {
int (*init)(struct team *team);
--
1.7.10.4
next prev parent reply other threads:[~2012-07-11 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-11 15:34 [patch net-next 0/3] team: couple of patches Jiri Pirko
2012-07-11 15:34 ` Jiri Pirko [this message]
2012-07-11 15:34 ` [patch net-next 2/3] team: add broadcast mode Jiri Pirko
2012-07-11 15:34 ` [patch net-next 3/3] team: make team_port_enabled() and team_port_txable() static inline Jiri Pirko
2012-07-12 15:11 ` [patch net-next 0/3] team: couple of patches David Miller
2012-07-12 15:14 ` David Miller
2012-07-12 15:53 ` Jiri Pirko
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=1342020844-3547-2-git-send-email-jpirko@redhat.com \
--to=jpirko@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).