| From 7bde7c544205bd389c0a327d86572586f13244e0 Mon Sep 17 00:00:00 2001 |
| From: Amit Cohen <amitc@mellanox.com> |
| Date: Sun, 29 Dec 2019 13:40:22 +0200 |
| Subject: [PATCH] mlxsw: spectrum_router: Skip loopback RIFs during MAC |
| validation |
| |
| commit 314bd842d98e1035cc40b671a71e07f48420e58f upstream. |
| |
| When a router interface (RIF) is created the MAC address of the backing |
| netdev is verified to have the same MSBs as existing RIFs. This is |
| required in order to avoid changing existing RIF MAC addresses that all |
| share the same MSBs. |
| |
| Loopback RIFs are special in this regard as they do not have a MAC |
| address, given they are only used to loop packets from the overlay to |
| the underlay. |
| |
| Without this change, an error is returned when trying to create a RIF |
| after the creation of a GRE tunnel that is represented by a loopback |
| RIF. 'rif->dev->dev_addr' points to the GRE device's local IP, which |
| does not share the same MSBs as physical interfaces. Adding an IP |
| address to any physical interface results in: |
| |
| Error: mlxsw_spectrum: All router interface MAC addresses must have the |
| same prefix. |
| |
| Fix this by skipping loopback RIFs during MAC validation. |
| |
| Fixes: 74bc99397438 ("mlxsw: spectrum_router: Veto unsupported RIF MAC addresses") |
| Signed-off-by: Amit Cohen <amitc@mellanox.com> |
| Signed-off-by: Ido Schimmel <idosch@mellanox.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
| index 7f2d2857b5db..58c232647b36 100644 |
| --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
| +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
| @@ -6865,6 +6865,9 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp, |
| |
| for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { |
| rif = mlxsw_sp->router->rifs[i]; |
| + if (rif && rif->ops && |
| + rif->ops->type == MLXSW_SP_RIF_TYPE_IPIP_LB) |
| + continue; |
| if (rif && rif->dev && rif->dev != dev && |
| !ether_addr_equal_masked(rif->dev->dev_addr, dev_addr, |
| mlxsw_sp->mac_mask)) { |
| -- |
| 2.7.4 |
| |