From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: [PATCH iproute2-next] tc: flower: add support for verbose logging Date: Sun, 13 May 2018 17:44:28 -0300 Message-ID: <7475756f86139d889344cf2675b13ce4364b81b1.1526243604.git.mleitner@redhat.com> References: <763cd60ed7addf605daf8b77c8639c5c08ada219.1526243501.git.marcelo.leitner@gmail.com> Cc: Jakub Kicinski , David Ahern , Stephen Hemminger , Jiri Pirko , Alexander Aring , Jamal Hadi Salim , Cong Wang , marcelo.leitner@gmail.com To: netdev@vger.kernel.org Return-path: Received: from mail-qt0-f194.google.com ([209.85.216.194]:40351 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438AbeEMUop (ORCPT ); Sun, 13 May 2018 16:44:45 -0400 Received: by mail-qt0-f194.google.com with SMTP id h2-v6so13699756qtp.7 for ; Sun, 13 May 2018 13:44:45 -0700 (PDT) In-Reply-To: <763cd60ed7addf605daf8b77c8639c5c08ada219.1526243501.git.marcelo.leitner@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Marcelo Ricardo Leitner Currently there is no way to log offloading errors if the rule is not explicitly marked as skip_sw, making it hard for other applications such as Open vSwitch to log why a given could not be offloaded. This patch adds support for signaling the kernel that more verbose logging is wanted, which now will include such messages. Signed-off-by: Marcelo Ricardo Leitner --- include/uapi/linux/pkt_cls.h | 1 + man/man8/tc-flower.8 | 7 +++++++ tc/f_flower.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index be05e66c167b12a70db409242519a9b1958b1000..84e4c1d0f874afec5891fcf95def286c121f71ed 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h @@ -129,6 +129,7 @@ enum { #define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ #define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ #define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ +#define TCA_CLS_FLAGS_VERBOSE (1 << 4) /* verbose logging */ /* U32 filters */ diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 index a561443b9978bee55142f7dfed6b46106f7b9baf..4f3714b79544b33f198d711fa9006806685d43a8 100644 --- a/man/man8/tc-flower.8 +++ b/man/man8/tc-flower.8 @@ -22,6 +22,8 @@ flower \- flow based traffic control filter .IR MATCH " := { " .B indev .IR ifname " | " +.BR verbose +.RI " | " .BR skip_sw " | " skip_hw .RI " | { " .BR dst_mac " | " src_mac " } " @@ -100,6 +102,11 @@ is the name of an interface which must exist at the time of .B tc invocation. .TP +.BI verbose +Enable verbose logging, including offloading errors when not using +.B skip_sw +flag. +.TP .BI skip_sw Do not process filter by software. If hardware has no offload support for this filter, or TC offload is not enabled for the interface, operation will fail. diff --git a/tc/f_flower.c b/tc/f_flower.c index ba8eb66cdd111adf4f68f041fb6c4acc48fd1a90..c710765179fb08ac94e04ec664fac0d30cf04931 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -41,7 +41,7 @@ enum flower_icmp_field { static void explain(void) { fprintf(stderr, - "Usage: ... flower [ MATCH-LIST ]\n" + "Usage: ... flower [ MATCH-LIST ] [ verbose ]\n" " [ skip_sw | skip_hw ]\n" " [ action ACTION-SPEC ] [ classid CLASSID ]\n" "\n" @@ -648,6 +648,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, fprintf(stderr, "Illegal \"ip_flags\"\n"); return -1; } + } else if (matches(*argv, "verbose") == 0) { + flags |= TCA_CLS_FLAGS_VERBOSE; } else if (matches(*argv, "skip_hw") == 0) { flags |= TCA_CLS_FLAGS_SKIP_HW; } else if (matches(*argv, "skip_sw") == 0) { -- 2.14.3