[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180123213340.19235-9-jakub.kicinski@netronome.com>
Date: Tue, 23 Jan 2018 13:33:40 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: jiri@...nulli.us
Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com,
dsahern@...il.com, Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [RFC net-next 8/8] cls_bpf: drivers: don't try to use extack before callback type is validated
Although today only classifier offloads call block callbacks,
we shouldn't really assume that @type_data starts with
struct tc_cls_common_offload until we validated the type.
Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
---
drivers/net/ethernet/netronome/nfp/bpf/main.c | 5 +----
drivers/net/netdevsim/bpf.c | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c
index 552e2657b536..165276b50b4c 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/main.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c
@@ -125,11 +125,8 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
struct nfp_bpf_vnic *bv;
int err;
- if (type != TC_SETUP_CLSBPF) {
- NL_SET_ERR_MSG_MOD(cls_bpf->common.extack,
- "only offload of BPF classifiers supported");
+ if (type != TC_SETUP_CLSBPF)
return -EOPNOTSUPP;
- }
if (!tc_can_offload_cls(nn->dp.netdev, &cls_bpf->common))
return -EOPNOTSUPP;
if (!nfp_net_ebpf_capable(nn)) {
diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
index bbcb8ec42208..5b2c5260624d 100644
--- a/drivers/net/netdevsim/bpf.c
+++ b/drivers/net/netdevsim/bpf.c
@@ -129,11 +129,8 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
struct netdevsim *ns = cb_priv;
struct bpf_prog *oldprog;
- if (type != TC_SETUP_CLSBPF) {
- NSIM_EA(cls_bpf->common.extack,
- "only offload of BPF classifiers supported");
+ if (type != TC_SETUP_CLSBPF)
return -EOPNOTSUPP;
- }
if (!tc_can_offload_cls(ns->netdev, &cls_bpf->common))
return -EOPNOTSUPP;
--
2.15.1
Powered by blists - more mailing lists