Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24755
b: refs/heads/master
c: ff59c45
h: refs/heads/master
i:
  24753: 0a0e4e9
  24751: 3f43f84
v: v3
  • Loading branch information
Jay Vosburgh authored and Jeff Garzik committed Mar 29, 2006
1 parent d6a32ee commit e1ebf90
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e21a2b0cc5849e76434b37aff3a4b502c772f191
refs/heads/master: ff59c4563a8d1b39597aab4917959146c61f09b0
28 changes: 28 additions & 0 deletions trunk/drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,34 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)
port->sm_vars |= AD_PORT_BEGIN;
}

/*
* set link state for bonding master: if we have an active partnered
* aggregator, we're up, if not, we're down. Presumes that we cannot
* have an active aggregator if there are no slaves with link up.
*
* Called by bond_set_carrier(). Return zero if carrier state does not
* change, nonzero if it does.
*/
int bond_3ad_set_carrier(struct bonding *bond)
{
struct aggregator *agg;

agg = __get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator));
if (agg && MAC_ADDRESS_COMPARE(&agg->partner_system, &null_mac_addr)) {
if (!netif_carrier_ok(bond->dev)) {
netif_carrier_on(bond->dev);
return 1;
}
return 0;
}

if (netif_carrier_ok(bond->dev)) {
netif_carrier_off(bond->dev);
return 1;
}
return 0;
}

/**
* bond_3ad_get_active_agg_info - get information of the active aggregator
* @bond: bonding struct to work on
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/bonding/bond_3ad.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,6 @@ void bond_3ad_handle_link_change(struct slave *slave, char link);
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev);
int bond_3ad_set_carrier(struct bonding *bond);
#endif //__BOND_3AD_H__

97 changes: 71 additions & 26 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,42 @@ static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *s

/*------------------------------- Link status -------------------------------*/

/*
* Set the carrier state for the master according to the state of its
* slaves. If any slaves are up, the master is up. In 802.3ad mode,
* do special 802.3ad magic.
*
* Returns zero if carrier state does not change, nonzero if it does.
*/
static int bond_set_carrier(struct bonding *bond)
{
struct slave *slave;
int i;

if (bond->slave_cnt == 0)
goto down;

if (bond->params.mode == BOND_MODE_8023AD)
return bond_3ad_set_carrier(bond);

bond_for_each_slave(bond, slave, i) {
if (slave->link == BOND_LINK_UP) {
if (!netif_carrier_ok(bond->dev)) {
netif_carrier_on(bond->dev);
return 1;
}
return 0;
}
}

down:
if (netif_carrier_ok(bond->dev)) {
netif_carrier_off(bond->dev);
return 1;
}
return 0;
}

/*
* Get link speed and duplex from the slave's base driver
* using ethtool. If for some reason the call fails or the
Expand Down Expand Up @@ -1074,10 +1110,24 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
void bond_select_active_slave(struct bonding *bond)
{
struct slave *best_slave;
int rv;

best_slave = bond_find_best_slave(bond);
if (best_slave != bond->curr_active_slave) {
bond_change_active_slave(bond, best_slave);
rv = bond_set_carrier(bond);
if (!rv)
return;

if (netif_carrier_ok(bond->dev)) {
printk(KERN_INFO DRV_NAME
": %s: first active interface up!\n",
bond->dev->name);
} else {
printk(KERN_INFO DRV_NAME ": %s: "
"now running without any active interface !\n",
bond->dev->name);
}
}
}

Expand Down Expand Up @@ -1458,10 +1508,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
if (((!bond->curr_active_slave) ||
(bond->curr_active_slave->dev->priv_flags & IFF_SLAVE_INACTIVE)) &&
(new_slave->link != BOND_LINK_DOWN)) {
dprintk("This is the first active slave\n");
/* first slave or no active slave yet, and this link
is OK, so make this interface the active one */
bond_change_active_slave(bond, new_slave);
printk(KERN_INFO DRV_NAME
": %s: first active interface up!\n",
bond->dev->name);
netif_carrier_on(bond->dev);

} else {
dprintk("This is just a backup slave\n");
bond_set_slave_inactive_flags(new_slave);
Expand Down Expand Up @@ -1517,6 +1571,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
break;
} /* switch(bond_mode) */

bond_set_carrier(bond);

write_unlock_bh(&bond->lock);

res = bond_create_slave_symlinks(bond_dev, slave_dev);
Expand Down Expand Up @@ -1656,18 +1712,12 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
bond_alb_deinit_slave(bond, slave);
}

if (oldcurrent == slave) {
if (oldcurrent == slave)
bond_select_active_slave(bond);

if (!bond->curr_active_slave) {
printk(KERN_INFO DRV_NAME
": %s: now running without any active "
"interface !\n",
bond_dev->name);
}
}

if (bond->slave_cnt == 0) {
bond_set_carrier(bond);

/* if the last slave was removed, zero the mac address
* of the master so it will be set by the application
* to the mac address of the first slave
Expand Down Expand Up @@ -1751,6 +1801,8 @@ static int bond_release_all(struct net_device *bond_dev)

write_lock_bh(&bond->lock);

netif_carrier_off(bond_dev);

if (bond->slave_cnt == 0) {
goto out;
}
Expand Down Expand Up @@ -2187,15 +2239,9 @@ void bond_mii_monitor(struct net_device *bond_dev)

bond_select_active_slave(bond);

if (oldcurrent && !bond->curr_active_slave) {
printk(KERN_INFO DRV_NAME
": %s: now running without any active "
"interface !\n",
bond_dev->name);
}

write_unlock(&bond->curr_slave_lock);
}
} else
bond_set_carrier(bond);

re_arm:
if (bond->params.miimon) {
Expand Down Expand Up @@ -2499,13 +2545,6 @@ void bond_loadbalance_arp_mon(struct net_device *bond_dev)

bond_select_active_slave(bond);

if (oldcurrent && !bond->curr_active_slave) {
printk(KERN_INFO DRV_NAME
": %s: now running without any active "
"interface !\n",
bond_dev->name);
}

write_unlock(&bond->curr_slave_lock);
}

Expand Down Expand Up @@ -2579,12 +2618,15 @@ void bond_activebackup_arp_mon(struct net_device *bond_dev)
bond->current_arp_slave = NULL;
}

bond_set_carrier(bond);

if (slave == bond->curr_active_slave) {
printk(KERN_INFO DRV_NAME
": %s: %s is up and now the "
"active interface\n",
bond_dev->name,
slave->dev->name);
netif_carrier_on(bond->dev);
} else {
printk(KERN_INFO DRV_NAME
": %s: backup interface %s is "
Expand Down Expand Up @@ -2844,7 +2886,8 @@ static void bond_info_show_master(struct seq_file *seq)
(curr) ? curr->dev->name : "None");
}

seq_printf(seq, "MII Status: %s\n", (curr) ? "up" : "down");
seq_printf(seq, "MII Status: %s\n", netif_carrier_ok(bond->dev) ?
"up" : "down");
seq_printf(seq, "MII Polling Interval (ms): %d\n", bond->params.miimon);
seq_printf(seq, "Up Delay (ms): %d\n",
bond->params.updelay * bond->params.miimon);
Expand Down Expand Up @@ -4531,6 +4574,8 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
if (newbond)
*newbond = bond_dev->priv;

netif_carrier_off(bond_dev);

rtnl_unlock(); /* allows sysfs registration of net device */
res = bond_create_sysfs_entry(bond_dev->priv);
goto done;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/bonding/bonding.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "bond_3ad.h"
#include "bond_alb.h"

#define DRV_VERSION "3.0.2"
#define DRV_RELDATE "February 21, 2006"
#define DRV_VERSION "3.0.3"
#define DRV_RELDATE "March 23, 2006"
#define DRV_NAME "bonding"
#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"

Expand Down

0 comments on commit e1ebf90

Please sign in to comment.