Skip to content

Commit 1897936

Browse files
idoschdavem330
authored andcommitted
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: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5eb18a2 commit 1897936

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • drivers/net/netdevsim

‎drivers/net/netdevsim/dev.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ enum {
431431
DEVLINK_TRAP_GENERIC(EXCEPTION, TRAP, _id, \
432432
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
433433
NSIM_TRAP_METADATA)
434+
#define NSIM_TRAP_CONTROL(_id, _group_id, _action) \
435+
DEVLINK_TRAP_GENERIC(CONTROL, _action, _id, \
436+
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
437+
NSIM_TRAP_METADATA)
434438
#define NSIM_TRAP_DRIVER_EXCEPTION(_id, _group_id) \
435439
DEVLINK_TRAP_DRIVER(EXCEPTION, TRAP, NSIM_TRAP_ID_##_id, \
436440
NSIM_TRAP_NAME_##_id, \
@@ -461,6 +465,7 @@ static const struct devlink_trap_group nsim_trap_groups_arr[] = {
461465
DEVLINK_TRAP_GROUP_GENERIC(L3_EXCEPTIONS, 1),
462466
DEVLINK_TRAP_GROUP_GENERIC(BUFFER_DROPS, 2),
463467
DEVLINK_TRAP_GROUP_GENERIC(ACL_DROPS, 3),
468+
DEVLINK_TRAP_GROUP_GENERIC(MC_SNOOPING, 3),
464469
};
465470

466471
static const struct devlink_trap nsim_traps_arr[] = {
@@ -478,6 +483,8 @@ static const struct devlink_trap nsim_traps_arr[] = {
478483
DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE),
479484
NSIM_TRAP_DROP_EXT(EGRESS_FLOW_ACTION_DROP, ACL_DROPS,
480485
DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE),
486+
NSIM_TRAP_CONTROL(IGMP_QUERY, MC_SNOOPING, MIRROR),
487+
NSIM_TRAP_CONTROL(IGMP_V1_REPORT, MC_SNOOPING, TRAP),
481488
};
482489

483490
#define NSIM_TRAP_L4_DATA_LEN 100

0 commit comments

Comments
 (0)