Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162877
b: refs/heads/master
c: 75c7850
h: refs/heads/master
i:
  162875: 8ccd14a
v: v3
  • Loading branch information
Moni Shoua authored and David S. Miller committed Sep 15, 2009
1 parent 69297dd commit dd0c97f
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 7 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: 481a8199142c050b72bff8a1956a49fd0a75bbe0
refs/heads/master: 75c78500ddad74b229cd0691496b8549490496a2
9 changes: 6 additions & 3 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
write_unlock_bh(&bond->curr_slave_lock);
read_unlock(&bond->lock);

netdev_bonding_change(bond->dev);
netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER);

read_lock(&bond->lock);
write_lock_bh(&bond->curr_slave_lock);
Expand Down Expand Up @@ -1469,14 +1469,17 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
*/
if (bond->slave_cnt == 0) {
if (bond_dev->type != slave_dev->type) {
dev_close(bond_dev);
pr_debug("%s: change device type from %d to %d\n",
bond_dev->name, bond_dev->type, slave_dev->type);

netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE);

if (slave_dev->type != ARPHRD_ETHER)
bond_setup_by_slave(bond_dev, slave_dev);
else
ether_setup(bond_dev);
dev_open(bond_dev);

netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE);
}
} else if (bond_dev->type != slave_dev->type) {
pr_err(DRV_NAME ": %s ether type (%d) is different "
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/igmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ extern void ip_mc_init_dev(struct in_device *);
extern void ip_mc_destroy_dev(struct in_device *);
extern void ip_mc_up(struct in_device *);
extern void ip_mc_down(struct in_device *);
extern void ip_mc_unmap(struct in_device *);
extern void ip_mc_remap(struct in_device *);
extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
extern void ip_mc_rejoin_group(struct ip_mc_list *im);
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,8 @@ extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
extern int dev_set_promiscuity(struct net_device *dev, int inc);
extern int dev_set_allmulti(struct net_device *dev, int inc);
extern void netdev_state_change(struct net_device *dev);
extern void netdev_bonding_change(struct net_device *dev);
extern void netdev_bonding_change(struct net_device *dev,
unsigned long event);
extern void netdev_features_change(struct net_device *dev);
/* Load a device via the kmod */
extern void dev_load(struct net *net, const char *name);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_FEAT_CHANGE 0x000B
#define NETDEV_BONDING_FAILOVER 0x000C
#define NETDEV_PRE_UP 0x000D
#define NETDEV_BONDING_OLDTYPE 0x000E
#define NETDEV_BONDING_NEWTYPE 0x000F

#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr
extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
extern void ipv6_mc_up(struct inet6_dev *idev);
extern void ipv6_mc_down(struct inet6_dev *idev);
extern void ipv6_mc_unmap(struct inet6_dev *idev);
extern void ipv6_mc_remap(struct inet6_dev *idev);
extern void ipv6_mc_init_dev(struct inet6_dev *idev);
extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,9 @@ void netdev_state_change(struct net_device *dev)
}
EXPORT_SYMBOL(netdev_state_change);

void netdev_bonding_change(struct net_device *dev)
void netdev_bonding_change(struct net_device *dev, unsigned long event)
{
call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev);
call_netdevice_notifiers(event, dev);
}
EXPORT_SYMBOL(netdev_bonding_change);

Expand Down
6 changes: 6 additions & 0 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
case NETDEV_DOWN:
ip_mc_down(in_dev);
break;
case NETDEV_BONDING_OLDTYPE:
ip_mc_unmap(in_dev);
break;
case NETDEV_BONDING_NEWTYPE:
ip_mc_remap(in_dev);
break;
case NETDEV_CHANGEMTU:
if (inetdev_valid_mtu(dev->mtu))
break;
Expand Down
22 changes: 22 additions & 0 deletions trunk/net/ipv4/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,28 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
}
}

/* Device changing type */

void ip_mc_unmap(struct in_device *in_dev)
{
struct ip_mc_list *i;

ASSERT_RTNL();

for (i = in_dev->mc_list; i; i = i->next)
igmp_group_dropped(i);
}

void ip_mc_remap(struct in_device *in_dev)
{
struct ip_mc_list *i;

ASSERT_RTNL();

for (i = in_dev->mc_list; i; i = i->next)
igmp_group_added(i);
}

/* Device going down */

void ip_mc_down(struct in_device *in_dev)
Expand Down
19 changes: 19 additions & 0 deletions trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ static DEFINE_SPINLOCK(addrconf_verify_lock);
static void addrconf_join_anycast(struct inet6_ifaddr *ifp);
static void addrconf_leave_anycast(struct inet6_ifaddr *ifp);

static void addrconf_bonding_change(struct net_device *dev,
unsigned long event);
static int addrconf_ifdown(struct net_device *dev, int how);

static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags);
Expand Down Expand Up @@ -2582,6 +2584,10 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
return notifier_from_errno(err);
}
break;
case NETDEV_BONDING_OLDTYPE:
case NETDEV_BONDING_NEWTYPE:
addrconf_bonding_change(dev, event);
break;
}

return NOTIFY_OK;
Expand All @@ -2595,6 +2601,19 @@ static struct notifier_block ipv6_dev_notf = {
.priority = 0
};

static void addrconf_bonding_change(struct net_device *dev, unsigned long event)
{
struct inet6_dev *idev;
ASSERT_RTNL();

idev = __in6_dev_get(dev);

if (event == NETDEV_BONDING_NEWTYPE)
ipv6_mc_remap(idev);
else if (event == NETDEV_BONDING_OLDTYPE)
ipv6_mc_unmap(idev);
}

static int addrconf_ifdown(struct net_device *dev, int how)
{
struct inet6_dev *idev;
Expand Down
19 changes: 19 additions & 0 deletions trunk/net/ipv6/mcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,25 @@ static void igmp6_timer_handler(unsigned long data)
ma_put(ma);
}

/* Device changing type */

void ipv6_mc_unmap(struct inet6_dev *idev)
{
struct ifmcaddr6 *i;

/* Install multicast list, except for all-nodes (already installed) */

read_lock_bh(&idev->lock);
for (i = idev->mc_list; i; i = i->next)
igmp6_group_dropped(i);
read_unlock_bh(&idev->lock);
}

void ipv6_mc_remap(struct inet6_dev *idev)
{
ipv6_mc_up(idev);
}

/* Device going down */

void ipv6_mc_down(struct inet6_dev *idev)
Expand Down

0 comments on commit dd0c97f

Please sign in to comment.