mlxsw: spectrum_router: Adjust loopback RIF configuration
authorNir Dotan <nird@mellanox.com>
Sun, 20 Jan 2019 06:50:42 +0000 (06:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Jan 2019 19:12:57 +0000 (11:12 -0800)
In Spectrum-2, the underlay routing table is pointed by an underlay router
interface in contrary to Spectrum where only an underlay virtual router
should be set. That makes the underlay virtual router field in RITR
reserved for Spectrum-2.

Change loopback RIF creation function to support the new underlay RIF
field, however leave this field reserved for Spectrum-1 updates.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 1397677..c55bd5a 100644 (file)
@@ -1437,8 +1437,8 @@ mlxsw_sp_ipip_entry_ol_up_event(struct mlxsw_sp *mlxsw_sp,
 }
 
 static int
-mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
-                       struct mlxsw_sp_vr *ul_vr, bool enable)
+mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif, u16 ul_vr_id,
+                       u16 ul_rif_id, bool enable)
 {
        struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
        struct mlxsw_sp_rif *rif = &lb_rif->common;
@@ -1453,7 +1453,7 @@ mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif,
                                    rif->rif_index, rif->vr_id, rif->dev->mtu);
                mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
                            MLXSW_REG_RITR_LOOPBACK_IPIP_OPTIONS_GRE_KEY_PRESET,
-                           ul_vr->id, 0, saddr4, lb_cf.okey);
+                           ul_vr_id, ul_rif_id, saddr4, lb_cf.okey);
                break;
 
        case MLXSW_SP_L3_PROTO_IPV6:
@@ -1475,7 +1475,7 @@ static int mlxsw_sp_netdevice_ipip_ol_update_mtu(struct mlxsw_sp *mlxsw_sp,
        if (ipip_entry) {
                lb_rif = ipip_entry->ol_lb;
                ul_vr = &mlxsw_sp->router->vrs[lb_rif->ul_vr_id];
-               err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr, true);
+               err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr->id, 0, true);
                if (err)
                        goto out;
                lb_rif->common.mtu = ol_dev->mtu;
@@ -7436,7 +7436,7 @@ mlxsw_sp1_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif)
        if (IS_ERR(ul_vr))
                return PTR_ERR(ul_vr);
 
-       err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr, true);
+       err = mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr->id, 0, true);
        if (err)
                goto err_loopback_op;
 
@@ -7456,7 +7456,7 @@ static void mlxsw_sp1_rif_ipip_lb_deconfigure(struct mlxsw_sp_rif *rif)
        struct mlxsw_sp_vr *ul_vr;
 
        ul_vr = &mlxsw_sp->router->vrs[lb_rif->ul_vr_id];
-       mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr, false);
+       mlxsw_sp_rif_ipip_lb_op(lb_rif, ul_vr->id, 0, false);
 
        --ul_vr->rif_count;
        mlxsw_sp_vr_put(mlxsw_sp, ul_vr);