Skip to content

Commit 9eefeab

Browse files
idoschdavem330
authored andcommitted
devlink: Add 'mirror' trap action
The action is used by control traps such as IGMP query. The packet is flooded by the device, but also trapped to the CPU in order for the software bridge to mark the receiving port as a multicast router port. Such packets are marked with 'skb->offload_fwd_mark = 1' in order to prevent the software bridge from flooding them again. 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 85176f1 commit 9eefeab

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎Documentation/networking/devlink/devlink-trap.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ The ``devlink-trap`` mechanism supports the following packet trap actions:
108108
* ``trap``: The sole copy of the packet is sent to the CPU.
109109
* ``drop``: The packet is dropped by the underlying device and a copy is not
110110
sent to the CPU.
111+
* ``mirror``: The packet is forwarded by the underlying device and a copy is
112+
sent to the CPU.
111113

112114
Generic Packet Traps
113115
====================

‎include/uapi/linux/devlink.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,13 @@ enum {
233233
* @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
234234
* sent to the CPU.
235235
* @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.
236+
* @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is
237+
* sent to the CPU.
236238
*/
237239
enum devlink_trap_action {
238240
DEVLINK_TRAP_ACTION_DROP,
239241
DEVLINK_TRAP_ACTION_TRAP,
242+
DEVLINK_TRAP_ACTION_MIRROR,
240243
};
241244

242245
/**

‎net/core/devlink.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5869,7 +5869,8 @@ devlink_trap_action_get_from_info(struct genl_info *info,
58695869
val = nla_get_u8(info->attrs[DEVLINK_ATTR_TRAP_ACTION]);
58705870
switch (val) {
58715871
case DEVLINK_TRAP_ACTION_DROP: /* fall-through */
5872-
case DEVLINK_TRAP_ACTION_TRAP:
5872+
case DEVLINK_TRAP_ACTION_TRAP: /* fall-through */
5873+
case DEVLINK_TRAP_ACTION_MIRROR:
58735874
*p_trap_action = val;
58745875
break;
58755876
default:

0 commit comments

Comments
 (0)