nfp: use tc_cls_can_offload_and_chain0()
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 25 Jan 2018 22:00:45 +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/ethernet/netronome/nfp/bpf/main.c
drivers/net/ethernet/netronome/nfp/flower/offload.c

index b3206855535a8210bd7bc8d1549db07d98536646..322027792fe8137ba20d478e5275daebf3faffe9 100644 (file)
@@ -130,7 +130,7 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
                                   "only offload of BPF classifiers supported");
                return -EOPNOTSUPP;
        }
-       if (!tc_can_offload_extack(nn->dp.netdev, cls_bpf->common.extack))
+       if (!tc_cls_can_offload_and_chain0(nn->dp.netdev, &cls_bpf->common))
                return -EOPNOTSUPP;
        if (!nfp_net_ebpf_capable(nn)) {
                NL_SET_ERR_MSG_MOD(cls_bpf->common.extack,
@@ -142,8 +142,6 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
                                   "only ETH_P_ALL supported as filter protocol");
                return -EOPNOTSUPP;
        }
-       if (cls_bpf->common.chain_index)
-               return -EOPNOTSUPP;
 
        /* Only support TC direct action */
        if (!cls_bpf->exts_integrated ||
index 837134a9137c805860246c5918f80ef5d51024c6..08c4c6dc5f7f26dedab581589a53036e4ba3fee8 100644 (file)
@@ -483,8 +483,7 @@ static int
 nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
                        struct tc_cls_flower_offload *flower, bool egress)
 {
-       if (!eth_proto_is_802_3(flower->common.protocol) ||
-           flower->common.chain_index)
+       if (!eth_proto_is_802_3(flower->common.protocol))
                return -EOPNOTSUPP;
 
        switch (flower->command) {
@@ -504,7 +503,7 @@ int nfp_flower_setup_tc_egress_cb(enum tc_setup_type type, void *type_data,
 {
        struct nfp_repr *repr = cb_priv;
 
-       if (!tc_can_offload(repr->netdev))
+       if (!tc_cls_can_offload_and_chain0(repr->netdev, type_data))
                return -EOPNOTSUPP;
 
        switch (type) {
@@ -521,7 +520,7 @@ static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type,
 {
        struct nfp_repr *repr = cb_priv;
 
-       if (!tc_can_offload(repr->netdev))
+       if (!tc_cls_can_offload_and_chain0(repr->netdev, type_data))
                return -EOPNOTSUPP;
 
        switch (type) {