diff options
author | Kurt Kanzenbach <kurt@linutronix.de> | 2022-03-05 14:21:25 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-03-07 14:31:34 +0300 |
commit | f72de02ebece2e962462bc0c1e9efd29eaa029b2 (patch) | |
tree | 5a7102eaf367b9301bf49c8d9d6ca328a016fad5 /net/core | |
parent | 669b258a793db9f1c3bff29ce2bbd61b810503ad (diff) | |
download | linux-f72de02ebece2e962462bc0c1e9efd29eaa029b2.tar.xz |
ptp: Add generic PTP is_sync() function
PHY drivers such as micrel or dp83640 need to analyze whether a given
skb is a PTP sync message for one step functionality.
In order to avoid code duplication introduce a generic function and
move it to ptp classify.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/ptp_classifier.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/core/ptp_classifier.c b/net/core/ptp_classifier.c index dd4cf01d1e0a..598041b0499e 100644 --- a/net/core/ptp_classifier.c +++ b/net/core/ptp_classifier.c @@ -137,6 +137,18 @@ struct ptp_header *ptp_parse_header(struct sk_buff *skb, unsigned int type) } EXPORT_SYMBOL_GPL(ptp_parse_header); +bool ptp_msg_is_sync(struct sk_buff *skb, unsigned int type) +{ + struct ptp_header *hdr; + + hdr = ptp_parse_header(skb, type); + if (!hdr) + return false; + + return ptp_get_msgtype(hdr, type) == PTP_MSGTYPE_SYNC; +} +EXPORT_SYMBOL_GPL(ptp_msg_is_sync); + void __init ptp_classifier_init(void) { static struct sock_filter ptp_filter[] __initdata = { |