diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-03-16 04:45:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-16 15:51:19 -0400 |
commit | 0bd80dad57d82676ee484fb1f9aa4c5e8b5bc469 (patch) | |
tree | f74ad36f8ab30ef3cff0404946cb440744d2b8b5 /drivers/net/bonding | |
parent | f1c1775ac7e61950225925c949045406ffcb43de (diff) |
net: get rid of multiple bond-related netdevice->priv_flags
Now when bond-related code is moved from net/core/dev.c into bonding
code, multiple priv_flags are not needed anymore. So let them rot.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 33 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 8 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 24 |
3 files changed, 15 insertions, 50 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b047d75c28d4..00e9710caf7f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1458,20 +1458,20 @@ static void bond_setup_by_slave(struct net_device *bond_dev, | |||
1458 | * ARP on active-backup slaves with arp_validate enabled. | 1458 | * ARP on active-backup slaves with arp_validate enabled. |
1459 | */ | 1459 | */ |
1460 | static bool bond_should_deliver_exact_match(struct sk_buff *skb, | 1460 | static bool bond_should_deliver_exact_match(struct sk_buff *skb, |
1461 | struct net_device *slave_dev, | 1461 | struct slave *slave, |
1462 | struct net_device *bond_dev) | 1462 | struct bonding *bond) |
1463 | { | 1463 | { |
1464 | if (slave_dev->priv_flags & IFF_SLAVE_INACTIVE) { | 1464 | if (slave->dev->priv_flags & IFF_SLAVE_INACTIVE) { |
1465 | if (slave_dev->priv_flags & IFF_SLAVE_NEEDARP && | 1465 | if (slave_do_arp_validate(bond, slave) && |
1466 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) | 1466 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) |
1467 | return false; | 1467 | return false; |
1468 | 1468 | ||
1469 | if (bond_dev->priv_flags & IFF_MASTER_ALB && | 1469 | if (bond->params.mode == BOND_MODE_ALB && |
1470 | skb->pkt_type != PACKET_BROADCAST && | 1470 | skb->pkt_type != PACKET_BROADCAST && |
1471 | skb->pkt_type != PACKET_MULTICAST) | 1471 | skb->pkt_type != PACKET_MULTICAST) |
1472 | return false; | 1472 | return false; |
1473 | 1473 | ||
1474 | if (bond_dev->priv_flags & IFF_MASTER_8023AD && | 1474 | if (bond->params.mode == BOND_MODE_8023AD && |
1475 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) | 1475 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) |
1476 | return false; | 1476 | return false; |
1477 | 1477 | ||
@@ -1484,6 +1484,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | |||
1484 | { | 1484 | { |
1485 | struct slave *slave; | 1485 | struct slave *slave; |
1486 | struct net_device *bond_dev; | 1486 | struct net_device *bond_dev; |
1487 | struct bonding *bond; | ||
1487 | 1488 | ||
1488 | skb = skb_share_check(skb, GFP_ATOMIC); | 1489 | skb = skb_share_check(skb, GFP_ATOMIC); |
1489 | if (unlikely(!skb)) | 1490 | if (unlikely(!skb)) |
@@ -1494,17 +1495,19 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | |||
1494 | if (unlikely(!bond_dev)) | 1495 | if (unlikely(!bond_dev)) |
1495 | return skb; | 1496 | return skb; |
1496 | 1497 | ||
1497 | if (bond_dev->priv_flags & IFF_MASTER_ARPMON) | 1498 | bond = netdev_priv(bond_dev); |
1499 | |||
1500 | if (bond->params.arp_interval) | ||
1498 | slave->dev->last_rx = jiffies; | 1501 | slave->dev->last_rx = jiffies; |
1499 | 1502 | ||
1500 | if (bond_should_deliver_exact_match(skb, slave->dev, bond_dev)) { | 1503 | if (bond_should_deliver_exact_match(skb, slave, bond)) { |
1501 | skb->deliver_no_wcard = 1; | 1504 | skb->deliver_no_wcard = 1; |
1502 | return skb; | 1505 | return skb; |
1503 | } | 1506 | } |
1504 | 1507 | ||
1505 | skb->dev = bond_dev; | 1508 | skb->dev = bond_dev; |
1506 | 1509 | ||
1507 | if (bond_dev->priv_flags & IFF_MASTER_ALB && | 1510 | if (bond->params.mode == BOND_MODE_ALB && |
1508 | bond_dev->priv_flags & IFF_BRIDGE_PORT && | 1511 | bond_dev->priv_flags & IFF_BRIDGE_PORT && |
1509 | skb->pkt_type == PACKET_HOST) { | 1512 | skb->pkt_type == PACKET_HOST) { |
1510 | 1513 | ||
@@ -2119,9 +2122,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
2119 | 2122 | ||
2120 | dev_set_mtu(slave_dev, slave->original_mtu); | 2123 | dev_set_mtu(slave_dev, slave->original_mtu); |
2121 | 2124 | ||
2122 | slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | | 2125 | slave_dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_BONDING); |
2123 | IFF_SLAVE_INACTIVE | IFF_BONDING | | ||
2124 | IFF_SLAVE_NEEDARP); | ||
2125 | 2126 | ||
2126 | kfree(slave); | 2127 | kfree(slave); |
2127 | 2128 | ||
@@ -2232,8 +2233,7 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2232 | dev_set_mac_address(slave_dev, &addr); | 2233 | dev_set_mac_address(slave_dev, &addr); |
2233 | } | 2234 | } |
2234 | 2235 | ||
2235 | slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | | 2236 | slave_dev->priv_flags &= ~IFF_SLAVE_INACTIVE; |
2236 | IFF_SLAVE_INACTIVE); | ||
2237 | 2237 | ||
2238 | kfree(slave); | 2238 | kfree(slave); |
2239 | 2239 | ||
@@ -4419,11 +4419,9 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4419 | case BOND_MODE_BROADCAST: | 4419 | case BOND_MODE_BROADCAST: |
4420 | break; | 4420 | break; |
4421 | case BOND_MODE_8023AD: | 4421 | case BOND_MODE_8023AD: |
4422 | bond_set_master_3ad_flags(bond); | ||
4423 | bond_set_xmit_hash_policy(bond); | 4422 | bond_set_xmit_hash_policy(bond); |
4424 | break; | 4423 | break; |
4425 | case BOND_MODE_ALB: | 4424 | case BOND_MODE_ALB: |
4426 | bond_set_master_alb_flags(bond); | ||
4427 | /* FALLTHRU */ | 4425 | /* FALLTHRU */ |
4428 | case BOND_MODE_TLB: | 4426 | case BOND_MODE_TLB: |
4429 | break; | 4427 | break; |
@@ -4514,9 +4512,6 @@ static void bond_setup(struct net_device *bond_dev) | |||
4514 | bond_dev->priv_flags |= IFF_BONDING; | 4512 | bond_dev->priv_flags |= IFF_BONDING; |
4515 | bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | 4513 | bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; |
4516 | 4514 | ||
4517 | if (bond->params.arp_interval) | ||
4518 | bond_dev->priv_flags |= IFF_MASTER_ARPMON; | ||
4519 | |||
4520 | /* At first, we block adding VLANs. That's the only way to | 4515 | /* At first, we block adding VLANs. That's the only way to |
4521 | * prevent problems that occur when adding VLANs over an | 4516 | * prevent problems that occur when adding VLANs over an |
4522 | * empty bond. The block will be removed once non-challenged | 4517 | * empty bond. The block will be removed once non-challenged |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index e718144c5cfa..3a530eb9d104 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -325,11 +325,6 @@ static ssize_t bonding_store_mode(struct device *d, | |||
325 | ret = -EINVAL; | 325 | ret = -EINVAL; |
326 | goto out; | 326 | goto out; |
327 | } | 327 | } |
328 | if (bond->params.mode == BOND_MODE_8023AD) | ||
329 | bond_unset_master_3ad_flags(bond); | ||
330 | |||
331 | if (bond->params.mode == BOND_MODE_ALB) | ||
332 | bond_unset_master_alb_flags(bond); | ||
333 | 328 | ||
334 | bond->params.mode = new_value; | 329 | bond->params.mode = new_value; |
335 | bond_set_mode_ops(bond, bond->params.mode); | 330 | bond_set_mode_ops(bond, bond->params.mode); |
@@ -530,8 +525,6 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
530 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 525 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
531 | bond->dev->name, new_value); | 526 | bond->dev->name, new_value); |
532 | bond->params.arp_interval = new_value; | 527 | bond->params.arp_interval = new_value; |
533 | if (bond->params.arp_interval) | ||
534 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; | ||
535 | if (bond->params.miimon) { | 528 | if (bond->params.miimon) { |
536 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 529 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
537 | bond->dev->name, bond->dev->name); | 530 | bond->dev->name, bond->dev->name); |
@@ -1007,7 +1000,6 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1007 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | 1000 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
1008 | bond->dev->name); | 1001 | bond->dev->name); |
1009 | bond->params.arp_interval = 0; | 1002 | bond->params.arp_interval = 0; |
1010 | bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; | ||
1011 | if (bond->params.arp_validate) { | 1003 | if (bond->params.arp_validate) { |
1012 | bond_unregister_arp(bond); | 1004 | bond_unregister_arp(bond); |
1013 | bond->params.arp_validate = | 1005 | bond->params.arp_validate = |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index ff9af31e8c5b..049619f29144 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -356,34 +356,12 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave) | |||
356 | slave->state = BOND_STATE_BACKUP; | 356 | slave->state = BOND_STATE_BACKUP; |
357 | if (!bond->params.all_slaves_active) | 357 | if (!bond->params.all_slaves_active) |
358 | slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; | 358 | slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; |
359 | if (slave_do_arp_validate(bond, slave)) | ||
360 | slave->dev->priv_flags |= IFF_SLAVE_NEEDARP; | ||
361 | } | 359 | } |
362 | 360 | ||
363 | static inline void bond_set_slave_active_flags(struct slave *slave) | 361 | static inline void bond_set_slave_active_flags(struct slave *slave) |
364 | { | 362 | { |
365 | slave->state = BOND_STATE_ACTIVE; | 363 | slave->state = BOND_STATE_ACTIVE; |
366 | slave->dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_SLAVE_NEEDARP); | 364 | slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE; |
367 | } | ||
368 | |||
369 | static inline void bond_set_master_3ad_flags(struct bonding *bond) | ||
370 | { | ||
371 | bond->dev->priv_flags |= IFF_MASTER_8023AD; | ||
372 | } | ||
373 | |||
374 | static inline void bond_unset_master_3ad_flags(struct bonding *bond) | ||
375 | { | ||
376 | bond->dev->priv_flags &= ~IFF_MASTER_8023AD; | ||
377 | } | ||
378 | |||
379 | static inline void bond_set_master_alb_flags(struct bonding *bond) | ||
380 | { | ||
381 | bond->dev->priv_flags |= IFF_MASTER_ALB; | ||
382 | } | ||
383 | |||
384 | static inline void bond_unset_master_alb_flags(struct bonding *bond) | ||
385 | { | ||
386 | bond->dev->priv_flags &= ~IFF_MASTER_ALB; | ||
387 | } | 365 | } |
388 | 366 | ||
389 | struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); | 367 | struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); |