From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, nogahf@mellanox.com, idosch@mellanox.com,
eladr@mellanox.com, yotamg@mellanox.com, arkadis@mellanox.com,
ogerlitz@mellanox.com
Subject: [patch net-next 11/19] mlxsw: Add option to choose trap group
Date: Fri, 25 Nov 2016 10:33:39 +0100 [thread overview]
Message-ID: <1480066427-3961-12-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1480066427-3961-1-git-send-email-jiri@resnulli.us>
From: Nogah Frankel <nogahf@mellanox.com>
Currently, we set the trap group to pre-determined option, based on whether
it is an rx or event trap.
This commit adds a possibility to chose the trap group, so it can be set
to different values in the following patches.
Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/core.h | 29 +++++++++++++-------------
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 8 +++----
drivers/net/ethernet/mellanox/mlxsw/switchib.c | 2 +-
drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 4 ++--
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h
index b5b5b36..d663b8e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -103,7 +103,8 @@ struct mlxsw_listener {
bool is_event;
};
-#define MLXSW_RXL(_func, _trap_id, _action, _is_ctrl, _unreg_action) \
+#define MLXSW_RXL(_func, _trap_id, _action, _is_ctrl, _trap_group, \
+ _unreg_action) \
{ \
.trap_id = MLXSW_TRAP_ID_##_trap_id, \
.u.rx_listener = \
@@ -114,23 +115,23 @@ struct mlxsw_listener {
}, \
.action = MLXSW_REG_HPKT_ACTION_##_action, \
.unreg_action = MLXSW_REG_HPKT_ACTION_##_unreg_action, \
- .trap_group = MLXSW_REG_HTGT_TRAP_GROUP_RX, \
+ .trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_trap_group, \
.is_ctrl = _is_ctrl, \
.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, \
- .trap_group = MLXSW_REG_HTGT_TRAP_GROUP_EMAD, \
- .is_ctrl = false, \
- .is_event = true, \
+#define MLXSW_EVENTL(_func, _trap_id, _trap_group) \
+ { \
+ .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, \
+ .trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_trap_group, \
+ .is_ctrl = false, \
+ .is_event = true, \
}
int mlxsw_core_rx_listener_register(struct mlxsw_core *mlxsw_core,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 3582e3f..44243a4 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2731,16 +2731,16 @@ static void mlxsw_sp_rx_listener_mark_func(struct sk_buff *skb, u8 local_port,
}
#define MLXSW_SP_RXL_NO_MARK(_trap_id, _action, _is_ctrl) \
- MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
- _is_ctrl, DISCARD)
+ MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
+ _is_ctrl, RX, DISCARD)
#define MLXSW_SP_RXL_MARK(_trap_id, _action, _is_ctrl) \
MLXSW_RXL(mlxsw_sp_rx_listener_mark_func, _trap_id, _action, \
- _is_ctrl, DISCARD)
+ _is_ctrl, RX, DISCARD)
static const struct mlxsw_listener mlxsw_sp_listener[] = {
/* Events */
- MLXSW_EVENTL(mlxsw_sp_pude_event_func, PUDE),
+ MLXSW_EVENTL(mlxsw_sp_pude_event_func, PUDE, EMAD),
/* L2 traps */
MLXSW_SP_RXL_NO_MARK(STP, TRAP_TO_CPU, true),
MLXSW_SP_RXL_NO_MARK(LACP, TRAP_TO_CPU, true),
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchib.c b/drivers/net/ethernet/mellanox/mlxsw/switchib.c
index 847cbbf..b798711 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchib.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchib.c
@@ -409,7 +409,7 @@ static void mlxsw_sib_pude_event_func(const struct mlxsw_reg_info *reg,
}
static const struct mlxsw_listener mlxsw_sib_listener[] = {
- MLXSW_EVENTL(mlxsw_sib_pude_event_func, PUDE),
+ MLXSW_EVENTL(mlxsw_sib_pude_event_func, PUDE, EMAD),
};
static int mlxsw_sib_taps_init(struct mlxsw_sib *mlxsw_sib)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index a158756..1bcb391 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -1450,10 +1450,10 @@ static int mlxsw_sx_port_type_set(struct mlxsw_core *mlxsw_core, u8 local_port,
#define MLXSW_SX_RXL(_trap_id) \
MLXSW_RXL(mlxsw_sx_rx_listener_func, _trap_id, TRAP_TO_CPU, \
- false, FORWARD)
+ false, RX, FORWARD)
static const struct mlxsw_listener mlxsw_sx_listener[] = {
- MLXSW_EVENTL(mlxsw_sx_pude_event_func, PUDE),
+ MLXSW_EVENTL(mlxsw_sx_pude_event_func, PUDE, EMAD),
MLXSW_SX_RXL(FDB_MC),
MLXSW_SX_RXL(STP),
MLXSW_SX_RXL(LACP),
--
2.7.4
next prev parent reply other threads:[~2016-11-25 9:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 9:33 [patch net-next 00/19] mlxsw: traps, trap groups and policers Jiri Pirko
2016-11-25 9:33 ` [patch net-next 01/19] mlxsw: spectrum: Remove unused traps Jiri Pirko
2016-11-25 9:33 ` [patch net-next 02/19] mlxsw: core: Create a generic function to register / unregister traps Jiri Pirko
2016-11-25 9:33 ` [patch net-next 03/19] mlxsw: core: Expose generic macros for rx trap Jiri Pirko
2016-11-25 9:33 ` [patch net-next 04/19] mlxsw: spectrum: Use generic listener struct for rx traps Jiri Pirko
2016-11-25 9:33 ` [patch net-next 05/19] mlxsw: switchx2: " Jiri Pirko
2016-11-25 9:33 ` [patch net-next 06/19] mlxsw: core: Introduce generic macro for event Jiri Pirko
2016-11-25 9:33 ` [patch net-next 07/19] mlxsw: spectrum: Use generic listener struct for events Jiri Pirko
2016-11-25 9:33 ` [patch net-next 08/19] mlxsw: switchx2: " Jiri Pirko
2016-11-25 9:33 ` [patch net-next 09/19] mlxsw: switchib: " Jiri Pirko
2016-11-25 9:33 ` [patch net-next 10/19] mlxsw: Change trap set function Jiri Pirko
2016-11-25 9:33 ` Jiri Pirko [this message]
2016-11-25 9:33 ` [patch net-next 12/19] mlxsw: core: Change emad trap group settings Jiri Pirko
2016-11-25 9:33 ` [patch net-next 13/19] mlxsw: resources: Add max trap groups resource Jiri Pirko
2016-11-25 9:33 ` [patch net-next 14/19] mlxsw: Change trap groups setting Jiri Pirko
2016-11-25 9:33 ` [patch net-next 15/19] mlxsw: spectrum: Add BGP trap Jiri Pirko
2016-11-25 9:33 ` [patch net-next 16/19] mlxsw: Create a different trap group list for each device Jiri Pirko
2016-11-25 9:33 ` [patch net-next 17/19] mlxsw: resources: Add max cpu policers resource Jiri Pirko
2016-11-25 9:33 ` [patch net-next 18/19] mlxsw: reg: Add QoS Policer Configuration Register Jiri Pirko
2016-11-25 9:33 ` [patch net-next 19/19] mlxsw: spectrum: Add policers for trap groups Jiri Pirko
2016-11-26 2:22 ` [patch net-next 00/19] mlxsw: traps, trap groups and policers David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480066427-3961-12-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=arkadis@mellanox.com \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.com \
--cc=ogerlitz@mellanox.com \
--cc=yotamg@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).