From: Ding Tianhong <dingtianhong@huawei•com>
To: Andy Gospodarek <andy@greyhouse•net>,
Dan Williams <dcbw@redhat•com>,
David Miller <davem@davemloft•net>
Cc: <fubar@us•ibm.com>, <nikolay@redhat•com>, <vfalico@redhat•com>,
<netdev@vger•kernel.org>
Subject: [PATCH net v2] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
Date: Fri, 22 Nov 2013 10:12:38 +0800 [thread overview]
Message-ID: <528EBD96.2090706@huawei.com> (raw)
In-Reply-To: <528ACD8A.1010409@greyhouse.net>
Because the ARP monitoring is not support for 802.3ad, but I still
could change the mode to 802.3ad from ab mode while ARP monitoring
is running, it is incorrect.
So add a check for 802.3ad in bonding_store_mode to fix the problem,
and make a new macro BOND_NO_USES_ARP() to simplify the code.
v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options.
So when the mode is changed, the conficting values should be cleared
or reset, otherwise the user has to duplicate more operations to modify
the logic. I disable the arp and enable mii monitoring when the bond mode
is changed to AB, TB and 8023AD if the arp interval is true.
Suggested-by: Dan Williams <dcbw@redhat•com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei•com>
---
drivers/net/bonding/bond_options.c | 13 +++++++++----
drivers/net/bonding/bonding.h | 5 +++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 9a5223c..04364f7a 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)
return -EPERM;
}
- if (BOND_MODE_IS_LB(mode) && bond->params.arp_interval) {
- pr_err("%s: %s mode is incompatible with arp monitoring.\n",
- bond->dev->name, bond_mode_tbl[mode].modename);
- return -EINVAL;
+ if (BOND_NO_USES_ARP(mode) && bond->params.arp_interval) {
+ pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n",
+ bond->dev->name, bond_mode_tbl[mode].modename);
+ /* disable arp monitoring */
+ bond->params.arp_interval = 0;
+ /* set miimon to default value */
+ bond->params.miimon = 100;
+ pr_info("%s: Setting MII monitoring interval to %d.\n",
+ bond->dev->name, bond->params.miimon);
}
/* don't cache arp_validate between modes */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ca31286..a310fb5 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -55,6 +55,11 @@
((mode) == BOND_MODE_TLB) || \
((mode) == BOND_MODE_ALB))
+#define BOND_NO_USES_ARP(mode) \
+ (((mode) == BOND_MODE_8023AD) || \
+ ((mode) == BOND_MODE_TLB) || \
+ ((mode) == BOND_MODE_ALB))
+
#define TX_QUEUE_OVERRIDE(mode) \
(((mode) == BOND_MODE_ACTIVEBACKUP) || \
((mode) == BOND_MODE_ROUNDROBIN))
--
1.8.0
next prev parent reply other threads:[~2013-11-22 2:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-16 6:30 [PATCH net RESEND] bonding: don't change to 802.3ad mode while ARP monitoring is running Ding Tianhong
2013-11-18 17:44 ` Dan Williams
2013-11-18 20:48 ` David Miller
2013-11-18 22:50 ` Dan Williams
2013-11-19 1:48 ` Ding Tianhong
2013-11-19 2:31 ` Andy Gospodarek
2013-11-19 3:02 ` Ding Tianhong
2013-11-22 2:12 ` Ding Tianhong [this message]
2013-11-22 13:55 ` [PATCH net v2] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode Nikolay Aleksandrov
2013-11-22 14:12 ` Ding Tianhong
2013-11-22 13:36 ` [PATCH net RESEND] bonding: don't change to 802.3ad mode while ARP monitoring is running Nikolay Aleksandrov
2013-11-22 14:28 ` [PATCH net v3] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode Ding Tianhong
2013-11-22 19:07 ` Dan Williams
2013-11-22 20:01 ` Nikolay Aleksandrov
2013-11-28 23:20 ` 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=528EBD96.2090706@huawei.com \
--to=dingtianhong@huawei$(echo .)com \
--cc=andy@greyhouse$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=dcbw@redhat$(echo .)com \
--cc=fubar@us$(echo .)ibm.com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nikolay@redhat$(echo .)com \
--cc=vfalico@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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