]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: add new attr TCA_EXT_WARN_MSG
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 17 Jan 2023 07:19:25 +0000 (15:19 +0800)
committerDavid Ahern <dsahern@kernel.org>
Sun, 22 Jan 2023 18:01:11 +0000 (11:01 -0700)
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

  mlx5_core: matching on ct_state +new isn't supported.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/m_action.c
tc/tc_filter.c
tc/tc_qdisc.c
tc/tc_util.c
tc/tc_util.h

index 7b12b6fc51d88b4a6b5d804da5dcd4ff00efaba3..0400132ceff63480003b18ed52699d3b8d83d18a 100644 (file)
@@ -586,6 +586,7 @@ 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);
+       print_ext_msg(tb);
        close_json_object();
 
        return 0;
index 9617d28a831f9df2d885f79e07fd845deaa1499a..700a09f628820bf55528785421db3707bad2a7df 100644 (file)
@@ -366,6 +366,7 @@ int print_filter(struct nlmsghdr *n, void *arg)
                print_nl();
        }
 
+       print_ext_msg(tb);
        close_json_object();
        fflush(fp);
        return 0;
index b97f21822e2780fe09c6bf672332ac45cee560ad..92ceb4c2f9801bfa5e244ebba661bdca9c152a25 100644 (file)
@@ -342,6 +342,8 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
                        print_nl();
                }
        }
+
+       print_ext_msg(tb);
        close_json_object();
        fflush(fp);
        return 0;
index f72a19ca2757d44761f0e1b262405ccc19754918..d9dd5a819ab9be14d05b1e231ffd1992001441b5 100644 (file)
@@ -843,3 +843,12 @@ void print_masked_be16(const char *name, struct rtattr *attr,
        print_masked_type(UINT16_MAX, __rta_getattr_be16_u32, name, attr,
                          mask_attr, newline);
 }
+
+void print_ext_msg(struct rtattr **tb)
+{
+       if (!tb[TCA_EXT_WARN_MSG])
+               return;
+
+       print_string(PRINT_ANY, "warn", "%s", rta_getattr_str(tb[TCA_EXT_WARN_MSG]));
+       print_nl();
+}
index a3fa7360f0933d2eb7b96ec2db20e0b1d751bab2..c535dccbc20046e838f07bc4261629ad5ed70f00 100644 (file)
@@ -133,4 +133,6 @@ void print_masked_u8(const char *name, struct rtattr *attr,
                     struct rtattr *mask_attr, bool newline);
 void print_masked_be16(const char *name, struct rtattr *attr,
                       struct rtattr *mask_attr, bool newline);
+
+void print_ext_msg(struct rtattr **tb);
 #endif