Skip to content

Commit 83c289e

Browse files
vladimirolteanPaolo Abeni
authored andcommitted
net/sched: act_api: unexport tcf_action_dump_1()
This isn't used outside act_api.c, but is called by tcf_dump_walker() prior to its definition. So move it upwards and make it static. Simultaneously, reorder the variable declarations so that they follow the networking "reverse Christmas tree" coding style. Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 94fa523 commit 83c289e

File tree

2 files changed

+44
-46
lines changed

2 files changed

+44
-46
lines changed

include/net/act_api.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
219219
int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind,
220220
int ref, bool terse);
221221
int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
222-
int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
223222

224223
static inline void tcf_action_update_bstats(struct tc_action *a,
225224
struct sk_buff *skb)

net/sched/act_api.c

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,50 @@ tcf_action_dump_terse(struct sk_buff *skb, struct tc_action *a, bool from_act)
504504
return -1;
505505
}
506506

507+
static int
508+
tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
509+
{
510+
unsigned char *b = skb_tail_pointer(skb);
511+
struct nlattr *nest;
512+
int err = -EINVAL;
513+
u32 flags;
514+
515+
if (tcf_action_dump_terse(skb, a, false))
516+
goto nla_put_failure;
517+
518+
if (a->hw_stats != TCA_ACT_HW_STATS_ANY &&
519+
nla_put_bitfield32(skb, TCA_ACT_HW_STATS,
520+
a->hw_stats, TCA_ACT_HW_STATS_ANY))
521+
goto nla_put_failure;
522+
523+
if (a->used_hw_stats_valid &&
524+
nla_put_bitfield32(skb, TCA_ACT_USED_HW_STATS,
525+
a->used_hw_stats, TCA_ACT_HW_STATS_ANY))
526+
goto nla_put_failure;
527+
528+
flags = a->tcfa_flags & TCA_ACT_FLAGS_USER_MASK;
529+
if (flags &&
530+
nla_put_bitfield32(skb, TCA_ACT_FLAGS,
531+
flags, flags))
532+
goto nla_put_failure;
533+
534+
if (nla_put_u32(skb, TCA_ACT_IN_HW_COUNT, a->in_hw_count))
535+
goto nla_put_failure;
536+
537+
nest = nla_nest_start_noflag(skb, TCA_ACT_OPTIONS);
538+
if (nest == NULL)
539+
goto nla_put_failure;
540+
err = tcf_action_dump_old(skb, a, bind, ref);
541+
if (err > 0) {
542+
nla_nest_end(skb, nest);
543+
return err;
544+
}
545+
546+
nla_put_failure:
547+
nlmsg_trim(skb, b);
548+
return -1;
549+
}
550+
507551
static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
508552
struct netlink_callback *cb)
509553
{
@@ -1190,51 +1234,6 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
11901234
return a->ops->dump(skb, a, bind, ref);
11911235
}
11921236

1193-
int
1194-
tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
1195-
{
1196-
int err = -EINVAL;
1197-
unsigned char *b = skb_tail_pointer(skb);
1198-
struct nlattr *nest;
1199-
u32 flags;
1200-
1201-
if (tcf_action_dump_terse(skb, a, false))
1202-
goto nla_put_failure;
1203-
1204-
if (a->hw_stats != TCA_ACT_HW_STATS_ANY &&
1205-
nla_put_bitfield32(skb, TCA_ACT_HW_STATS,
1206-
a->hw_stats, TCA_ACT_HW_STATS_ANY))
1207-
goto nla_put_failure;
1208-
1209-
if (a->used_hw_stats_valid &&
1210-
nla_put_bitfield32(skb, TCA_ACT_USED_HW_STATS,
1211-
a->used_hw_stats, TCA_ACT_HW_STATS_ANY))
1212-
goto nla_put_failure;
1213-
1214-
flags = a->tcfa_flags & TCA_ACT_FLAGS_USER_MASK;
1215-
if (flags &&
1216-
nla_put_bitfield32(skb, TCA_ACT_FLAGS,
1217-
flags, flags))
1218-
goto nla_put_failure;
1219-
1220-
if (nla_put_u32(skb, TCA_ACT_IN_HW_COUNT, a->in_hw_count))
1221-
goto nla_put_failure;
1222-
1223-
nest = nla_nest_start_noflag(skb, TCA_ACT_OPTIONS);
1224-
if (nest == NULL)
1225-
goto nla_put_failure;
1226-
err = tcf_action_dump_old(skb, a, bind, ref);
1227-
if (err > 0) {
1228-
nla_nest_end(skb, nest);
1229-
return err;
1230-
}
1231-
1232-
nla_put_failure:
1233-
nlmsg_trim(skb, b);
1234-
return -1;
1235-
}
1236-
EXPORT_SYMBOL(tcf_action_dump_1);
1237-
12381237
int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
12391238
int bind, int ref, bool terse)
12401239
{

0 commit comments

Comments
 (0)