Commit 50401f29 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum_matchall: Convert if statements to a switch statement

Previous patch moved the protocol check out of the action check, so
these if statements can now be converted to a switch statement. Perform
the conversion.
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4947e730
...@@ -252,7 +252,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp, ...@@ -252,7 +252,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp,
act = &f->rule->action.entries[0]; act = &f->rule->action.entries[0];
if (act->id == FLOW_ACTION_MIRRED) { switch (act->id) {
case FLOW_ACTION_MIRRED:
if (flower_prio_valid && mall_entry->ingress && if (flower_prio_valid && mall_entry->ingress &&
mall_entry->priority >= flower_min_prio) { mall_entry->priority >= flower_min_prio) {
NL_SET_ERR_MSG(f->common.extack, "Failed to add behind existing flower rules"); NL_SET_ERR_MSG(f->common.extack, "Failed to add behind existing flower rules");
...@@ -267,7 +268,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp, ...@@ -267,7 +268,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp,
} }
mall_entry->type = MLXSW_SP_MALL_ACTION_TYPE_MIRROR; mall_entry->type = MLXSW_SP_MALL_ACTION_TYPE_MIRROR;
mall_entry->mirror.to_dev = act->dev; mall_entry->mirror.to_dev = act->dev;
} else if (act->id == FLOW_ACTION_SAMPLE) { break;
case FLOW_ACTION_SAMPLE:
if (flower_prio_valid && if (flower_prio_valid &&
mall_entry->priority >= flower_min_prio) { mall_entry->priority >= flower_min_prio) {
NL_SET_ERR_MSG(f->common.extack, "Failed to add behind existing flower rules"); NL_SET_ERR_MSG(f->common.extack, "Failed to add behind existing flower rules");
...@@ -279,7 +281,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp, ...@@ -279,7 +281,8 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp *mlxsw_sp,
mall_entry->sample.params.truncate = act->sample.truncate; mall_entry->sample.params.truncate = act->sample.truncate;
mall_entry->sample.params.trunc_size = act->sample.trunc_size; mall_entry->sample.params.trunc_size = act->sample.trunc_size;
mall_entry->sample.params.rate = act->sample.rate; mall_entry->sample.params.rate = act->sample.rate;
} else { break;
default:
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto errout; goto errout;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment