提交 18aa23b3 编写于 作者: J Jiri Pirko 提交者: Jakub Kicinski

mlxsw: spectrum_matchall: Restrict sample action to be allowed only on ingress

HW supports packet sampling on ingress only. Check and fail if user
is adding sample on egress.
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 72ef908b
...@@ -212,6 +212,11 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp_flow_block *block, ...@@ -212,6 +212,11 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp_flow_block *block,
mall_entry->mirror.to_dev = act->dev; mall_entry->mirror.to_dev = act->dev;
} else if (act->id == FLOW_ACTION_SAMPLE && } else if (act->id == FLOW_ACTION_SAMPLE &&
protocol == htons(ETH_P_ALL)) { protocol == htons(ETH_P_ALL)) {
if (!mall_entry->ingress) {
NL_SET_ERR_MSG(f->common.extack, "Sample is not supported on egress");
err = -EOPNOTSUPP;
goto errout;
}
if (act->sample.rate > MLXSW_REG_MPSC_RATE_MAX) { if (act->sample.rate > MLXSW_REG_MPSC_RATE_MAX) {
NL_SET_ERR_MSG(f->common.extack, "Sample rate not supported"); NL_SET_ERR_MSG(f->common.extack, "Sample rate not supported");
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册