Allow driver to indicate cookie metadata for registered traps.
Unified · Split
| @@ -541,6 +541,7 @@ struct devlink_trap_group { · 540 unmodified lines | |||
| 541 | }; | 541 | }; |
| 542 | 542 | ||
| 543 | #define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT BIT(0) | 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 | * struct devlink_trap - Immutable packet trap attributes. | 547 | * struct devlink_trap - Immutable packet trap attributes. |
| @@ -252,6 +252,8 @@ enum devlink_trap_type { · 251 unmodified lines | |||
| 252 | enum { | 252 | enum { |
| 253 | /* Trap can report input port as metadata */ | 253 | /* Trap can report input port as metadata */ |
| 254 | DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT, | 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 | enum devlink_attr { | 259 | enum devlink_attr { |
| @@ -5540,6 +5540,9 @@ static int devlink_trap_metadata_put(struct sk_buff *msg, · 5539 unmodified lines | |||
| 5540 | if ((trap->metadata_cap & DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT) && | 5540 | if ((trap->metadata_cap & DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT) && |
| 5541 | nla_put_flag(msg, DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT)) | 5541 | nla_put_flag(msg, DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT)) |
| 5542 | goto nla_put_failure; | 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 | nla_nest_end(msg, attr); | 5547 | nla_nest_end(msg, attr); |
| 5545 | 5548 | ||