• Petr Machata's avatar
    switchdev: Add SWITCHDEV_PORT_OBJ_ADD, SWITCHDEV_PORT_OBJ_DEL · aa4efe21
    Petr Machata authored
    An offloading driver may need to have access to switchdev events on
    ports that aren't directly under its control. An example is a VXLAN port
    attached to a bridge offloaded by a driver. The driver needs to know
    about VLANs configured on the VXLAN device. However the VXLAN device
    isn't stashed between the bridge and a front-panel-port device (such as
    is the case e.g. for LAG devices), so the usual switchdev ops don't
    reach the driver.
    
    VXLAN is likely not the only device type like this: in theory any L2
    tunnel device that needs offloading will prompt requirement of this
    sort. This falsifies the assumption that only the lower devices of a
    front panel port need to be notified to achieve flawless offloading.
    
    A way to fix this is to give up the notion of port object addition /
    deletion as a switchdev operation, which assumes somewhat tight coupling
    between the message producer and consumer. And instead send the message
    over a notifier chain.
    
    To that end, introduce two new switchdev notifier types,
    SWITCHDEV_PORT_OBJ_ADD and SWITCHDEV_PORT_OBJ_DEL. These notifier types
    communicate the same event as the corresponding switchdev op, except in
    a form of a notification. struct switchdev_notifier_port_obj_info was
    added to carry the fields that the switchdev op carries. An additional
    field, handled, will be used to communicate back to switchdev that the
    event has reached an interested party, which will be important for the
    two-phase commit.
    
    The two switchdev operations themselves are kept in place. Following
    patches first convert individual clients to the notifier protocol, and
    only then are the operations removed.
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    aa4efe21
switchdev.h 7.63 KB