diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-08-15 23:15:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-17 23:17:47 -0400 |
commit | d03462b999307ec5c186851ec9c5751bd5a675f7 (patch) | |
tree | 500f727d52572ae2e5124cde25823c4d3cedbe55 /drivers/net/bonding | |
parent | f3ba150392c85d8175c454a7190b5fa46a49039e (diff) |
bonding: use ndo_change_rx_flags callback
Benefit from use of ndo_change_rx_flags in handling change of promisc
and allmulti. No need to store previous state locally.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 44 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 1 |
2 files changed, 14 insertions, 31 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 854aa8d3a2e0..c3e46832599e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3686,44 +3686,27 @@ static bool bond_addr_in_mc_list(unsigned char *addr, | |||
3686 | return false; | 3686 | return false; |
3687 | } | 3687 | } |
3688 | 3688 | ||
3689 | static void bond_set_multicast_list(struct net_device *bond_dev) | 3689 | static void bond_change_rx_flags(struct net_device *bond_dev, int change) |
3690 | { | 3690 | { |
3691 | struct bonding *bond = netdev_priv(bond_dev); | 3691 | struct bonding *bond = netdev_priv(bond_dev); |
3692 | struct netdev_hw_addr *ha; | ||
3693 | bool found; | ||
3694 | 3692 | ||
3695 | /* | 3693 | if (change & IFF_PROMISC) |
3696 | * Do promisc before checking multicast_mode | 3694 | bond_set_promiscuity(bond, |
3697 | */ | 3695 | bond_dev->flags & IFF_PROMISC ? 1 : -1); |
3698 | if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) | ||
3699 | /* | ||
3700 | * FIXME: Need to handle the error when one of the multi-slaves | ||
3701 | * encounters error. | ||
3702 | */ | ||
3703 | bond_set_promiscuity(bond, 1); | ||
3704 | |||
3705 | |||
3706 | if (!(bond_dev->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC)) | ||
3707 | bond_set_promiscuity(bond, -1); | ||
3708 | 3696 | ||
3697 | if (change & IFF_ALLMULTI) | ||
3698 | bond_set_allmulti(bond, | ||
3699 | bond_dev->flags & IFF_ALLMULTI ? 1 : -1); | ||
3700 | } | ||
3709 | 3701 | ||
3710 | /* set allmulti flag to slaves */ | 3702 | static void bond_set_multicast_list(struct net_device *bond_dev) |
3711 | if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) | 3703 | { |
3712 | /* | 3704 | struct bonding *bond = netdev_priv(bond_dev); |
3713 | * FIXME: Need to handle the error when one of the multi-slaves | 3705 | struct netdev_hw_addr *ha; |
3714 | * encounters error. | 3706 | bool found; |
3715 | */ | ||
3716 | bond_set_allmulti(bond, 1); | ||
3717 | |||
3718 | |||
3719 | if (!(bond_dev->flags & IFF_ALLMULTI) && (bond->flags & IFF_ALLMULTI)) | ||
3720 | bond_set_allmulti(bond, -1); | ||
3721 | |||
3722 | 3707 | ||
3723 | read_lock(&bond->lock); | 3708 | read_lock(&bond->lock); |
3724 | 3709 | ||
3725 | bond->flags = bond_dev->flags; | ||
3726 | |||
3727 | /* looking for addresses to add to slaves' mc list */ | 3710 | /* looking for addresses to add to slaves' mc list */ |
3728 | netdev_for_each_mc_addr(ha, bond_dev) { | 3711 | netdev_for_each_mc_addr(ha, bond_dev) { |
3729 | found = bond_addr_in_mc_list(ha->addr, &bond->mc_list, | 3712 | found = bond_addr_in_mc_list(ha->addr, &bond->mc_list, |
@@ -4282,6 +4265,7 @@ static const struct net_device_ops bond_netdev_ops = { | |||
4282 | .ndo_select_queue = bond_select_queue, | 4265 | .ndo_select_queue = bond_select_queue, |
4283 | .ndo_get_stats64 = bond_get_stats, | 4266 | .ndo_get_stats64 = bond_get_stats, |
4284 | .ndo_do_ioctl = bond_do_ioctl, | 4267 | .ndo_do_ioctl = bond_do_ioctl, |
4268 | .ndo_change_rx_flags = bond_change_rx_flags, | ||
4285 | .ndo_set_multicast_list = bond_set_multicast_list, | 4269 | .ndo_set_multicast_list = bond_set_multicast_list, |
4286 | .ndo_change_mtu = bond_change_mtu, | 4270 | .ndo_change_mtu = bond_change_mtu, |
4287 | .ndo_set_mac_address = bond_set_mac_address, | 4271 | .ndo_set_mac_address = bond_set_mac_address, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 43526a2d275c..e82336615600 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -234,7 +234,6 @@ struct bonding { | |||
234 | struct netdev_hw_addr_list mc_list; | 234 | struct netdev_hw_addr_list mc_list; |
235 | int (*xmit_hash_policy)(struct sk_buff *, int); | 235 | int (*xmit_hash_policy)(struct sk_buff *, int); |
236 | __be32 master_ip; | 236 | __be32 master_ip; |
237 | u16 flags; | ||
238 | u16 rr_tx_counter; | 237 | u16 rr_tx_counter; |
239 | struct ad_bond_info ad_info; | 238 | struct ad_bond_info ad_info; |
240 | struct alb_bond_info alb_info; | 239 | struct alb_bond_info alb_info; |