|
@@ -93,6 +93,8 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
|
|
|
spec, &flow_act, dest, i);
|
|
|
if (IS_ERR(rule))
|
|
|
mlx5_fc_destroy(esw->dev, counter);
|
|
|
+ else
|
|
|
+ esw->offloads.num_flows++;
|
|
|
|
|
|
return rule;
|
|
|
}
|
|
@@ -108,6 +110,7 @@ mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
|
|
|
counter = mlx5_flow_rule_counter(rule);
|
|
|
mlx5_del_flow_rules(rule);
|
|
|
mlx5_fc_destroy(esw->dev, counter);
|
|
|
+ esw->offloads.num_flows--;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -922,6 +925,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode)
|
|
|
MLX5_CAP_INLINE_MODE_VPORT_CONTEXT)
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
+ if (esw->offloads.num_flows > 0) {
|
|
|
+ esw_warn(dev, "Can't set inline mode when flows are configured\n");
|
|
|
+ return -EOPNOTSUPP;
|
|
|
+ }
|
|
|
+
|
|
|
err = esw_inline_mode_from_devlink(mode, &mlx5_mode);
|
|
|
if (err)
|
|
|
goto out;
|