Commit 5d30530e authored by David Decotigny's avatar David Decotigny Committed by David S. Miller

net-bonding: Adding support for throughputs larger than 65536 Mbps

This updates the bonding driver to support v2.6.27-rc3 enhancements
(b11f8d8c aka. "ethtool: Expand ethtool_cmd.speed to 32 bits") which
allow to encode the Mbps link speed on 32-bits (Max 4 Pbps) instead of
16 (Max 65536 Mbps).

This patch also attempts to compact struct slave by reordering its
fields.
Signed-off-by: default avatarDavid Decotigny <decot@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65cce19c
...@@ -631,7 +631,8 @@ static int bond_set_carrier(struct bonding *bond) ...@@ -631,7 +631,8 @@ static int bond_set_carrier(struct bonding *bond)
static int bond_update_speed_duplex(struct slave *slave) static int bond_update_speed_duplex(struct slave *slave)
{ {
struct net_device *slave_dev = slave->dev; struct net_device *slave_dev = slave->dev;
struct ethtool_cmd etool; struct ethtool_cmd etool = { .cmd = ETHTOOL_GSET };
u32 slave_speed;
int res; int res;
/* Fake speed and duplex */ /* Fake speed and duplex */
...@@ -645,7 +646,8 @@ static int bond_update_speed_duplex(struct slave *slave) ...@@ -645,7 +646,8 @@ static int bond_update_speed_duplex(struct slave *slave)
if (res < 0) if (res < 0)
return -1; return -1;
switch (etool.speed) { slave_speed = ethtool_cmd_speed(&etool);
switch (slave_speed) {
case SPEED_10: case SPEED_10:
case SPEED_100: case SPEED_100:
case SPEED_1000: case SPEED_1000:
...@@ -663,7 +665,7 @@ static int bond_update_speed_duplex(struct slave *slave) ...@@ -663,7 +665,7 @@ static int bond_update_speed_duplex(struct slave *slave)
return -1; return -1;
} }
slave->speed = etool.speed; slave->speed = slave_speed;
slave->duplex = etool.duplex; slave->duplex = etool.duplex;
return 0; return 0;
...@@ -2493,7 +2495,7 @@ static void bond_miimon_commit(struct bonding *bond) ...@@ -2493,7 +2495,7 @@ static void bond_miimon_commit(struct bonding *bond)
bond_update_speed_duplex(slave); bond_update_speed_duplex(slave);
pr_info("%s: link status definitely up for interface %s, %d Mbps %s duplex.\n", pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
bond->dev->name, slave->dev->name, bond->dev->name, slave->dev->name,
slave->speed, slave->duplex ? "full" : "half"); slave->speed, slave->duplex ? "full" : "half");
...@@ -3339,7 +3341,7 @@ static int bond_slave_netdev_event(unsigned long event, ...@@ -3339,7 +3341,7 @@ static int bond_slave_netdev_event(unsigned long event,
slave = bond_get_slave_by_dev(bond, slave_dev); slave = bond_get_slave_by_dev(bond, slave_dev);
if (slave) { if (slave) {
u16 old_speed = slave->speed; u32 old_speed = slave->speed;
u8 old_duplex = slave->duplex; u8 old_duplex = slave->duplex;
bond_update_speed_duplex(slave); bond_update_speed_duplex(slave);
......
...@@ -196,12 +196,12 @@ struct slave { ...@@ -196,12 +196,12 @@ struct slave {
u8 backup:1, /* indicates backup slave. Value corresponds with u8 backup:1, /* indicates backup slave. Value corresponds with
BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
inactive:1; /* indicates inactive slave */ inactive:1; /* indicates inactive slave */
u8 duplex;
u32 original_mtu; u32 original_mtu;
u32 link_failure_count; u32 link_failure_count;
u8 perm_hwaddr[ETH_ALEN]; u32 speed;
u16 speed;
u8 duplex;
u16 queue_id; u16 queue_id;
u8 perm_hwaddr[ETH_ALEN];
struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */ struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
struct tlb_slave_info tlb_info; struct tlb_slave_info tlb_info;
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment