diff options
author | Ido Schimmel <idosch@mellanox.com> | 2015-07-29 23:33:48 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-30 00:05:00 -0700 |
commit | 4ec14b7634b298186f18f65d959354dc3c60e02c (patch) | |
tree | a84c854cdde90198542c2468f043b75b5dec83a8 /drivers/net/ethernet/mellanox/mlxsw/core.h | |
parent | eda6500a987a027b78a275c11db6454404a626aa (diff) |
mlxsw: Add interface to access registers and process events
Ethernet Management Datagrams (EMADs) are Ethernet packets sent between
the host and the device in order to configure the available device registers.
Another use case is notifications sent from the device to the host,
letting it know about certain events, such as port up / down.
Add the ability to construct EMADs with provisions to construct and
parse the registers' payloads. Implement EMAD transaction layer
which is responsible for the reliable transmission of EMADs. Also, add
an infrastructure used by the switch driver to register for particular
events generated by the device.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Elad Raz <eladr@mellanox.com>
Reviewed-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/core.h')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/core.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h index f4ab36a0235e..53ef20ab06cb 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.h +++ b/drivers/net/ethernet/mellanox/mlxsw/core.h @@ -44,6 +44,9 @@ #include <linux/types.h> #include <linux/skbuff.h> +#include "trap.h" +#include "reg.h" + #include "cmd.h" #define MLXSW_MODULE_ALIAS_PREFIX "mlxsw-driver-" @@ -77,6 +80,12 @@ struct mlxsw_rx_listener { u16 trap_id; }; +struct mlxsw_event_listener { + void (*func)(const struct mlxsw_reg_info *reg, + char *payload, void *priv); + enum mlxsw_event_trap_id trap_id; +}; + int mlxsw_core_rx_listener_register(struct mlxsw_core *mlxsw_core, const struct mlxsw_rx_listener *rxl, void *priv); @@ -84,6 +93,18 @@ void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core, const struct mlxsw_rx_listener *rxl, void *priv); +int mlxsw_core_event_listener_register(struct mlxsw_core *mlxsw_core, + const struct mlxsw_event_listener *el, + void *priv); +void mlxsw_core_event_listener_unregister(struct mlxsw_core *mlxsw_core, + const struct mlxsw_event_listener *el, + void *priv); + +int mlxsw_reg_query(struct mlxsw_core *mlxsw_core, + const struct mlxsw_reg_info *reg, char *payload); +int mlxsw_reg_write(struct mlxsw_core *mlxsw_core, + const struct mlxsw_reg_info *reg, char *payload); + struct mlxsw_rx_info { u16 sys_port; int trap_id; |