forked from Minki/linux
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: Petr Machata <petrm@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a34dda7284
commit
0908e42ad9
@ -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,
|
||||
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_span_trigger_parms trigger_parms = {};
|
||||
bool ingress;
|
||||
int span_id;
|
||||
int err;
|
||||
|
||||
@ -1491,18 +1493,19 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp,
|
||||
if (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)
|
||||
goto err_analyzed_port_get;
|
||||
|
||||
trigger_parms.span_id = span_id;
|
||||
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);
|
||||
if (err)
|
||||
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);
|
||||
if (err)
|
||||
goto err_trigger_enable;
|
||||
@ -1511,10 +1514,10 @@ static int mlxsw_sp_qevent_span_configure(struct mlxsw_sp *mlxsw_sp,
|
||||
return 0;
|
||||
|
||||
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);
|
||||
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:
|
||||
mlxsw_sp_span_agent_put(mlxsw_sp, span_id);
|
||||
return err;
|
||||
@ -1524,16 +1527,20 @@ static void mlxsw_sp_qevent_span_deconfigure(struct mlxsw_sp *mlxsw_sp,
|
||||
struct mlxsw_sp_qevent_binding *qevent_binding,
|
||||
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_span_trigger_parms trigger_parms = {
|
||||
.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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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,
|
||||
enum mlxsw_sp_span_trigger trigger, u8 tc);
|
||||
void mlxsw_sp_span_trigger_disable(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||
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_sp2_span_ops;
|
||||
|
Loading…
Reference in New Issue
Block a user