]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mlxsw: spectrum: Configure shaper rate and burst size together
authorPetr Machata <petrm@mellanox.com>
Fri, 24 Jan 2020 13:23:13 +0000 (15:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jan 2020 09:56:31 +0000 (10:56 +0100)
In order to allow configuration of burst size together with shaper rate,
extend mlxsw_sp_port_ets_maxrate_set() with a burst_size argument. Convert
call sites to pass 0 (for default).

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c

index 72d24595df7a0a0572b42c403f12275e460ac18a..021664c62bba885af674087c53882f3513760340 100644 (file)
@@ -3577,7 +3577,7 @@ int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
 
 int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
                                  enum mlxsw_reg_qeec_hr hr, u8 index,
-                                 u8 next_index, u32 maxrate)
+                                 u8 next_index, u32 maxrate, u8 burst_size)
 {
        struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
        char qeec_pl[MLXSW_REG_QEEC_LEN];
@@ -3586,6 +3586,7 @@ int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
                            next_index);
        mlxsw_reg_qeec_mase_set(qeec_pl, true);
        mlxsw_reg_qeec_max_shaper_rate_set(qeec_pl, maxrate);
+       mlxsw_reg_qeec_max_shaper_bs_set(qeec_pl, burst_size);
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl);
 }
 
@@ -3654,14 +3655,14 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port)
         */
        err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                            MLXSW_REG_QEEC_HR_PORT, 0, 0,
-                                           MLXSW_REG_QEEC_MAS_DIS);
+                                           MLXSW_REG_QEEC_MAS_DIS, 0);
        if (err)
                return err;
        for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
                err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                                    MLXSW_REG_QEEC_HR_SUBGROUP,
                                                    i, 0,
-                                                   MLXSW_REG_QEEC_MAS_DIS);
+                                                   MLXSW_REG_QEEC_MAS_DIS, 0);
                if (err)
                        return err;
        }
@@ -3669,14 +3670,14 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port)
                err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                                    MLXSW_REG_QEEC_HR_TC,
                                                    i, i,
-                                                   MLXSW_REG_QEEC_MAS_DIS);
+                                                   MLXSW_REG_QEEC_MAS_DIS, 0);
                if (err)
                        return err;
 
                err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                                    MLXSW_REG_QEEC_HR_TC,
                                                    i + 8, i,
-                                                   MLXSW_REG_QEEC_MAS_DIS);
+                                                   MLXSW_REG_QEEC_MAS_DIS, 0);
                if (err)
                        return err;
        }
index bbc23939964e1eeb19ceccc7689da11cf7065973..a2393c02a5e5c99fd84c0e7a05d6b8b6b2f9fa58 100644 (file)
@@ -488,7 +488,7 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
                                 struct ieee_pfc *my_pfc);
 int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
                                  enum mlxsw_reg_qeec_hr hr, u8 index,
-                                 u8 next_index, u32 maxrate);
+                                 u8 next_index, u32 maxrate, u8 burst_size);
 enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 stp_state);
 int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
                              u8 state);
index db66f2b56a6d6a3c7fba0695d42b026d35423e80..49a72a8f1f578a27054fdbd2b9ca4f0c96302bd8 100644 (file)
@@ -526,7 +526,7 @@ static int mlxsw_sp_dcbnl_ieee_setmaxrate(struct net_device *dev,
                err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                                    MLXSW_REG_QEEC_HR_SUBGROUP,
                                                    i, 0,
-                                                   maxrate->tc_maxrate[i]);
+                                                   maxrate->tc_maxrate[i], 0);
                if (err) {
                        netdev_err(dev, "Failed to set maxrate for TC %d\n", i);
                        goto err_port_ets_maxrate_set;
@@ -541,7 +541,8 @@ err_port_ets_maxrate_set:
        for (i--; i >= 0; i--)
                mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port,
                                              MLXSW_REG_QEEC_HR_SUBGROUP,
-                                             i, 0, my_maxrate->tc_maxrate[i]);
+                                             i, 0,
+                                             my_maxrate->tc_maxrate[i], 0);
        return err;
 }