mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
mlxsw: spectrum_trap: Register ACL control traps
In a similar fashion to other control traps, register ACL control traps with devlink. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8110668ecd
commit
88e2774961
3 changed files with 55 additions and 23 deletions
|
@ -3987,10 +3987,15 @@ static void mlxsw_sp_rx_listener_l3_mark_func(struct sk_buff *skb,
|
||||||
return mlxsw_sp_rx_listener_no_mark_func(skb, local_port, priv);
|
return mlxsw_sp_rx_listener_no_mark_func(skb, local_port, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlxsw_sp_rx_listener_sample_func(struct sk_buff *skb, u8 local_port,
|
void mlxsw_sp_ptp_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
||||||
void *priv)
|
u8 local_port)
|
||||||
|
{
|
||||||
|
mlxsw_sp->ptp_ops->receive(mlxsw_sp, skb, local_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
||||||
|
u8 local_port)
|
||||||
{
|
{
|
||||||
struct mlxsw_sp *mlxsw_sp = priv;
|
|
||||||
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port];
|
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port];
|
||||||
struct mlxsw_sp_port_sample *sample;
|
struct mlxsw_sp_port_sample *sample;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
@ -4014,12 +4019,6 @@ out:
|
||||||
consume_skb(skb);
|
consume_skb(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlxsw_sp_ptp_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
|
||||||
u8 local_port)
|
|
||||||
{
|
|
||||||
mlxsw_sp->ptp_ops->receive(mlxsw_sp, skb, local_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MLXSW_SP_RXL_NO_MARK(_trap_id, _action, _trap_group, _is_ctrl) \
|
#define MLXSW_SP_RXL_NO_MARK(_trap_id, _action, _trap_group, _is_ctrl) \
|
||||||
MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
|
MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
|
||||||
_is_ctrl, SP_##_trap_group, DISCARD)
|
_is_ctrl, SP_##_trap_group, DISCARD)
|
||||||
|
@ -4054,11 +4053,6 @@ static const struct mlxsw_listener mlxsw_sp_listener[] = {
|
||||||
ROUTER_EXP, false),
|
ROUTER_EXP, false),
|
||||||
MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_DIP_LINK_LOCAL, FORWARD,
|
MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_DIP_LINK_LOCAL, FORWARD,
|
||||||
ROUTER_EXP, false),
|
ROUTER_EXP, false),
|
||||||
/* PKT Sample trap */
|
|
||||||
MLXSW_RXL(mlxsw_sp_rx_listener_sample_func, PKT_SAMPLE, MIRROR_TO_CPU,
|
|
||||||
false, SP_PKT_SAMPLE, DISCARD),
|
|
||||||
/* ACL trap */
|
|
||||||
MLXSW_SP_RXL_NO_MARK(ACL0, TRAP_TO_CPU, FLOW_LOGGING, false),
|
|
||||||
/* Multicast Router Traps */
|
/* Multicast Router Traps */
|
||||||
MLXSW_SP_RXL_MARK(ACL1, TRAP_TO_CPU, MULTICAST, false),
|
MLXSW_SP_RXL_MARK(ACL1, TRAP_TO_CPU, MULTICAST, false),
|
||||||
MLXSW_SP_RXL_L3_MARK(ACL2, TRAP_TO_CPU, MULTICAST, false),
|
MLXSW_SP_RXL_L3_MARK(ACL2, TRAP_TO_CPU, MULTICAST, false),
|
||||||
|
@ -4094,7 +4088,6 @@ static int mlxsw_sp_cpu_policers_set(struct mlxsw_core *mlxsw_core)
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP:
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST:
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FLOW_LOGGING:
|
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS:
|
||||||
rate = 1024;
|
rate = 1024;
|
||||||
burst_size = 7;
|
burst_size = 7;
|
||||||
|
@ -4133,20 +4126,12 @@ static int mlxsw_sp_trap_groups_set(struct mlxsw_core *mlxsw_core)
|
||||||
for (i = 0; i < max_trap_groups; i++) {
|
for (i = 0; i < max_trap_groups; i++) {
|
||||||
policer_id = i;
|
policer_id = i;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FLOW_LOGGING:
|
|
||||||
priority = 4;
|
|
||||||
tc = 4;
|
|
||||||
break;
|
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP:
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST:
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS:
|
||||||
priority = 1;
|
priority = 1;
|
||||||
tc = 1;
|
tc = 1;
|
||||||
break;
|
break;
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_PKT_SAMPLE:
|
|
||||||
priority = 0;
|
|
||||||
tc = 0;
|
|
||||||
break;
|
|
||||||
case MLXSW_REG_HTGT_TRAP_GROUP_SP_EVENT:
|
case MLXSW_REG_HTGT_TRAP_GROUP_SP_EVENT:
|
||||||
priority = MLXSW_REG_HTGT_DEFAULT_PRIORITY;
|
priority = MLXSW_REG_HTGT_DEFAULT_PRIORITY;
|
||||||
tc = MLXSW_REG_HTGT_DEFAULT_TC;
|
tc = MLXSW_REG_HTGT_DEFAULT_TC;
|
||||||
|
|
|
@ -453,6 +453,8 @@ void mlxsw_sp_rx_listener_no_mark_func(struct sk_buff *skb,
|
||||||
u8 local_port, void *priv);
|
u8 local_port, void *priv);
|
||||||
void mlxsw_sp_ptp_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
void mlxsw_sp_ptp_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
||||||
u8 local_port);
|
u8 local_port);
|
||||||
|
void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
|
||||||
|
u8 local_port);
|
||||||
int mlxsw_sp_port_speed_get(struct mlxsw_sp_port *mlxsw_sp_port, u32 *speed);
|
int mlxsw_sp_port_speed_get(struct mlxsw_sp_port *mlxsw_sp_port, u32 *speed);
|
||||||
int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index,
|
enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index,
|
||||||
|
|
|
@ -195,6 +195,23 @@ static void mlxsw_sp_rx_ptp_listener(struct sk_buff *skb, u8 local_port,
|
||||||
mlxsw_sp_ptp_receive(mlxsw_sp, skb, local_port);
|
mlxsw_sp_ptp_receive(mlxsw_sp, skb, local_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mlxsw_sp_rx_sample_listener(struct sk_buff *skb, u8 local_port,
|
||||||
|
void *trap_ctx)
|
||||||
|
{
|
||||||
|
struct mlxsw_sp *mlxsw_sp = devlink_trap_ctx_priv(trap_ctx);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = __mlxsw_sp_rx_no_mark_listener(skb, local_port, trap_ctx);
|
||||||
|
if (err)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* The sample handler expects skb->data to point to the start of the
|
||||||
|
* Ethernet header.
|
||||||
|
*/
|
||||||
|
skb_push(skb, ETH_HLEN);
|
||||||
|
mlxsw_sp_sample_receive(mlxsw_sp, skb, local_port);
|
||||||
|
}
|
||||||
|
|
||||||
#define MLXSW_SP_TRAP_DROP(_id, _group_id) \
|
#define MLXSW_SP_TRAP_DROP(_id, _group_id) \
|
||||||
DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \
|
DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \
|
||||||
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
|
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
|
||||||
|
@ -308,6 +325,9 @@ mlxsw_sp_trap_policer_items_arr[] = {
|
||||||
{
|
{
|
||||||
.policer = MLXSW_SP_TRAP_POLICER(17, 19 * 1024, 4096),
|
.policer = MLXSW_SP_TRAP_POLICER(17, 19 * 1024, 4096),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.policer = MLXSW_SP_TRAP_POLICER(18, 1024, 128),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = {
|
static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = {
|
||||||
|
@ -416,6 +436,16 @@ static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = {
|
||||||
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP1,
|
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP1,
|
||||||
.priority = 2,
|
.priority = 2,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.group = DEVLINK_TRAP_GROUP_GENERIC(ACL_SAMPLE, 0),
|
||||||
|
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_PKT_SAMPLE,
|
||||||
|
.priority = 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.group = DEVLINK_TRAP_GROUP_GENERIC(ACL_TRAP, 18),
|
||||||
|
.hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_FLOW_LOGGING,
|
||||||
|
.priority = 4,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = {
|
static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = {
|
||||||
|
@ -935,6 +965,21 @@ static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = {
|
||||||
MLXSW_SP_RXL_NO_MARK(PTP1, PTP1, TRAP_TO_CPU, false),
|
MLXSW_SP_RXL_NO_MARK(PTP1, PTP1, TRAP_TO_CPU, false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.trap = MLXSW_SP_TRAP_CONTROL(FLOW_ACTION_SAMPLE, ACL_SAMPLE,
|
||||||
|
MIRROR),
|
||||||
|
.listeners_arr = {
|
||||||
|
MLXSW_RXL(mlxsw_sp_rx_sample_listener, PKT_SAMPLE,
|
||||||
|
MIRROR_TO_CPU, false, SP_PKT_SAMPLE, DISCARD),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.trap = MLXSW_SP_TRAP_CONTROL(FLOW_ACTION_TRAP, ACL_TRAP, TRAP),
|
||||||
|
.listeners_arr = {
|
||||||
|
MLXSW_SP_RXL_NO_MARK(ACL0, FLOW_LOGGING, TRAP_TO_CPU,
|
||||||
|
false),
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mlxsw_sp_trap_policer_item *
|
static struct mlxsw_sp_trap_policer_item *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue