]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mlxsw: spectrum: Change mlxsw_sp_rif_vlan_fid_op() to be dedicated for FID RIFs
authorAmit Cohen <amcohen@nvidia.com>
Thu, 23 Jun 2022 07:17:37 +0000 (10:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Jun 2022 11:32:33 +0000 (12:32 +0100)
The function was designed to configure both VLAN and FID RIFs, but
currently the driver does not use VLAN RIFs. Instead, it emulates VLAN
RIFs using FID RIFs.

As part of the conversion to the unified bridge model, the driver will
need to use VLAN RIFs, but they will be configured differently from FID
RIFs.

As a preparation for this change, rename the function to reflect the
fact that it is specific to FID RIFs and do not pass the RIF type as an
argument.

This leaves mlxsw_reg_ritr_fid_set() unused, so remove it.

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

index c9070e2a9dc49bcabe19db25b475a157debe22a2..7961f0c55fa68ea5b529d2f2f012d6dbde1142d2 100644 (file)
@@ -6937,16 +6937,6 @@ MLXSW_ITEM32(reg, ritr, vlan_if_efid, 0x0C, 0, 16);
  */
 MLXSW_ITEM32(reg, ritr, fid_if_fid, 0x08, 0, 16);
 
-static inline void mlxsw_reg_ritr_fid_set(char *payload,
-                                         enum mlxsw_reg_ritr_if_type rif_type,
-                                         u16 fid)
-{
-       if (rif_type == MLXSW_REG_RITR_FID_IF)
-               mlxsw_reg_ritr_fid_if_fid_set(payload, fid);
-       else
-               mlxsw_reg_ritr_vlan_if_vlan_id_set(payload, fid);
-}
-
 /* Sub-port Interface */
 
 /* reg_ritr_sp_if_lag
index f4ad045e26e3fc18c5701e97cd1ba471fdc0ce62..0b103fc68a1a0fe500112f53ec846b57c5b32fdc 100644 (file)
@@ -9377,10 +9377,9 @@ static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_subport_ops = {
        .fid_get                = mlxsw_sp_rif_subport_fid_get,
 };
 
-static int mlxsw_sp_rif_vlan_fid_op(struct mlxsw_sp_rif *rif,
-                                   enum mlxsw_reg_ritr_if_type type,
-                                   u16 vid_fid, bool enable)
+static int mlxsw_sp_rif_fid_op(struct mlxsw_sp_rif *rif, u16 fid, bool enable)
 {
+       enum mlxsw_reg_ritr_if_type type = MLXSW_REG_RITR_FID_IF;
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        char ritr_pl[MLXSW_REG_RITR_LEN];
 
@@ -9388,7 +9387,7 @@ static int mlxsw_sp_rif_vlan_fid_op(struct mlxsw_sp_rif *rif,
                            rif->dev->mtu);
        mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr);
        mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id);
-       mlxsw_reg_ritr_fid_set(ritr_pl, type, vid_fid);
+       mlxsw_reg_ritr_fid_if_fid_set(ritr_pl, fid);
 
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
 }
@@ -9412,10 +9411,9 @@ static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif,
                return err;
        rif->mac_profile_id = mac_profile;
 
-       err = mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index,
-                                      true);
+       err = mlxsw_sp_rif_fid_op(rif, fid_index, true);
        if (err)
-               goto err_rif_vlan_fid_op;
+               goto err_rif_fid_op;
 
        err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC,
                                     mlxsw_sp_router_port(mlxsw_sp), true);
@@ -9442,8 +9440,8 @@ err_fid_bc_flood_set:
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC,
                               mlxsw_sp_router_port(mlxsw_sp), false);
 err_fid_mc_flood_set:
-       mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index, false);
-err_rif_vlan_fid_op:
+       mlxsw_sp_rif_fid_op(rif, fid_index, false);
+err_rif_fid_op:
        mlxsw_sp_rif_mac_profile_put(mlxsw_sp, mac_profile);
        return err;
 }
@@ -9462,7 +9460,7 @@ static void mlxsw_sp_rif_fid_deconfigure(struct mlxsw_sp_rif *rif)
                               mlxsw_sp_router_port(mlxsw_sp), false);
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC,
                               mlxsw_sp_router_port(mlxsw_sp), false);
-       mlxsw_sp_rif_vlan_fid_op(rif, MLXSW_REG_RITR_FID_IF, fid_index, false);
+       mlxsw_sp_rif_fid_op(rif, fid_index, false);
        mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, rif->mac_profile_id);
 }