• Ido Schimmel's avatar
    mlxsw: spectrum_router: Allocate discard adjacency entry when needed · 983db619
    Ido Schimmel authored
    Commit 0c3cbbf9 ("mlxsw: Add specific trap for packets routed via
    invalid nexthops") allocated an adjacency entry during driver
    initialization whose purpose is to discard packets hitting the route
    pointing to it.
    
    These adjacency entries are allocated from a resource called KVD linear
    (KVDL). There are situations in which the user can decide to set the
    size of this resource (via devlink-resource) to 0, in which case the
    driver will not be able to load.
    
    Therefore, instead of pre-allocating this adjacency entry, simply
    allocate it only when needed. A variable indicating the validity of the
    entry is added and is used to ensure it is only allocated and written
    once and that it is freed after all the routes were flushed.
    
    Fixes: 0c3cbbf9 ("mlxsw: Add specific trap for packets routed via invalid nexthops")
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    983db619
spectrum_router.c 220 KB