Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed HW timestamping of RX UDP P2P packets. #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions hw_atl/hw_atl_b0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1481,9 +1481,19 @@ static u16 hw_atl_b0_rx_extract_ts(struct aq_hw_s *self, u8 *p,
*timestamp = (be64_to_cpu(sec) & 0xffffffffffffllu) * NSEC_PER_SEC +
be32_to_cpu(ns) + self->ptp_clk_offset;

eth = (struct ethhdr *)p;

return (eth->h_proto == htons(ETH_P_1588)) ? 12 : 14;
return 12;
// This is super weird. It seems that the timestamps occupy the last 14
// bytes, but for some reason, the packet is only extended by 12 bytes.
// No idea what happens to the last 2 bytes of the payload, but it is
// probably wrong (fortunately, there's hopefully not too much interesting
// data there in the timestamped PTP packets, and the first 2 bytes of sec
// will always be 00 00, so basically the last 2 bytes will get zeroed out).
// Following is an even weirder construct that used to be in the driver,
// giving some proof that removing just 12 of the 14 bytes is not a complete
// nonsense. However, in my experience, both L2 and UDP packets suffer from
// this weirdness.
//eth = (struct ethhdr *)p;
//return (eth->h_proto == htons(ETH_P_1588)) ? 12 : 14;
}

static int hw_atl_b0_extract_hwts(struct aq_hw_s *self, u8 *p, unsigned int len,
Expand Down