mlxsw: spectrum_qdisc: Offload RED ECN nodrop mode
authorPetr Machata <petrm@mellanox.com>
Thu, 12 Mar 2020 23:10:58 +0000 (01:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Mar 2020 04:03:46 +0000 (21:03 -0700)
RED ECN nodrop mode means that non-ECT traffic should not be early-dropped,
but enqueued normally instead. In Spectrum systems, this is achieved by
disabling CWTPM.ew (enable WRED) for a given traffic class.

So far CWTPM.ew was unconditionally enabled. Instead disable it when the
RED qdisc is in nodrop mode.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c

index b9f429e..670a43f 100644 (file)
@@ -323,7 +323,7 @@ mlxsw_sp_qdisc_get_tc_stats(struct mlxsw_sp_port *mlxsw_sp_port,
 static int
 mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
                                  int tclass_num, u32 min, u32 max,
-                                 u32 probability, bool is_ecn)
+                                 u32 probability, bool is_wred, bool is_ecn)
 {
        char cwtpm_cmd[MLXSW_REG_CWTPM_LEN];
        char cwtp_cmd[MLXSW_REG_CWTP_LEN];
@@ -341,7 +341,7 @@ mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
                return err;
 
        mlxsw_reg_cwtpm_pack(cwtpm_cmd, mlxsw_sp_port->local_port, tclass_num,
-                            MLXSW_REG_CWTP_DEFAULT_PROFILE, true, is_ecn);
+                            MLXSW_REG_CWTP_DEFAULT_PROFILE, is_wred, is_ecn);
 
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(cwtpm), cwtpm_cmd);
 }
@@ -445,8 +445,9 @@ mlxsw_sp_qdisc_red_replace(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle,
        prob = DIV_ROUND_UP(prob, 1 << 16);
        min = mlxsw_sp_bytes_cells(mlxsw_sp, p->min);
        max = mlxsw_sp_bytes_cells(mlxsw_sp, p->max);
-       return mlxsw_sp_tclass_congestion_enable(mlxsw_sp_port, tclass_num, min,
-                                                max, prob, p->is_ecn);
+       return mlxsw_sp_tclass_congestion_enable(mlxsw_sp_port, tclass_num,
+                                                min, max, prob,
+                                                !p->is_nodrop, p->is_ecn);
 }
 
 static void