]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mlxsw: core: Introduce generic macro for event
authorNogah Frankel <nogahf@mellanox.com>
Fri, 25 Nov 2016 09:33:34 +0000 (10:33 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Nov 2016 02:22:14 +0000 (21:22 -0500)
Create a macro for creating the generic listener struct for events,
similar to the one for rx traps.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.h

index 5f6fed12ba2770c28d3b48b1b5a744f793eff888..852218e44b23edb456c80a1922b90d335eeb4275 100644 (file)
@@ -115,6 +115,18 @@ struct mlxsw_listener {
                .is_event = false,                                      \
        }
 
+#define MLXSW_EVENTL(_func, _trap_id)                          \
+       {                                                       \
+               .trap_id = MLXSW_TRAP_ID_##_trap_id,            \
+               .u.event_listener =                             \
+               {                                               \
+                       .func = _func,                          \
+                       .trap_id = MLXSW_TRAP_ID_##_trap_id,    \
+               },                                              \
+               .action = MLXSW_REG_HPKT_ACTION_TRAP_TO_CPU,    \
+               .is_event = true,                               \
+       }
+
 int mlxsw_core_rx_listener_register(struct mlxsw_core *mlxsw_core,
                                    const struct mlxsw_rx_listener *rxl,
                                    void *priv);