mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 02:46:41 +07:00
mlxsw: spectrum_span: Allow passing parameters to SPAN agents
Currently, the only parameter of a SPAN agent is the netdev which the SPAN agent should mirror to. The next patch will add the ability to request a SPAN agent that mirrors to a specific netdev and has a specific policer ID bound to it. This is required when mirroring packets to the CPU port. Therefore, encapsulate the sole parameter to mlxsw_sp_span_agent_get() in a structure, so that it could later be extended with policer information. Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fa8c08b8fc
commit
a120ecc3c5
@ -136,11 +136,13 @@ mlxsw_sp_act_mirror_add(void *priv, u8 local_in_port,
|
||||
const struct net_device *out_dev,
|
||||
bool ingress, int *p_span_id)
|
||||
{
|
||||
struct mlxsw_sp_span_agent_parms agent_parms;
|
||||
struct mlxsw_sp_port *mlxsw_sp_port;
|
||||
struct mlxsw_sp *mlxsw_sp = priv;
|
||||
int err;
|
||||
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, out_dev, p_span_id);
|
||||
agent_parms.to_dev = out_dev;
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, p_span_id, &agent_parms);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -27,6 +27,7 @@ mlxsw_sp_mall_port_mirror_add(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||
struct mlxsw_sp_mall_entry *mall_entry)
|
||||
{
|
||||
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
|
||||
struct mlxsw_sp_span_agent_parms agent_parms;
|
||||
struct mlxsw_sp_span_trigger_parms parms;
|
||||
enum mlxsw_sp_span_trigger trigger;
|
||||
int err;
|
||||
@ -36,8 +37,9 @@ mlxsw_sp_mall_port_mirror_add(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, mall_entry->mirror.to_dev,
|
||||
&mall_entry->mirror.span_id);
|
||||
agent_parms.to_dev = mall_entry->mirror.to_dev;
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, &mall_entry->mirror.span_id,
|
||||
&agent_parms);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -1295,10 +1295,13 @@ static int mlxsw_sp_qevent_mirror_configure(struct mlxsw_sp *mlxsw_sp,
|
||||
{
|
||||
struct mlxsw_sp_port *mlxsw_sp_port = qevent_binding->mlxsw_sp_port;
|
||||
struct mlxsw_sp_span_trigger_parms trigger_parms = {};
|
||||
struct mlxsw_sp_span_agent_parms agent_parms = {
|
||||
.to_dev = mall_entry->mirror.to_dev,
|
||||
};
|
||||
int span_id;
|
||||
int err;
|
||||
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, mall_entry->mirror.to_dev, &span_id);
|
||||
err = mlxsw_sp_span_agent_get(mlxsw_sp, &span_id, &agent_parms);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -1032,9 +1032,10 @@ void mlxsw_sp_span_respin(struct mlxsw_sp *mlxsw_sp)
|
||||
mlxsw_core_schedule_work(&mlxsw_sp->span->work);
|
||||
}
|
||||
|
||||
int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp,
|
||||
const struct net_device *to_dev, int *p_span_id)
|
||||
int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp, int *p_span_id,
|
||||
const struct mlxsw_sp_span_agent_parms *parms)
|
||||
{
|
||||
const struct net_device *to_dev = parms->to_dev;
|
||||
const struct mlxsw_sp_span_entry_ops *ops;
|
||||
struct mlxsw_sp_span_entry *span_entry;
|
||||
struct mlxsw_sp_span_parms sparms;
|
||||
|
@ -35,6 +35,10 @@ struct mlxsw_sp_span_trigger_parms {
|
||||
int span_id;
|
||||
};
|
||||
|
||||
struct mlxsw_sp_span_agent_parms {
|
||||
const struct net_device *to_dev;
|
||||
};
|
||||
|
||||
struct mlxsw_sp_span_entry_ops;
|
||||
|
||||
struct mlxsw_sp_span_ops {
|
||||
@ -74,8 +78,8 @@ void mlxsw_sp_span_entry_invalidate(struct mlxsw_sp *mlxsw_sp,
|
||||
int mlxsw_sp_span_port_mtu_update(struct mlxsw_sp_port *port, u16 mtu);
|
||||
void mlxsw_sp_span_speed_update_work(struct work_struct *work);
|
||||
|
||||
int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp,
|
||||
const struct net_device *to_dev, int *p_span_id);
|
||||
int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp, int *p_span_id,
|
||||
const struct mlxsw_sp_span_agent_parms *parms);
|
||||
void mlxsw_sp_span_agent_put(struct mlxsw_sp *mlxsw_sp, int span_id);
|
||||
int mlxsw_sp_span_analyzed_port_get(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||
bool ingress);
|
||||
|
Loading…
Reference in New Issue
Block a user