Skip to content

Commit cf1facd

Browse files
jpirkodavem330
authored andcommitted
sched: move tcf_proto_destroy and tcf_destroy_chain helpers into cls_api
Creation is done in this file, move destruction to be at the same place. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 79112c2 commit cf1facd

File tree

15 files changed

+34
-26
lines changed

15 files changed

+34
-26
lines changed

include/net/pkt_cls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ struct tcf_walker {
1717
int register_tcf_proto_ops(struct tcf_proto_ops *ops);
1818
int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
1919

20+
void tcf_destroy_chain(struct tcf_proto __rcu **fl);
21+
2022
static inline unsigned long
2123
__cls_set_class(unsigned long *clp, unsigned long cl)
2224
{

include/net/sch_generic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,6 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
405405
const struct Qdisc_ops *ops, u32 parentid);
406406
void __qdisc_calculate_pkt_len(struct sk_buff *skb,
407407
const struct qdisc_size_table *stab);
408-
bool tcf_proto_destroy(struct tcf_proto *tp, bool force);
409-
void tcf_destroy_chain(struct tcf_proto __rcu **fl);
410408
int skb_do_redirect(struct sk_buff *);
411409

412410
static inline void skb_reset_tc(struct sk_buff *skb)

net/sched/cls_api.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp)
127127
return first;
128128
}
129129

130+
static bool tcf_proto_destroy(struct tcf_proto *tp, bool force)
131+
{
132+
if (tp->ops->destroy(tp, force)) {
133+
module_put(tp->ops->owner);
134+
kfree_rcu(tp, rcu);
135+
return true;
136+
}
137+
return false;
138+
}
139+
140+
void tcf_destroy_chain(struct tcf_proto __rcu **fl)
141+
{
142+
struct tcf_proto *tp;
143+
144+
while ((tp = rtnl_dereference(*fl)) != NULL) {
145+
RCU_INIT_POINTER(*fl, tp->next);
146+
tcf_proto_destroy(tp, true);
147+
}
148+
}
149+
EXPORT_SYMBOL(tcf_destroy_chain);
150+
130151
/* Add/change/delete/get a filter node */
131152

132153
static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)

net/sched/sch_api.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,28 +1900,6 @@ int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
19001900
}
19011901
EXPORT_SYMBOL(tc_classify);
19021902

1903-
bool tcf_proto_destroy(struct tcf_proto *tp, bool force)
1904-
{
1905-
if (tp->ops->destroy(tp, force)) {
1906-
module_put(tp->ops->owner);
1907-
kfree_rcu(tp, rcu);
1908-
return true;
1909-
}
1910-
1911-
return false;
1912-
}
1913-
1914-
void tcf_destroy_chain(struct tcf_proto __rcu **fl)
1915-
{
1916-
struct tcf_proto *tp;
1917-
1918-
while ((tp = rtnl_dereference(*fl)) != NULL) {
1919-
RCU_INIT_POINTER(*fl, tp->next);
1920-
tcf_proto_destroy(tp, true);
1921-
}
1922-
}
1923-
EXPORT_SYMBOL(tcf_destroy_chain);
1924-
19251903
#ifdef CONFIG_PROC_FS
19261904
static int psched_show(struct seq_file *seq, void *v)
19271905
{

net/sched/sch_atm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/file.h> /* for fput */
1616
#include <net/netlink.h>
1717
#include <net/pkt_sched.h>
18+
#include <net/pkt_cls.h>
1819

1920
/*
2021
* The ATM queuing discipline provides a framework for invoking classifiers

net/sched/sch_cbq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/skbuff.h>
2020
#include <net/netlink.h>
2121
#include <net/pkt_sched.h>
22+
#include <net/pkt_cls.h>
2223

2324

2425
/* Class-Based Queueing (CBQ) algorithm.

net/sched/sch_choke.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/skbuff.h>
1717
#include <linux/vmalloc.h>
1818
#include <net/pkt_sched.h>
19+
#include <net/pkt_cls.h>
1920
#include <net/inet_ecn.h>
2021
#include <net/red.h>
2122
#include <net/flow_dissector.h>

net/sched/sch_dsmark.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/rtnetlink.h>
1414
#include <linux/bitops.h>
1515
#include <net/pkt_sched.h>
16+
#include <net/pkt_cls.h>
1617
#include <net/dsfield.h>
1718
#include <net/inet_ecn.h>
1819
#include <asm/byteorder.h>

net/sched/sch_fq_codel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/vmalloc.h>
2424
#include <net/netlink.h>
2525
#include <net/pkt_sched.h>
26+
#include <net/pkt_cls.h>
2627
#include <net/codel.h>
2728
#include <net/codel_impl.h>
2829
#include <net/codel_qdisc.h>

net/sched/sch_htb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <net/netlink.h>
4141
#include <net/sch_generic.h>
4242
#include <net/pkt_sched.h>
43+
#include <net/pkt_cls.h>
4344

4445
/* HTB algorithm.
4546

net/sched/sch_ingress.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <net/netlink.h>
1818
#include <net/pkt_sched.h>
19+
#include <net/pkt_cls.h>
1920

2021
static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
2122
{

net/sched/sch_multiq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <linux/skbuff.h>
2626
#include <net/netlink.h>
2727
#include <net/pkt_sched.h>
28-
28+
#include <net/pkt_cls.h>
2929

3030
struct multiq_sched_data {
3131
u16 bands;

net/sched/sch_prio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <linux/skbuff.h>
2121
#include <net/netlink.h>
2222
#include <net/pkt_sched.h>
23-
23+
#include <net/pkt_cls.h>
2424

2525
struct prio_sched_data {
2626
int bands;

net/sched/sch_sfb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/jhash.h>
2626
#include <net/ip.h>
2727
#include <net/pkt_sched.h>
28+
#include <net/pkt_cls.h>
2829
#include <net/inet_ecn.h>
2930

3031
/*

net/sched/sch_sfq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/vmalloc.h>
2424
#include <net/netlink.h>
2525
#include <net/pkt_sched.h>
26+
#include <net/pkt_cls.h>
2627
#include <net/red.h>
2728

2829

0 commit comments

Comments
 (0)