On Thu, Mar 03, 2016 at 09:45:28AM -0800, Cong Wang wrote:
> On Thu, Mar 3, 2016 at 6:55 AM, Amir Vadai <[email protected]> wrote:
> > Introduce the macros tc_no_actions and tc_for_each_action to make code
> > clearer.
> >
> > Suggested-by: Jiri Pirko <[email protected]>
> > Signed-off-by: Amir Vadai <[email protected]>
> > ---
> > include/net/act_api.h | 21 ++++++++++++++++-----
> > include/net/tc_act/tc_gact.h | 4 ++--
> > 2 files changed, 18 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/net/act_api.h b/include/net/act_api.h
> > index 342be6c..2a19fe1 100644
> > --- a/include/net/act_api.h
> > +++ b/include/net/act_api.h
> > @@ -78,11 +78,6 @@ static inline void tcf_lastuse_update(struct tcf_t *tm)
> > tm->lastuse = now;
> > }
> >
> > -#ifdef CONFIG_NET_CLS_ACT
> > -
> > -#define ACT_P_CREATED 1
> > -#define ACT_P_DELETED 1
> > -
> > struct tc_action {
> > void *priv;
> > const struct tc_action_ops *ops;
> > @@ -92,6 +87,11 @@ struct tc_action {
> > struct tcf_hashinfo *hinfo;
> > };
>
> You also expose struct tc_action out of CONFIG_NET_CLS_ACT,
> which you never mention in your changelog at all.
Yes - it was a mistake not to mention it in the changelog.
>
> So why?
The struct will not be used, and without exposing it, the compiler will
complain on code like I have in patch 9/10 ("net/mlx5e: Support offload
cls_flower with drop action"):
static int parse_tc_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
u32 *action, u32 *flow_tag)
{
const struct tc_action *a;
if (tc_no_actions(exts))
return -EINVAL;
*flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
*action = 0;
tc_for_each_action(a, exts) {
[...]