Commit 0908e42a authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

mlxsw: spectrum_qdisc: Distinguish between ingress and egress triggers

The following patches will configure the MLXSW_SP_SPAN_TRIGGER_ECN
mirroring trigger. This trigger is considered "egress", unlike the
previously-offloaded _EARLY_DROP. Add a helper to spectrum_span,
mlxsw_sp_span_trigger_is_ingress(), to classify triggers to ingress and
egress. Pass result of this instead of hardcoding true when calling
mlxsw_sp_span_analyzed_port_get()/_put().
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a34dda72
...@@ -1482,8 +1482,10 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp, ...@@ -1482,8 +1482,10 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp,
const struct mlxsw_sp_span_agent_parms *agent_parms, const struct mlxsw_sp_span_agent_parms *agent_parms,
int *p_span_id) int *p_span_id)
{ {
enum mlxsw_sp_span_trigger span_trigger = qevent_binding->span_trigger;
struct mlxsw_sp_port *mlxsw_sp_port = qevent_binding->mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port = qevent_binding->mlxsw_sp_port;
struct mlxsw_sp_span_trigger_parms trigger_parms = {}; struct mlxsw_sp_span_trigger_parms trigger_parms = {};
bool ingress;
int span_id; int span_id;
int err; int err;
...@@ -1491,18 +1493,19 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp, ...@@ -1491,18 +1493,19 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp,
if (err) if (err)
return err; return err;
err = mlxsw_sp_span_analyzed_port_get(mlxsw_sp_port, true); ingress = mlxsw_sp_span_trigger_is_ingress(span_trigger);
err = mlxsw_sp_span_analyzed_port_get(mlxsw_sp_port, ingress);
if (err) if (err)
goto err_analyzed_port_get; goto err_analyzed_port_get;
trigger_parms.span_id = span_id; trigger_parms.span_id = span_id;
trigger_parms.probability_rate = 1; trigger_parms.probability_rate = 1;
err = mlxsw_sp_span_agent_bind(mlxsw_sp, qevent_binding->span_trigger, mlxsw_sp_port, err = mlxsw_sp_span_agent_bind(mlxsw_sp, span_trigger, mlxsw_sp_port,
&trigger_parms); &trigger_parms);
if (err) if (err)
goto err_agent_bind; goto err_agent_bind;
err = mlxsw_sp_span_trigger_enable(mlxsw_sp_port, qevent_binding->span_trigger, err = mlxsw_sp_span_trigger_enable(mlxsw_sp_port, span_trigger,
qevent_binding->tclass_num); qevent_binding->tclass_num);
if (err) if (err)
goto err_trigger_enable; goto err_trigger_enable;
...@@ -1511,10 +1514,10 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp, ...@@ -1511,10 +1514,10 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp,
return 0; return 0;
err_trigger_enable: err_trigger_enable:
mlxsw_sp_span_agent_unbind(mlxsw_sp, qevent_binding->span_trigger, mlxsw_sp_port, mlxsw_sp_span_agent_unbind(mlxsw_sp, span_trigger, mlxsw_sp_port,
&trigger_parms); &trigger_parms);
err_agent_bind: err_agent_bind:
mlxsw_sp_span_analyzed_port_put(mlxsw_sp_port, true); mlxsw_sp_span_analyzed_port_put(mlxsw_sp_port, ingress);
err_analyzed_port_get: err_analyzed_port_get:
mlxsw_sp_span_agent_put(mlxsw_sp, span_id); mlxsw_sp_span_agent_put(mlxsw_sp, span_id);
return err; return err;
...@@ -1524,16 +1527,20 @@ static void mlxsw_sp_qevent_span_deconfigure(struct mlxsw_sp *mlxsw_sp, ...@@ -1524,16 +1527,20 @@ static void mlxsw_sp_qevent_span_deconfigure(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_qevent_binding *qevent_binding, struct mlxsw_sp_qevent_binding *qevent_binding,
int span_id) int span_id)
{ {
enum mlxsw_sp_span_trigger span_trigger = qevent_binding->span_trigger;
struct mlxsw_sp_port *mlxsw_sp_port = qevent_binding->mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port = qevent_binding->mlxsw_sp_port;
struct mlxsw_sp_span_trigger_parms trigger_parms = { struct mlxsw_sp_span_trigger_parms trigger_parms = {
.span_id = span_id, .span_id = span_id,
}; };
bool ingress;
mlxsw_sp_span_trigger_disable(mlxsw_sp_port, qevent_binding->span_trigger, ingress = mlxsw_sp_span_trigger_is_ingress(span_trigger);
mlxsw_sp_span_trigger_disable(mlxsw_sp_port, span_trigger,
qevent_binding->tclass_num); qevent_binding->tclass_num);
mlxsw_sp_span_agent_unbind(mlxsw_sp, qevent_binding->span_trigger, mlxsw_sp_port, mlxsw_sp_span_agent_unbind(mlxsw_sp, span_trigger, mlxsw_sp_port,
&trigger_parms); &trigger_parms);
mlxsw_sp_span_analyzed_port_put(mlxsw_sp_port, true); mlxsw_sp_span_analyzed_port_put(mlxsw_sp_port, ingress);
mlxsw_sp_span_agent_put(mlxsw_sp, span_id); mlxsw_sp_span_agent_put(mlxsw_sp, span_id);
} }
......
...@@ -1650,6 +1650,22 @@ void mlxsw_sp_span_trigger_disable(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1650,6 +1650,22 @@ void mlxsw_sp_span_trigger_disable(struct mlxsw_sp_port *mlxsw_sp_port,
return trigger_entry->ops->disable(trigger_entry, mlxsw_sp_port, tc); return trigger_entry->ops->disable(trigger_entry, mlxsw_sp_port, tc);
} }
bool mlxsw_sp_span_trigger_is_ingress(enum mlxsw_sp_span_trigger trigger)
{
switch (trigger) {
case MLXSW_SP_SPAN_TRIGGER_INGRESS:
case MLXSW_SP_SPAN_TRIGGER_EARLY_DROP:
case MLXSW_SP_SPAN_TRIGGER_TAIL_DROP:
return true;
case MLXSW_SP_SPAN_TRIGGER_EGRESS:
case MLXSW_SP_SPAN_TRIGGER_ECN:
return false;
}
WARN_ON_ONCE(1);
return false;
}
static int mlxsw_sp1_span_init(struct mlxsw_sp *mlxsw_sp) static int mlxsw_sp1_span_init(struct mlxsw_sp *mlxsw_sp)
{ {
size_t arr_size = ARRAY_SIZE(mlxsw_sp1_span_entry_ops_arr); size_t arr_size = ARRAY_SIZE(mlxsw_sp1_span_entry_ops_arr);
......
...@@ -120,6 +120,7 @@ int mlxsw_sp_span_trigger_enable(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -120,6 +120,7 @@ int mlxsw_sp_span_trigger_enable(struct mlxsw_sp_port *mlxsw_sp_port,
enum mlxsw_sp_span_trigger trigger, u8 tc); enum mlxsw_sp_span_trigger trigger, u8 tc);
void mlxsw_sp_span_trigger_disable(struct mlxsw_sp_port *mlxsw_sp_port, void mlxsw_sp_span_trigger_disable(struct mlxsw_sp_port *mlxsw_sp_port,
enum mlxsw_sp_span_trigger trigger, u8 tc); enum mlxsw_sp_span_trigger trigger, u8 tc);
bool mlxsw_sp_span_trigger_is_ingress(enum mlxsw_sp_span_trigger trigger);
extern const struct mlxsw_sp_span_ops mlxsw_sp1_span_ops; extern const struct mlxsw_sp_span_ops mlxsw_sp1_span_ops;
extern const struct mlxsw_sp_span_ops mlxsw_sp2_span_ops; extern const struct mlxsw_sp_span_ops mlxsw_sp2_span_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment