[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvswitch-discuss
Subject:    [ovs-discuss] Help needed to understand code snippet
From:       azhou () nicira ! com (Andy Zhou)
Date:       2015-09-23 20:00:00
Message-ID: CACzMAJ+NYcDZV2PiCVPjUFNruTmnk-j0zoPA1=GfW6BRakkKVg () mail ! gmail ! com
[Download RAW message or body]

On Wed, Sep 23, 2015 at 5:55 AM, neeraj mehta <mehtaneeraj07 at gmail.com> wrote:
> Hello Team,
>
> Can you help me in understanding below snippet.
>
> I was looking at the code in bond.c:bond_compose_learning_packet( ). In
> this, function choose_output_slave ( ) can return NULL. And returned pointer
> is used as  "*port_aux = slave->aux".
> How will it work?
> ====================================================
> static struct bond_slave *
> choose_output_slave(const struct bond *bond, const struct flow *flow,
>                     struct flow_wildcards *wc, uint16_t vlan)
> {
>     struct bond_entry *e;
>     int balance;
>
>     balance = bond->balance;
>     if (bond->lacp_status == LACP_CONFIGURED) {
>         /* LACP has been configured on this bond but negotiations were
>          * unsuccussful. If lacp_fallback_ab is enabled use active-
>          * backup mode else drop all traffic. */
>         if (!bond->lacp_fallback_ab) {
>             return NULL;
>         }
>
> .....
> ===================================================
>
> ===================================================
> slave = choose_output_slave(bond, &flow, NULL, vlan);
>
>     packet = ofpbuf_new(0);
>     compose_rarp(packet, eth_src);
>     if (vlan) {
>         eth_push_vlan(packet, htons(ETH_TYPE_VLAN), htons(vlan));
>     }
>
>     *port_aux = slave->aux;
>     ovs_rwlock_unlock(&rwlock);
>     }
> ======================================================
>
The may_send_learning_packets() check above should make this code safe.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic