Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlxsw: spectrum_router: Only perform atomic nexthop bucket replacement when requested

When cleared, the 'force' parameter in nexthop bucket replacement
notifications indicates that a driver should try to perform an atomic
replacement. Meaning, only update the contents of the bucket if it is
inactive.

Since mlxsw only queries buckets' activity once every second, there is
no point in trying an atomic replacement if the idle timer interval is
smaller than 1 second.

Currently, mlxsw ignores the original value of 'force' and will always
try an atomic replacement if the idle timer is not smaller than 1
second.

Fix this by taking the original value of 'force' into account and never
promoting a non-atomic replacement to an atomic one.

Fixes: 617a77f044ed ("mlxsw: spectrum_router: Add nexthop bucket replacement support")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
7866f265 65550f03

+3 -2
+3 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 5068 5068 /* No point in trying an atomic replacement if the idle timer interval 5069 5069 * is smaller than the interval in which we query and clear activity. 5070 5070 */ 5071 - force = info->nh_res_bucket->idle_timer_ms < 5072 - MLXSW_SP_NH_GRP_ACTIVITY_UPDATE_INTERVAL; 5071 + if (!force && info->nh_res_bucket->idle_timer_ms < 5072 + MLXSW_SP_NH_GRP_ACTIVITY_UPDATE_INTERVAL) 5073 + force = true; 5073 5074 5074 5075 adj_index = nh->nhgi->adj_index + bucket_index; 5075 5076 err = mlxsw_sp_nexthop_update(mlxsw_sp, adj_index, nh, force, ratr_pl);