mlxsw: spectrum: Avoid copying sample values and use RCU pointer direcly instead
authorJiri Pirko <jiri@mellanox.com>
Mon, 27 Apr 2020 15:13:07 +0000 (18:13 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Apr 2020 19:43:29 +0000 (12:43 -0700)
commit481ff57aadf5ea36bb3c5a9e659a2e1c5ecc6725
tree49dd001b3dafd1445ac5a7cb56f33bc6b3218404
parentdd0fbc89d274e392a077c5dc9a21d581de3252d1
mlxsw: spectrum: Avoid copying sample values and use RCU pointer direcly instead

Currently, only the psample_group is accessed using RCU on RX path.
However, it is possible (unlikely) that other sample values get change
during RX processing. Fix this by having the port->sample struct
accessed as RCU pointer, containing all sample values including
psample_group pointer. That avoids extra alloc per-port, copying the
values and the race condition described above.

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