~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/net/bonding/bond_3ad.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
 */
247
247
static inline int __port_is_enabled(struct port *port)
248
248
{
249
 
        return port->slave->state == BOND_STATE_ACTIVE;
 
249
        return bond_is_active_slave(port->slave);
250
250
}
251
251
 
252
252
/**
716
716
static u32 __get_agg_bandwidth(struct aggregator *aggregator)
717
717
{
718
718
        u32 bandwidth = 0;
719
 
        u32 basic_speed;
720
719
 
721
720
        if (aggregator->num_of_ports) {
722
 
                basic_speed = __get_link_speed(aggregator->lag_ports);
723
 
                switch (basic_speed) {
 
721
                switch (__get_link_speed(aggregator->lag_ports)) {
724
722
                case AD_LINK_SPEED_BITMASK_1MBPS:
725
723
                        bandwidth = aggregator->num_of_ports;
726
724
                        break;
1482
1480
 
1483
1481
static int agg_device_up(const struct aggregator *agg)
1484
1482
{
1485
 
        return (netif_running(agg->slave->dev) &&
1486
 
                netif_carrier_ok(agg->slave->dev));
 
1483
        struct port *port = agg->lag_ports;
 
1484
        if (!port)
 
1485
                return 0;
 
1486
        return (netif_running(port->slave->dev) &&
 
1487
                netif_carrier_ok(port->slave->dev));
1487
1488
}
1488
1489
 
1489
1490
/**
2402
2403
        struct ad_info ad_info;
2403
2404
        int res = 1;
2404
2405
 
2405
 
        /* make sure that the slaves list will
2406
 
         * not change during tx
2407
 
         */
2408
 
        read_lock(&bond->lock);
2409
 
 
2410
 
        if (!BOND_IS_OK(bond))
2411
 
                goto out;
2412
 
 
2413
2406
        if (bond_3ad_get_active_agg_info(bond, &ad_info)) {
2414
2407
                pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n",
2415
2408
                         dev->name);
2463
2456
                /* no suitable interface, frame not sent */
2464
2457
                dev_kfree_skb(skb);
2465
2458
        }
2466
 
        read_unlock(&bond->lock);
 
2459
 
2467
2460
        return NETDEV_TX_OK;
2468
2461
}
2469
2462
 
2470
 
int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev)
 
2463
void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
 
2464
                          struct slave *slave)
2471
2465
{
2472
 
        struct bonding *bond = netdev_priv(dev);
2473
 
        struct slave *slave = NULL;
2474
 
        int ret = NET_RX_DROP;
2475
 
 
2476
 
        if (!(dev->flags & IFF_MASTER))
2477
 
                goto out;
2478
 
 
2479
 
        skb = skb_share_check(skb, GFP_ATOMIC);
2480
 
        if (!skb)
2481
 
                goto out;
 
2466
        if (skb->protocol != PKT_TYPE_LACPDU)
 
2467
                return;
2482
2468
 
2483
2469
        if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
2484
 
                goto out;
 
2470
                return;
2485
2471
 
2486
2472
        read_lock(&bond->lock);
2487
 
        slave = bond_get_slave_by_dev(netdev_priv(dev), orig_dev);
2488
 
        if (!slave)
2489
 
                goto out_unlock;
2490
 
 
2491
2473
        bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
2492
 
 
2493
 
        ret = NET_RX_SUCCESS;
2494
 
 
2495
 
out_unlock:
2496
2474
        read_unlock(&bond->lock);
2497
 
out:
2498
 
        dev_kfree_skb(skb);
2499
 
 
2500
 
        return ret;
2501
2475
}