net: sched: change names of action number helpers to be aligned with the rest
authorJiri Pirko <jiri@mellanox.com>
Fri, 4 Aug 2017 12:28:58 +0000 (14:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Aug 2017 18:21:23 +0000 (11:21 -0700)
The rest of the helpers are named tcf_exts_*, so change the name of
the action number helpers to be aligned. While at it, change to inline
functions.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
drivers/net/ethernet/netronome/nfp/bpf/offload.c
include/net/pkt_cls.h
net/dsa/slave.c
net/sched/cls_api.c

index ef06ce8247ab65734085bf38458f65efbf009349..6f734c52ef2565d6e9be7f83c09d26b52617f69d 100644 (file)
@@ -96,7 +96,7 @@ static int fill_action_fields(struct adapter *adap,
        LIST_HEAD(actions);
 
        exts = cls->knode.exts;
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return -EINVAL;
 
        tcf_exts_to_list(exts, &actions);
index 96606e3eb965ba344b7789734d45babdcacde508..091fcc7e6e43621449643746574f4ca707ba7b08 100644 (file)
@@ -8953,7 +8953,7 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter,
        LIST_HEAD(actions);
        int err;
 
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return -EINVAL;
 
        tcf_exts_to_list(exts, &actions);
index 3c536f560dd2b529607ddf30de70d979efd0c59b..78f50d9f621d76750058e92f214cba1d689d6a0d 100644 (file)
@@ -1326,7 +1326,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
        LIST_HEAD(actions);
        int err;
 
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return -EINVAL;
 
        attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
@@ -1839,7 +1839,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
        bool encap = false;
        int err = 0;
 
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return -EINVAL;
 
        memset(attr, 0, sizeof(*attr));
index 88b668ba0d8a2711dd228af6fa55cb735509276b..66d511d45c253eee4e31131cacc11ae09797e2ec 100644 (file)
@@ -1626,7 +1626,7 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
        LIST_HEAD(actions);
        int err;
 
-       if (!tc_single_action(cls->exts)) {
+       if (!tcf_exts_has_one_action(cls->exts)) {
                netdev_err(mlxsw_sp_port->dev, "only singular actions are supported\n");
                return -EOPNOTSUPP;
        }
index 400ad4081660f0a8e360624167253f02de0469bc..9be48d2e43cabd879b52be02b1bbafa141dd7e67 100644 (file)
@@ -53,7 +53,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
        LIST_HEAD(actions);
        int err;
 
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return 0;
 
        /* Count action is inserted first */
index 78d80a364edb4cdb0f1b301e7fdf02232d050cdd..a88bb5bc00826689c2366b9ca5de9cf911545683 100644 (file)
@@ -115,14 +115,14 @@ nfp_net_bpf_get_act(struct nfp_net *nn, struct tc_cls_bpf_offload *cls_bpf)
 
        /* TC direct action */
        if (cls_bpf->exts_integrated) {
-               if (tc_no_actions(cls_bpf->exts))
+               if (!tcf_exts_has_actions(cls_bpf->exts))
                        return NN_ACT_DIRECT;
 
                return -EOPNOTSUPP;
        }
 
        /* TC legacy mode */
-       if (!tc_single_action(cls_bpf->exts))
+       if (!tcf_exts_has_one_action(cls_bpf->exts))
                return -EOPNOTSUPP;
 
        tcf_exts_to_list(cls_bpf->exts, &actions);
index f4462ec8b2f4ee6532ad3078c8cedf9eac6cfada..7f2563636df00ea774a4c77eafdfd817f726981c 100644 (file)
@@ -199,17 +199,35 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
        return 0;
 }
 
+/**
+ * tcf_exts_has_actions - check if at least one action is present
+ * @exts: tc filter extensions handle
+ *
+ * Returns true if at least one action is present.
+ */
+static inline bool tcf_exts_has_actions(struct tcf_exts *exts)
+{
 #ifdef CONFIG_NET_CLS_ACT
+       return exts->nr_actions;
+#else
+       return false;
+#endif
+}
 
-#define tc_no_actions(_exts)  ((_exts)->nr_actions == 0)
-#define tc_single_action(_exts) ((_exts)->nr_actions == 1)
-
-#else /* CONFIG_NET_CLS_ACT */
-
-#define tc_no_actions(_exts) true
-#define tc_single_action(_exts) false
-
-#endif /* CONFIG_NET_CLS_ACT */
+/**
+ * tcf_exts_has_one_action - check if exactly one action is present
+ * @exts: tc filter extensions handle
+ *
+ * Returns true if exactly one action is present.
+ */
+static inline bool tcf_exts_has_one_action(struct tcf_exts *exts)
+{
+#ifdef CONFIG_NET_CLS_ACT
+       return exts->nr_actions == 1;
+#else
+       return false;
+#endif
+}
 
 int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
                      struct nlattr **tb, struct nlattr *rate_tlv,
index e196562035b15f17263ea6fd34bad5d60d98d475..83252e8426d7d74f6291de01376829156639278a 100644 (file)
@@ -779,7 +779,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev,
        if (!ds->ops->port_mirror_add)
                return err;
 
-       if (!tc_single_action(cls->exts))
+       if (!tcf_exts_has_one_action(cls->exts))
                return err;
 
        tcf_exts_to_list(cls->exts, &actions);
index 39da0c5801c908e28c4e258319adefde836c6b0c..287ae6cbf73bf13fd1154de767790db399381d6a 100644 (file)
@@ -972,7 +972,7 @@ int tcf_exts_get_dev(struct net_device *dev, struct tcf_exts *exts,
        const struct tc_action *a;
        LIST_HEAD(actions);
 
-       if (tc_no_actions(exts))
+       if (!tcf_exts_has_actions(exts))
                return -EINVAL;
 
        tcf_exts_to_list(exts, &actions);