From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net, daniel@iogearbox.net,
alexei.starovoitov@gmail.com, netdev@vger.kernel.org
Cc: dsahern@gmail.com, oss-drivers@netronome.com, jiri@resnulli.us,
john.fastabend@gmail.com, jhs@mojatatu.com, gerlitz.or@gmail.com,
aring@mojatatu.com, xiyou.wangcong@gmail.com,
Quentin Monnet <quentin.monnet@netronome.com>
Subject: [PATCH bpf-next 07/11] net: sched: create tc_can_offload_extack() wrapper
Date: Mon, 15 Jan 2018 16:30:23 -0800 [thread overview]
Message-ID: <20180116003027.9405-8-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180116003027.9405-1-jakub.kicinski@netronome.com>
From: Quentin Monnet <quentin.monnet@netronome.com>
Create a wrapper around tc_can_offload() that takes an additional
extack pointer argument in order to output an error message if TC
offload is disabled on the device.
In this way, the error message is handled by the core and can be the
same for all drivers.
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
include/net/pkt_cls.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index c88c61234cb3..a3ad6a5a2d12 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -644,6 +644,17 @@ static inline bool tc_can_offload(const struct net_device *dev)
return dev->features & NETIF_F_HW_TC;
}
+static inline bool tc_can_offload_extack(const struct net_device *dev,
+ struct netlink_ext_ack *extack)
+{
+ bool can = tc_can_offload(dev);
+
+ if (!can)
+ NL_SET_ERR_MSG(extack, "TC offload is disabled on net device");
+
+ return can;
+}
+
static inline bool tc_skip_hw(u32 flags)
{
return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;
--
2.15.1
next prev parent reply other threads:[~2018-01-16 0:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 0:30 [PATCH bpf-next 00/11] net: sched: add extack support for cls offload Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 01/11] net: sched: add extack support to change() classifier operation Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 02/11] net: sched: prepare extack support for offload via tc_cls_common_offload Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 03/11] net: sched: cls_flower: propagate extack support for filter offload Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 04/11] net: sched: cls_matchall: " Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 05/11] net: sched: cls_u32: " Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 06/11] net: sched: cls_bpf: plumb extack support in filter for hardware offload Jakub Kicinski
2018-01-16 0:30 ` Jakub Kicinski [this message]
2018-01-16 0:30 ` [PATCH bpf-next 08/11] nfp: bpf: plumb extack into functions related to XDP offload Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 09/11] nfp: bpf: use extack support to improve debugging Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 10/11] netdevsim: add extack support for TC eBPF offload Jakub Kicinski
2018-01-16 0:30 ` [PATCH bpf-next 11/11] selftests/bpf: add checks on extack messages for eBPF hw offload tests Jakub Kicinski
2018-01-16 0:49 ` David Ahern
2018-01-16 0:55 ` Jakub Kicinski
2018-01-16 1:02 ` David Ahern
2018-01-16 1:04 ` Jakub Kicinski
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=20180116003027.9405-8-jakub.kicinski@netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=alexei.starovoitov@gmail.com \
--cc=aring@mojatatu.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=gerlitz.or@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=quentin.monnet@netronome.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;
as well as URLs for NNTP newsgroup(s).