aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2021-03-16 17:02:58 +0200
committerDavid S. Miller <davem@davemloft.net>2021-03-16 15:32:22 -0700
commit90f53c53ec4acaa86055f4d2e98767eeb735b42d (patch)
treea5411e9d2e145bc71fd7527af64e2aef23527911 /drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
parentmlxsw: spectrum: Track sampling triggers in a hash table (diff)
downloadwireguard-linux-90f53c53ec4acaa86055f4d2e98767eeb735b42d.tar.xz
wireguard-linux-90f53c53ec4acaa86055f4d2e98767eeb735b42d.zip
mlxsw: spectrum: Start using sampling triggers hash table
Start using the previously introduced sampling triggers hash table to store sampling parameters instead of storing them as attributes of the sampled port. This makes it easier to introduce new sampling triggers. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
index 056201029ce5..db3c561ac3ea 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
@@ -257,8 +257,9 @@ static void mlxsw_sp_rx_sample_listener(struct sk_buff *skb, u8 local_port,
void *trap_ctx)
{
struct mlxsw_sp *mlxsw_sp = devlink_trap_ctx_priv(trap_ctx);
+ struct mlxsw_sp_sample_trigger trigger;
+ struct mlxsw_sp_sample_params *params;
struct mlxsw_sp_port *mlxsw_sp_port;
- struct mlxsw_sp_port_sample *sample;
struct psample_metadata md = {};
int err;
@@ -270,8 +271,10 @@ static void mlxsw_sp_rx_sample_listener(struct sk_buff *skb, u8 local_port,
if (!mlxsw_sp_port)
goto out;
- sample = rcu_dereference(mlxsw_sp_port->sample);
- if (!sample)
+ trigger.type = MLXSW_SP_SAMPLE_TRIGGER_TYPE_INGRESS;
+ trigger.local_port = local_port;
+ params = mlxsw_sp_sample_trigger_params_lookup(mlxsw_sp, &trigger);
+ if (!params)
goto out;
/* The psample module expects skb->data to point to the start of the
@@ -279,9 +282,9 @@ static void mlxsw_sp_rx_sample_listener(struct sk_buff *skb, u8 local_port,
*/
skb_push(skb, ETH_HLEN);
mlxsw_sp_psample_md_init(mlxsw_sp, &md, skb,
- mlxsw_sp_port->dev->ifindex, sample->truncate,
- sample->trunc_size);
- psample_sample_packet(sample->psample_group, skb, sample->rate, &md);
+ mlxsw_sp_port->dev->ifindex, params->truncate,
+ params->trunc_size);
+ psample_sample_packet(params->psample_group, skb, params->rate, &md);
out:
consume_skb(skb);
}