From: Petr Machata <pe...@mellanox.com> Move the function next to the rest of gretap4 functions. Thus the generic functions shared between gretap4 and gretap6 are in one block at the beginning, followed by a gretap4 block, followed by a gretap6 block.
Signed-off-by: Petr Machata <pe...@mellanox.com> Signed-off-by: Ido Schimmel <ido...@mellanox.com> --- .../net/ethernet/mellanox/mlxsw/spectrum_span.c | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index f537e1de11d9..e82f5f4d66aa 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -133,39 +133,6 @@ struct mlxsw_sp_span_entry_ops mlxsw_sp_span_entry_ops_phys = { .deconfigure = mlxsw_sp_span_entry_phys_deconfigure, }; -static struct net_device * -mlxsw_sp_span_gretap4_route(const struct net_device *to_dev, - __be32 *saddrp, __be32 *daddrp) -{ - struct ip_tunnel *tun = netdev_priv(to_dev); - struct net_device *dev = NULL; - struct ip_tunnel_parm parms; - struct rtable *rt = NULL; - struct flowi4 fl4; - - /* We assume "dev" stays valid after rt is put. */ - ASSERT_RTNL(); - - parms = mlxsw_sp_ipip_netdev_parms4(to_dev); - ip_tunnel_init_flow(&fl4, parms.iph.protocol, *daddrp, *saddrp, - 0, 0, parms.link, tun->fwmark); - - rt = ip_route_output_key(tun->net, &fl4); - if (IS_ERR(rt)) - return NULL; - - if (rt->rt_type != RTN_UNICAST) - goto out; - - dev = rt->dst.dev; - *saddrp = fl4.saddr; - *daddrp = rt->rt_gateway; - -out: - ip_rt_put(rt); - return dev; -} - static int mlxsw_sp_span_dmac(struct neigh_table *tbl, const void *pkey, struct net_device *l3edev, @@ -227,6 +194,39 @@ mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *l3edev, return 0; } +static struct net_device * +mlxsw_sp_span_gretap4_route(const struct net_device *to_dev, + __be32 *saddrp, __be32 *daddrp) +{ + struct ip_tunnel *tun = netdev_priv(to_dev); + struct net_device *dev = NULL; + struct ip_tunnel_parm parms; + struct rtable *rt = NULL; + struct flowi4 fl4; + + /* We assume "dev" stays valid after rt is put. */ + ASSERT_RTNL(); + + parms = mlxsw_sp_ipip_netdev_parms4(to_dev); + ip_tunnel_init_flow(&fl4, parms.iph.protocol, *daddrp, *saddrp, + 0, 0, parms.link, tun->fwmark); + + rt = ip_route_output_key(tun->net, &fl4); + if (IS_ERR(rt)) + return NULL; + + if (rt->rt_type != RTN_UNICAST) + goto out; + + dev = rt->dst.dev; + *saddrp = fl4.saddr; + *daddrp = rt->rt_gateway; + +out: + ip_rt_put(rt); + return dev; +} + static int mlxsw_sp_span_entry_gretap4_parms(const struct net_device *to_dev, struct mlxsw_sp_span_parms *sparmsp) -- 2.14.3