• Petr Machata's avatar
    net: Add lag.h, net_lag_port_dev_txable() · eeed992b
    Petr Machata authored
    LAG devices (team or bond) recognize for each one of their slave devices
    whether LAG traffic is going to be sent through that device. Bond calls
    such devices "active", team calls them "txable". When this state
    changes, a NETDEV_CHANGELOWERSTATE notification is distributed, together
    with a netdev_notifier_changelowerstate_info structure that for LAG
    devices includes a tx_enabled flag that refers to the new state. The
    notification thus makes it possible to react to the changes in txability
    in drivers.
    
    However there's no way to query txability from the outside on demand.
    That is problematic namely for mlxsw, which when resolving ERSPAN packet
    path, may encounter a LAG device, and needs to determine which of the
    slaves it should choose.
    
    To that end, introduce a new function, net_lag_port_dev_txable(), which
    determines whether a given slave device is "active" or
    "txable" (depending on the flavor of the LAG device). That function then
    dispatches to per-LAG-flavor helpers, bond_is_active_slave_dev() resp.
    team_port_dev_txable().
    
    Because there currently is no good place where net_lag_port_dev_txable()
    should be added, introduce a new header file, lag.h, which should from
    now on hold any logic common to both team and bond. (But keep
    netif_is_lag_master() together with the rest of netif_is_*_master()
    functions).
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    eeed992b
lag.h 409 Bytes