Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
	petrm@nvidia.com, jianbol@nvidia.com, roid@nvidia.com,
	vladbu@nvidia.com, olteanv@gmail.com, simon.horman@corigine.com,
	baowen.zheng@corigine.com, marcelo.leitner@gmail.com,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 04/14] net/sched: act_gact: Add extack messages for offload failure
Date: Thu,  7 Apr 2022 10:35:23 +0300	[thread overview]
Message-ID: <20220407073533.2422896-5-idosch@nvidia.com> (raw)
In-Reply-To: <20220407073533.2422896-1-idosch@nvidia.com>

For better error reporting to user space, add extack messages when gact
action offload fails.

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 continue
 Error: cls_matchall: Failed to setup flow action.
 We have an error talking to the kernel

 # cat /sys/kernel/tracing/trace_pipe
       tc-181     [002] b..1.   105.493450: netlink_extack: msg=act_gact: Offload of "continue" action is not supported
       tc-181     [002] .....   105.493466: netlink_extack: msg=cls_matchall: Failed to setup flow action

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

 # cat /sys/kernel/tracing/trace_pipe
       tc-183     [002] b..1.   124.126477: netlink_extack: msg=act_gact: Offload of "reclassify" action is not supported
       tc-183     [002] .....   124.126489: netlink_extack: msg=cls_matchall: Failed to setup flow action

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

 # cat /sys/kernel/tracing/trace_pipe
       tc-185     [002] b..1.   137.097791: netlink_extack: msg=act_gact: Offload of "pipe" action is not supported
       tc-185     [002] .....   137.097804: netlink_extack: msg=cls_matchall: Failed to setup flow action

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
---
 include/net/tc_act/tc_gact.h | 15 +++++++++++++++
 net/sched/act_gact.c         | 10 ++++++++++
 2 files changed, 25 insertions(+)

diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index eb8f01c819e6..832efd40e023 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -59,4 +59,19 @@ static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
 	return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK;
 }
 
+static inline bool is_tcf_gact_continue(const struct tc_action *a)
+{
+	return __is_tcf_gact_act(a, TC_ACT_UNSPEC, false);
+}
+
+static inline bool is_tcf_gact_reclassify(const struct tc_action *a)
+{
+	return __is_tcf_gact_act(a, TC_ACT_RECLASSIFY, false);
+}
+
+static inline bool is_tcf_gact_pipe(const struct tc_action *a)
+{
+	return __is_tcf_gact_act(a, TC_ACT_PIPE, false);
+}
+
 #endif /* __NET_TC_GACT_H */
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index db84a0473cc1..ac29d1065232 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -268,7 +268,17 @@ static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data,
 		} else if (is_tcf_gact_goto_chain(act)) {
 			entry->id = FLOW_ACTION_GOTO;
 			entry->chain_index = tcf_gact_goto_chain_index(act);
+		} else if (is_tcf_gact_continue(act)) {
+			NL_SET_ERR_MSG_MOD(extack, "Offload of \"continue\" action is not supported");
+			return -EOPNOTSUPP;
+		} else if (is_tcf_gact_reclassify(act)) {
+			NL_SET_ERR_MSG_MOD(extack, "Offload of \"reclassify\" action is not supported");
+			return -EOPNOTSUPP;
+		} else if (is_tcf_gact_pipe(act)) {
+			NL_SET_ERR_MSG_MOD(extack, "Offload of \"pipe\" action is not supported");
+			return -EOPNOTSUPP;
 		} else {
+			NL_SET_ERR_MSG_MOD(extack, "Unsupported generic action offload");
 			return -EOPNOTSUPP;
 		}
 		*index_inc = 1;
-- 
2.33.1


  parent reply	other threads:[~2022-04-07  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  7:35 [PATCH net-next 00/14] net/sched: Better error reporting for offload failures Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 01/14] net/sched: matchall: Take verbose flag into account when logging error messages Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 02/14] net/sched: flower: " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 03/14] net/sched: act_api: Add extack to offload_act_setup() callback Ido Schimmel
2022-04-07  7:35 ` Ido Schimmel [this message]
2022-04-07  7:35 ` [PATCH net-next 05/14] net/sched: act_mirred: Add extack message for offload failure Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 06/14] net/sched: act_mpls: Add extack messages " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 07/14] net/sched: act_pedit: Add extack message " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 08/14] net/sched: act_police: Add extack messages " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 09/14] net/sched: act_skbedit: " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 10/14] net/sched: act_tunnel_key: Add extack message " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 11/14] net/sched: act_vlan: " Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 12/14] net/sched: cls_api: Add extack message for unsupported action offload Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 13/14] net/sched: matchall: Avoid overwriting error messages Ido Schimmel
2022-04-07  7:35 ` [PATCH net-next 14/14] net/sched: flower: " Ido Schimmel
2022-04-07 21:15 ` [PATCH net-next 00/14] net/sched: Better error reporting for offload failures Jamal Hadi Salim
2022-04-08 12:50 ` patchwork-bot+netdevbpf
2022-04-08 18:51 ` Marcelo Ricardo Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220407073533.2422896-5-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=baowen.zheng@corigine.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jianbol@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=roid@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=vladbu@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox