diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 4 | ||||
-rw-r--r-- | drivers/net/bonding/bond_ipv6.c | 8 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 98 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 6 |
4 files changed, 33 insertions, 83 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 2df9276720a..7f8b20a34ee 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -635,7 +635,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
635 | client_info->ntt = 0; | 635 | client_info->ntt = 0; |
636 | } | 636 | } |
637 | 637 | ||
638 | if (bond->vlgrp) { | 638 | if (bond_vlan_used(bond)) { |
639 | if (!vlan_get_tag(skb, &client_info->vlan_id)) | 639 | if (!vlan_get_tag(skb, &client_info->vlan_id)) |
640 | client_info->tag = 1; | 640 | client_info->tag = 1; |
641 | } | 641 | } |
@@ -847,7 +847,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) | |||
847 | skb->priority = TC_PRIO_CONTROL; | 847 | skb->priority = TC_PRIO_CONTROL; |
848 | skb->dev = slave->dev; | 848 | skb->dev = slave->dev; |
849 | 849 | ||
850 | if (bond->vlgrp) { | 850 | if (bond_vlan_used(bond)) { |
851 | struct vlan_entry *vlan; | 851 | struct vlan_entry *vlan; |
852 | 852 | ||
853 | vlan = bond_next_vlan(bond, | 853 | vlan = bond_next_vlan(bond, |
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c index 84fbd4ebd77..027a0ee7d85 100644 --- a/drivers/net/bonding/bond_ipv6.c +++ b/drivers/net/bonding/bond_ipv6.c | |||
@@ -183,10 +183,10 @@ static int bond_inet6addr_event(struct notifier_block *this, | |||
183 | } | 183 | } |
184 | 184 | ||
185 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | 185 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { |
186 | if (!bond->vlgrp) | 186 | rcu_read_lock(); |
187 | continue; | 187 | vlan_dev = __vlan_find_dev_deep(bond->dev, |
188 | vlan_dev = vlan_group_get_device(bond->vlgrp, | 188 | vlan->vlan_id); |
189 | vlan->vlan_id); | 189 | rcu_read_unlock(); |
190 | if (vlan_dev == event_dev) { | 190 | if (vlan_dev == event_dev) { |
191 | switch (event) { | 191 | switch (event) { |
192 | case NETDEV_UP: | 192 | case NETDEV_UP: |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b9eaf5c0dc7..02842d05c11 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -408,9 +408,8 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, | |||
408 | } | 408 | } |
409 | 409 | ||
410 | /* | 410 | /* |
411 | * In the following 3 functions, bond_vlan_rx_register(), bond_vlan_rx_add_vid | 411 | * In the following 2 functions, bond_vlan_rx_add_vid and bond_vlan_rx_kill_vid, |
412 | * and bond_vlan_rx_kill_vid, We don't protect the slave list iteration with a | 412 | * We don't protect the slave list iteration with a lock because: |
413 | * lock because: | ||
414 | * a. This operation is performed in IOCTL context, | 413 | * a. This operation is performed in IOCTL context, |
415 | * b. The operation is protected by the RTNL semaphore in the 8021q code, | 414 | * b. The operation is protected by the RTNL semaphore in the 8021q code, |
416 | * c. Holding a lock with BH disabled while directly calling a base driver | 415 | * c. Holding a lock with BH disabled while directly calling a base driver |
@@ -426,33 +425,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, | |||
426 | */ | 425 | */ |
427 | 426 | ||
428 | /** | 427 | /** |
429 | * bond_vlan_rx_register - Propagates registration to slaves | ||
430 | * @bond_dev: bonding net device that got called | ||
431 | * @grp: vlan group being registered | ||
432 | */ | ||
433 | static void bond_vlan_rx_register(struct net_device *bond_dev, | ||
434 | struct vlan_group *grp) | ||
435 | { | ||
436 | struct bonding *bond = netdev_priv(bond_dev); | ||
437 | struct slave *slave; | ||
438 | int i; | ||
439 | |||
440 | write_lock_bh(&bond->lock); | ||
441 | bond->vlgrp = grp; | ||
442 | write_unlock_bh(&bond->lock); | ||
443 | |||
444 | bond_for_each_slave(bond, slave, i) { | ||
445 | struct net_device *slave_dev = slave->dev; | ||
446 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | ||
447 | |||
448 | if ((slave_dev->features & NETIF_F_HW_VLAN_RX) && | ||
449 | slave_ops->ndo_vlan_rx_register) { | ||
450 | slave_ops->ndo_vlan_rx_register(slave_dev, grp); | ||
451 | } | ||
452 | } | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * bond_vlan_rx_add_vid - Propagates adding an id to slaves | 428 | * bond_vlan_rx_add_vid - Propagates adding an id to slaves |
457 | * @bond_dev: bonding net device that got called | 429 | * @bond_dev: bonding net device that got called |
458 | * @vid: vlan id being added | 430 | * @vid: vlan id being added |
@@ -489,7 +461,6 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) | |||
489 | { | 461 | { |
490 | struct bonding *bond = netdev_priv(bond_dev); | 462 | struct bonding *bond = netdev_priv(bond_dev); |
491 | struct slave *slave; | 463 | struct slave *slave; |
492 | struct net_device *vlan_dev; | ||
493 | int i, res; | 464 | int i, res; |
494 | 465 | ||
495 | bond_for_each_slave(bond, slave, i) { | 466 | bond_for_each_slave(bond, slave, i) { |
@@ -498,12 +469,7 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) | |||
498 | 469 | ||
499 | if ((slave_dev->features & NETIF_F_HW_VLAN_FILTER) && | 470 | if ((slave_dev->features & NETIF_F_HW_VLAN_FILTER) && |
500 | slave_ops->ndo_vlan_rx_kill_vid) { | 471 | slave_ops->ndo_vlan_rx_kill_vid) { |
501 | /* Save and then restore vlan_dev in the grp array, | ||
502 | * since the slave's driver might clear it. | ||
503 | */ | ||
504 | vlan_dev = vlan_group_get_device(bond->vlgrp, vid); | ||
505 | slave_ops->ndo_vlan_rx_kill_vid(slave_dev, vid); | 472 | slave_ops->ndo_vlan_rx_kill_vid(slave_dev, vid); |
506 | vlan_group_set_device(bond->vlgrp, vid, vlan_dev); | ||
507 | } | 473 | } |
508 | } | 474 | } |
509 | 475 | ||
@@ -519,13 +485,6 @@ static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *sla | |||
519 | struct vlan_entry *vlan; | 485 | struct vlan_entry *vlan; |
520 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 486 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
521 | 487 | ||
522 | if (!bond->vlgrp) | ||
523 | return; | ||
524 | |||
525 | if ((slave_dev->features & NETIF_F_HW_VLAN_RX) && | ||
526 | slave_ops->ndo_vlan_rx_register) | ||
527 | slave_ops->ndo_vlan_rx_register(slave_dev, bond->vlgrp); | ||
528 | |||
529 | if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) || | 488 | if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) || |
530 | !(slave_ops->ndo_vlan_rx_add_vid)) | 489 | !(slave_ops->ndo_vlan_rx_add_vid)) |
531 | return; | 490 | return; |
@@ -539,30 +498,16 @@ static void bond_del_vlans_from_slave(struct bonding *bond, | |||
539 | { | 498 | { |
540 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 499 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
541 | struct vlan_entry *vlan; | 500 | struct vlan_entry *vlan; |
542 | struct net_device *vlan_dev; | ||
543 | |||
544 | if (!bond->vlgrp) | ||
545 | return; | ||
546 | 501 | ||
547 | if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) || | 502 | if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) || |
548 | !(slave_ops->ndo_vlan_rx_kill_vid)) | 503 | !(slave_ops->ndo_vlan_rx_kill_vid)) |
549 | goto unreg; | 504 | return; |
550 | 505 | ||
551 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | 506 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { |
552 | if (!vlan->vlan_id) | 507 | if (!vlan->vlan_id) |
553 | continue; | 508 | continue; |
554 | /* Save and then restore vlan_dev in the grp array, | ||
555 | * since the slave's driver might clear it. | ||
556 | */ | ||
557 | vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id); | ||
558 | slave_ops->ndo_vlan_rx_kill_vid(slave_dev, vlan->vlan_id); | 509 | slave_ops->ndo_vlan_rx_kill_vid(slave_dev, vlan->vlan_id); |
559 | vlan_group_set_device(bond->vlgrp, vlan->vlan_id, vlan_dev); | ||
560 | } | 510 | } |
561 | |||
562 | unreg: | ||
563 | if ((slave_dev->features & NETIF_F_HW_VLAN_RX) && | ||
564 | slave_ops->ndo_vlan_rx_register) | ||
565 | slave_ops->ndo_vlan_rx_register(slave_dev, NULL); | ||
566 | } | 511 | } |
567 | 512 | ||
568 | /*------------------------------- Link status -------------------------------*/ | 513 | /*------------------------------- Link status -------------------------------*/ |
@@ -836,13 +781,13 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
836 | __bond_resend_igmp_join_requests(bond->dev); | 781 | __bond_resend_igmp_join_requests(bond->dev); |
837 | 782 | ||
838 | /* rejoin all groups on vlan devices */ | 783 | /* rejoin all groups on vlan devices */ |
839 | if (bond->vlgrp) { | 784 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { |
840 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | 785 | rcu_read_lock(); |
841 | vlan_dev = vlan_group_get_device(bond->vlgrp, | 786 | vlan_dev = __vlan_find_dev_deep(bond->dev, |
842 | vlan->vlan_id); | 787 | vlan->vlan_id); |
843 | if (vlan_dev) | 788 | rcu_read_unlock(); |
844 | __bond_resend_igmp_join_requests(vlan_dev); | 789 | if (vlan_dev) |
845 | } | 790 | __bond_resend_igmp_join_requests(vlan_dev); |
846 | } | 791 | } |
847 | 792 | ||
848 | if (--bond->igmp_retrans > 0) | 793 | if (--bond->igmp_retrans > 0) |
@@ -1557,7 +1502,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1557 | /* no need to lock since we're protected by rtnl_lock */ | 1502 | /* no need to lock since we're protected by rtnl_lock */ |
1558 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { | 1503 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { |
1559 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); | 1504 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); |
1560 | if (bond->vlgrp) { | 1505 | if (bond_vlan_used(bond)) { |
1561 | pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", | 1506 | pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", |
1562 | bond_dev->name, slave_dev->name, bond_dev->name); | 1507 | bond_dev->name, slave_dev->name, bond_dev->name); |
1563 | return -EPERM; | 1508 | return -EPERM; |
@@ -2065,7 +2010,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
2065 | */ | 2010 | */ |
2066 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); | 2011 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); |
2067 | 2012 | ||
2068 | if (bond->vlgrp) { | 2013 | if (bond_vlan_used(bond)) { |
2069 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", | 2014 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", |
2070 | bond_dev->name, bond_dev->name); | 2015 | bond_dev->name, bond_dev->name); |
2071 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", | 2016 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", |
@@ -2247,7 +2192,7 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2247 | */ | 2192 | */ |
2248 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); | 2193 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); |
2249 | 2194 | ||
2250 | if (bond->vlgrp) { | 2195 | if (bond_vlan_used(bond)) { |
2251 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", | 2196 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", |
2252 | bond_dev->name, bond_dev->name); | 2197 | bond_dev->name, bond_dev->name); |
2253 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", | 2198 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", |
@@ -2685,7 +2630,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2685 | if (!targets[i]) | 2630 | if (!targets[i]) |
2686 | break; | 2631 | break; |
2687 | pr_debug("basa: target %x\n", targets[i]); | 2632 | pr_debug("basa: target %x\n", targets[i]); |
2688 | if (!bond->vlgrp) { | 2633 | if (!bond_vlan_used(bond)) { |
2689 | pr_debug("basa: empty vlan: arp_send\n"); | 2634 | pr_debug("basa: empty vlan: arp_send\n"); |
2690 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], | 2635 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], |
2691 | bond->master_ip, 0); | 2636 | bond->master_ip, 0); |
@@ -2720,7 +2665,10 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2720 | 2665 | ||
2721 | vlan_id = 0; | 2666 | vlan_id = 0; |
2722 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | 2667 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { |
2723 | vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id); | 2668 | rcu_read_lock(); |
2669 | vlan_dev = __vlan_find_dev_deep(bond->dev, | ||
2670 | vlan->vlan_id); | ||
2671 | rcu_read_unlock(); | ||
2724 | if (vlan_dev == rt->dst.dev) { | 2672 | if (vlan_dev == rt->dst.dev) { |
2725 | vlan_id = vlan->vlan_id; | 2673 | vlan_id = vlan->vlan_id; |
2726 | pr_debug("basa: vlan match on %s %d\n", | 2674 | pr_debug("basa: vlan match on %s %d\n", |
@@ -3381,9 +3329,8 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
3381 | } | 3329 | } |
3382 | 3330 | ||
3383 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | 3331 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { |
3384 | if (!bond->vlgrp) | 3332 | vlan_dev = __vlan_find_dev_deep(bond->dev, |
3385 | continue; | 3333 | vlan->vlan_id); |
3386 | vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id); | ||
3387 | if (vlan_dev == event_dev) { | 3334 | if (vlan_dev == event_dev) { |
3388 | switch (event) { | 3335 | switch (event) { |
3389 | case NETDEV_UP: | 3336 | case NETDEV_UP: |
@@ -4335,10 +4282,9 @@ static const struct net_device_ops bond_netdev_ops = { | |||
4335 | .ndo_do_ioctl = bond_do_ioctl, | 4282 | .ndo_do_ioctl = bond_do_ioctl, |
4336 | .ndo_set_multicast_list = bond_set_multicast_list, | 4283 | .ndo_set_multicast_list = bond_set_multicast_list, |
4337 | .ndo_change_mtu = bond_change_mtu, | 4284 | .ndo_change_mtu = bond_change_mtu, |
4338 | .ndo_set_mac_address = bond_set_mac_address, | 4285 | .ndo_set_mac_address = bond_set_mac_address, |
4339 | .ndo_neigh_setup = bond_neigh_setup, | 4286 | .ndo_neigh_setup = bond_neigh_setup, |
4340 | .ndo_vlan_rx_register = bond_vlan_rx_register, | 4287 | .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid, |
4341 | .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid, | ||
4342 | .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid, | 4288 | .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid, |
4343 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4289 | #ifdef CONFIG_NET_POLL_CONTROLLER |
4344 | .ndo_netpoll_setup = bond_netpoll_setup, | 4290 | .ndo_netpoll_setup = bond_netpoll_setup, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 2936171f533..43526a2d275 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -240,7 +240,6 @@ struct bonding { | |||
240 | struct alb_bond_info alb_info; | 240 | struct alb_bond_info alb_info; |
241 | struct bond_params params; | 241 | struct bond_params params; |
242 | struct list_head vlan_list; | 242 | struct list_head vlan_list; |
243 | struct vlan_group *vlgrp; | ||
244 | struct workqueue_struct *wq; | 243 | struct workqueue_struct *wq; |
245 | struct delayed_work mii_work; | 244 | struct delayed_work mii_work; |
246 | struct delayed_work arp_work; | 245 | struct delayed_work arp_work; |
@@ -253,6 +252,11 @@ struct bonding { | |||
253 | #endif /* CONFIG_DEBUG_FS */ | 252 | #endif /* CONFIG_DEBUG_FS */ |
254 | }; | 253 | }; |
255 | 254 | ||
255 | static inline bool bond_vlan_used(struct bonding *bond) | ||
256 | { | ||
257 | return !list_empty(&bond->vlan_list); | ||
258 | } | ||
259 | |||
256 | #define bond_slave_get_rcu(dev) \ | 260 | #define bond_slave_get_rcu(dev) \ |
257 | ((struct slave *) rcu_dereference(dev->rx_handler_data)) | 261 | ((struct slave *) rcu_dereference(dev->rx_handler_data)) |
258 | 262 | ||