net: sched: avoid ndo_setup_tc calls for TC_SETUP_CLS*
authorJiri Pirko <jiri@mellanox.com>
Thu, 19 Oct 2017 13:50:46 +0000 (15:50 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Oct 2017 02:04:08 +0000 (03:04 +0100)
All drivers are converted to use block callbacks for TC_SETUP_CLS*.
So it is now safe to remove the calls to ndo_setup_tc from cls_*

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 files changed:
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/netronome/nfp/bpf/main.c
drivers/net/ethernet/netronome/nfp/flower/offload.c
net/dsa/slave.c
net/sched/cls_bpf.c
net/sched/cls_flower.c
net/sched/cls_matchall.c
net/sched/cls_u32.c

index 4dde2b81609265e046427096e2a41d2066062ec9..22a94b16ebfad69f7d9fb484461332dd78f0f4f6 100644 (file)
@@ -7335,8 +7335,6 @@ static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
                         void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return bnxt_setup_tc_block(dev, type_data);
        case TC_SETUP_MQPRIO: {
index cc278d7b56a440ac4595b6266103e008f8389733..6dff5aa57f16c3309d56a8306ede18af7b806a49 100644 (file)
@@ -158,8 +158,6 @@ static int bnxt_vf_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
                                void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return bnxt_vf_rep_setup_tc_block(dev, type_data);
        default:
index 3cd82aea3bb68fee300c6ef2597e51adc1e9eb04..e16078ddb39f716bcd77cf58ee9bb869b5056df6 100644 (file)
@@ -2969,9 +2969,6 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
                         void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSU32:
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return cxgb_setup_tc_block(dev, type_data);
        default:
index 38e01e0c83145506f4c2776fd940f37ef57df651..7f503d35eb1ca0c42ccf69ee3159344c5d4e85de 100644 (file)
@@ -9432,8 +9432,6 @@ static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
                            void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSU32:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return ixgbe_setup_tc_block(dev, type_data);
        case TC_SETUP_MQPRIO:
index e8108688a7cf849b22f4b4586d365cb0284fbfbd..560b208c048366313dcd649c4fd7088eb1337f3c 100644 (file)
@@ -3141,8 +3141,6 @@ int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
 {
        switch (type) {
 #ifdef CONFIG_MLX5_ESWITCH
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return mlx5e_setup_tc_block(dev, type_data);
 #endif
index f59d81aa8a0cc72b6370a23a101dd2ceacaf5309..0edb7065d811645bf2eca1197dd9ec18eb958bdf 100644 (file)
@@ -714,8 +714,6 @@ static int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
                              void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return mlx5e_rep_setup_tc_block(dev, type_data);
        default:
index 7b60c75d96f4357f6b929e362ed3e7d606d9da08..4d73a6f7759e1aa5737ab40b3e1b0c826b885f26 100644 (file)
@@ -1792,9 +1792,6 @@ static int mlxsw_sp_setup_tc(struct net_device *dev, enum tc_setup_type type,
        struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
 
        switch (type) {
-       case TC_SETUP_CLSMATCHALL:
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return mlxsw_sp_setup_tc_block(mlxsw_sp_port, type_data);
        default:
index 64f97b3f89492e06171de0d0c1df9309a27beede..fa0ac90ed956c7007f890ec4335cfbf17d1d3872 100644 (file)
@@ -159,8 +159,6 @@ static int nfp_bpf_setup_tc(struct nfp_app *app, struct net_device *netdev,
                            enum tc_setup_type type, void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSBPF:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return nfp_bpf_setup_tc_block(netdev, type_data);
        default:
index f8523df827a668af78fd01139e278c207c9b8e9b..c47753fdb55bf50a9698fdc4e6cfa658ec39bf3a 100644 (file)
@@ -506,8 +506,6 @@ int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
                        enum tc_setup_type type, void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSFLOWER:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return nfp_flower_setup_tc_block(netdev, type_data);
        default:
index 80142918d5d174575806d408d0763855687fdb20..d0ae7010ea45f04d536f1aed06c88723bcf75eae 100644 (file)
@@ -846,8 +846,6 @@ static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
                              void *type_data)
 {
        switch (type) {
-       case TC_SETUP_CLSMATCHALL:
-               return 0; /* will be removed after conversion from ndo */
        case TC_SETUP_BLOCK:
                return dsa_slave_setup_tc_block(dev, type_data);
        default:
index e379fdf928bddd4691a5dbbe191255fdfd71d000..0f8b51061c3916f43df0410a163126651c27a903 100644 (file)
@@ -148,7 +148,6 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
                               enum tc_clsbpf_command cmd)
 {
        bool addorrep = cmd == TC_CLSBPF_ADD || cmd == TC_CLSBPF_REPLACE;
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
        bool skip_sw = tc_skip_sw(prog->gen_flags);
        struct tc_cls_bpf_offload cls_bpf = {};
@@ -162,19 +161,6 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
        cls_bpf.exts_integrated = prog->exts_integrated;
        cls_bpf.gen_flags = prog->gen_flags;
 
-       if (tc_can_offload(dev)) {
-               err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSBPF,
-                                                   &cls_bpf);
-               if (addorrep) {
-                       if (err) {
-                               if (skip_sw)
-                                       return err;
-                       } else {
-                               prog->gen_flags |= TCA_CLS_FLAGS_IN_HW;
-                       }
-               }
-       }
-
        err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
        if (addorrep) {
                if (err < 0) {
index 76b4e0a1c92f5008ac0e7b413daa791b264ab282..16f58abaa697dca2643901d750d6ab0a3653d114 100644 (file)
@@ -200,16 +200,12 @@ static void fl_destroy_filter(struct rcu_head *head)
 static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f)
 {
        struct tc_cls_flower_offload cls_flower = {};
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
 
        tc_cls_common_offload_init(&cls_flower.common, tp);
        cls_flower.command = TC_CLSFLOWER_DESTROY;
        cls_flower.cookie = (unsigned long) f;
 
-       if (tc_can_offload(dev))
-               dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
-                                             &cls_flower);
        tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
                         &cls_flower, false);
 }
@@ -219,7 +215,6 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
                                struct fl_flow_key *mask,
                                struct cls_fl_filter *f)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tc_cls_flower_offload cls_flower = {};
        struct tcf_block *block = tp->chain->block;
        bool skip_sw = tc_skip_sw(f->flags);
@@ -233,17 +228,6 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
        cls_flower.key = &f->mkey;
        cls_flower.exts = &f->exts;
 
-       if (tc_can_offload(dev)) {
-               err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
-                                                   &cls_flower);
-               if (err) {
-                       if (skip_sw)
-                               return err;
-               } else {
-                       f->flags |= TCA_CLS_FLAGS_IN_HW;
-               }
-       }
-
        err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
                               &cls_flower, skip_sw);
        if (err < 0) {
@@ -262,7 +246,6 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
 static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
 {
        struct tc_cls_flower_offload cls_flower = {};
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
 
        tc_cls_common_offload_init(&cls_flower.common, tp);
@@ -270,9 +253,6 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
        cls_flower.cookie = (unsigned long) f;
        cls_flower.exts = &f->exts;
 
-       if (tc_can_offload(dev))
-               dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
-                                             &cls_flower);
        tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
                         &cls_flower, false);
 }
index 5278534c7e87f3a4502a0542713123ada7eb3d15..70e78d74f6d3a755789cafd23c680346ff495fcf 100644 (file)
@@ -54,7 +54,6 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
                                   struct cls_mall_head *head,
                                   unsigned long cookie)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tc_cls_matchall_offload cls_mall = {};
        struct tcf_block *block = tp->chain->block;
 
@@ -62,9 +61,6 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
        cls_mall.command = TC_CLSMATCHALL_DESTROY;
        cls_mall.cookie = cookie;
 
-       if (tc_can_offload(dev))
-               dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL,
-                                             &cls_mall);
        tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, &cls_mall, false);
 }
 
@@ -72,7 +68,6 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
                                  struct cls_mall_head *head,
                                  unsigned long cookie)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tc_cls_matchall_offload cls_mall = {};
        struct tcf_block *block = tp->chain->block;
        bool skip_sw = tc_skip_sw(head->flags);
@@ -83,17 +78,6 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
        cls_mall.exts = &head->exts;
        cls_mall.cookie = cookie;
 
-       if (tc_can_offload(dev)) {
-               err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL,
-                                                   &cls_mall);
-               if (err) {
-                       if (skip_sw)
-                               return err;
-               } else {
-                       head->flags |= TCA_CLS_FLAGS_IN_HW;
-               }
-       }
-
        err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL,
                               &cls_mall, skip_sw);
        if (err < 0) {
index d53da7968edaa4edeb7b58538c33124836aa71dc..9ff17159fb61d97b52d2f04bea63c40aaa4222ff 100644 (file)
@@ -464,7 +464,6 @@ static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key)
 
 static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
        struct tc_cls_u32_offload cls_u32 = {};
 
@@ -474,15 +473,12 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
        cls_u32.hnode.handle = h->handle;
        cls_u32.hnode.prio = h->prio;
 
-       if (tc_can_offload(dev))
-               dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &cls_u32);
        tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false);
 }
 
 static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
                                u32 flags)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
        struct tc_cls_u32_offload cls_u32 = {};
        bool skip_sw = tc_skip_sw(flags);
@@ -495,17 +491,6 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
        cls_u32.hnode.handle = h->handle;
        cls_u32.hnode.prio = h->prio;
 
-       if (tc_can_offload(dev)) {
-               err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
-                                                   &cls_u32);
-               if (err) {
-                       if (skip_sw)
-                               return err;
-               } else {
-                       offloaded = true;
-               }
-       }
-
        err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw);
        if (err < 0) {
                u32_clear_hw_hnode(tp, h);
@@ -522,7 +507,6 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
 
 static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
        struct tc_cls_u32_offload cls_u32 = {};
 
@@ -530,15 +514,12 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
        cls_u32.command = TC_CLSU32_DELETE_KNODE;
        cls_u32.knode.handle = handle;
 
-       if (tc_can_offload(dev))
-               dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, &cls_u32);
        tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, false);
 }
 
 static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
                                u32 flags)
 {
-       struct net_device *dev = tp->q->dev_queue->dev;
        struct tcf_block *block = tp->chain->block;
        struct tc_cls_u32_offload cls_u32 = {};
        bool skip_sw = tc_skip_sw(flags);
@@ -560,18 +541,6 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
        if (n->ht_down)
                cls_u32.knode.link_handle = n->ht_down->handle;
 
-
-       if (tc_can_offload(dev)) {
-               err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
-                                                   &cls_u32);
-               if (err) {
-                       if (skip_sw)
-                               return err;
-               } else {
-                       n->flags |= TCA_CLS_FLAGS_IN_HW;
-               }
-       }
-
        err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSU32, &cls_u32, skip_sw);
        if (err < 0) {
                u32_remove_hw_knode(tp, n->handle);