提交 c440615f 编写于 作者: I Ido Schimmel 提交者: David S. Miller

net/sched: cls_api: Add extack message for unsupported action offload

For better error reporting to user space, add an extack message when the
requested action does not support offload.

Example:

 # echo 1 > /sys/kernel/tracing/events/netlink/netlink_extack/enable

 # tc filter add dev dummy0 ingress pref 1 proto all matchall skip_sw action nat ingress 192.0.2.1 198.51.100.1
 Error: cls_matchall: Failed to setup flow action.
 We have an error talking to the kernel

 # cat /sys/kernel/tracing/trace_pipe
       tc-181     [000] b..1.    88.406093: netlink_extack: msg=Action does not support offload
       tc-181     [000] .....    88.406108: netlink_extack: msg=cls_matchall: Failed to setup flow action
Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
Reviewed-by: NPetr Machata <petrm@nvidia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f8fab316
......@@ -3517,11 +3517,13 @@ static int tc_setup_offload_act(struct tc_action *act,
struct netlink_ext_ack *extack)
{
#ifdef CONFIG_NET_CLS_ACT
if (act->ops->offload_act_setup)
if (act->ops->offload_act_setup) {
return act->ops->offload_act_setup(act, entry, index_inc, true,
extack);
else
} else {
NL_SET_ERR_MSG(extack, "Action does not support offload");
return -EOPNOTSUPP;
}
#else
return 0;
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册