Skip to content

Commit 2734437

Browse files
congwangdavem330
authored andcommitted
net_sched: move tc offload macros to pkt_cls.h
struct tcf_exts belongs to filters, should not be visible to plain tc actions. Cc: Ido Schimmel <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0c23c3e commit 2734437

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

include/net/act_api.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,30 +189,17 @@ int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
189189
int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
190190
int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
191191

192-
#define tc_no_actions(_exts) \
193-
(list_empty(&(_exts)->actions))
194-
195-
#define tc_for_each_action(_a, _exts) \
196-
list_for_each_entry(_a, &(_exts)->actions, list)
197-
198-
#define tc_single_action(_exts) \
199-
(list_is_singular(&(_exts)->actions))
192+
#endif /* CONFIG_NET_CLS_ACT */
200193

201194
static inline void tcf_action_stats_update(struct tc_action *a, u64 bytes,
202195
u64 packets, u64 lastuse)
203196
{
197+
#ifdef CONFIG_NET_CLS_ACT
204198
if (!a->ops->stats_update)
205199
return;
206200

207201
a->ops->stats_update(a, bytes, packets, lastuse);
202+
#endif
208203
}
209204

210-
#else /* CONFIG_NET_CLS_ACT */
211-
212-
#define tc_no_actions(_exts) true
213-
#define tc_for_each_action(_a, _exts) while ((void)(_a), 0)
214-
#define tc_single_action(_exts) false
215-
#define tcf_action_stats_update(a, bytes, packets, lastuse)
216-
217-
#endif /* CONFIG_NET_CLS_ACT */
218205
#endif

include/net/pkt_cls.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,25 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
130130
return 0;
131131
}
132132

133+
#ifdef CONFIG_NET_CLS_ACT
134+
135+
#define tc_no_actions(_exts) \
136+
(list_empty(&(_exts)->actions))
137+
138+
#define tc_for_each_action(_a, _exts) \
139+
list_for_each_entry(_a, &(_exts)->actions, list)
140+
141+
#define tc_single_action(_exts) \
142+
(list_is_singular(&(_exts)->actions))
143+
144+
#else /* CONFIG_NET_CLS_ACT */
145+
146+
#define tc_no_actions(_exts) true
147+
#define tc_for_each_action(_a, _exts) while ((void)(_a), 0)
148+
#define tc_single_action(_exts) false
149+
150+
#endif /* CONFIG_NET_CLS_ACT */
151+
133152
int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
134153
struct nlattr **tb, struct nlattr *rate_tlv,
135154
struct tcf_exts *exts, bool ovr);

0 commit comments

Comments
 (0)