aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_3ad.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_3ad.c')
-rw-r--r--drivers/net/bonding/bond_3ad.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 31912f17653..c7537abca4f 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -716,11 +716,9 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
716static u32 __get_agg_bandwidth(struct aggregator *aggregator) 716static u32 __get_agg_bandwidth(struct aggregator *aggregator)
717{ 717{
718 u32 bandwidth = 0; 718 u32 bandwidth = 0;
719 u32 basic_speed;
720 719
721 if (aggregator->num_of_ports) { 720 if (aggregator->num_of_ports) {
722 basic_speed = __get_link_speed(aggregator->lag_ports); 721 switch (__get_link_speed(aggregator->lag_ports)) {
723 switch (basic_speed) {
724 case AD_LINK_SPEED_BITMASK_1MBPS: 722 case AD_LINK_SPEED_BITMASK_1MBPS:
725 bandwidth = aggregator->num_of_ports; 723 bandwidth = aggregator->num_of_ports;
726 break; 724 break;
@@ -2405,14 +2403,6 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2405 struct ad_info ad_info; 2403 struct ad_info ad_info;
2406 int res = 1; 2404 int res = 1;
2407 2405
2408 /* make sure that the slaves list will
2409 * not change during tx
2410 */
2411 read_lock(&bond->lock);
2412
2413 if (!BOND_IS_OK(bond))
2414 goto out;
2415
2416 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 2406 if (bond_3ad_get_active_agg_info(bond, &ad_info)) {
2417 pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", 2407 pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n",
2418 dev->name); 2408 dev->name);
@@ -2466,39 +2456,20 @@ out:
2466 /* no suitable interface, frame not sent */ 2456 /* no suitable interface, frame not sent */
2467 dev_kfree_skb(skb); 2457 dev_kfree_skb(skb);
2468 } 2458 }
2469 read_unlock(&bond->lock); 2459
2470 return NETDEV_TX_OK; 2460 return NETDEV_TX_OK;
2471} 2461}
2472 2462
2473int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev) 2463void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
2464 struct slave *slave)
2474{ 2465{
2475 struct bonding *bond = netdev_priv(dev); 2466 if (skb->protocol != PKT_TYPE_LACPDU)
2476 struct slave *slave = NULL; 2467 return;
2477 int ret = NET_RX_DROP;
2478
2479 if (!(dev->flags & IFF_MASTER))
2480 goto out;
2481
2482 skb = skb_share_check(skb, GFP_ATOMIC);
2483 if (!skb)
2484 goto out;
2485 2468
2486 if (!pskb_may_pull(skb, sizeof(struct lacpdu))) 2469 if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
2487 goto out; 2470 return;
2488 2471
2489 read_lock(&bond->lock); 2472 read_lock(&bond->lock);
2490 slave = bond_get_slave_by_dev(netdev_priv(dev), orig_dev);
2491 if (!slave)
2492 goto out_unlock;
2493
2494 bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); 2473 bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
2495
2496 ret = NET_RX_SUCCESS;
2497
2498out_unlock:
2499 read_unlock(&bond->lock); 2474 read_unlock(&bond->lock);
2500out:
2501 dev_kfree_skb(skb);
2502
2503 return ret;
2504} 2475}