diff options
author | Jiri Pirko <jiri@mellanox.com> | 2020-02-25 11:45:25 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-25 11:05:55 -0800 |
commit | 6de9fceeaa654a5470627817f7800aa849dd4489 (patch) | |
tree | ce7d218b20c02ef32df7e14abb975bd855c74732 /drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c | |
parent | mlxsw: pci: Extract cookie index for ACL discard trap packets (diff) | |
download | linux-dev-6de9fceeaa654a5470627817f7800aa849dd4489.tar.xz linux-dev-6de9fceeaa654a5470627817f7800aa849dd4489.zip |
mlxsw: spectrum_trap: Lookup and pass cookie down to devlink_trap_report()
Use the cookie index received along with the packet to lookup original
flow_offload cookie binary and pass it down to devlink_trap_report().
Add "fa_cookie" metadata to the ACL trap.
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>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c index 9fad56df8303..1f2e6db743e1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -769,6 +769,22 @@ static void mlxsw_afa_cookie_put(struct mlxsw_afa *mlxsw_afa, mlxsw_afa_cookie_destroy(mlxsw_afa, cookie); } +/* RCU read lock must be held */ +const struct flow_action_cookie * +mlxsw_afa_cookie_lookup(struct mlxsw_afa *mlxsw_afa, u32 cookie_index) +{ + struct mlxsw_afa_cookie *cookie; + + /* 0 index means no cookie */ + if (!cookie_index) + return NULL; + cookie = idr_find(&mlxsw_afa->cookie_idr, cookie_index); + if (!cookie) + return NULL; + return &cookie->fa_cookie; +} +EXPORT_SYMBOL(mlxsw_afa_cookie_lookup); + struct mlxsw_afa_cookie_ref { struct mlxsw_afa_resource resource; struct mlxsw_afa_cookie *cookie; |