• Petr Machata's avatar
    net: bridge: br_switchdev: Tolerate -EOPNOTSUPP when replaying MDB · 989280d6
    Petr Machata authored
    There are two kinds of MDB entries to be replayed: port MDB entries, and
    host MDB entries. They are both replayed by br_switchdev_mdb_replay(). If
    the driver supports one kind, but lacks the other, the first -EOPNOTSUPP
    returned terminates the whole replay, including any further still-supported
    objects in the list.
    
    For this to cause issues, there must be MDB entries for both the host and
    the port being replayed. In that case, if the driver bails out from
    handling the host entry, the port entries are never replayed. However, the
    replay is currently only done when a switchdev port joins a bridge. There
    would be no port memberships at that point. Thus despite being erroneous,
    the code does not cause observable bugs.
    
    This is not an issue with other object kinds either, because there, each
    function replays one object kind. If a driver does not support that kind,
    it makes sense to bail out early. -EOPNOTSUPP is then ignored in
    nbp_switchdev_sync_objs().
    
    For MDB, suppress the -EOPNOTSUPP error code in br_switchdev_mdb_replay()
    already, so that the whole list gets replayed.
    
    The reason we need this patch is that a future patch will introduce a
    replay that should be used when a front-panel port netdevice is enslaved to
    a bridge lower, in particular a LAG. The LAG netdevice can already have
    both host and port MDB entries. The port entries need to be replayed so
    that they are offloaded on the port that joins the LAG.
    
    Cc: Jiri Pirko <jiri@resnulli.us>
    Cc: Ivan Vecera <ivecera@redhat.com>
    Cc: Roopa Prabhu <roopa@nvidia.com>
    Cc: Nikolay Aleksandrov <razor@blackwall.org>
    Cc: bridge@lists.linux-foundation.org
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarDanielle Ratson <danieller@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    989280d6
br_switchdev.c 19.7 KB