提交 b5b0c364 编写于 作者: S Steen Hegelund 提交者: Paolo Abeni

net: microchip: sparx5: Improve the error handling for linked rules

Ensure that an error is returned if the VCAP instance was not found.
The chain offset (diff) is allowed to be zero as this just means that the
user did not request rules to be linked.
Signed-off-by: NSteen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
上级 0518e914
...@@ -551,12 +551,16 @@ static int sparx5_tc_add_rule_link(struct vcap_control *vctrl, ...@@ -551,12 +551,16 @@ static int sparx5_tc_add_rule_link(struct vcap_control *vctrl,
struct vcap_admin *to_admin = vcap_find_admin(vctrl, to_cid); struct vcap_admin *to_admin = vcap_find_admin(vctrl, to_cid);
int diff, err = 0; int diff, err = 0;
diff = vcap_chain_offset(vctrl, from_cid, to_cid); if (!to_admin) {
if (!(to_admin && diff > 0)) {
pr_err("%s:%d: unsupported chain direction: %d\n", pr_err("%s:%d: unsupported chain direction: %d\n",
__func__, __LINE__, to_cid); __func__, __LINE__, to_cid);
return -EINVAL; return -EINVAL;
} }
diff = vcap_chain_offset(vctrl, from_cid, to_cid);
if (!diff)
return 0;
if (admin->vtype == VCAP_TYPE_IS0 && if (admin->vtype == VCAP_TYPE_IS0 &&
to_admin->vtype == VCAP_TYPE_IS0) { to_admin->vtype == VCAP_TYPE_IS0) {
/* Between IS0 instances the G_IDX value is used */ /* Between IS0 instances the G_IDX value is used */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册