From: Ding Tianhong <dingtianhong@huawei.com>
To: Jay Vosburgh <fubar@us.ibm.com>,
Veaceslav Falico <vfalico@redhat.com>,
Netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH net] bonding: reset the slave's mtu when its be changed
Date: Fri, 10 Jan 2014 19:32:51 +0800 [thread overview]
Message-ID: <52CFDA63.8070601@huawei.com> (raw)
All slave should have the same mtu with mastet's, and the bond do it when
enslave the slave, but the user could change the slave's mtu, it will cause
the master and slave have different mtu, althrough in AB mode, it does not
matter if the slave is not the current slave, but in other mode, it is incorrect,
so reset the slave's mtu like the master set.
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_main.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 398e299..e7b5bcf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2882,18 +2882,17 @@ static int bond_slave_netdev_event(unsigned long event,
*/
break;
case NETDEV_CHANGEMTU:
- /*
- * TODO: Should slaves be allowed to
- * independently alter their MTU? For
- * an active-backup bond, slaves need
- * not be the same type of device, so
- * MTUs may vary. For other modes,
- * slaves arguably should have the
- * same MTUs. To do this, we'd need to
- * take over the slave's change_mtu
- * function for the duration of their
- * servitude.
+ /* All slave should have the same mtu
+ * as master.
*/
+ if (slave->dev->mtu != bond->dev->mtu) {
+ int res;
+ slave->original_mtu = slave->dev->mtu;
+ res = dev_set_mtu(slave->dev, bond->dev->mtu);
+ if (res)
+ pr_debug("Error %d calling dev_set_mtu for slave %s\n",
+ res, slave->dev->name);
+ }
break;
case NETDEV_CHANGENAME:
/*
--
1.8.0
next reply other threads:[~2014-01-10 11:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 11:32 Ding Tianhong [this message]
2014-01-10 12:19 ` [PATCH net] bonding: reset the slave's mtu when its be changed Veaceslav Falico
2014-01-12 5:18 ` Ding Tianhong
2014-01-14 2:11 ` Ding Tianhong
2014-01-14 6:03 ` Veaceslav Falico
2014-01-10 18:33 ` David Miller
2014-01-10 19:41 ` Sergei Shtylyov
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=52CFDA63.8070601@huawei.com \
--to=dingtianhong@huawei.com \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--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 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).