bnxt: use tc_cls_can_offload_and_chain0()
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 25 Jan 2018 22:00:48 +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/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c

index 6b7e99675571b070aab53f8fcac17902758ea1de..4b001d2050c2d4a056ae0a7247be81c3176797aa 100644 (file)
@@ -7778,7 +7778,8 @@ static int bnxt_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 {
        struct bnxt *bp = cb_priv;
 
-       if (!bnxt_tc_flower_enabled(bp) || !tc_can_offload(bp->dev))
+       if (!bnxt_tc_flower_enabled(bp) ||
+           !tc_cls_can_offload_and_chain0(bp->dev, type_data))
                return -EOPNOTSUPP;
 
        switch (type) {
index 2ece1645f55d293e720dcd103bbe99d4703f4a73..fbe6e208e17b9ad190d1ee017c68075d0af70bb9 100644 (file)
@@ -1474,9 +1474,6 @@ int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
 {
        int rc = 0;
 
-       if (cls_flower->common.chain_index)
-               return -EOPNOTSUPP;
-
        switch (cls_flower->command) {
        case TC_CLSFLOWER_REPLACE:
                rc = bnxt_tc_add_flow(bp, src_fid, cls_flower);
index 2ca11be64182c7fd8febfb2538260ec100226aa3..26290403f38fa321e3f7bc397f2d2916857338c7 100644 (file)
@@ -124,7 +124,8 @@ static int bnxt_vf_rep_setup_tc_block_cb(enum tc_setup_type type,
        struct bnxt *bp = vf_rep->bp;
        int vf_fid = bp->pf.vf[vf_rep->vf_idx].fw_fid;
 
-       if (!bnxt_tc_flower_enabled(vf_rep->bp) || !tc_can_offload(bp->dev))
+       if (!bnxt_tc_flower_enabled(vf_rep->bp) ||
+           !tc_cls_can_offload_and_chain0(bp->dev, type_data))
                return -EOPNOTSUPP;
 
        switch (type) {