mlxsw: spectrum: Fix IP2ME CPU policer configuration
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlxsw / spectrum.c
index 8a4983adae940a08b4d4d5ec39637522fb1bea46..9bec940330a450856d2dba23ed7274321cf82059 100644 (file)
@@ -2740,6 +2740,21 @@ int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl);
 }
 
+static int mlxsw_sp_port_min_bw_set(struct mlxsw_sp_port *mlxsw_sp_port,
+                                   enum mlxsw_reg_qeec_hr hr, u8 index,
+                                   u8 next_index, u32 minrate)
+{
+       struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+       char qeec_pl[MLXSW_REG_QEEC_LEN];
+
+       mlxsw_reg_qeec_pack(qeec_pl, mlxsw_sp_port->local_port, hr, index,
+                           next_index);
+       mlxsw_reg_qeec_mise_set(qeec_pl, true);
+       mlxsw_reg_qeec_min_shaper_rate_set(qeec_pl, minrate);
+
+       return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(qeec), qeec_pl);
+}
+
 int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port,
                              u8 switch_prio, u8 tclass)
 {
@@ -2817,6 +2832,16 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port)
                        return err;
        }
 
+       /* Configure the min shaper for multicast TCs. */
+       for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
+               err = mlxsw_sp_port_min_bw_set(mlxsw_sp_port,
+                                              MLXSW_REG_QEEC_HIERARCY_TC,
+                                              i + 8, i,
+                                              MLXSW_REG_QEEC_MIS_MIN);
+               if (err)
+                       return err;
+       }
+
        /* Map all priorities to traffic class 0. */
        for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
                err = mlxsw_sp_port_prio_tc_set(mlxsw_sp_port, i, 0);
@@ -3543,7 +3568,6 @@ static int mlxsw_sp_cpu_policers_set(struct mlxsw_core *mlxsw_core)
                        burst_size = 7;
                        break;
                case MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME:
-                       is_bytes = true;
                        rate = 4 * 1024;
                        burst_size = 4;
                        break;