Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e91a159e authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net_sched-next'

John Fastabend says:

====================
net sched rcu updates

This fixes the use of tcf_proto from RCU callbacks it requires
moving the unbind calls out of the callbacks and removing the
tcf_proto argument from the tcf_em_tree_destroy().

This is a rework of two previous series and addresses comments
from Cong. And should apply against latest net-next.

The previous series links below for reference:

(1/2) net: sched: do not use tcf_proto 'tp' argument from call_rcu
http://patchwork.ozlabs.org/patch/396149/

(2/2) net: sched: replace ematch calls to use struct net
http://patchwork.ozlabs.org/patch/396150/

net: sched: cls_cgroup tear down exts and ematch from rcu callback
http://patchwork.ozlabs.org/patch/396307/


====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fcbeb976 18cdb37e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ struct tcf_ematch {
	unsigned int		datalen;
	u16			matchid;
	u16			flags;
	struct net		*net;
};

static inline int tcf_em_is_container(struct tcf_ematch *em)
@@ -229,12 +230,11 @@ struct tcf_ematch_tree {
struct tcf_ematch_ops {
	int			kind;
	int			datalen;
	int			(*change)(struct tcf_proto *, void *,
	int			(*change)(struct net *net, void *,
					  int, struct tcf_ematch *);
	int			(*match)(struct sk_buff *, struct tcf_ematch *,
					 struct tcf_pkt_info *);
	void			(*destroy)(struct tcf_proto *,
					   struct tcf_ematch *);
	void			(*destroy)(struct tcf_ematch *);
	int			(*dump)(struct sk_buff *, struct tcf_ematch *);
	struct module		*owner;
	struct list_head	link;
@@ -244,7 +244,7 @@ int tcf_em_register(struct tcf_ematch_ops *);
void tcf_em_unregister(struct tcf_ematch_ops *);
int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
			 struct tcf_ematch_tree *);
void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
void tcf_em_tree_destroy(struct tcf_ematch_tree *);
int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);
int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
			struct tcf_pkt_info *);
@@ -301,7 +301,7 @@ struct tcf_ematch_tree {
};

#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
#define tcf_em_tree_destroy(tp, t) do { (void)(t); } while(0)
#define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
#define tcf_em_tree_dump(skb, t, tlv) (0)
#define tcf_em_tree_change(tp, dst, src) do { } while(0)
#define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
+4 −3
Original line number Diff line number Diff line
@@ -91,11 +91,9 @@ static int basic_init(struct tcf_proto *tp)
static void basic_delete_filter(struct rcu_head *head)
{
	struct basic_filter *f = container_of(head, struct basic_filter, rcu);
	struct tcf_proto *tp = f->tp;

	tcf_unbind_filter(tp, &f->res);
	tcf_exts_destroy(&f->exts);
	tcf_em_tree_destroy(tp, &f->ematches);
	tcf_em_tree_destroy(&f->ematches);
	kfree(f);
}

@@ -106,6 +104,7 @@ static void basic_destroy(struct tcf_proto *tp)

	list_for_each_entry_safe(f, n, &head->flist, link) {
		list_del_rcu(&f->link);
		tcf_unbind_filter(tp, &f->res);
		call_rcu(&f->rcu, basic_delete_filter);
	}
	RCU_INIT_POINTER(tp->root, NULL);
@@ -120,6 +119,7 @@ static int basic_delete(struct tcf_proto *tp, unsigned long arg)
	list_for_each_entry(t, &head->flist, link)
		if (t == f) {
			list_del_rcu(&t->link);
			tcf_unbind_filter(tp, &t->res);
			call_rcu(&t->rcu, basic_delete_filter);
			return 0;
		}
@@ -222,6 +222,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,

	if (fold) {
		list_replace_rcu(&fold->link, &fnew->link);
		tcf_unbind_filter(tp, &fold->res);
		call_rcu(&fold->rcu, basic_delete_filter);
	} else {
		list_add_rcu(&fnew->link, &head->flist);
+3 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ static int cls_bpf_init(struct tcf_proto *tp)

static void cls_bpf_delete_prog(struct tcf_proto *tp, struct cls_bpf_prog *prog)
{
	tcf_unbind_filter(tp, &prog->res);
	tcf_exts_destroy(&prog->exts);

	bpf_prog_destroy(prog->filter);
@@ -116,6 +115,7 @@ static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg)
	list_for_each_entry(prog, &head->plist, link) {
		if (prog == todel) {
			list_del_rcu(&prog->link);
			tcf_unbind_filter(tp, &prog->res);
			call_rcu(&prog->rcu, __cls_bpf_delete_prog);
			return 0;
		}
@@ -131,6 +131,7 @@ static void cls_bpf_destroy(struct tcf_proto *tp)

	list_for_each_entry_safe(prog, tmp, &head->plist, link) {
		list_del_rcu(&prog->link);
		tcf_unbind_filter(tp, &prog->res);
		call_rcu(&prog->rcu, __cls_bpf_delete_prog);
	}

@@ -282,6 +283,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,

	if (oldprog) {
		list_replace_rcu(&prog->link, &oldprog->link);
		tcf_unbind_filter(tp, &oldprog->res);
		call_rcu(&oldprog->rcu, __cls_bpf_delete_prog);
	} else {
		list_add_rcu(&prog->link, &head->plist);
+2 −4
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ static void cls_cgroup_destroy_rcu(struct rcu_head *root)
						    rcu);

	tcf_exts_destroy(&head->exts);
	tcf_em_tree_destroy(head->tp, &head->ematches);
	tcf_em_tree_destroy(&head->ematches);
	kfree(head);
}

@@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
	struct cls_cgroup_head *head = rtnl_dereference(tp->root);

	if (head) {
		tcf_exts_destroy(&head->exts);
		tcf_em_tree_destroy(tp, &head->ematches);
		RCU_INIT_POINTER(tp->root, NULL);
		kfree_rcu(head, rcu);
		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
	}
}

+2 −2
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ static void flow_destroy_filter(struct rcu_head *head)

	del_timer_sync(&f->perturb_timer);
	tcf_exts_destroy(&f->exts);
	tcf_em_tree_destroy(f->tp, &f->ematches);
	tcf_em_tree_destroy(&f->ematches);
	kfree(f);
}

@@ -530,7 +530,7 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
	return 0;

err2:
	tcf_em_tree_destroy(tp, &t);
	tcf_em_tree_destroy(&t);
	kfree(fnew);
err1:
	tcf_exts_destroy(&e);
Loading