diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2018-08-19 15:22:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-21 15:45:44 -0400 |
commit | 244cd96adb5f5ab39551081fb1f9009a54bb12ee (patch) | |
tree | d3c9fee9d752278765efd4aef56a82ff900747de | |
parent | 7d485c451fc82f8ae431cdb379521bc6d0641064 (diff) |
net_sched: remove list_head from tc_action
After commit 90b73b77d08e, list_head is no longer needed.
Now we just need to convert the list iteration to array
iteration for drivers.
Fixes: 90b73b77d08e ("net: sched: change action API to use array of pointers to actions")
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/flower/action.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qede/qede_filter.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 5 | ||||
-rw-r--r-- | include/net/act_api.h | 1 | ||||
-rw-r--r-- | include/net/pkt_cls.h | 25 | ||||
-rw-r--r-- | net/dsa/slave.c | 4 | ||||
-rw-r--r-- | net/sched/act_api.c | 1 |
14 files changed, 43 insertions, 60 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 139d96c5a023..092c817f8f11 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | |||
@@ -110,16 +110,14 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, | |||
110 | struct tcf_exts *tc_exts) | 110 | struct tcf_exts *tc_exts) |
111 | { | 111 | { |
112 | const struct tc_action *tc_act; | 112 | const struct tc_action *tc_act; |
113 | LIST_HEAD(tc_actions); | 113 | int i, rc; |
114 | int rc; | ||
115 | 114 | ||
116 | if (!tcf_exts_has_actions(tc_exts)) { | 115 | if (!tcf_exts_has_actions(tc_exts)) { |
117 | netdev_info(bp->dev, "no actions"); | 116 | netdev_info(bp->dev, "no actions"); |
118 | return -EINVAL; | 117 | return -EINVAL; |
119 | } | 118 | } |
120 | 119 | ||
121 | tcf_exts_to_list(tc_exts, &tc_actions); | 120 | tcf_exts_for_each_action(i, tc_act, tc_exts) { |
122 | list_for_each_entry(tc_act, &tc_actions, list) { | ||
123 | /* Drop action */ | 121 | /* Drop action */ |
124 | if (is_tcf_gact_shot(tc_act)) { | 122 | if (is_tcf_gact_shot(tc_act)) { |
125 | actions->flags |= BNXT_TC_ACTION_FLAG_DROP; | 123 | actions->flags |= BNXT_TC_ACTION_FLAG_DROP; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c index 623f73dd7738..c116f96956fe 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | |||
@@ -417,10 +417,9 @@ static void cxgb4_process_flow_actions(struct net_device *in, | |||
417 | struct ch_filter_specification *fs) | 417 | struct ch_filter_specification *fs) |
418 | { | 418 | { |
419 | const struct tc_action *a; | 419 | const struct tc_action *a; |
420 | LIST_HEAD(actions); | 420 | int i; |
421 | 421 | ||
422 | tcf_exts_to_list(cls->exts, &actions); | 422 | tcf_exts_for_each_action(i, a, cls->exts) { |
423 | list_for_each_entry(a, &actions, list) { | ||
424 | if (is_tcf_gact_ok(a)) { | 423 | if (is_tcf_gact_ok(a)) { |
425 | fs->action = FILTER_PASS; | 424 | fs->action = FILTER_PASS; |
426 | } else if (is_tcf_gact_shot(a)) { | 425 | } else if (is_tcf_gact_shot(a)) { |
@@ -591,10 +590,9 @@ static int cxgb4_validate_flow_actions(struct net_device *dev, | |||
591 | bool act_redir = false; | 590 | bool act_redir = false; |
592 | bool act_pedit = false; | 591 | bool act_pedit = false; |
593 | bool act_vlan = false; | 592 | bool act_vlan = false; |
594 | LIST_HEAD(actions); | 593 | int i; |
595 | 594 | ||
596 | tcf_exts_to_list(cls->exts, &actions); | 595 | tcf_exts_for_each_action(i, a, cls->exts) { |
597 | list_for_each_entry(a, &actions, list) { | ||
598 | if (is_tcf_gact_ok(a)) { | 596 | if (is_tcf_gact_ok(a)) { |
599 | /* Do nothing */ | 597 | /* Do nothing */ |
600 | } else if (is_tcf_gact_shot(a)) { | 598 | } else if (is_tcf_gact_shot(a)) { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c index 18eb2aedd4cb..c7d2b4dc7568 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | |||
@@ -93,14 +93,13 @@ static int fill_action_fields(struct adapter *adap, | |||
93 | unsigned int num_actions = 0; | 93 | unsigned int num_actions = 0; |
94 | const struct tc_action *a; | 94 | const struct tc_action *a; |
95 | struct tcf_exts *exts; | 95 | struct tcf_exts *exts; |
96 | LIST_HEAD(actions); | 96 | int i; |
97 | 97 | ||
98 | exts = cls->knode.exts; | 98 | exts = cls->knode.exts; |
99 | if (!tcf_exts_has_actions(exts)) | 99 | if (!tcf_exts_has_actions(exts)) |
100 | return -EINVAL; | 100 | return -EINVAL; |
101 | 101 | ||
102 | tcf_exts_to_list(exts, &actions); | 102 | tcf_exts_for_each_action(i, a, exts) { |
103 | list_for_each_entry(a, &actions, list) { | ||
104 | /* Don't allow more than one action per rule. */ | 103 | /* Don't allow more than one action per rule. */ |
105 | if (num_actions) | 104 | if (num_actions) |
106 | return -EINVAL; | 105 | return -EINVAL; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 447098005490..af4c9ae7f432 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -9171,14 +9171,12 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter, | |||
9171 | struct tcf_exts *exts, u64 *action, u8 *queue) | 9171 | struct tcf_exts *exts, u64 *action, u8 *queue) |
9172 | { | 9172 | { |
9173 | const struct tc_action *a; | 9173 | const struct tc_action *a; |
9174 | LIST_HEAD(actions); | 9174 | int i; |
9175 | 9175 | ||
9176 | if (!tcf_exts_has_actions(exts)) | 9176 | if (!tcf_exts_has_actions(exts)) |
9177 | return -EINVAL; | 9177 | return -EINVAL; |
9178 | 9178 | ||
9179 | tcf_exts_to_list(exts, &actions); | 9179 | tcf_exts_for_each_action(i, a, exts) { |
9180 | list_for_each_entry(a, &actions, list) { | ||
9181 | |||
9182 | /* Drop action */ | 9180 | /* Drop action */ |
9183 | if (is_tcf_gact_shot(a)) { | 9181 | if (is_tcf_gact_shot(a)) { |
9184 | *action = IXGBE_FDIR_DROP_QUEUE; | 9182 | *action = IXGBE_FDIR_DROP_QUEUE; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 9131a1376e7d..9fed54017659 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -1982,14 +1982,15 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | |||
1982 | goto out_ok; | 1982 | goto out_ok; |
1983 | 1983 | ||
1984 | modify_ip_header = false; | 1984 | modify_ip_header = false; |
1985 | tcf_exts_to_list(exts, &actions); | 1985 | tcf_exts_for_each_action(i, a, exts) { |
1986 | list_for_each_entry(a, &actions, list) { | 1986 | int k; |
1987 | |||
1987 | if (!is_tcf_pedit(a)) | 1988 | if (!is_tcf_pedit(a)) |
1988 | continue; | 1989 | continue; |
1989 | 1990 | ||
1990 | nkeys = tcf_pedit_nkeys(a); | 1991 | nkeys = tcf_pedit_nkeys(a); |
1991 | for (i = 0; i < nkeys; i++) { | 1992 | for (k = 0; k < nkeys; k++) { |
1992 | htype = tcf_pedit_htype(a, i); | 1993 | htype = tcf_pedit_htype(a, k); |
1993 | if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 || | 1994 | if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 || |
1994 | htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP6) { | 1995 | htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP6) { |
1995 | modify_ip_header = true; | 1996 | modify_ip_header = true; |
@@ -2053,15 +2054,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | |||
2053 | const struct tc_action *a; | 2054 | const struct tc_action *a; |
2054 | LIST_HEAD(actions); | 2055 | LIST_HEAD(actions); |
2055 | u32 action = 0; | 2056 | u32 action = 0; |
2056 | int err; | 2057 | int err, i; |
2057 | 2058 | ||
2058 | if (!tcf_exts_has_actions(exts)) | 2059 | if (!tcf_exts_has_actions(exts)) |
2059 | return -EINVAL; | 2060 | return -EINVAL; |
2060 | 2061 | ||
2061 | attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG; | 2062 | attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG; |
2062 | 2063 | ||
2063 | tcf_exts_to_list(exts, &actions); | 2064 | tcf_exts_for_each_action(i, a, exts) { |
2064 | list_for_each_entry(a, &actions, list) { | ||
2065 | if (is_tcf_gact_shot(a)) { | 2065 | if (is_tcf_gact_shot(a)) { |
2066 | action |= MLX5_FLOW_CONTEXT_ACTION_DROP; | 2066 | action |= MLX5_FLOW_CONTEXT_ACTION_DROP; |
2067 | if (MLX5_CAP_FLOWTABLE(priv->mdev, | 2067 | if (MLX5_CAP_FLOWTABLE(priv->mdev, |
@@ -2666,7 +2666,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | |||
2666 | LIST_HEAD(actions); | 2666 | LIST_HEAD(actions); |
2667 | bool encap = false; | 2667 | bool encap = false; |
2668 | u32 action = 0; | 2668 | u32 action = 0; |
2669 | int err; | 2669 | int err, i; |
2670 | 2670 | ||
2671 | if (!tcf_exts_has_actions(exts)) | 2671 | if (!tcf_exts_has_actions(exts)) |
2672 | return -EINVAL; | 2672 | return -EINVAL; |
@@ -2674,8 +2674,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | |||
2674 | attr->in_rep = rpriv->rep; | 2674 | attr->in_rep = rpriv->rep; |
2675 | attr->in_mdev = priv->mdev; | 2675 | attr->in_mdev = priv->mdev; |
2676 | 2676 | ||
2677 | tcf_exts_to_list(exts, &actions); | 2677 | tcf_exts_for_each_action(i, a, exts) { |
2678 | list_for_each_entry(a, &actions, list) { | ||
2679 | if (is_tcf_gact_shot(a)) { | 2678 | if (is_tcf_gact_shot(a)) { |
2680 | action |= MLX5_FLOW_CONTEXT_ACTION_DROP | | 2679 | action |= MLX5_FLOW_CONTEXT_ACTION_DROP | |
2681 | MLX5_FLOW_CONTEXT_ACTION_COUNT; | 2680 | MLX5_FLOW_CONTEXT_ACTION_COUNT; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 6070d1591d1e..930700413b1d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
@@ -1346,8 +1346,7 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1346 | return -ENOMEM; | 1346 | return -ENOMEM; |
1347 | mall_tc_entry->cookie = f->cookie; | 1347 | mall_tc_entry->cookie = f->cookie; |
1348 | 1348 | ||
1349 | tcf_exts_to_list(f->exts, &actions); | 1349 | a = tcf_exts_first_action(f->exts); |
1350 | a = list_first_entry(&actions, struct tc_action, list); | ||
1351 | 1350 | ||
1352 | if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { | 1351 | if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { |
1353 | struct mlxsw_sp_port_mall_mirror_tc_entry *mirror; | 1352 | struct mlxsw_sp_port_mall_mirror_tc_entry *mirror; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c index ebd1b24ebaa5..8d211972c5e9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | |||
@@ -21,8 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, | |||
21 | struct netlink_ext_ack *extack) | 21 | struct netlink_ext_ack *extack) |
22 | { | 22 | { |
23 | const struct tc_action *a; | 23 | const struct tc_action *a; |
24 | LIST_HEAD(actions); | 24 | int err, i; |
25 | int err; | ||
26 | 25 | ||
27 | if (!tcf_exts_has_actions(exts)) | 26 | if (!tcf_exts_has_actions(exts)) |
28 | return 0; | 27 | return 0; |
@@ -32,8 +31,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, | |||
32 | if (err) | 31 | if (err) |
33 | return err; | 32 | return err; |
34 | 33 | ||
35 | tcf_exts_to_list(exts, &actions); | 34 | tcf_exts_for_each_action(i, a, exts) { |
36 | list_for_each_entry(a, &actions, list) { | ||
37 | if (is_tcf_gact_ok(a)) { | 35 | if (is_tcf_gact_ok(a)) { |
38 | err = mlxsw_sp_acl_rulei_act_terminate(rulei); | 36 | err = mlxsw_sp_acl_rulei_act_terminate(rulei); |
39 | if (err) { | 37 | if (err) { |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c index 0ba0356ec4e6..9044496803e6 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/action.c +++ b/drivers/net/ethernet/netronome/nfp/flower/action.c | |||
@@ -796,11 +796,10 @@ int nfp_flower_compile_action(struct nfp_app *app, | |||
796 | struct net_device *netdev, | 796 | struct net_device *netdev, |
797 | struct nfp_fl_payload *nfp_flow) | 797 | struct nfp_fl_payload *nfp_flow) |
798 | { | 798 | { |
799 | int act_len, act_cnt, err, tun_out_cnt, out_cnt; | 799 | int act_len, act_cnt, err, tun_out_cnt, out_cnt, i; |
800 | enum nfp_flower_tun_type tun_type; | 800 | enum nfp_flower_tun_type tun_type; |
801 | const struct tc_action *a; | 801 | const struct tc_action *a; |
802 | u32 csum_updated = 0; | 802 | u32 csum_updated = 0; |
803 | LIST_HEAD(actions); | ||
804 | 803 | ||
805 | memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ); | 804 | memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ); |
806 | nfp_flow->meta.act_len = 0; | 805 | nfp_flow->meta.act_len = 0; |
@@ -810,8 +809,7 @@ int nfp_flower_compile_action(struct nfp_app *app, | |||
810 | tun_out_cnt = 0; | 809 | tun_out_cnt = 0; |
811 | out_cnt = 0; | 810 | out_cnt = 0; |
812 | 811 | ||
813 | tcf_exts_to_list(flow->exts, &actions); | 812 | tcf_exts_for_each_action(i, a, flow->exts) { |
814 | list_for_each_entry(a, &actions, list) { | ||
815 | err = nfp_flower_loop_action(app, a, flow, nfp_flow, &act_len, | 813 | err = nfp_flower_loop_action(app, a, flow, nfp_flow, &act_len, |
816 | netdev, &tun_type, &tun_out_cnt, | 814 | netdev, &tun_type, &tun_out_cnt, |
817 | &out_cnt, &csum_updated); | 815 | &out_cnt, &csum_updated); |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index 9673d19308e6..b16ce7d93caf 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c | |||
@@ -2006,18 +2006,16 @@ unlock: | |||
2006 | static int qede_parse_actions(struct qede_dev *edev, | 2006 | static int qede_parse_actions(struct qede_dev *edev, |
2007 | struct tcf_exts *exts) | 2007 | struct tcf_exts *exts) |
2008 | { | 2008 | { |
2009 | int rc = -EINVAL, num_act = 0; | 2009 | int rc = -EINVAL, num_act = 0, i; |
2010 | const struct tc_action *a; | 2010 | const struct tc_action *a; |
2011 | bool is_drop = false; | 2011 | bool is_drop = false; |
2012 | LIST_HEAD(actions); | ||
2013 | 2012 | ||
2014 | if (!tcf_exts_has_actions(exts)) { | 2013 | if (!tcf_exts_has_actions(exts)) { |
2015 | DP_NOTICE(edev, "No tc actions received\n"); | 2014 | DP_NOTICE(edev, "No tc actions received\n"); |
2016 | return rc; | 2015 | return rc; |
2017 | } | 2016 | } |
2018 | 2017 | ||
2019 | tcf_exts_to_list(exts, &actions); | 2018 | tcf_exts_for_each_action(i, a, exts) { |
2020 | list_for_each_entry(a, &actions, list) { | ||
2021 | num_act++; | 2019 | num_act++; |
2022 | 2020 | ||
2023 | if (is_tcf_gact_shot(a)) | 2021 | if (is_tcf_gact_shot(a)) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 1a96dd9c1091..531294f4978b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | |||
@@ -61,7 +61,7 @@ static int tc_fill_actions(struct stmmac_tc_entry *entry, | |||
61 | struct stmmac_tc_entry *action_entry = entry; | 61 | struct stmmac_tc_entry *action_entry = entry; |
62 | const struct tc_action *act; | 62 | const struct tc_action *act; |
63 | struct tcf_exts *exts; | 63 | struct tcf_exts *exts; |
64 | LIST_HEAD(actions); | 64 | int i; |
65 | 65 | ||
66 | exts = cls->knode.exts; | 66 | exts = cls->knode.exts; |
67 | if (!tcf_exts_has_actions(exts)) | 67 | if (!tcf_exts_has_actions(exts)) |
@@ -69,8 +69,7 @@ static int tc_fill_actions(struct stmmac_tc_entry *entry, | |||
69 | if (frag) | 69 | if (frag) |
70 | action_entry = frag; | 70 | action_entry = frag; |
71 | 71 | ||
72 | tcf_exts_to_list(exts, &actions); | 72 | tcf_exts_for_each_action(i, act, exts) { |
73 | list_for_each_entry(act, &actions, list) { | ||
74 | /* Accept */ | 73 | /* Accept */ |
75 | if (is_tcf_gact_ok(act)) { | 74 | if (is_tcf_gact_ok(act)) { |
76 | action_entry->val.af = 1; | 75 | action_entry->val.af = 1; |
diff --git a/include/net/act_api.h b/include/net/act_api.h index eaa0e8b93d5b..f9c4b871af88 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -23,7 +23,6 @@ struct tc_action { | |||
23 | const struct tc_action_ops *ops; | 23 | const struct tc_action_ops *ops; |
24 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | 24 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
25 | __u32 order; | 25 | __u32 order; |
26 | struct list_head list; | ||
27 | struct tcf_idrinfo *idrinfo; | 26 | struct tcf_idrinfo *idrinfo; |
28 | 27 | ||
29 | u32 tcfa_index; | 28 | u32 tcfa_index; |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index ef727f71336e..c17d51865469 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -298,19 +298,13 @@ static inline void tcf_exts_put_net(struct tcf_exts *exts) | |||
298 | #endif | 298 | #endif |
299 | } | 299 | } |
300 | 300 | ||
301 | static inline void tcf_exts_to_list(const struct tcf_exts *exts, | ||
302 | struct list_head *actions) | ||
303 | { | ||
304 | #ifdef CONFIG_NET_CLS_ACT | 301 | #ifdef CONFIG_NET_CLS_ACT |
305 | int i; | 302 | #define tcf_exts_for_each_action(i, a, exts) \ |
306 | 303 | for (i = 0; i < TCA_ACT_MAX_PRIO && ((a) = (exts)->actions[i]); i++) | |
307 | for (i = 0; i < exts->nr_actions; i++) { | 304 | #else |
308 | struct tc_action *a = exts->actions[i]; | 305 | #define tcf_exts_for_each_action(i, a, exts) \ |
309 | 306 | for (; 0; ) | |
310 | list_add_tail(&a->list, actions); | ||
311 | } | ||
312 | #endif | 307 | #endif |
313 | } | ||
314 | 308 | ||
315 | static inline void | 309 | static inline void |
316 | tcf_exts_stats_update(const struct tcf_exts *exts, | 310 | tcf_exts_stats_update(const struct tcf_exts *exts, |
@@ -361,6 +355,15 @@ static inline bool tcf_exts_has_one_action(struct tcf_exts *exts) | |||
361 | #endif | 355 | #endif |
362 | } | 356 | } |
363 | 357 | ||
358 | static inline struct tc_action *tcf_exts_first_action(struct tcf_exts *exts) | ||
359 | { | ||
360 | #ifdef CONFIG_NET_CLS_ACT | ||
361 | return exts->actions[0]; | ||
362 | #else | ||
363 | return NULL; | ||
364 | #endif | ||
365 | } | ||
366 | |||
364 | /** | 367 | /** |
365 | * tcf_exts_exec - execute tc filter extensions | 368 | * tcf_exts_exec - execute tc filter extensions |
366 | * @skb: socket buffer | 369 | * @skb: socket buffer |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 962c4fd338ba..1c45c1d6d241 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -767,7 +767,6 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, | |||
767 | const struct tc_action *a; | 767 | const struct tc_action *a; |
768 | struct dsa_port *to_dp; | 768 | struct dsa_port *to_dp; |
769 | int err = -EOPNOTSUPP; | 769 | int err = -EOPNOTSUPP; |
770 | LIST_HEAD(actions); | ||
771 | 770 | ||
772 | if (!ds->ops->port_mirror_add) | 771 | if (!ds->ops->port_mirror_add) |
773 | return err; | 772 | return err; |
@@ -775,8 +774,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, | |||
775 | if (!tcf_exts_has_one_action(cls->exts)) | 774 | if (!tcf_exts_has_one_action(cls->exts)) |
776 | return err; | 775 | return err; |
777 | 776 | ||
778 | tcf_exts_to_list(cls->exts, &actions); | 777 | a = tcf_exts_first_action(cls->exts); |
779 | a = list_first_entry(&actions, struct tc_action, list); | ||
780 | 778 | ||
781 | if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { | 779 | if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { |
782 | struct dsa_mall_mirror_tc_entry *mirror; | 780 | struct dsa_mall_mirror_tc_entry *mirror; |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index d76948f02a02..db83dac1e7f4 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -391,7 +391,6 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, | |||
391 | 391 | ||
392 | p->idrinfo = idrinfo; | 392 | p->idrinfo = idrinfo; |
393 | p->ops = ops; | 393 | p->ops = ops; |
394 | INIT_LIST_HEAD(&p->list); | ||
395 | *a = p; | 394 | *a = p; |
396 | return 0; | 395 | return 0; |
397 | err3: | 396 | err3: |