Commit 9f3101dc authored by Pedro Tammela's avatar Pedro Tammela Committed by David S. Miller
Browse files

net/sched: avoid indirect classify functions on retpoline kernels



Expose the necessary tc classifier functions and wire up cls_api to use
direct calls in retpoline kernels.

Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: default avatarVictor Nogueira <victor@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 871cf386
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include <net/tc_act/tc_mpls.h>
#include <net/tc_act/tc_gate.h>
#include <net/flow_offload.h>
#include <net/tc_wrapper.h>

extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];

@@ -1564,7 +1565,7 @@ static inline int __tcf_classify(struct sk_buff *skb,
		    tp->protocol != htons(ETH_P_ALL))
			continue;

		err = tp->classify(skb, tp, res);
		err = tc_classify(skb, tp, res);
#ifdef CONFIG_NET_CLS_ACT
		if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) {
			first_tp = orig_tp;
+4 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <net/netlink.h>
#include <net/act_api.h>
#include <net/pkt_cls.h>
#include <net/tc_wrapper.h>

struct basic_head {
	struct list_head	flist;
@@ -36,7 +37,8 @@ struct basic_filter {
	struct rcu_work		rwork;
};

static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp,
TC_INDIRECT_SCOPE int basic_classify(struct sk_buff *skb,
				     const struct tcf_proto *tp,
				     struct tcf_result *res)
{
	int r;
+4 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
#include <net/sock.h>
#include <net/tc_wrapper.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Daniel Borkmann <dborkman@redhat.com>");
@@ -77,7 +78,8 @@ static int cls_bpf_exec_opcode(int code)
	}
}

static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
TC_INDIRECT_SCOPE int cls_bpf_classify(struct sk_buff *skb,
				       const struct tcf_proto *tp,
				       struct tcf_result *res)
{
	struct cls_bpf_head *head = rcu_dereference_bh(tp->root);
+4 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <net/pkt_cls.h>
#include <net/sock.h>
#include <net/cls_cgroup.h>
#include <net/tc_wrapper.h>

struct cls_cgroup_head {
	u32			handle;
@@ -22,7 +23,8 @@ struct cls_cgroup_head {
	struct rcu_work		rwork;
};

static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
TC_INDIRECT_SCOPE int cls_cgroup_classify(struct sk_buff *skb,
					  const struct tcf_proto *tp,
					  struct tcf_result *res)
{
	struct cls_cgroup_head *head = rcu_dereference_bh(tp->root);
+4 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <net/ip.h>
#include <net/route.h>
#include <net/flow_dissector.h>
#include <net/tc_wrapper.h>

#if IS_ENABLED(CONFIG_NF_CONNTRACK)
#include <net/netfilter/nf_conntrack.h>
@@ -292,7 +293,8 @@ static u32 flow_key_get(struct sk_buff *skb, int key, struct flow_keys *flow)
			  (1 << FLOW_KEY_NFCT_PROTO_SRC) |	\
			  (1 << FLOW_KEY_NFCT_PROTO_DST))

static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp,
TC_INDIRECT_SCOPE int flow_classify(struct sk_buff *skb,
				    const struct tcf_proto *tp,
				    struct tcf_result *res)
{
	struct flow_head *head = rcu_dereference_bh(tp->root);
Loading