net_sched: switch to rcu_work
Commit 05f0fe6b74
("RCU, workqueue: Implement rcu_work") introduces
new API's for dispatching work in a RCU callback. Now we can just
switch to the new API's for tc filters. This could get rid of a lot
of code.
Cc: Tejun Heo <tj@kernel.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Šī revīzija ir iekļauta:

revīziju iesūtīja
David S. Miller

vecāks
1bb58d2d3c
revīzija
aaa908ffbe
@@ -47,10 +47,7 @@ struct fw_filter {
|
||||
#endif /* CONFIG_NET_CLS_IND */
|
||||
struct tcf_exts exts;
|
||||
struct tcf_proto *tp;
|
||||
union {
|
||||
struct work_struct work;
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
struct rcu_work rwork;
|
||||
};
|
||||
|
||||
static u32 fw_hash(u32 handle)
|
||||
@@ -134,21 +131,14 @@ static void __fw_delete_filter(struct fw_filter *f)
|
||||
|
||||
static void fw_delete_filter_work(struct work_struct *work)
|
||||
{
|
||||
struct fw_filter *f = container_of(work, struct fw_filter, work);
|
||||
|
||||
struct fw_filter *f = container_of(to_rcu_work(work),
|
||||
struct fw_filter,
|
||||
rwork);
|
||||
rtnl_lock();
|
||||
__fw_delete_filter(f);
|
||||
rtnl_unlock();
|
||||
}
|
||||
|
||||
static void fw_delete_filter(struct rcu_head *head)
|
||||
{
|
||||
struct fw_filter *f = container_of(head, struct fw_filter, rcu);
|
||||
|
||||
INIT_WORK(&f->work, fw_delete_filter_work);
|
||||
tcf_queue_work(&f->work);
|
||||
}
|
||||
|
||||
static void fw_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct fw_head *head = rtnl_dereference(tp->root);
|
||||
@@ -164,7 +154,7 @@ static void fw_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
|
||||
rtnl_dereference(f->next));
|
||||
tcf_unbind_filter(tp, &f->res);
|
||||
if (tcf_exts_get_net(&f->exts))
|
||||
call_rcu(&f->rcu, fw_delete_filter);
|
||||
tcf_queue_work(&f->rwork, fw_delete_filter_work);
|
||||
else
|
||||
__fw_delete_filter(f);
|
||||
}
|
||||
@@ -193,7 +183,7 @@ static int fw_delete(struct tcf_proto *tp, void *arg, bool *last,
|
||||
RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
|
||||
tcf_unbind_filter(tp, &f->res);
|
||||
tcf_exts_get_net(&f->exts);
|
||||
call_rcu(&f->rcu, fw_delete_filter);
|
||||
tcf_queue_work(&f->rwork, fw_delete_filter_work);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@@ -316,7 +306,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
|
||||
rcu_assign_pointer(*fp, fnew);
|
||||
tcf_unbind_filter(tp, &f->res);
|
||||
tcf_exts_get_net(&f->exts);
|
||||
call_rcu(&f->rcu, fw_delete_filter);
|
||||
tcf_queue_work(&f->rwork, fw_delete_filter_work);
|
||||
|
||||
*arg = fnew;
|
||||
return err;
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user