diff options
author | Stefan Sørensen <stefan.sorensen@spectralink.com> | 2014-06-27 11:59:10 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-07 16:57:18 -0700 |
commit | ae5c6c6d7bcadfbedefb5fc8ff0ebe2bfa83a0a1 (patch) | |
tree | d1071ae8d47415a2575f689e54e35119f541befd /drivers/net/ethernet/ti | |
parent | b9c701edc7ff6ddd522497b0194b0bc3ec1b51a9 (diff) | |
download | op-kernel-dev-ae5c6c6d7bcadfbedefb5fc8ff0ebe2bfa83a0a1.zip op-kernel-dev-ae5c6c6d7bcadfbedefb5fc8ff0ebe2bfa83a0a1.tar.gz |
ptp: Classify ptp over ip over vlan packets
This extends the ptp bpf to also match ptp over ip over vlan packets. The ptp
classes are changed to orthogonal bitfields representing version, transport
and vlan values to simplify matching.
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti')
-rw-r--r-- | drivers/net/ethernet/ti/cpts.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 6b56f85..ab92f67 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -256,23 +256,21 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class, u16 ts_seqid, u8 ts_msgtype) { u16 *seqid; - unsigned int offset; + unsigned int offset = 0; u8 *msgtype, *data = skb->data; - switch (ptp_class) { - case PTP_CLASS_V1_IPV4: - case PTP_CLASS_V2_IPV4: - offset = ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; - break; - case PTP_CLASS_V1_IPV6: - case PTP_CLASS_V2_IPV6: - offset = OFF_PTP6; + if (ptp_class & PTP_CLASS_VLAN) + offset += VLAN_HLEN; + + switch (ptp_class & PTP_CLASS_PMASK) { + case PTP_CLASS_IPV4: + offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; break; - case PTP_CLASS_V2_L2: - offset = ETH_HLEN; + case PTP_CLASS_IPV6: + offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; break; - case PTP_CLASS_V2_VLAN: - offset = ETH_HLEN + VLAN_HLEN; + case PTP_CLASS_L2: + offset += ETH_HLEN; break; default: return 0; |