From: Moni Shoua <monis@voltaire.com>
To: jgarzik@pobox.com, fubar@us.ibm.com, rdreier@cisco.com
Cc: netdev@vger.kernel.org, general@lists.openfabrics.org
Subject: [PATCH V7 6/8] net/bonding: Handlle wrong assumptions that slave is always an Ethernet device
Date: Mon, 15 Oct 2007 18:13:10 +0200 [thread overview]
Message-ID: <47139196.30501@voltaire.com> (raw)
In-Reply-To: <47138EB7.40703@gmail.com>
bonding sometimes uses Ethernet constants (such as MTU and address length) which
are not good when it enslaves non Ethernet devices (such as InfiniBand).
Signed-off-by: Moni Shoua <monis at voltaire.com>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 3 ++-
drivers/net/bonding/bond_sysfs.c | 10 ++++++++--
drivers/net/bonding/bonding.h | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d7e43ba..3f082dc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1225,7 +1225,8 @@ static int bond_compute_features(struct
struct slave *slave;
struct net_device *bond_dev = bond->dev;
unsigned long features = bond_dev->features;
- unsigned short max_hard_header_len = ETH_HLEN;
+ unsigned short max_hard_header_len = max((u16)ETH_HLEN,
+ bond_dev->hard_header_len);
int i;
features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ca4e429..583c568 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -260,6 +260,7 @@ static ssize_t bonding_store_slaves(stru
char command[IFNAMSIZ + 1] = { 0, };
char *ifname;
int i, res, found, ret = count;
+ u32 original_mtu;
struct slave *slave;
struct net_device *dev = NULL;
struct bonding *bond = to_bond(d);
@@ -325,6 +326,7 @@ static ssize_t bonding_store_slaves(stru
}
/* Set the slave's MTU to match the bond */
+ original_mtu = dev->mtu;
if (dev->mtu != bond->dev->mtu) {
if (dev->change_mtu) {
res = dev->change_mtu(dev,
@@ -339,6 +341,9 @@ static ssize_t bonding_store_slaves(stru
}
rtnl_lock();
res = bond_enslave(bond->dev, dev);
+ bond_for_each_slave(bond, slave, i)
+ if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
+ slave->original_mtu = original_mtu;
rtnl_unlock();
if (res) {
ret = res;
@@ -351,6 +356,7 @@ static ssize_t bonding_store_slaves(stru
bond_for_each_slave(bond, slave, i)
if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
dev = slave->dev;
+ original_mtu = slave->original_mtu;
break;
}
if (dev) {
@@ -365,9 +371,9 @@ static ssize_t bonding_store_slaves(stru
}
/* set the slave MTU to the default */
if (dev->change_mtu) {
- dev->change_mtu(dev, 1500);
+ dev->change_mtu(dev, original_mtu);
} else {
- dev->mtu = 1500;
+ dev->mtu = original_mtu;
}
}
else {
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 5011ba9..ad9c632 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -156,6 +156,7 @@ struct slave {
s8 link; /* one of BOND_LINK_XXXX */
s8 state; /* one of BOND_STATE_XXXX */
u32 original_flags;
+ u32 original_mtu;
u32 link_failure_count;
u16 speed;
u8 duplex;
next prev parent reply other threads:[~2007-10-15 16:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 16:00 [PATCH V7 0/8] net/bonding: ADD IPoIB support for the bonding driver Moni Shoua
2007-10-15 16:03 ` [ofa-general] [PATCH V7 1/8] IB/ipoib: Bound the net device to the ipoib_neigh structue Moni Shoua
2007-10-15 16:08 ` [ofa-general] [PATCH V7 0/8] net/bonding: ADD IPoIB support for the bonding driver Moni Shoua
2007-10-15 16:09 ` [ofa-general] [PATCH V7 2/8] IB/ipoib: Verify address handle validity on send Moni Shoua
2007-10-15 16:10 ` [PATCH V7 3/8] net/bonding: Enable bonding to enslave non ARPHRD_ETHER Moni Shoua
2007-10-15 16:11 ` [PATCH V7 4/8] net/bonding: Enable bonding to enslave netdevices not supporting set_mac_address() Moni Shoua
2007-10-15 16:12 ` [PATCH V7 5/8] net/bonding: Enable IP multicast for bonding IPoIB devices Moni Shoua
2007-10-15 16:13 ` Moni Shoua [this message]
2007-10-15 16:13 ` PATCH V6 7/8] net/bonding: Delay sending of gratuitous ARP to avoid failure Moni Shoua
2007-10-15 16:14 ` [PATCH V7 8/8] net/bonding: Destroy bonding master when last slave is gone Moni Shoua
2007-10-15 18:23 ` [ofa-general] Re: [PATCH V7 0/8] net/bonding: ADD IPoIB support for the bonding driver Jeff Garzik
2007-10-15 20:34 ` Jay Vosburgh
2007-10-15 20:50 ` [ofa-general] " Jeff Garzik
2007-10-15 21:53 ` Jay Vosburgh
2007-10-15 21:56 ` Jeff Garzik
2007-10-15 23:44 ` [PATCH linux-2.6] bonding: two small fixes for IPoIB support Jay Vosburgh
2007-10-16 7:56 ` Moni Shoua
2007-10-17 1:15 ` [ofa-general] " Jeff Garzik
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=47139196.30501@voltaire.com \
--to=monis@voltaire.com \
--cc=fubar@us.ibm.com \
--cc=general@lists.openfabrics.org \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=rdreier@cisco.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).