[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1516699052-19259-2-git-send-email-eyal.birger@gmail.com>
Date: Tue, 23 Jan 2018 11:17:31 +0200
From: Eyal Birger <eyal.birger@...il.com>
To: jhs@...atatu.com, xiyou.wangcong@...il.com, davem@...emloft.net,
netdev@...r.kernel.org, pablo@...filter.org
Cc: shmulik@...anetworks.com, Eyal Birger <eyal@...anetworks.com>
Subject: [PATCH net-next 1/2] net: sched: ematch: pass protocol to ematch 'change()' handlers
From: Eyal Birger <eyal@...anetworks.com>
In order to allow ematches to create their internal state based on the
L3 protocol specified when creating the filter.
Signed-off-by: Eyal Birger <eyal@...anetworks.com>
---
include/net/pkt_cls.h | 2 +-
net/sched/em_canid.c | 4 ++--
net/sched/em_ipset.c | 4 ++--
net/sched/em_meta.c | 2 +-
net/sched/em_nbyte.c | 4 ++--
net/sched/em_text.c | 2 +-
net/sched/ematch.c | 3 ++-
7 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 2f8f16a..929b117 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -474,7 +474,7 @@ struct tcf_ematch_tree {
struct tcf_ematch_ops {
int kind;
int datalen;
- int (*change)(struct net *net, void *,
+ int (*change)(struct net *net, __be16, void *,
int, struct tcf_ematch *);
int (*match)(struct sk_buff *, struct tcf_ematch *,
struct tcf_pkt_info *);
diff --git a/net/sched/em_canid.c b/net/sched/em_canid.c
index ddd883c..445c10d 100644
--- a/net/sched/em_canid.c
+++ b/net/sched/em_canid.c
@@ -120,8 +120,8 @@ static int em_canid_match(struct sk_buff *skb, struct tcf_ematch *m,
return match;
}
-static int em_canid_change(struct net *net, void *data, int len,
- struct tcf_ematch *m)
+static int em_canid_change(struct net *net, __be16 protocol, void *data,
+ int len, struct tcf_ematch *m)
{
struct can_filter *conf = data; /* Array with rules */
struct canid_match *cm;
diff --git a/net/sched/em_ipset.c b/net/sched/em_ipset.c
index c1b23e3..50f7282 100644
--- a/net/sched/em_ipset.c
+++ b/net/sched/em_ipset.c
@@ -19,8 +19,8 @@
#include <net/ip.h>
#include <net/pkt_cls.h>
-static int em_ipset_change(struct net *net, void *data, int data_len,
- struct tcf_ematch *em)
+static int em_ipset_change(struct net *net, __be16 protocol, void *data,
+ int data_len, struct tcf_ematch *em)
{
struct xt_set_info *set = data;
ip_set_id_t index;
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index d6e9711..6892efc 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -904,7 +904,7 @@ static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = {
[TCA_EM_META_HDR] = { .len = sizeof(struct tcf_meta_hdr) },
};
-static int em_meta_change(struct net *net, void *data, int len,
+static int em_meta_change(struct net *net, __be16 protocol, void *data, int len,
struct tcf_ematch *m)
{
int err;
diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c
index df3110d..1cd5983 100644
--- a/net/sched/em_nbyte.c
+++ b/net/sched/em_nbyte.c
@@ -23,8 +23,8 @@ struct nbyte_data {
char pattern[0];
};
-static int em_nbyte_change(struct net *net, void *data, int data_len,
- struct tcf_ematch *em)
+static int em_nbyte_change(struct net *net, __be16 protocol, void *data,
+ int data_len, struct tcf_ematch *em)
{
struct tcf_em_nbyte *nbyte = data;
diff --git a/net/sched/em_text.c b/net/sched/em_text.c
index 73e2ed5..b5d9e21 100644
--- a/net/sched/em_text.c
+++ b/net/sched/em_text.c
@@ -44,7 +44,7 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m,
return skb_find_text(skb, from, to, tm->config) != UINT_MAX;
}
-static int em_text_change(struct net *net, void *data, int len,
+static int em_text_change(struct net *net, __be16 protocol, void *data, int len,
struct tcf_ematch *m)
{
struct text_match *tm;
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 1331a4c..a69abd8 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -242,7 +242,8 @@ static int tcf_em_validate(struct tcf_proto *tp,
goto errout;
if (em->ops->change) {
- err = em->ops->change(net, data, data_len, em);
+ err = em->ops->change(net, tp->protocol, data, data_len,
+ em);
if (err < 0)
goto errout;
} else if (data_len > 0) {
--
2.7.4
Powered by blists - more mailing lists