Commit 85b0589ede83d7b4aeb2bc3cb8910183876cd5ee

Authored by Jiri Pirko
Committed by David S. Miller
1 parent 2008495d81

devlink: add trap metadata type for cookie

Allow driver to indicate cookie metadata for registered traps.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 6 additions and 0 deletions Side-by-side Diff

include/net/devlink.h
... ... @@ -541,6 +541,7 @@
541 541 };
542 542  
543 543 #define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT BIT(0)
  544 +#define DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE BIT(1)
544 545  
545 546 /**
546 547 * struct devlink_trap - Immutable packet trap attributes.
include/uapi/linux/devlink.h
... ... @@ -252,6 +252,8 @@
252 252 enum {
253 253 /* Trap can report input port as metadata */
254 254 DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
  255 + /* Trap can report flow action cookie as metadata */
  256 + DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,
255 257 };
256 258  
257 259 enum devlink_attr {
... ... @@ -5540,6 +5540,9 @@
5540 5540 if ((trap->metadata_cap & DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT) &&
5541 5541 nla_put_flag(msg, DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT))
5542 5542 goto nla_put_failure;
  5543 + if ((trap->metadata_cap & DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE) &&
  5544 + nla_put_flag(msg, DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE))
  5545 + goto nla_put_failure;
5543 5546  
5544 5547 nla_nest_end(msg, attr);
5545 5548