diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-03-28 13:58:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-31 00:45:09 -0400 |
commit | 164d8c6665213c931645578310256da7b1259331 (patch) | |
tree | 336d19cb5fd510a3aaf6b1eb908f256c0cb9ee09 /net/core | |
parent | e62d2df084e2849edffb206559725fa81bb569a8 (diff) |
net: ptp: do not reimplement PTP/BPF classifier
There are currently pch_gbe, cpts, and ixp4xx_eth drivers that open-code
and reimplement a BPF classifier for the PTP protocol. Since all of them
effectively do the very same thing and load the very same PTP/BPF filter,
we can just consolidate that code by introducing ptp_classify_raw() in
the time-stamping core framework which can be used in drivers.
As drivers get initialized after bootstrapping the core networking
subsystem, they can make use of ptp_insns wrapped through
ptp_classify_raw(), which allows to simplify and remove PTP classifier
setup code in drivers.
Joint work with Alexei Starovoitov.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Richard Cochran <richard.cochran@omicron.at>
Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/timestamping.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index e43d56acf803..9ff26b3cc021 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c | |||
@@ -25,11 +25,17 @@ | |||
25 | 25 | ||
26 | static struct sk_filter *ptp_insns __read_mostly; | 26 | static struct sk_filter *ptp_insns __read_mostly; |
27 | 27 | ||
28 | unsigned int ptp_classify_raw(const struct sk_buff *skb) | ||
29 | { | ||
30 | return SK_RUN_FILTER(ptp_insns, skb); | ||
31 | } | ||
32 | EXPORT_SYMBOL_GPL(ptp_classify_raw); | ||
33 | |||
28 | static unsigned int classify(const struct sk_buff *skb) | 34 | static unsigned int classify(const struct sk_buff *skb) |
29 | { | 35 | { |
30 | if (likely(skb->dev && skb->dev->phydev && | 36 | if (likely(skb->dev && skb->dev->phydev && |
31 | skb->dev->phydev->drv)) | 37 | skb->dev->phydev->drv)) |
32 | return SK_RUN_FILTER(ptp_insns, skb); | 38 | return ptp_classify_raw(skb); |
33 | else | 39 | else |
34 | return PTP_CLASS_NONE; | 40 | return PTP_CLASS_NONE; |
35 | } | 41 | } |