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

Commit 82a470f1 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller
Browse files

net: sched: remove tcf_proto from ematch calls



This removes the tcf_proto argument from the ematch code paths that
only need it to reference the net namespace. This allows simplifying
qdisc code paths especially when we need to tear down the ematch
from an RCU callback. In this case we can not guarentee that the
tcf_proto structure is still valid.

Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Acked-by: default avatarCong Wang <cwang@twopensource.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fcbeb976
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)
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static void basic_delete_filter(struct rcu_head *head)

	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);
}

+2 −2
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);
}

@@ -157,7 +157,7 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)

	if (head) {
		tcf_exts_destroy(&head->exts);
		tcf_em_tree_destroy(tp, &head->ematches);
		tcf_em_tree_destroy(&head->ematches);
		RCU_INIT_POINTER(tp->root, NULL);
		kfree_rcu(head, 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);
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ static int em_canid_match(struct sk_buff *skb, struct tcf_ematch *m,
	return match;
}

static int em_canid_change(struct tcf_proto *tp, void *data, int len,
static int em_canid_change(struct net *net, void *data, int len,
			  struct tcf_ematch *m)
{
	struct can_filter *conf = data; /* Array with rules */
@@ -183,7 +183,7 @@ static int em_canid_change(struct tcf_proto *tp, void *data, int len,
	return 0;
}

static void em_canid_destroy(struct tcf_proto *tp, struct tcf_ematch *m)
static void em_canid_destroy(struct tcf_ematch *m)
{
	struct canid_match *cm = em_canid_priv(m);

Loading