Commit 18979367 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

netdevsim: Register control traps

Register two control traps with devlink. The existing selftest at
tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh iterates
over all registered traps and checks that the action of non-drop traps
cannot be changed. Up until now only exception traps were tested, now
control traps will be tested as well.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5eb18a2b
...@@ -431,6 +431,10 @@ enum { ...@@ -431,6 +431,10 @@ enum {
DEVLINK_TRAP_GENERIC(EXCEPTION, TRAP, _id, \ DEVLINK_TRAP_GENERIC(EXCEPTION, TRAP, _id, \
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \ DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
NSIM_TRAP_METADATA) NSIM_TRAP_METADATA)
#define NSIM_TRAP_CONTROL(_id, _group_id, _action) \
DEVLINK_TRAP_GENERIC(CONTROL, _action, _id, \
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
NSIM_TRAP_METADATA)
#define NSIM_TRAP_DRIVER_EXCEPTION(_id, _group_id) \ #define NSIM_TRAP_DRIVER_EXCEPTION(_id, _group_id) \
DEVLINK_TRAP_DRIVER(EXCEPTION, TRAP, NSIM_TRAP_ID_##_id, \ DEVLINK_TRAP_DRIVER(EXCEPTION, TRAP, NSIM_TRAP_ID_##_id, \
NSIM_TRAP_NAME_##_id, \ NSIM_TRAP_NAME_##_id, \
...@@ -461,6 +465,7 @@ static const struct devlink_trap_group nsim_trap_groups_arr[] = { ...@@ -461,6 +465,7 @@ static const struct devlink_trap_group nsim_trap_groups_arr[] = {
DEVLINK_TRAP_GROUP_GENERIC(L3_EXCEPTIONS, 1), DEVLINK_TRAP_GROUP_GENERIC(L3_EXCEPTIONS, 1),
DEVLINK_TRAP_GROUP_GENERIC(BUFFER_DROPS, 2), DEVLINK_TRAP_GROUP_GENERIC(BUFFER_DROPS, 2),
DEVLINK_TRAP_GROUP_GENERIC(ACL_DROPS, 3), DEVLINK_TRAP_GROUP_GENERIC(ACL_DROPS, 3),
DEVLINK_TRAP_GROUP_GENERIC(MC_SNOOPING, 3),
}; };
static const struct devlink_trap nsim_traps_arr[] = { static const struct devlink_trap nsim_traps_arr[] = {
...@@ -478,6 +483,8 @@ static const struct devlink_trap nsim_traps_arr[] = { ...@@ -478,6 +483,8 @@ static const struct devlink_trap nsim_traps_arr[] = {
DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE), DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE),
NSIM_TRAP_DROP_EXT(EGRESS_FLOW_ACTION_DROP, ACL_DROPS, NSIM_TRAP_DROP_EXT(EGRESS_FLOW_ACTION_DROP, ACL_DROPS,
DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE), DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE),
NSIM_TRAP_CONTROL(IGMP_QUERY, MC_SNOOPING, MIRROR),
NSIM_TRAP_CONTROL(IGMP_V1_REPORT, MC_SNOOPING, TRAP),
}; };
#define NSIM_TRAP_L4_DATA_LEN 100 #define NSIM_TRAP_L4_DATA_LEN 100
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment