mlxsw: spectrum_span: Only update mirroring agents if present
authorIdo Schimmel <idosch@mellanox.com>
Thu, 20 Feb 2020 07:07:52 +0000 (09:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Feb 2020 18:04:34 +0000 (10:04 -0800)
commiteb833eec3b4cad9d5ba54d573f88f756e4c5fb84
tree27a745b2249af410c3fccb4753581f3e31c33fd7
parent622110f24b453ab7542c51a0c7a4c799d252b0aa
mlxsw: spectrum_span: Only update mirroring agents if present

In order not to needlessly schedule the work item that updates the
mirroring agents, only schedule it if there are any mirroring agents
present.

This is done by adding an atomic counter that counts the active
mirroring agents.

It is incremented / decremented whenever a mirroring agent is created /
destroyed. It is read before scheduling the work item and in the
devlink-resource occupancy callback.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c