diff options
-rw-r--r-- | drivers/net/ethernet/xscale/Kconfig | 1 | ||||
-rw-r--r-- | drivers/net/phy/dp83640.c | 1 | ||||
-rw-r--r-- | drivers/ptp/Kconfig | 1 | ||||
-rw-r--r-- | include/linux/ptp_classify.h | 95 | ||||
-rw-r--r-- | include/linux/skbuff.h | 2 | ||||
-rw-r--r-- | net/Kconfig | 4 | ||||
-rw-r--r-- | net/core/Makefile | 1 | ||||
-rw-r--r-- | net/core/ptp_classifier.c | 141 | ||||
-rw-r--r-- | net/core/timestamping.c | 18 | ||||
-rw-r--r-- | net/socket.c | 5 |
10 files changed, 173 insertions, 96 deletions
diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig index 3f431019e615..b81bc9fca378 100644 --- a/drivers/net/ethernet/xscale/Kconfig +++ b/drivers/net/ethernet/xscale/Kconfig | |||
@@ -23,6 +23,7 @@ config IXP4XX_ETH | |||
23 | tristate "Intel IXP4xx Ethernet support" | 23 | tristate "Intel IXP4xx Ethernet support" |
24 | depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR | 24 | depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR |
25 | select PHYLIB | 25 | select PHYLIB |
26 | select NET_PTP_CLASSIFY | ||
26 | ---help--- | 27 | ---help--- |
27 | Say Y here if you want to use built-in Ethernet ports | 28 | Say Y here if you want to use built-in Ethernet ports |
28 | on IXP4xx processor. | 29 | on IXP4xx processor. |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 352c5e45fe9c..6a999e6814a0 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/net_tstamp.h> | 28 | #include <linux/net_tstamp.h> |
29 | #include <linux/netdevice.h> | 29 | #include <linux/netdevice.h> |
30 | #include <linux/if_vlan.h> | ||
30 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
31 | #include <linux/ptp_classify.h> | 32 | #include <linux/ptp_classify.h> |
32 | #include <linux/ptp_clock_kernel.h> | 33 | #include <linux/ptp_clock_kernel.h> |
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 5a7910e61e17..6963bdf54175 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig | |||
@@ -7,6 +7,7 @@ menu "PTP clock support" | |||
7 | config PTP_1588_CLOCK | 7 | config PTP_1588_CLOCK |
8 | tristate "PTP clock support" | 8 | tristate "PTP clock support" |
9 | select PPS | 9 | select PPS |
10 | select NET_PTP_CLASSIFY | ||
10 | help | 11 | help |
11 | The IEEE 1588 standard defines a method to precisely | 12 | The IEEE 1588 standard defines a method to precisely |
12 | synchronize distributed clocks over Ethernet networks. The | 13 | synchronize distributed clocks over Ethernet networks. The |
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h index 6d3b0a2ef9ce..7dfed71d76a6 100644 --- a/include/linux/ptp_classify.h +++ b/include/linux/ptp_classify.h | |||
@@ -23,11 +23,8 @@ | |||
23 | #ifndef _PTP_CLASSIFY_H_ | 23 | #ifndef _PTP_CLASSIFY_H_ |
24 | #define _PTP_CLASSIFY_H_ | 24 | #define _PTP_CLASSIFY_H_ |
25 | 25 | ||
26 | #include <linux/if_ether.h> | ||
27 | #include <linux/if_vlan.h> | ||
28 | #include <linux/ip.h> | 26 | #include <linux/ip.h> |
29 | #include <linux/filter.h> | 27 | #include <linux/skbuff.h> |
30 | #include <linux/in.h> | ||
31 | 28 | ||
32 | #define PTP_CLASS_NONE 0x00 /* not a PTP event message */ | 29 | #define PTP_CLASS_NONE 0x00 /* not a PTP event message */ |
33 | #define PTP_CLASS_V1 0x01 /* protocol version 1 */ | 30 | #define PTP_CLASS_V1 0x01 /* protocol version 1 */ |
@@ -40,7 +37,7 @@ | |||
40 | #define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ | 37 | #define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ |
41 | 38 | ||
42 | #define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) | 39 | #define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) |
43 | #define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/ | 40 | #define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */ |
44 | #define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4) | 41 | #define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4) |
45 | #define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6) | 42 | #define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6) |
46 | #define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2) | 43 | #define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2) |
@@ -49,82 +46,34 @@ | |||
49 | #define PTP_EV_PORT 319 | 46 | #define PTP_EV_PORT 319 |
50 | #define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */ | 47 | #define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */ |
51 | 48 | ||
52 | #define OFF_ETYPE 12 | ||
53 | #define OFF_IHL 14 | ||
54 | #define OFF_FRAG 20 | ||
55 | #define OFF_PROTO4 23 | ||
56 | #define OFF_NEXT 6 | ||
57 | #define OFF_UDP_DST 2 | ||
58 | |||
59 | #define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */ | 49 | #define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */ |
60 | #define OFF_PTP_SEQUENCE_ID 30 | 50 | #define OFF_PTP_SEQUENCE_ID 30 |
61 | #define OFF_PTP_CONTROL 32 /* PTPv1 only */ | 51 | #define OFF_PTP_CONTROL 32 /* PTPv1 only */ |
62 | 52 | ||
63 | #define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) | 53 | /* Below defines should actually be removed at some point in time. */ |
64 | |||
65 | #define IP6_HLEN 40 | 54 | #define IP6_HLEN 40 |
66 | #define UDP_HLEN 8 | 55 | #define UDP_HLEN 8 |
67 | 56 | #define OFF_IHL 14 | |
68 | #define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST) | ||
69 | #define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST) | ||
70 | #define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) | 57 | #define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) |
58 | #define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) | ||
71 | 59 | ||
72 | #define OP_AND (BPF_ALU | BPF_AND | BPF_K) | 60 | #if defined(CONFIG_NET_PTP_CLASSIFY) |
73 | #define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K) | 61 | /** |
74 | #define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) | 62 | * ptp_classify_raw - classify a PTP packet |
75 | #define OP_LDB (BPF_LD | BPF_B | BPF_ABS) | 63 | * @skb: buffer |
76 | #define OP_LDH (BPF_LD | BPF_H | BPF_ABS) | 64 | * |
77 | #define OP_LDHI (BPF_LD | BPF_H | BPF_IND) | 65 | * Runs a minimal BPF dissector to classify a network packet to |
78 | #define OP_LDX (BPF_LDX | BPF_B | BPF_MSH) | 66 | * determine the PTP class. In case the skb does not contain any |
79 | #define OP_OR (BPF_ALU | BPF_OR | BPF_K) | 67 | * PTP protocol data, PTP_CLASS_NONE will be returned, otherwise |
80 | #define OP_RETA (BPF_RET | BPF_A) | 68 | * PTP_CLASS_V1_IPV{4,6}, PTP_CLASS_V2_IPV{4,6} or |
81 | #define OP_RETK (BPF_RET | BPF_K) | 69 | * PTP_CLASS_V2_{L2,VLAN}, depending on the packet content. |
82 | 70 | */ | |
83 | #define PTP_FILTER \ | ||
84 | {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \ | ||
85 | {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \ | ||
86 | {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \ | ||
87 | {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \ | ||
88 | {OP_LDH, 0, 0, OFF_FRAG }, /* */ \ | ||
89 | {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \ | ||
90 | {OP_LDX, 0, 0, OFF_IHL }, /* */ \ | ||
91 | {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \ | ||
92 | {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \ | ||
93 | {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \ | ||
94 | {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ | ||
95 | {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \ | ||
96 | {OP_RETA, 0, 0, 0 }, /* */ \ | ||
97 | /*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \ | ||
98 | /*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \ | ||
99 | {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \ | ||
100 | {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \ | ||
101 | {OP_LDH, 0, 0, OFF_DST6 }, /* */ \ | ||
102 | {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \ | ||
103 | {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \ | ||
104 | {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ | ||
105 | {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \ | ||
106 | {OP_RETA, 0, 0, 0 }, /* */ \ | ||
107 | /*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \ | ||
108 | /*L40*/ {OP_JEQ, 0, 9, ETH_P_8021Q }, /* f goto L50 */ \ | ||
109 | {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \ | ||
110 | {OP_JEQ, 0, 15, ETH_P_1588 }, /* f goto L60 */ \ | ||
111 | {OP_LDB, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \ | ||
112 | {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \ | ||
113 | {OP_JEQ, 0, 12, 0 }, /* f goto L6x */ \ | ||
114 | {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \ | ||
115 | {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ | ||
116 | {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \ | ||
117 | {OP_RETA, 0, 0, 0 }, /* */ \ | ||
118 | /*L50*/ {OP_JEQ, 0, 7, ETH_P_1588 }, /* f goto L61 */ \ | ||
119 | {OP_LDB, 0, 0, ETH_HLEN }, /* */ \ | ||
120 | {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \ | ||
121 | {OP_JEQ, 0, 4, 0 }, /* f goto L6x */ \ | ||
122 | {OP_LDH, 0, 0, ETH_HLEN }, /* */ \ | ||
123 | {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ | ||
124 | {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \ | ||
125 | {OP_RETA, 0, 0, 0 }, /* */ \ | ||
126 | /*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, | ||
127 | |||
128 | unsigned int ptp_classify_raw(const struct sk_buff *skb); | 71 | unsigned int ptp_classify_raw(const struct sk_buff *skb); |
129 | 72 | ||
73 | void __init ptp_classifier_init(void); | ||
74 | #else | ||
75 | static inline void ptp_classifier_init(void) | ||
76 | { | ||
77 | } | ||
130 | #endif | 78 | #endif |
79 | #endif /* _PTP_CLASSIFY_H_ */ | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 18ef0224fb6a..31edf63937a1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2630,8 +2630,6 @@ static inline ktime_t net_invalid_timestamp(void) | |||
2630 | return ktime_set(0, 0); | 2630 | return ktime_set(0, 0); |
2631 | } | 2631 | } |
2632 | 2632 | ||
2633 | void skb_timestamping_init(void); | ||
2634 | |||
2635 | #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING | 2633 | #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING |
2636 | 2634 | ||
2637 | void skb_clone_tx_timestamp(struct sk_buff *skb); | 2635 | void skb_clone_tx_timestamp(struct sk_buff *skb); |
diff --git a/net/Kconfig b/net/Kconfig index e411046a62e3..d1f6f968fc09 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -89,8 +89,12 @@ config NETWORK_SECMARK | |||
89 | to nfmark, but designated for security purposes. | 89 | to nfmark, but designated for security purposes. |
90 | If you are unsure how to answer this question, answer N. | 90 | If you are unsure how to answer this question, answer N. |
91 | 91 | ||
92 | config NET_PTP_CLASSIFY | ||
93 | def_bool n | ||
94 | |||
92 | config NETWORK_PHY_TIMESTAMPING | 95 | config NETWORK_PHY_TIMESTAMPING |
93 | bool "Timestamping in PHY devices" | 96 | bool "Timestamping in PHY devices" |
97 | select NET_PTP_CLASSIFY | ||
94 | help | 98 | help |
95 | This allows timestamping of network packets by PHYs with | 99 | This allows timestamping of network packets by PHYs with |
96 | hardware timestamping capabilities. This option adds some | 100 | hardware timestamping capabilities. This option adds some |
diff --git a/net/core/Makefile b/net/core/Makefile index 9628c20acff6..826b925aa453 100644 --- a/net/core/Makefile +++ b/net/core/Makefile | |||
@@ -21,5 +21,6 @@ obj-$(CONFIG_FIB_RULES) += fib_rules.o | |||
21 | obj-$(CONFIG_TRACEPOINTS) += net-traces.o | 21 | obj-$(CONFIG_TRACEPOINTS) += net-traces.o |
22 | obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o | 22 | obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o |
23 | obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o | 23 | obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o |
24 | obj-$(CONFIG_NET_PTP_CLASSIFY) += ptp_classifier.o | ||
24 | obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o | 25 | obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o |
25 | obj-$(CONFIG_CGROUP_NET_CLASSID) += netclassid_cgroup.o | 26 | obj-$(CONFIG_CGROUP_NET_CLASSID) += netclassid_cgroup.o |
diff --git a/net/core/ptp_classifier.c b/net/core/ptp_classifier.c new file mode 100644 index 000000000000..eaba0f68f860 --- /dev/null +++ b/net/core/ptp_classifier.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /* PTP classifier | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or | ||
4 | * modify it under the terms of version 2 of the GNU General Public | ||
5 | * License as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, but | ||
8 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
10 | * General Public License for more details. | ||
11 | */ | ||
12 | |||
13 | /* The below program is the bpf_asm (tools/net/) representation of | ||
14 | * the opcode array in the ptp_filter structure. | ||
15 | * | ||
16 | * For convenience, this can easily be altered and reviewed with | ||
17 | * bpf_asm and bpf_dbg, e.g. `./bpf_asm -c prog` where prog is a | ||
18 | * simple file containing the below program: | ||
19 | * | ||
20 | * ldh [12] ; load ethertype | ||
21 | * | ||
22 | * ; PTP over UDP over IPv4 over Ethernet | ||
23 | * test_ipv4: | ||
24 | * jneq #0x800, test_ipv6 ; ETH_P_IP ? | ||
25 | * ldb [23] ; load proto | ||
26 | * jneq #17, drop_ipv4 ; IPPROTO_UDP ? | ||
27 | * ldh [20] ; load frag offset field | ||
28 | * jset #0x1fff, drop_ipv4 ; don't allow fragments | ||
29 | * ldxb 4*([14]&0xf) ; load IP header len | ||
30 | * ldh [x + 16] ; load UDP dst port | ||
31 | * jneq #319, drop_ipv4 ; is port PTP_EV_PORT ? | ||
32 | * ldh [x + 22] ; load payload | ||
33 | * and #0xf ; mask PTP_CLASS_VMASK | ||
34 | * or #0x10 ; PTP_CLASS_IPV4 | ||
35 | * ret a ; return PTP class | ||
36 | * drop_ipv4: ret #0x0 ; PTP_CLASS_NONE | ||
37 | * | ||
38 | * ; PTP over UDP over IPv6 over Ethernet | ||
39 | * test_ipv6: | ||
40 | * jneq #0x86dd, test_8021q ; ETH_P_IPV6 ? | ||
41 | * ldb [20] ; load proto | ||
42 | * jneq #17, drop_ipv6 ; IPPROTO_UDP ? | ||
43 | * ldh [56] ; load UDP dst port | ||
44 | * jneq #319, drop_ipv6 ; is port PTP_EV_PORT ? | ||
45 | * ldh [62] ; load payload | ||
46 | * and #0xf ; mask PTP_CLASS_VMASK | ||
47 | * or #0x20 ; PTP_CLASS_IPV6 | ||
48 | * ret a ; return PTP class | ||
49 | * drop_ipv6: ret #0x0 ; PTP_CLASS_NONE | ||
50 | * | ||
51 | * ; PTP over 802.1Q over Ethernet | ||
52 | * test_8021q: | ||
53 | * jneq #0x8100, test_ieee1588 ; ETH_P_8021Q ? | ||
54 | * ldh [16] ; load inner type | ||
55 | * jneq #0x88f7, drop_ieee1588 ; ETH_P_1588 ? | ||
56 | * ldb [18] ; load payload | ||
57 | * and #0x8 ; as we don't have ports here, test | ||
58 | * jneq #0x0, drop_ieee1588 ; for PTP_GEN_BIT and drop these | ||
59 | * ldh [18] ; reload payload | ||
60 | * and #0xf ; mask PTP_CLASS_VMASK | ||
61 | * or #0x40 ; PTP_CLASS_V2_VLAN | ||
62 | * ret a ; return PTP class | ||
63 | * | ||
64 | * ; PTP over Ethernet | ||
65 | * test_ieee1588: | ||
66 | * jneq #0x88f7, drop_ieee1588 ; ETH_P_1588 ? | ||
67 | * ldb [14] ; load payload | ||
68 | * and #0x8 ; as we don't have ports here, test | ||
69 | * jneq #0x0, drop_ieee1588 ; for PTP_GEN_BIT and drop these | ||
70 | * ldh [14] ; reload payload | ||
71 | * and #0xf ; mask PTP_CLASS_VMASK | ||
72 | * or #0x30 ; PTP_CLASS_L2 | ||
73 | * ret a ; return PTP class | ||
74 | * drop_ieee1588: ret #0x0 ; PTP_CLASS_NONE | ||
75 | */ | ||
76 | |||
77 | #include <linux/skbuff.h> | ||
78 | #include <linux/filter.h> | ||
79 | #include <linux/ptp_classify.h> | ||
80 | |||
81 | static struct sk_filter *ptp_insns __read_mostly; | ||
82 | |||
83 | unsigned int ptp_classify_raw(const struct sk_buff *skb) | ||
84 | { | ||
85 | return SK_RUN_FILTER(ptp_insns, skb); | ||
86 | } | ||
87 | EXPORT_SYMBOL_GPL(ptp_classify_raw); | ||
88 | |||
89 | void __init ptp_classifier_init(void) | ||
90 | { | ||
91 | static struct sock_filter ptp_filter[] = { | ||
92 | { 0x28, 0, 0, 0x0000000c }, | ||
93 | { 0x15, 0, 12, 0x00000800 }, | ||
94 | { 0x30, 0, 0, 0x00000017 }, | ||
95 | { 0x15, 0, 9, 0x00000011 }, | ||
96 | { 0x28, 0, 0, 0x00000014 }, | ||
97 | { 0x45, 7, 0, 0x00001fff }, | ||
98 | { 0xb1, 0, 0, 0x0000000e }, | ||
99 | { 0x48, 0, 0, 0x00000010 }, | ||
100 | { 0x15, 0, 4, 0x0000013f }, | ||
101 | { 0x48, 0, 0, 0x00000016 }, | ||
102 | { 0x54, 0, 0, 0x0000000f }, | ||
103 | { 0x44, 0, 0, 0x00000010 }, | ||
104 | { 0x16, 0, 0, 0x00000000 }, | ||
105 | { 0x06, 0, 0, 0x00000000 }, | ||
106 | { 0x15, 0, 9, 0x000086dd }, | ||
107 | { 0x30, 0, 0, 0x00000014 }, | ||
108 | { 0x15, 0, 6, 0x00000011 }, | ||
109 | { 0x28, 0, 0, 0x00000038 }, | ||
110 | { 0x15, 0, 4, 0x0000013f }, | ||
111 | { 0x28, 0, 0, 0x0000003e }, | ||
112 | { 0x54, 0, 0, 0x0000000f }, | ||
113 | { 0x44, 0, 0, 0x00000020 }, | ||
114 | { 0x16, 0, 0, 0x00000000 }, | ||
115 | { 0x06, 0, 0, 0x00000000 }, | ||
116 | { 0x15, 0, 9, 0x00008100 }, | ||
117 | { 0x28, 0, 0, 0x00000010 }, | ||
118 | { 0x15, 0, 15, 0x000088f7 }, | ||
119 | { 0x30, 0, 0, 0x00000012 }, | ||
120 | { 0x54, 0, 0, 0x00000008 }, | ||
121 | { 0x15, 0, 12, 0x00000000 }, | ||
122 | { 0x28, 0, 0, 0x00000012 }, | ||
123 | { 0x54, 0, 0, 0x0000000f }, | ||
124 | { 0x44, 0, 0, 0x00000040 }, | ||
125 | { 0x16, 0, 0, 0x00000000 }, | ||
126 | { 0x15, 0, 7, 0x000088f7 }, | ||
127 | { 0x30, 0, 0, 0x0000000e }, | ||
128 | { 0x54, 0, 0, 0x00000008 }, | ||
129 | { 0x15, 0, 4, 0x00000000 }, | ||
130 | { 0x28, 0, 0, 0x0000000e }, | ||
131 | { 0x54, 0, 0, 0x0000000f }, | ||
132 | { 0x44, 0, 0, 0x00000030 }, | ||
133 | { 0x16, 0, 0, 0x00000000 }, | ||
134 | { 0x06, 0, 0, 0x00000000 }, | ||
135 | }; | ||
136 | struct sock_fprog ptp_prog = { | ||
137 | .len = ARRAY_SIZE(ptp_filter), .filter = ptp_filter, | ||
138 | }; | ||
139 | |||
140 | BUG_ON(sk_unattached_filter_create(&ptp_insns, &ptp_prog)); | ||
141 | } | ||
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index 9ff26b3cc021..6521dfd8b7c8 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c | |||
@@ -23,14 +23,6 @@ | |||
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <linux/export.h> | 24 | #include <linux/export.h> |
25 | 25 | ||
26 | static struct sk_filter *ptp_insns __read_mostly; | ||
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 | |||
34 | static unsigned int classify(const struct sk_buff *skb) | 26 | static unsigned int classify(const struct sk_buff *skb) |
35 | { | 27 | { |
36 | if (likely(skb->dev && skb->dev->phydev && | 28 | if (likely(skb->dev && skb->dev->phydev && |
@@ -140,13 +132,3 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) | |||
140 | return false; | 132 | return false; |
141 | } | 133 | } |
142 | EXPORT_SYMBOL_GPL(skb_defer_rx_timestamp); | 134 | EXPORT_SYMBOL_GPL(skb_defer_rx_timestamp); |
143 | |||
144 | void __init skb_timestamping_init(void) | ||
145 | { | ||
146 | static struct sock_filter ptp_filter[] = { PTP_FILTER }; | ||
147 | struct sock_fprog ptp_prog = { | ||
148 | .len = ARRAY_SIZE(ptp_filter), .filter = ptp_filter, | ||
149 | }; | ||
150 | |||
151 | BUG_ON(sk_unattached_filter_create(&ptp_insns, &ptp_prog)); | ||
152 | } | ||
diff --git a/net/socket.c b/net/socket.c index f25eaa30b690..1b1e7e6a960f 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/if_bridge.h> | 72 | #include <linux/if_bridge.h> |
73 | #include <linux/if_frad.h> | 73 | #include <linux/if_frad.h> |
74 | #include <linux/if_vlan.h> | 74 | #include <linux/if_vlan.h> |
75 | #include <linux/ptp_classify.h> | ||
75 | #include <linux/init.h> | 76 | #include <linux/init.h> |
76 | #include <linux/poll.h> | 77 | #include <linux/poll.h> |
77 | #include <linux/cache.h> | 78 | #include <linux/cache.h> |
@@ -2685,9 +2686,7 @@ static int __init sock_init(void) | |||
2685 | goto out; | 2686 | goto out; |
2686 | #endif | 2687 | #endif |
2687 | 2688 | ||
2688 | #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING | 2689 | ptp_classifier_init(); |
2689 | skb_timestamping_init(); | ||
2690 | #endif | ||
2691 | 2690 | ||
2692 | out: | 2691 | out: |
2693 | return err; | 2692 | return err; |