]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mlxsw: spectrum_fid: Pass FID structure to mlxsw_sp_fid_op()
authorAmit Cohen <amcohen@nvidia.com>
Thu, 23 Jun 2022 07:17:33 +0000 (10:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Jun 2022 11:32:33 +0000 (12:32 +0100)
The function gets several arguments derived from the FID structure
itself. In the future, it will need to be extended to configure
additional FID attributes.

Prepare for that change and reduce the arguments list by passing the FID
structure itself.

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/spectrum_fid.c

index f642c25a02192806c02bcb2756324529a3579461..e356b4d2193db8baca88f9351d85b62f6a966499 100644 (file)
@@ -418,13 +418,13 @@ static enum mlxsw_reg_sfmr_op mlxsw_sp_sfmr_op(bool valid)
                       MLXSW_REG_SFMR_OP_DESTROY_FID;
 }
 
-static int mlxsw_sp_fid_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index,
-                          u16 fid_offset, bool valid)
+static int mlxsw_sp_fid_op(const struct mlxsw_sp_fid *fid, bool valid)
 {
+       struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp;
        char sfmr_pl[MLXSW_REG_SFMR_LEN];
 
-       mlxsw_reg_sfmr_pack(sfmr_pl, mlxsw_sp_sfmr_op(valid), fid_index,
-                           fid_offset);
+       mlxsw_reg_sfmr_pack(sfmr_pl, mlxsw_sp_sfmr_op(valid), fid->fid_index,
+                           fid->fid_offset);
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl);
 }
 
@@ -468,18 +468,14 @@ static void mlxsw_sp_fid_8021d_setup(struct mlxsw_sp_fid *fid, const void *arg)
 
 static int mlxsw_sp_fid_8021d_configure(struct mlxsw_sp_fid *fid)
 {
-       struct mlxsw_sp_fid_family *fid_family = fid->fid_family;
-
-       return mlxsw_sp_fid_op(fid_family->mlxsw_sp, fid->fid_index,
-                              fid->fid_offset, true);
+       return mlxsw_sp_fid_op(fid, true);
 }
 
 static void mlxsw_sp_fid_8021d_deconfigure(struct mlxsw_sp_fid *fid)
 {
        if (fid->vni_valid)
                mlxsw_sp_nve_fid_disable(fid->fid_family->mlxsw_sp, fid);
-       mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index,
-                       fid->fid_offset, false);
+       mlxsw_sp_fid_op(fid, false);
 }
 
 static int mlxsw_sp_fid_8021d_index_alloc(struct mlxsw_sp_fid *fid,
@@ -916,15 +912,12 @@ static void mlxsw_sp_fid_dummy_setup(struct mlxsw_sp_fid *fid, const void *arg)
 
 static int mlxsw_sp_fid_dummy_configure(struct mlxsw_sp_fid *fid)
 {
-       struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp;
-
-       return mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, fid->fid_offset, true);
+       return mlxsw_sp_fid_op(fid, true);
 }
 
 static void mlxsw_sp_fid_dummy_deconfigure(struct mlxsw_sp_fid *fid)
 {
-       mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index,
-                       fid->fid_offset, false);
+       mlxsw_sp_fid_op(fid, false);
 }
 
 static int mlxsw_sp_fid_dummy_index_alloc(struct mlxsw_sp_fid *fid,