]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 5 Oct 2011 18:53:00 +0000 (11:53 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 5 Oct 2011 18:53:00 +0000 (11:53 -0700)
queue-3.0/ptp-fix-l2-event-message-recognition.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/ptp-fix-l2-event-message-recognition.patch b/queue-3.0/ptp-fix-l2-event-message-recognition.patch
new file mode 100644 (file)
index 0000000..79e3b36
--- /dev/null
@@ -0,0 +1,62 @@
+From f75159e9936143177b442afc78150b7a7ad8aa07 Mon Sep 17 00:00:00 2001
+From: Richard Cochran <richardcochran@gmail.com>
+Date: Tue, 20 Sep 2011 01:25:41 +0000
+Subject: ptp: fix L2 event message recognition
+
+From: Richard Cochran <richardcochran@gmail.com>
+
+commit f75159e9936143177b442afc78150b7a7ad8aa07 upstream.
+
+The IEEE 1588 standard defines two kinds of messages, event and general
+messages. Event messages require time stamping, and general do not. When
+using UDP transport, two separate ports are used for the two message
+types.
+
+The BPF designed to recognize event messages incorrectly classifies L2
+general messages as event messages. This commit fixes the issue by
+extending the filter to check the message type field for L2 PTP packets.
+Event messages are be distinguished from general messages by testing
+the "general" bit.
+
+Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/ptp_classify.h |   13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/include/linux/ptp_classify.h
++++ b/include/linux/ptp_classify.h
+@@ -51,6 +51,7 @@
+ #define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN)
+ #define PTP_EV_PORT 319
++#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */
+ #define OFF_ETYPE     12
+ #define OFF_IHL               14
+@@ -116,14 +117,20 @@ static inline int ptp_filter_init(struct
+       {OP_OR,         0,   0, PTP_CLASS_IPV6          }, /*              */ \
+       {OP_RETA,       0,   0, 0                       }, /*              */ \
+ /*L3x*/       {OP_RETK,       0,   0, PTP_CLASS_NONE          }, /*              */ \
+-/*L40*/       {OP_JEQ,        0,   6, ETH_P_8021Q             }, /* f goto L50   */ \
++/*L40*/       {OP_JEQ,        0,   9, ETH_P_8021Q             }, /* f goto L50   */ \
+       {OP_LDH,        0,   0, OFF_ETYPE + 4           }, /*              */ \
+-      {OP_JEQ,        0,   9, ETH_P_1588              }, /* f goto L60   */ \
++      {OP_JEQ,        0,  15, ETH_P_1588              }, /* f goto L60   */ \
++      {OP_LDB,        0,   0, ETH_HLEN + VLAN_HLEN    }, /*              */ \
++      {OP_AND,        0,   0, PTP_GEN_BIT             }, /*              */ \
++      {OP_JEQ,        0,  12, 0                       }, /* f goto L6x   */ \
+       {OP_LDH,        0,   0, ETH_HLEN + VLAN_HLEN    }, /*              */ \
+       {OP_AND,        0,   0, PTP_CLASS_VMASK         }, /*              */ \
+       {OP_OR,         0,   0, PTP_CLASS_VLAN          }, /*              */ \
+       {OP_RETA,       0,   0, 0                       }, /*              */ \
+-/*L50*/       {OP_JEQ,        0,   4, ETH_P_1588              }, /* f goto L61   */ \
++/*L50*/       {OP_JEQ,        0,   7, ETH_P_1588              }, /* f goto L61   */ \
++      {OP_LDB,        0,   0, ETH_HLEN                }, /*              */ \
++      {OP_AND,        0,   0, PTP_GEN_BIT             }, /*              */ \
++      {OP_JEQ,        0,   4, 0                       }, /* f goto L6x   */ \
+       {OP_LDH,        0,   0, ETH_HLEN                }, /*              */ \
+       {OP_AND,        0,   0, PTP_CLASS_VMASK         }, /*              */ \
+       {OP_OR,         0,   0, PTP_CLASS_L2            }, /*              */ \
index 3179fb166a752bd5608d5ee8ff8b7ff040af9896..1592d3ddb5a5cb56f1ffc6202f00beb14e1e0bb4 100644 (file)
@@ -16,3 +16,4 @@ drm-radeon-kms-fix-logic-error-in-dp-hpd-handler.patch
 drm-radeon-kms-fix-regression-in-dp-aux-defer-handling.patch
 drm-radeon-kms-add-retry-limits-for-native-dp-aux-defer.patch
 drm-radeon-kms-fix-channel_remap-setup-v2.patch
+ptp-fix-l2-event-message-recognition.patch