netdevsim: use tc_cls_can_offload_and_chain0()
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 25 Jan 2018 22:00:44 +0000 (14:00 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Jan 2018 02:23:08 +0000 (21:23 -0500)
Make use of tc_cls_can_offload_and_chain0() to set extack msg in case
ethtool tc offload flag is not set or chain unsupported.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/bpf.c

index 8166f121bbccdaac13d9f69f84590598c6f60bf0..de73c1ff09397c2c9836be1d214bd098fa0093e2 100644 (file)
@@ -135,7 +135,7 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
                return -EOPNOTSUPP;
        }
 
-       if (!tc_can_offload_extack(ns->netdev, cls_bpf->common.extack))
+       if (!tc_cls_can_offload_and_chain0(ns->netdev, &cls_bpf->common))
                return -EOPNOTSUPP;
 
        if (cls_bpf->common.protocol != htons(ETH_P_ALL)) {
@@ -144,9 +144,6 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
                return -EOPNOTSUPP;
        }
 
-       if (cls_bpf->common.chain_index)
-               return -EOPNOTSUPP;
-
        if (!ns->bpf_tc_accept) {
                NSIM_EA(cls_bpf->common.extack,
                        "netdevsim configured to reject BPF TC offload");