mlxsw: spectrum_buffers: Allow skipping ingress port quota configuration
authorIdo Schimmel <idosch@mellanox.com>
Mon, 22 Apr 2019 12:08:55 +0000 (12:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Apr 2019 05:09:33 +0000 (22:09 -0700)
The CPU port is used to transmit traffic that is trapped to the host
CPU. It is therefore irrelevant to define ingress quota for it.

Add a 'skip_ingress' argument to the function tasked with configuring
per-port quotas, so that ingress quotas could be skipped in case the
passed local port is the CPU port.

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

index e324fad..32a74cc 100644 (file)
@@ -730,15 +730,21 @@ static const struct mlxsw_sp_sb_pm mlxsw_sp2_sb_pms[] = {
 };
 
 static int mlxsw_sp_sb_pms_init(struct mlxsw_sp *mlxsw_sp, u8 local_port,
-                               const struct mlxsw_sp_sb_pm *pms)
+                               const struct mlxsw_sp_sb_pm *pms,
+                               bool skip_ingress)
 {
        int i, err;
 
        for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) {
                const struct mlxsw_sp_sb_pm *pm = &pms[i];
+               const struct mlxsw_sp_sb_pool_des *des;
                u32 max_buff;
                u32 min_buff;
 
+               des = &mlxsw_sp->sb_vals->pool_dess[i];
+               if (skip_ingress && des->dir == MLXSW_REG_SBXX_DIR_INGRESS)
+                       continue;
+
                min_buff = mlxsw_sp_bytes_cells(mlxsw_sp, pm->min_buff);
                max_buff = pm->max_buff;
                if (mlxsw_sp_sb_pool_is_static(mlxsw_sp, i))
@@ -756,7 +762,7 @@ static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port)
        struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 
        return mlxsw_sp_sb_pms_init(mlxsw_sp, mlxsw_sp_port->local_port,
-                                   mlxsw_sp->sb_vals->pms);
+                                   mlxsw_sp->sb_vals->pms, false);
 }
 
 #define MLXSW_SP_SB_MM(_min_buff, _max_buff)           \