Commit f4a626e2 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum_span: Add driver private info to parms_set() callback

The parms_set() callback is supposed to fill in the parameters for the
SPAN agent, such as the destination port and encapsulation info, if any.

When mirroring to the CPU port we cannot resolve the destination port
(the CPU port) without access to the driver private info.

Pass the driver private info to parms_set() callback so that it could be
used later on to resolve the CPU port.
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 34e4ace5
...@@ -129,7 +129,8 @@ void mlxsw_sp_span_fini(struct mlxsw_sp *mlxsw_sp) ...@@ -129,7 +129,8 @@ void mlxsw_sp_span_fini(struct mlxsw_sp *mlxsw_sp)
} }
static int static int
mlxsw_sp_span_entry_phys_parms(const struct net_device *to_dev, mlxsw_sp_span_entry_phys_parms(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp) struct mlxsw_sp_span_parms *sparmsp)
{ {
sparmsp->dest_port = netdev_priv(to_dev); sparmsp->dest_port = netdev_priv(to_dev);
...@@ -405,7 +406,8 @@ mlxsw_sp_span_gretap4_route(const struct net_device *to_dev, ...@@ -405,7 +406,8 @@ mlxsw_sp_span_gretap4_route(const struct net_device *to_dev,
} }
static int static int
mlxsw_sp_span_entry_gretap4_parms(const struct net_device *to_dev, mlxsw_sp_span_entry_gretap4_parms(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp) struct mlxsw_sp_span_parms *sparmsp)
{ {
struct ip_tunnel_parm tparm = mlxsw_sp_ipip_netdev_parms4(to_dev); struct ip_tunnel_parm tparm = mlxsw_sp_ipip_netdev_parms4(to_dev);
...@@ -506,7 +508,8 @@ mlxsw_sp_span_gretap6_route(const struct net_device *to_dev, ...@@ -506,7 +508,8 @@ mlxsw_sp_span_gretap6_route(const struct net_device *to_dev,
} }
static int static int
mlxsw_sp_span_entry_gretap6_parms(const struct net_device *to_dev, mlxsw_sp_span_entry_gretap6_parms(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp) struct mlxsw_sp_span_parms *sparmsp)
{ {
struct __ip6_tnl_parm tparm = mlxsw_sp_ipip_netdev_parms6(to_dev); struct __ip6_tnl_parm tparm = mlxsw_sp_ipip_netdev_parms6(to_dev);
...@@ -580,7 +583,8 @@ mlxsw_sp_span_vlan_can_handle(const struct net_device *dev) ...@@ -580,7 +583,8 @@ mlxsw_sp_span_vlan_can_handle(const struct net_device *dev)
} }
static int static int
mlxsw_sp_span_entry_vlan_parms(const struct net_device *to_dev, mlxsw_sp_span_entry_vlan_parms(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp) struct mlxsw_sp_span_parms *sparmsp)
{ {
struct net_device *real_dev; struct net_device *real_dev;
...@@ -652,7 +656,8 @@ struct mlxsw_sp_span_entry_ops *mlxsw_sp2_span_entry_ops_arr[] = { ...@@ -652,7 +656,8 @@ struct mlxsw_sp_span_entry_ops *mlxsw_sp2_span_entry_ops_arr[] = {
}; };
static int static int
mlxsw_sp_span_entry_nop_parms(const struct net_device *to_dev, mlxsw_sp_span_entry_nop_parms(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp) struct mlxsw_sp_span_parms *sparmsp)
{ {
return mlxsw_sp_span_entry_unoffloadable(sparmsp); return mlxsw_sp_span_entry_unoffloadable(sparmsp);
...@@ -935,7 +940,7 @@ static void mlxsw_sp_span_respin_work(struct work_struct *work) ...@@ -935,7 +940,7 @@ static void mlxsw_sp_span_respin_work(struct work_struct *work)
if (!refcount_read(&curr->ref_count)) if (!refcount_read(&curr->ref_count))
continue; continue;
err = curr->ops->parms_set(curr->to_dev, &sparms); err = curr->ops->parms_set(mlxsw_sp, curr->to_dev, &sparms);
if (err) if (err)
continue; continue;
...@@ -971,7 +976,7 @@ int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp, ...@@ -971,7 +976,7 @@ int mlxsw_sp_span_agent_get(struct mlxsw_sp *mlxsw_sp,
} }
memset(&sparms, 0, sizeof(sparms)); memset(&sparms, 0, sizeof(sparms));
err = ops->parms_set(to_dev, &sparms); err = ops->parms_set(mlxsw_sp, to_dev, &sparms);
if (err) if (err)
return err; return err;
......
...@@ -52,7 +52,8 @@ struct mlxsw_sp_span_entry { ...@@ -52,7 +52,8 @@ struct mlxsw_sp_span_entry {
struct mlxsw_sp_span_entry_ops { struct mlxsw_sp_span_entry_ops {
bool (*can_handle)(const struct net_device *to_dev); bool (*can_handle)(const struct net_device *to_dev);
int (*parms_set)(const struct net_device *to_dev, int (*parms_set)(struct mlxsw_sp *mlxsw_sp,
const struct net_device *to_dev,
struct mlxsw_sp_span_parms *sparmsp); struct mlxsw_sp_span_parms *sparmsp);
int (*configure)(struct mlxsw_sp_span_entry *span_entry, int (*configure)(struct mlxsw_sp_span_entry *span_entry,
struct mlxsw_sp_span_parms sparms); struct mlxsw_sp_span_parms sparms);
......
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