OSDN Git Service

mlxsw: Take tunnel's type into account when searching underlay device
authorAmit Cohen <amcohen@nvidia.com>
Thu, 23 Sep 2021 12:36:51 +0000 (15:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Sep 2021 09:26:51 +0000 (10:26 +0100)
commit59bf980dd90f01b79f6f86a0368ff79a742a37e4
tree6e727c6a46f4b17bffd9983b22508e583c6d8400
parent80ef2abcddbc0bcd28ed31552e6e7f942a1c3b6a
mlxsw: Take tunnel's type into account when searching underlay device

The function __mlxsw_sp_ipip_netdev_ul_dev_get() returns the underlay
device that corresponds to the overlay device that it gets.
Currently, this function assumes that the tunnel is IPv4 GRE, because it
is the only one that is supported by mlxsw driver.

This assumption will no longer be correct when IPv6 GRE support is added,
resulting in wrong underlay device being returned.
Instead, check 'ol_dev->type' and return the underlay device accordingly.

Move the function to spectrum_ipip.c because spectrum_router.c should not
be aware to tunnel type.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h