From: Jay Vosburgh <fubar@us.ibm.com>
To: Ding Tianhong <dingtianhong@huawei.com>
Cc: vfalico@redhat.com, andy@greyhouse.net, cwang@twopensource.com,
jiri@resnulli.us, thomas@glanzmann.de, eric.dumazet@gmail.com,
sfeldma@cumulusnetworks.com, davem@davemloft.net,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] bonding: add bond_set_slave_state/flags()
Date: Mon, 17 Feb 2014 18:08:22 -0800 [thread overview]
Message-ID: <5329.1392689302@death.nxdomain> (raw)
In-Reply-To: <1392626151-23916-2-git-send-email-dingtianhong@huawei.com>
Ding Tianhong <dingtianhong@huawei.com> wrote:
>The new function could change the slave state and flags, then call
>rtmsg_ifinfo() according to the input parameters notify.
>
>Cc: Jay Vosburgh <fubar@us.ibm.com>
>Cc: Veaceslav Falico <vfalico@redhat.com>
>Cc: Andy Gospodarek <andy@greyhouse.net>
>Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>---
> drivers/net/bonding/bonding.h | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
>diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
>index 86ccfb9..d210124 100644
>--- a/drivers/net/bonding/bonding.h
>+++ b/drivers/net/bonding/bonding.h
>@@ -303,6 +303,18 @@ static inline void bond_set_backup_slave(struct slave *slave)
> }
> }
>
>+static inline void bond_set_slave_state(struct slave *slave,
>+ int slave_state, bool notify)
>+{
>+ if (slave->backup != slave_state)
>+ slave->backup = slave_state;
>+ else
>+ return;
>+
>+ if (notify)
>+ rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL);
I think this would be clearer if coded as:
if (slave->backup == slave_slave)
return;
slave->backup = slave_state;
if (notify)
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL);
>+}
>+
> static inline void bond_slave_state_change(struct bonding *bond)
> {
> struct list_head *iter;
>@@ -408,6 +420,20 @@ static inline void bond_set_slave_active_flags(struct slave *slave)
> slave->inactive = 0;
> }
>
>+static inline void bond_set_slave_flags(struct slave *slave,
>+ int state, bool notify)
>+
>+{
>+ if (state == BOND_STATE_ACTIVE) {
>+ bond_set_slave_state(slave, state, notify);
>+ slave->inactive = 0;
>+ } else if (state == BOND_STATE_BACKUP && !bond_is_lb(slave->bond)) {
>+ bond_set_slave_state(slave, state, notify);
>+ if (!slave->bond->params.all_slaves_active)
>+ slave->inactive = 1;
>+ }
>+}
As I said in my other reply, I don't see why this shouldn't be
integrated into the existing state change functions instead of creating
a new function.
-J
> static inline bool bond_is_slave_inactive(struct slave *slave)
> {
> return slave->inactive;
>--
>1.8.0
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
next prev parent reply other threads:[~2014-02-18 2:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 8:35 [PATCH net-next 0/3] bonding: Fix RTNL: assertion failed at net/core/rtnetlink.c Ding Tianhong
2014-02-17 8:35 ` [PATCH net-next 1/3] bonding: add bond_set_slave_state/flags() Ding Tianhong
2014-02-18 2:08 ` Jay Vosburgh [this message]
2014-02-18 3:50 ` Ding Tianhong
2014-02-17 8:35 ` [PATCH net-next 2/3] bonding: add new slave param and bond_slave_state_notify() Ding Tianhong
2014-02-18 2:07 ` Jay Vosburgh
2014-02-18 3:49 ` Ding Tianhong
2014-02-17 8:35 ` [PATCH net-next 3/3] bonding: Fix the RTNL assertion failed for 802.3ad state machine Ding Tianhong
2014-02-18 2:06 ` Jay Vosburgh
2014-02-18 3:47 ` Ding Tianhong
2014-02-17 14:06 ` [PATCH net-next 0/3] bonding: Fix RTNL: assertion failed at net/core/rtnetlink.c Thomas Glanzmann
2014-02-17 21:36 ` 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=5329.1392689302@death.nxdomain \
--to=fubar@us.ibm.com \
--cc=andy@greyhouse.net \
--cc=cwang@twopensource.com \
--cc=davem@davemloft.net \
--cc=dingtianhong@huawei.com \
--cc=eric.dumazet@gmail.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@cumulusnetworks.com \
--cc=thomas@glanzmann.de \
--cc=vfalico@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.