Re: [PATCH iproute2-next 2/2] tc: add new attr TCA_EXT_WARN_MSG
From: Hangbin Liu <hidden>
Date: 2023-01-13 04:00:55
Hi David, Oh, I forgot to add --no-thread when send this patch. Sorry if this makes any trouble for you. Hangbin On Fri, Jan 13, 2023 at 11:46:17AM +0800, Hangbin Liu wrote:
quoted hunk ↗ jump to hunk
Currently, when the rule is not to be exclusively executed by the hardware, extack is not passed along and offloading failures don't get logged. Add a new attr TCA_EXT_WARN_MSG to log the extack message so we can monitor the HW failures. e.g. # tc monitor added chain dev enp3s0f1np1 parent ffff: chain 0 added filter dev enp3s0f1np1 ingress protocol all pref 49152 flower chain 0 handle 0x1 ct_state +trk+new not_in_hw action order 1: gact action drop random type none pass val 0 index 1 ref 1 bind 1 Warning: mlx5_core: matching on ct_state +new isn't supported. Signed-off-by: Hangbin Liu <redacted> --- include/uapi/linux/rtnetlink.h | 1 + tc/m_action.c | 6 ++++++ tc/tc_filter.c | 5 +++++ tc/tc_qdisc.c | 6 ++++++ 4 files changed, 18 insertions(+)diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index f4a540c0..217b25b9 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h@@ -635,6 +635,7 @@ enum { TCA_INGRESS_BLOCK, TCA_EGRESS_BLOCK, TCA_DUMP_FLAGS, + TCA_EXT_WARN_MSG, __TCA_MAX };diff --git a/tc/m_action.c b/tc/m_action.c index b3fd0193..7121c2fb 100644 --- a/tc/m_action.c +++ b/tc/m_action.c@@ -590,6 +590,12 @@ int print_action(struct nlmsghdr *n, void *arg) open_json_object(NULL); tc_dump_action(fp, tb[TCA_ACT_TAB], tot_acts ? *tot_acts:0, false); + + if (tb[TCA_EXT_WARN_MSG]) { + print_string(PRINT_ANY, "Warn", "%s ", rta_getattr_str(tb[TCA_EXT_WARN_MSG])); + print_nl(); + } + close_json_object(); return 0;diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 71be2e81..dac74f58 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c@@ -371,6 +371,11 @@ int print_filter(struct nlmsghdr *n, void *arg) print_nl(); } + if (tb[TCA_EXT_WARN_MSG]) { + print_string(PRINT_ANY, "Warn", "%s ", rta_getattr_str(tb[TCA_EXT_WARN_MSG])); + print_nl(); + } + close_json_object(); fflush(fp); return 0;diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index 33a6665e..a84602b4 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c@@ -346,6 +346,12 @@ int print_qdisc(struct nlmsghdr *n, void *arg) print_nl(); } } + + if (tb[TCA_EXT_WARN_MSG]) { + print_string(PRINT_ANY, "Warn", "%s ", rta_getattr_str(tb[TCA_EXT_WARN_MSG])); + print_nl(); + } + close_json_object(); fflush(fp); return 0;-- 2.38.1